[REBOL] Re: Drawing on images
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>