On Mon, 5 Nov 2001, Markus Fritsche wrote:
> So far, so good. I've made it by changing the gdk.defs-file. The next
> thing is, that I don't know how to draw things in a different color
> than black. I thought it should be something like this:
> \.\...
> GdkGC gc = new GdkGC(mainwindow.getWindow());
> GdkColor red = new GdkColor();
> red.parse("red");
> gc.setForeground(red);
> gwin = drawingarea.getWindow();
> gwin.drawRectangle(gc, false, 10, 10, 10, 10);
> \.\...
> should, afaic, draw a red rectangle into the drawingarea. But a black
> rectangle is drawn.
>
> Btw. shouldn't GdkPixmap and GdkBitmap be subclasses of GdkWindow,
> as in gdk?
Hmm, if I remember correctly you have to alloc the color from the window's
colormap, since gc needs a pixel value, which in turn is only allocated
(or determined for truecolor displays) at that phase. What happens now is
that the pixel value has a default of 0, which usually is black on indexed
color displays and black on truecolor displays.
If that doesn't help, I'll take a look at my own code when I get to home
later, and check the correct calling sequence.
--
sa...@ik... I have become death, destroyer of the worlds.
|