Groups | Search | Server Info | Login | Register


Groups > comp.lang.postscript > #4011

Colour Specs In ToastScript

Path csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Lawrence D'Oliveiro <ldo@nz.invalid>
Newsgroups comp.lang.postscript
Subject Colour Specs In ToastScript
Date Mon, 15 Jul 2024 22:16:15 -0000 (UTC)
Organization A noiseless patient Spider
Lines 32
Message-ID <v7473f$snp6$6@dont-email.me> (permalink)
MIME-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
Injection-Date Tue, 16 Jul 2024 00:16:16 +0200 (CEST)
Injection-Info dont-email.me; posting-host="55f74b4ae2f116c131f41dc172ef4daf"; logging-data="941862"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VVkfGbBVW4dJhC61Hf3ik"
User-Agent Pan/0.158 (Avdiivka; )
Cancel-Lock sha1:UQHziWXPCCWGg4BQvoBYKZFfJsw=
Xref csiph.com comp.lang.postscript:4011

Show key headers only | 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