REBOL Technologies

Try the Latest DRAW PUSH Function

Carl Sassenrath, CTO
REBOL Technologies
29-Dec-2004 7:44 GMT

Article #0077
Main page || Index || Prior Article [0076] || Next Article [0078] || Post Comments || Send feedback

There has not been much feedback regarding the way the DRAW effect deals with pushing and popping of the translation matrix, (see blog 0071). But, we need really comments on this. Perhaps it sounds a bit complicated, but it is not. Let me give you a simple example to show why we need to get this right.

1. Download this alpha test version of REBOL/View.

2. Then, run this code:

REBOL []

op: 'translate
val: 0

view layout [
    vh2 "Is this correct?"
    bx: box 500x500 black effect [
        draw [
            op val val
            fill-pen red box 100x100 400x400
            push [
                translate 100 100
                fill-pen blue box 10x10 200x200
                push [
                    translate 200 200
                    fill-pen green box 0x0 100x100
                ]
            ]
            fill-pen yellow box 400x400 500x500
        ]
    ]
    slider 500x20 [
        val: value * pick [4 40] op = 'scale
        show bx
    ]
    across
    btn 100 "Translate" [op: 'translate show bx]
    btn 100 "Rotate" [op: 'rotate show bx]
    btn 100 "Scale" [op: 'scale show bx]
]

Move the slider and click on the buttons to see a variety of results that combine translation, rotation, and scaling.

However, the question is: are these the correct results? They do not look correct to me for rotation and scaling because the translation of the sub-blocks is not affected by the higher level matrix. We need to confirm (or not) that this seems like the best results for this operator.

Your comments are requested.

Post Comments

Updated 11-Mar-2024   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code