How to draw pixels ?
Mattias Gaertner wrote 12 lines
But we must remember that it does not work.
Or already functions?

Mailing lists / lazarus / 2001-10
12 messages · 5 people ·
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
How to draw pixels ?
But we must remember that it does not work.
Or already functions?
How to draw pixels ?
I think I wote a function some time ago to convert to TColor. Check the gtk files for a procedure ???ToTColor
I found a TGDKColorToTColor function.
A GDKColor consists of Pixel, Red, Green and Blue, so it is no problem to convert this to TColor. But gdk_image_get_pixel returns a mere pixel index. How can we convert this to TColor?
Ideas?
Mattias Gaertner
Pffff... It was to long ago that I did something with GTK drawing. From what I remember…
Ok, then yot get a GDKColor fron the get_pixel.
From the description of the GDKColormap structure itself, I think you can lookup the index in this map. I only don't know if the SystemMAp is a pseudo colormap, but we can find out.
Marc
I think I wote a function some time ago to convert to TColor. Check the gtk files for a…
(see TGtkObject.SetPixel in gtkobject.inc)
With gdk_image_put_pixel. The TColor is converted to a TGDKColor via gdk_colormap_alloc_color with gdk_colormap_get_system as the colormap.
Mattias
On Mon, 08 Oct 2001 09:16:50 +0200 I think you are right. gdk_image_get_pixel returns a…
+ From: Mattias Gaertner
+
+ On Mon, 08 Oct 2001 09:16:50 +0200
+ Marc Weustink wrote:
+
+ > >(see TGtkObject.SetPixel in gtkobject.inc)
+ > >With gdk_image_put_pixel. The TColor is converted to a
+ > >TGDKColor via gdk_colormap_alloc_color with
+ > >gdk_colormap_get_system as the colormap.
+ >
+ > Ok, then yot get a GDKColor fron the get_pixel.
+ >
+ > From the description of the GDKColormap structure itself,
+ > I think you can lookup the index in this map. I only don't
+ > know if the SystemMAp is a pseudo colormap, but we can
+ > find out.
+
+ I think you are right. gdk_image_get_pixel returns a index in
+ the colormap (gdk_colormap_get_system). But this index can
+ also be a pseudo color (Direct Color or True Color). How can
+ we find out?
Pffff... It was to long ago that I did something with GTK drawing. From what I remember…
I think you are right. gdk_image_get_pixel returns a index in the colormap (gdk_colormap_get_system). But this index can also be a pseudo color (Direct Color or True Color). How can we find out?
I committed some new code for TColorDialog. The selected color can now be set.
Mattias
I found a way to convert gdk pixels to GDKColor using color contexts.
Mattias
How to draw pixels ?
How to draw pixels ?
Just the same like lines, circles and boxes. Any component with a canvas can be drawn onto:
Canvas.Pixels[x,y] := clRed;But these pixels are not stored. You must draw them in every OnPaint event of the component, which can be pretty slow.
Mattias Gaertner
How to draw pixels ?
Sorry, you are right, there was a bug. I fixed the SetPixel. But I don't know how to fix the GetPixel, because I don't know how to convert the result of gdk_image_get_pixel to TColor. Can anyone give me a hint?
I also fixed the TCustomForm.OnResize event and some smaller bugs.
Mattias
How to draw pixels ?
I think I wote a function some time ago to convert to TColor. Check the gtk files for a procedure ???ToTColor
Shane
Pffff... It was to long ago that I did something with GTK drawing. From what I remember there is a GTK/GDK finction to get the RGB values forn an index.
BTW how doe you set the pixel ?
Marc
How to draw pixels ?