gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Color handling implemented in GSGState


From: Adam Fedor
Subject: Color handling implemented in GSGState
Date: Fri, 10 May 2002 09:18:53 -0600
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:0.9.8) Gecko/20020310

I implemented color handling in GSGState, so now subclasses don't need to do this. If a subclass wants to be notified of a color change, it can implement -setColor:(device_colort_t)color state: (color_state_t)state, where state can be COLOR_FILL, COLOR_STROKE, or COLOR_BOTH=(COLOR_FILL|COLOR_STROKE) - since I've split the colors into two, one used for stroking and one for filling.

Since the colors aren't guarenteed to be in rgb format, you might do this:

-setColor:(device_colort_t)color state: (color_state_t)cState
{
  [super setColor: color state: cState];
  fillColor = gsColorToRGB(fillColor);
  strokeColor = gsColorToRGB(strokeColor);
}

Other than that, you can just use the colors, where (if in rgb format)

red = fillColor.field[0]
green = fillColor.field[1]
blue = fillColor.field[2]
alpha = fillColor.field[AINDEX]


I also implemented some of the other font/text methods. Now there is a separate ctm for text, which must be concatenated with the regular ctm to get the full ctm for text. Don't feel compeled to implement this right away as there is nothing in the frontend that uses it yet.

I updated xlib and winlib to use the new color scheme.


--
Adam Fedor, Digital Optics Corp.      | I'm glad I hate spinach, because
http://www.doc.com                    | if I didn't, I'd eat it, and you
                                      | know how I hate the stuff.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]