How to draw a XOR-Line



Hello,

I used to draw XOR-lines in an image the following way:

existing RGB-buffer -> GdkImlibImage -> render the GdkImlibImage to pixmap
-> gdk_draw_line(pixmap)

Now I attempt to remove the ImLib step because it makes no sense to
render it to different sizes.  I only want to draw the image in the
given RGB dimensions.

Now the questions:
1) To create a pixmap from RGB-data there is the function:

GdkPixmap* gdk_pixmap_create_from_data  (GdkWindow   *window,
                                         const gchar *data,
                                         gint         width,
                                         gint         height,
                                         gint         depth,
                                         GdkColor    *fg,
                                         GdkColor    *bg);
   What kind of "const char *data" are expected.  The tutorial says "bitmap
   data".  With the same RGB-buffer I used to render the ImLib image I
   I had no success.

2) Moreover I wonder if it is necessary to create the pixmap instead of
   using GdkRgb?  I could XOR the lines (only horizontal and vertical,
   no Breshnham or other line drawing algorithm necessary) which wouldn't
   make any problem and could use gdk_draw_rgb_image().  What do you
   think of this idea in matter of speed compared with the pixmap
   handling?

   By the way:  in testrgb I found a comment
  /* Let's warm up the cache, and also wait for the window manager
     to settle. */
   before the first images are displayed and I observed in tests of mine
   that I have to draw the first image twice in my testing program.  If
   not a certain part of the image remains in background color.  It is
   right that it is only necessary for the first image drawn by
   gdk_draw_rgb_image() ?

Kind regards

        Andreas.

[X] Against war.




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