Re: [gtk-list] Re: Drawing in GtkDrawingArea



Havoc Pennington wrote:

> On Sat, 28 Nov 1998, Marsel Osipov wrote:
> >
> > I did. I actually started with it. and it still does not work.
> >
>
> Post some code then, or give us more details. We can't guess what you're
> doing wrong.
>
> Havoc
>

void MyClass::displayPixel(RGBColor pixel, int x, int y)
{
  GdkColor *color;
  GdkGC * gc;
  gc = gdk_gc_new(d_area->window);

  color = (GdkColor *)malloc(sizeof(GdkColor));

  color->red = (gushort)pixel.red() * (65535/255);
  color->green = (gushort)pixel.green() * (65535/255);
  color->blue = (gushort)pixel.blue() * (65535/255);
  color->pixel = (gulong)(pixel.red()*65536 + pixel.green()*256 +
pixel.blue());
  gdk_color_alloc(gtk_widget_get_colormap(d_area), color);

  gdk_gc_set_foreground(gc, color);
  gdk_gc_set_background(gc, color);

  gdk_draw_point(pixmap,
   gc,
   x,
   y);



> --
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null






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