Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] drawing images on text face after displayed = "highlighting text"

From: fergus4:bellatlantic at: 1-Oct-2008 2:45

Is there a way to append an image object (a box for example) to a face that has already been displayed. I'm looking to get simple highlight functionality in an app in which a string is scanned for in a series of text faces. I've been able to highlight the search word in each face but if I click in any of the text faces the face looses the highlight effect sort of like loosing focus on normal highlighting. I would like the highlight to remain until no longer needed What I got working: rebol [] pad: 20x30 window: layout [ bx: box red 0x0 panel: panel [ text 400 "Here is a simple example how to use DRAW dialect for into alpha channel of the image. I think with the function make-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's native level" t: text 400 "Here is a simple example how to use DRAW dialect for e-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possiinto alpha channel of the image. I think with the function make-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's native level" text 500 "can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's naHere is a simple example how to use DRAW dialect for into alpha channel of the image. I think with the function make-alpha (bellow in the example) you can draw almost any kind of transparent shape though it is not the fastest method....IMO the possibility to use DRAW pens for alpha channel should be done at Rebol's native level"] button "Highlight" [foreach face panel/pane [if face/style = 'text [ system/view/focal-face: face system/view/highlight-start: find face/text "into alpha channel of the image" system/view/highlight-end: find/tail face/text "into alpha channel of the image" show face ]]] button "Paint" [foreach face panel/pane [if face/style = 'text [ keyword: "transparent" xy: caret-to-offset face find face/text keyword bx/offset: face/offset + pad + xy bx/size: as-pair (5.9 * length? keyword) 15 show face ]]] ] view window -Alan Macleod