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

Drawing on images

 [1/3] from: atruter::hih::com::au at: 11-Jul-2002 18:20

I'm looking at ways of speeding up drawing on images. Given the code below, and the differences in speed between 300x200 and 640x480, are there any better ways of doing this. <CODE> REBOL [] stylize/master: [ draw-image: image with [ line?: false feel: make feel [ engage: func [face action event] [ if action = 'down [ face/line?: true insert tail cmd compose [line (event/offset)] ] if action = 'up [face/line?: false] if all [event/type = 'move face/line?] [ insert tail cmd compose [(event/offset)] show face ] ] ] ] ] save/png %test.png to-image 300x200 ;save/png %test.png to-image 640x480 cmd: copy [pen red] view layout [ origin 0 space 0 across draw-color: choice "red" "green" "blue" [ insert tail cmd compose [pen (get to-word draw-color/text)] ] btn "Undo" [ if (length? cmd) > 2 [ while [(type? last cmd) = pair!] [remove back tail cmd] while [all [(type? last cmd) <> pair! (length? cmd) > 2]] [remove back tail cmd] show img ] ] return img: draw-image %test.png effect compose/deep/only [draw (cmd)] ] </CODE> Regards, Ashley

 [2/3] from: cyphre:seznam:cz at: 11-Jul-2002 14:37

Hi Ashley, unfortunately, the refreshing speed of bigger faces is not the best in /View. We would need either rendering C code optimization or possibility of using hw acceleration(DirectX, OpenGL) on selected platforms. But, I tried to write simple workaround in a few minutes of my free time. Try the code bellow. Drawing should be very fast but it has some problems ;-) I'm not sure if this method could be usefull but maybe it is a good starting point for you to improve it. Regards, Cyphre <CODE> (watch out line-breaks!) scr-size: 1024x768 cell: 100 matrix: copy [] for x 0 scr-size/x cell [ for y 0 scr-size/y cell [ insert tail matrix make face [ line?: false oft: 0x0 offset: to-pair reduce [x y] size: to-pair cell image: make image! size edge: none color: black effect: copy/deep [draw [pen red line]] feel: make feel [ over: func [f a o][ if a [ insert back tail f/effect/2 [pen red line] ] ] detect: func [f e][ f/oft: e/offset - f/offset - f/parent-face/offset if f/parent-face/line? [ insert tail f/effect/2 compose [(f/oft)] show f ] e ] ] ] ] ] view layout [ origin 0 bx: box scr-size with [ line?: false feel: make feel [ detect: func [f e][ switch e/type [ down [f/line?: true] up [f/line?: false] ] e ] redraw: over: engage: none ] pane: matrix ] ] </CODE>

 [3/3] from: robert:muench:robertmuench at: 11-Jul-2002 15:41

> -----Original Message----- > From: [rebol-bounce--rebol--com] [mailto:[rebol-bounce--rebol--com]]
<<quoted lines omitted: 6>>
> optimization or possibility of using hw acceleration(DirectX, > OpenGL) on selected platforms.
Hi, I hope RT is still scanning this list: For this I can highly recommend TinyPTC. There you will get this blitting code in about 10KB with highly optimized ASM routines. Even for several platforms IIRC. Have a look at: Robert -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (MingW32) Comment: For info see iEYEARECAAYFAj0tiAgACgkQZeksDS3TMVxGvgCePyF3cqvph9OrvrqY2wEgkOZ+ j2MAoJFNxliuZ8l9ek9OYKxc3SOVBdZt =1FI3 -----END PGP SIGNATURE-----

  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted