• Colour Specs In ToastScript

    From Lawrence D'Oliveiro@ldo@nz.invalid to comp.lang.postscript on Mon Jul 15 22:16:15 2024
    From Newsgroup: comp.lang.postscript

    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 rCLToastScriptrCY.

    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 rCLmakecolourrCY 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, |a la my Qahirah wrapper for cairo. Note the dot-operators to invoke method names that are scoped to the object.
    --- Synchronet 3.21d-Linux NewsLink 1.2