[comp.soft-sys.andrew] ATK Color Support

turner+@rchland.ibm.com (Mark Turner) (11/16/90)

I have some questions about ATK color support.

I have been using patch level 6 with color support for a couple of
months onan RS/6000 with X-Windows Release 3.

I have added some color to one of my applications but I find X paints
thecolored window very slow.  Is there anything I can do to speed up the
colorsupport?  In general this is how I set colors:

To color a rectangle I do this:

myview_SetBackgroundColor(self,self->Color.blockshad,0,0,0);
myview_FillRect(self,&oneword,myview_WhitePattern(self));

To draw a rectangle outline in a foreground color I do this:

myview_SetTransferMode(self,graphic_COPY);	   
myview_SetForegroundColor(self,self->Color.blockborder,0,0,0);
myview_DrawRect(self,&Rect);

Is there a faster way of using colors?  For any particular window I may
setforeground and background colors hundreds of times while painting the
window. Is the slow painting due to the R3 X server? I know R4 is faster.

Also, Is there a way to set colors on menu cards? on scroll bars?

Andy Arhelger
IBM Rochester MN

gk5g+@ANDREW.CMU.EDU (Gary Keim) (11/16/90)

Excerpts from misc: 15-Nov-90 ATK Color Support Mark Turner@rchland.ibm.
(1036+0)

> Is there a faster way of using colors?  For any particular window I may
> set foreground and background colors hundreds of times while painting
> the window.  Is the slow painting due to the R3 X server? I know R4 is
> faster.

The only way I can see to speed it up would be to not make a call to set
the fore- or background color unless the current settings are not what
you want:

#define myview_ForegroundColor(self) \
self->header.view.drawable->foreName

#define myview_BackgroundColor(self) \
self->header.view.drawable->backName

#define SetForeground(self,foreground) \
if(strcmp(foreground,myview_ForegroundColor(self)) \
myview_SetForegroundColor(self,foreground,0,0,0);

#define SetBackground(self,background) \
if(strcmp(background,myview_BackgroundColor(self)) \
myview_SetBackgroundColor(self,background,0,0,0);

Excerpts from misc: 15-Nov-90 ATK Color Support Mark Turner@rchland.ibm.
(1036+0)

> Also, Is there a way to set colors on menu cards? on scroll bars?


Scoll bars get the color that is set for the application via the
preferences *.ForegroundColor & *.BackgroundColor or through the
command-line switches -bg & -fg.

Try 'help cmenu' for info on how to set menu colors.  
Brief synopsis: in ~/.XDefaults add the lines:

*MenuBackground: red
*MenuForeground: blue

There is no programatic way to set the menu colors.