Groups | Search | Server Info | Login | Register


Groups > comp.lang.postscript > #4011

Colour Specs In ToastScript

From Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups comp.lang.postscript
Subject Colour Specs In ToastScript
Date 2024-07-15 22:16 +0000
Organization A noiseless patient Spider
Message-ID <v7473f$snp6$6@dont-email.me> (permalink)

Show all headers | View raw


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.

Back to comp.lang.postscript | Previous | Next | Find similar


Thread

Colour Specs In ToastScript Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-07-15 22:16 +0000

csiph-web