2003-09-17 07:44:49 +00:00
|
|
|
/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
|
2003-09-17 07:32:52 +00:00
|
|
|
|
|
|
|
color.c for the Openbox window manager
|
2006-08-22 16:44:18 +00:00
|
|
|
Copyright (c) 2006 Mikael Magnusson
|
2007-04-23 17:56:35 +00:00
|
|
|
Copyright (c) 2003-2007 Dana Jansens
|
2003-09-17 07:32:52 +00:00
|
|
|
Copyright (c) 2003 Derek Foreman
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
See the COPYING file for a copy of the GNU General Public License.
|
|
|
|
*/
|
|
|
|
|
2003-07-24 06:02:38 +00:00
|
|
|
#include "render.h"
|
|
|
|
#include "color.h"
|
2003-09-02 08:38:03 +00:00
|
|
|
#include "instance.h"
|
2003-07-24 06:02:38 +00:00
|
|
|
|
2003-03-16 21:11:39 +00:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
2003-05-18 23:06:11 +00:00
|
|
|
#include <string.h>
|
2003-04-06 04:03:05 +00:00
|
|
|
|
2003-06-21 02:30:14 +00:00
|
|
|
void RrColorAllocateGC(RrColor *in)
|
2003-03-16 21:11:39 +00:00
|
|
|
{
|
|
|
|
XGCValues gcv;
|
|
|
|
|
|
|
|
gcv.foreground = in->pixel;
|
|
|
|
gcv.cap_style = CapProjecting;
|
2003-06-20 07:58:51 +00:00
|
|
|
in->gc = XCreateGC(RrDisplay(in->inst),
|
|
|
|
RrRootWindow(in->inst),
|
|
|
|
GCForeground | GCCapStyle, &gcv);
|
2003-03-16 21:11:39 +00:00
|
|
|
}
|
|
|
|
|
2003-06-21 01:56:14 +00:00
|
|
|
RrColor *RrColorParse(const RrInstance *inst, gchar *colorname)
|
2003-03-16 21:11:39 +00:00
|
|
|
{
|
2003-03-17 02:10:24 +00:00
|
|
|
XColor xcol;
|
|
|
|
|
2003-03-16 21:11:39 +00:00
|
|
|
g_assert(colorname != NULL);
|
2003-03-21 20:25:34 +00:00
|
|
|
/* get rgb values from colorname */
|
2003-03-16 21:11:39 +00:00
|
|
|
|
|
|
|
xcol.red = 0;
|
|
|
|
xcol.green = 0;
|
|
|
|
xcol.blue = 0;
|
|
|
|
xcol.pixel = 0;
|
2003-06-20 07:58:51 +00:00
|
|
|
if (!XParseColor(RrDisplay(inst), RrColormap(inst), colorname, &xcol)) {
|
2007-04-23 17:56:35 +00:00
|
|
|
g_message("Unable to parse color '%s'", colorname);
|
2004-03-21 01:03:00 +00:00
|
|
|
return NULL;
|
2003-03-16 21:11:39 +00:00
|
|
|
}
|
2003-06-20 07:58:51 +00:00
|
|
|
return RrColorNew(inst, xcol.red >> 8, xcol.green >> 8, xcol.blue >> 8);
|
2003-03-16 21:11:39 +00:00
|
|
|
}
|
|
|
|
|
2003-10-11 06:45:04 +00:00
|
|
|
/*#define NO_COLOR_CACHE*/
|
|
|
|
#ifdef DEBUG
|
|
|
|
gint id;
|
|
|
|
#endif
|
|
|
|
|
2003-06-21 01:56:14 +00:00
|
|
|
RrColor *RrColorNew(const RrInstance *inst, gint r, gint g, gint b)
|
2003-03-16 21:11:39 +00:00
|
|
|
{
|
2003-06-20 07:58:51 +00:00
|
|
|
/* this should be replaced with something far cooler */
|
2003-06-21 01:56:14 +00:00
|
|
|
RrColor *out = NULL;
|
2003-03-16 21:11:39 +00:00
|
|
|
XColor xcol;
|
2003-09-02 08:38:03 +00:00
|
|
|
gint key;
|
|
|
|
|
2007-03-05 05:25:16 +00:00
|
|
|
g_assert(r >= 0 && r < 256);
|
|
|
|
g_assert(g >= 0 && g < 256);
|
|
|
|
g_assert(b >= 0 && b < 256);
|
|
|
|
|
2003-09-02 08:38:03 +00:00
|
|
|
key = (r << 24) + (g << 16) + (b << 8);
|
2003-10-11 06:45:04 +00:00
|
|
|
#ifndef NO_COLOR_CACHE
|
2003-09-02 08:38:03 +00:00
|
|
|
if ((out = g_hash_table_lookup(RrColorHash(inst), &key))) {
|
|
|
|
out->refcount++;
|
|
|
|
} else {
|
2003-10-11 06:45:04 +00:00
|
|
|
#endif
|
2003-09-02 08:38:03 +00:00
|
|
|
xcol.red = (r << 8) | r;
|
|
|
|
xcol.green = (g << 8) | g;
|
|
|
|
xcol.blue = (b << 8) | b;
|
|
|
|
if (XAllocColor(RrDisplay(inst), RrColormap(inst), &xcol)) {
|
2010-02-12 19:13:32 +00:00
|
|
|
out = g_slice_new(RrColor);
|
2003-09-02 08:38:03 +00:00
|
|
|
out->inst = inst;
|
|
|
|
out->r = xcol.red >> 8;
|
|
|
|
out->g = xcol.green >> 8;
|
|
|
|
out->b = xcol.blue >> 8;
|
|
|
|
out->gc = None;
|
|
|
|
out->pixel = xcol.pixel;
|
|
|
|
out->key = key;
|
|
|
|
out->refcount = 1;
|
2003-10-11 06:45:04 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
out->id = id++;
|
|
|
|
#endif
|
|
|
|
#ifndef NO_COLOR_CACHE
|
2003-10-10 05:37:24 +00:00
|
|
|
g_hash_table_insert(RrColorHash(inst), &out->key, out);
|
2003-09-02 08:38:03 +00:00
|
|
|
}
|
2003-10-11 06:45:04 +00:00
|
|
|
#endif
|
2003-03-16 21:11:39 +00:00
|
|
|
}
|
2003-06-20 07:58:51 +00:00
|
|
|
return out;
|
2003-03-16 21:11:39 +00:00
|
|
|
}
|
|
|
|
|
2007-08-31 03:11:38 +00:00
|
|
|
RrColor *RrColorCopy(RrColor* c)
|
|
|
|
{
|
|
|
|
return RrColorNew(c->inst, c->r, c->g, c->b);
|
|
|
|
}
|
|
|
|
|
2003-06-21 01:56:14 +00:00
|
|
|
void RrColorFree(RrColor *c)
|
2003-03-16 21:11:39 +00:00
|
|
|
{
|
2003-06-20 07:58:51 +00:00
|
|
|
if (c) {
|
2003-09-02 08:38:03 +00:00
|
|
|
if (--c->refcount < 1) {
|
2003-10-11 06:45:04 +00:00
|
|
|
#ifndef NO_COLOR_CACHE
|
2003-10-10 05:37:24 +00:00
|
|
|
g_assert(g_hash_table_lookup(RrColorHash(c->inst), &c->key));
|
2003-09-02 08:38:03 +00:00
|
|
|
g_hash_table_remove(RrColorHash(c->inst), &c->key);
|
2003-10-11 06:45:04 +00:00
|
|
|
#endif
|
2003-09-02 08:38:03 +00:00
|
|
|
if (c->pixel) XFreeColors(RrDisplay(c->inst), RrColormap(c->inst),
|
|
|
|
&c->pixel, 1, 0);
|
|
|
|
if (c->gc) XFreeGC(RrDisplay(c->inst), c->gc);
|
2010-02-12 19:13:32 +00:00
|
|
|
g_slice_free(RrColor, c);
|
2003-09-02 08:38:03 +00:00
|
|
|
}
|
2003-04-13 02:26:56 +00:00
|
|
|
}
|
2003-03-16 21:11:39 +00:00
|
|
|
}
|
2003-03-19 23:26:54 +00:00
|
|
|
|
2003-06-21 02:30:14 +00:00
|
|
|
void RrReduceDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
|
2003-03-19 23:26:54 +00:00
|
|
|
{
|
2003-10-15 03:59:35 +00:00
|
|
|
gint r, g, b;
|
|
|
|
gint x,y;
|
2003-06-21 02:00:42 +00:00
|
|
|
RrPixel32 *p32 = (RrPixel32 *) im->data;
|
|
|
|
RrPixel16 *p16 = (RrPixel16 *) im->data;
|
2007-03-14 03:05:47 +00:00
|
|
|
RrPixel8 *p8 = (RrPixel8 *) im->data;
|
2003-03-21 20:25:34 +00:00
|
|
|
switch (im->bits_per_pixel) {
|
|
|
|
case 32:
|
2003-06-21 02:26:50 +00:00
|
|
|
if ((RrRedOffset(inst) != RrDefaultRedOffset) ||
|
|
|
|
(RrBlueOffset(inst) != RrDefaultBlueOffset) ||
|
|
|
|
(RrGreenOffset(inst) != RrDefaultGreenOffset)) {
|
2003-03-21 20:25:34 +00:00
|
|
|
for (y = 0; y < im->height; y++) {
|
|
|
|
for (x = 0; x < im->width; x++) {
|
2003-06-21 02:26:50 +00:00
|
|
|
r = (data[x] >> RrDefaultRedOffset) & 0xFF;
|
|
|
|
g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
|
|
|
|
b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
|
2003-07-05 16:51:29 +00:00
|
|
|
p32[x] = (r << RrRedOffset(inst))
|
|
|
|
+ (g << RrGreenOffset(inst))
|
|
|
|
+ (b << RrBlueOffset(inst));
|
2003-03-21 20:25:34 +00:00
|
|
|
}
|
|
|
|
data += im->width;
|
2003-04-06 18:03:59 +00:00
|
|
|
p32 += im->width;
|
2007-07-17 00:48:16 +00:00
|
|
|
}
|
2003-10-15 03:59:35 +00:00
|
|
|
} else im->data = (gchar*) data;
|
2003-03-21 20:25:34 +00:00
|
|
|
break;
|
2009-06-06 09:12:06 +00:00
|
|
|
case 24:
|
|
|
|
{
|
|
|
|
/* reverse the ordering, shifting left 16bit should be the first byte
|
|
|
|
out of three, etc */
|
|
|
|
const guint roff = (16 - RrRedOffset(inst)) / 8;
|
|
|
|
const guint goff = (16 - RrGreenOffset(inst)) / 8;
|
|
|
|
const guint boff = (16 - RrBlueOffset(inst)) / 8;
|
|
|
|
gint outx;
|
|
|
|
for (y = 0; y < im->height; y++) {
|
|
|
|
for (x = 0, outx = 0; x < im->width; x++, outx += 3) {
|
|
|
|
r = (data[x] >> RrDefaultRedOffset) & 0xFF;
|
|
|
|
g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
|
|
|
|
b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
|
|
|
|
p8[outx+roff] = r;
|
|
|
|
p8[outx+goff] = g;
|
|
|
|
p8[outx+boff] = b;
|
|
|
|
}
|
|
|
|
data += im->width;
|
|
|
|
p8 += im->bytes_per_line;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2003-03-21 20:25:34 +00:00
|
|
|
case 16:
|
|
|
|
for (y = 0; y < im->height; y++) {
|
|
|
|
for (x = 0; x < im->width; x++) {
|
2003-06-21 02:26:50 +00:00
|
|
|
r = (data[x] >> RrDefaultRedOffset) & 0xFF;
|
2003-06-20 07:58:51 +00:00
|
|
|
r = r >> RrRedShift(inst);
|
2003-06-21 02:26:50 +00:00
|
|
|
g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
|
2003-06-20 07:58:51 +00:00
|
|
|
g = g >> RrGreenShift(inst);
|
2003-06-21 02:26:50 +00:00
|
|
|
b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
|
2003-06-20 07:58:51 +00:00
|
|
|
b = b >> RrBlueShift(inst);
|
|
|
|
p16[x] = (r << RrRedOffset(inst))
|
|
|
|
+ (g << RrGreenOffset(inst))
|
|
|
|
+ (b << RrBlueOffset(inst));
|
2003-03-21 20:25:34 +00:00
|
|
|
}
|
|
|
|
data += im->width;
|
2003-04-06 04:03:05 +00:00
|
|
|
p16 += im->bytes_per_line/2;
|
2003-03-21 20:25:34 +00:00
|
|
|
}
|
2006-03-14 15:27:15 +00:00
|
|
|
break;
|
2003-04-06 04:03:05 +00:00
|
|
|
case 8:
|
2007-03-14 03:05:47 +00:00
|
|
|
if (RrVisual(inst)->class == TrueColor) {
|
|
|
|
for (y = 0; y < im->height; y++) {
|
|
|
|
for (x = 0; x < im->width; x++) {
|
|
|
|
r = (data[x] >> RrDefaultRedOffset) & 0xFF;
|
|
|
|
r = r >> RrRedShift(inst);
|
|
|
|
g = (data[x] >> RrDefaultGreenOffset) & 0xFF;
|
|
|
|
g = g >> RrGreenShift(inst);
|
|
|
|
b = (data[x] >> RrDefaultBlueOffset) & 0xFF;
|
|
|
|
b = b >> RrBlueShift(inst);
|
|
|
|
p8[x] = (r << RrRedOffset(inst))
|
|
|
|
+ (g << RrGreenOffset(inst))
|
|
|
|
+ (b << RrBlueOffset(inst));
|
|
|
|
}
|
|
|
|
data += im->width;
|
|
|
|
p8 += im->bytes_per_line;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (y = 0; y < im->height; y++) {
|
|
|
|
for (x = 0; x < im->width; x++) {
|
|
|
|
p8[x] = RrPickColor(inst,
|
|
|
|
data[x] >> RrDefaultRedOffset,
|
|
|
|
data[x] >> RrDefaultGreenOffset,
|
|
|
|
data[x] >> RrDefaultBlueOffset)->pixel;
|
|
|
|
}
|
|
|
|
data += im->width;
|
|
|
|
p8 += im->bytes_per_line;
|
2006-03-14 15:27:15 +00:00
|
|
|
}
|
2003-04-06 04:03:05 +00:00
|
|
|
}
|
2006-03-14 15:27:15 +00:00
|
|
|
break;
|
2003-03-21 20:25:34 +00:00
|
|
|
default:
|
2009-06-06 09:12:06 +00:00
|
|
|
g_error("This image bit depth (%i) is currently unhandled", im->bits_per_pixel);
|
2007-07-17 00:48:16 +00:00
|
|
|
|
2003-03-19 23:26:54 +00:00
|
|
|
}
|
|
|
|
}
|
2003-05-18 23:06:11 +00:00
|
|
|
|
2007-07-17 00:48:16 +00:00
|
|
|
XColor *RrPickColor(const RrInstance *inst, gint r, gint g, gint b)
|
2003-04-06 04:03:05 +00:00
|
|
|
{
|
2003-06-21 02:38:47 +00:00
|
|
|
r = (r & 0xff) >> (8-RrPseudoBPC(inst));
|
|
|
|
g = (g & 0xff) >> (8-RrPseudoBPC(inst));
|
|
|
|
b = (b & 0xff) >> (8-RrPseudoBPC(inst));
|
|
|
|
return &RrPseudoColors(inst)[(r << (2*RrPseudoBPC(inst))) +
|
|
|
|
(g << (1*RrPseudoBPC(inst))) +
|
2003-06-20 07:58:51 +00:00
|
|
|
b];
|
2003-04-06 04:03:05 +00:00
|
|
|
}
|
2003-05-18 23:06:11 +00:00
|
|
|
|
|
|
|
static void swap_byte_order(XImage *im)
|
|
|
|
{
|
2003-10-15 03:59:35 +00:00
|
|
|
gint x, y, di;
|
2003-05-18 23:06:11 +00:00
|
|
|
|
|
|
|
di = 0;
|
|
|
|
for (y = 0; y < im->height; ++y) {
|
|
|
|
for (x = 0; x < im->height; ++x) {
|
2003-10-15 03:59:35 +00:00
|
|
|
gchar *c = &im->data[di + x * im->bits_per_pixel / 8];
|
|
|
|
gchar t;
|
2003-05-18 23:06:11 +00:00
|
|
|
|
|
|
|
switch (im->bits_per_pixel) {
|
|
|
|
case 32:
|
|
|
|
t = c[2];
|
|
|
|
c[2] = c[3];
|
|
|
|
c[3] = t;
|
|
|
|
case 16:
|
|
|
|
t = c[0];
|
|
|
|
c[0] = c[1];
|
|
|
|
c[1] = t;
|
|
|
|
case 8:
|
2006-03-14 15:27:15 +00:00
|
|
|
case 1:
|
2003-05-18 23:06:11 +00:00
|
|
|
break;
|
|
|
|
default:
|
2007-04-23 17:56:35 +00:00
|
|
|
g_error("Your bit depth (%i) is currently unhandled",
|
|
|
|
im->bits_per_pixel);
|
2003-05-18 23:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
di += im->bytes_per_line;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (im->byte_order == LSBFirst)
|
|
|
|
im->byte_order = MSBFirst;
|
|
|
|
else
|
|
|
|
im->byte_order = LSBFirst;
|
|
|
|
}
|
|
|
|
|
2003-06-21 02:30:14 +00:00
|
|
|
void RrIncreaseDepth(const RrInstance *inst, RrPixel32 *data, XImage *im)
|
2003-05-18 23:06:11 +00:00
|
|
|
{
|
2003-10-15 03:59:35 +00:00
|
|
|
gint r, g, b;
|
|
|
|
gint x,y;
|
2003-06-21 02:00:42 +00:00
|
|
|
RrPixel32 *p32 = (RrPixel32 *) im->data;
|
|
|
|
RrPixel16 *p16 = (RrPixel16 *) im->data;
|
2003-10-15 03:59:35 +00:00
|
|
|
guchar *p8 = (guchar *)im->data;
|
2003-05-18 23:06:11 +00:00
|
|
|
|
2003-07-11 16:07:43 +00:00
|
|
|
if (im->byte_order != LSBFirst)
|
2003-05-18 23:06:11 +00:00
|
|
|
swap_byte_order(im);
|
|
|
|
|
|
|
|
switch (im->bits_per_pixel) {
|
|
|
|
case 32:
|
|
|
|
for (y = 0; y < im->height; y++) {
|
|
|
|
for (x = 0; x < im->width; x++) {
|
2003-06-20 07:58:51 +00:00
|
|
|
r = (p32[x] >> RrRedOffset(inst)) & 0xff;
|
|
|
|
g = (p32[x] >> RrGreenOffset(inst)) & 0xff;
|
|
|
|
b = (p32[x] >> RrBlueOffset(inst)) & 0xff;
|
2003-06-21 02:26:50 +00:00
|
|
|
data[x] = (r << RrDefaultRedOffset)
|
|
|
|
+ (g << RrDefaultGreenOffset)
|
|
|
|
+ (b << RrDefaultBlueOffset)
|
|
|
|
+ (0xff << RrDefaultAlphaOffset);
|
2003-05-18 23:06:11 +00:00
|
|
|
}
|
|
|
|
data += im->width;
|
|
|
|
p32 += im->bytes_per_line/4;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
for (y = 0; y < im->height; y++) {
|
|
|
|
for (x = 0; x < im->width; x++) {
|
2003-06-20 07:58:51 +00:00
|
|
|
r = (p16[x] & RrRedMask(inst)) >>
|
|
|
|
RrRedOffset(inst) <<
|
|
|
|
RrRedShift(inst);
|
|
|
|
g = (p16[x] & RrGreenMask(inst)) >>
|
|
|
|
RrGreenOffset(inst) <<
|
|
|
|
RrGreenShift(inst);
|
|
|
|
b = (p16[x] & RrBlueMask(inst)) >>
|
|
|
|
RrBlueOffset(inst) <<
|
|
|
|
RrBlueShift(inst);
|
2003-06-21 02:26:50 +00:00
|
|
|
data[x] = (r << RrDefaultRedOffset)
|
|
|
|
+ (g << RrDefaultGreenOffset)
|
|
|
|
+ (b << RrDefaultBlueOffset)
|
|
|
|
+ (0xff << RrDefaultAlphaOffset);
|
2003-05-18 23:06:11 +00:00
|
|
|
}
|
|
|
|
data += im->width;
|
|
|
|
p16 += im->bytes_per_line/2;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 8:
|
2007-04-23 17:56:35 +00:00
|
|
|
g_error("This image bit depth (%i) is currently unhandled", 8);
|
2003-06-03 05:04:12 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2003-05-18 23:06:11 +00:00
|
|
|
for (y = 0; y < im->height; y++) {
|
|
|
|
for (x = 0; x < im->width; x++) {
|
2003-06-03 05:04:12 +00:00
|
|
|
if (!(((p8[x / 8]) >> (x % 8)) & 0x1))
|
2003-06-21 02:26:50 +00:00
|
|
|
data[x] = 0xff << RrDefaultAlphaOffset; /* black */
|
2003-06-03 05:04:12 +00:00
|
|
|
else
|
|
|
|
data[x] = 0xffffffff; /* white */
|
|
|
|
}
|
|
|
|
data += im->width;
|
|
|
|
p8 += im->bytes_per_line;
|
2003-05-18 23:06:11 +00:00
|
|
|
}
|
2003-06-03 05:04:12 +00:00
|
|
|
break;
|
2003-05-18 23:06:11 +00:00
|
|
|
default:
|
2007-04-23 17:56:35 +00:00
|
|
|
g_error("This image bit depth (%i) is currently unhandled",
|
|
|
|
im->bits_per_pixel);
|
2003-05-18 23:06:11 +00:00
|
|
|
}
|
|
|
|
}
|
2003-07-10 04:31:34 +00:00
|
|
|
|
2003-10-15 03:59:35 +00:00
|
|
|
gint RrColorRed(const RrColor *c)
|
2003-07-10 04:31:34 +00:00
|
|
|
{
|
|
|
|
return c->r;
|
|
|
|
}
|
|
|
|
|
2003-10-15 03:59:35 +00:00
|
|
|
gint RrColorGreen(const RrColor *c)
|
2003-07-10 04:31:34 +00:00
|
|
|
{
|
|
|
|
return c->g;
|
|
|
|
}
|
|
|
|
|
2003-10-15 03:59:35 +00:00
|
|
|
gint RrColorBlue(const RrColor *c)
|
2003-07-10 04:31:34 +00:00
|
|
|
{
|
|
|
|
return c->b;
|
|
|
|
}
|
|
|
|
|
|
|
|
gulong RrColorPixel(const RrColor *c)
|
|
|
|
{
|
|
|
|
return c->pixel;
|
|
|
|
}
|
2003-08-31 17:01:53 +00:00
|
|
|
|
2003-09-03 04:28:00 +00:00
|
|
|
GC RrColorGC(RrColor *c)
|
2003-08-31 17:01:53 +00:00
|
|
|
{
|
|
|
|
if (!c->gc)
|
|
|
|
RrColorAllocateGC(c);
|
|
|
|
return c->gc;
|
|
|
|
}
|