• Colour Specs In ToastScript

    From Lawrence D'Oliveiro@21:1/5 to All on Mon Jul 15 22:16:15 2024
    I have published an initial stab at a 2D graphical API for GXScript here <https://bitbucket.org/ldo17/gxscript_extensions/>. I am calling that
    language extension “ToastScript”.

    I have done away with all the old-style PostScript colour operators.
    Instead, colours are now objects in their own right. You construct one of
    these with the “makecolour” operator, which takes as operand a dictionary specifying the parameters of the colour, in any of a number of different
    colour spaces. For example, to define a colour in HSV space, you could do

    << /h 0.25 /s 0.5 /v 1 >> makecolour

    Patterns are also done in an entirely different way: instead of being able
    to execute arbitrary PostScript code, they are restricted to the types of patterns supported by Cairo. For example, this is a linear gradient
    pattern:

    <<
    /p0 [0 0]
    /p1 [1 1]
    /stops
    [
    [0 << /h 0.25 /s 0.5 /v 1 >> makecolour]
    [1 << /h 0.75 /s 0.5 /v 1 >> makecolour]
    ]
    /matrix 90 90 matrix .scale .inv
    >>
    makepattern

    Vectors and matrices are also objects in their own right, à la my Qahirah wrapper for cairo. Note the dot-operators to invoke method names that are scoped to the object.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)