Copying bitmaps into bitmaps

2002-01-17 Thread Edscott Wilson García


I've been trying to copy a bitmap into a bitmap with gdk_draw_pixmap(), 
without success. Is it necesary to use XCopyPlane in lieu of some gdk routine?
Basically all I want to do is a binary OR between the data in the 2 bitmaps.

TIA,

Edscott Wilson Garcia
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Copying bitmaps into bitmaps

2002-01-17 Thread Havoc Pennington


Edscott Wilson García [EMAIL PROTECTED] writes:
 I've been trying to copy a bitmap into a bitmap with gdk_draw_pixmap(), 
 without success. Is it necesary to use XCopyPlane in lieu of some
 gdk routine?

When you say without success, what happens? It should work fine.

 Basically all I want to do is a binary OR between the data in the 2 bitmaps.
 

That isn't what gdk_draw_pixmap() normally does, it just copies the
bits and overwrites the ones in dest. Look at gdk_gc_set_function(), 
I'm not sure it affects drawing a pixmap but I think it might.

Havoc
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Copying bitmaps into bitmaps

2002-01-17 Thread Edscott Wilson García

On Thu 17 Jan 2002 10:01, Havoc Pennington wrote:
 Edscott Wilson García [EMAIL PROTECTED] writes:
  I've been trying to copy a bitmap into a bitmap with gdk_draw_pixmap(),
  without success. Is it necesary to use XCopyPlane in lieu of some
  gdk routine?

 When you say without success, what happens? It should work fine.

I get messages like:

xftree: Fatal XLib internal error
BadMatch (invalid parameter attributes)
Request 62, Error 8

when I try to use the resulting bitmap. It croaks with only one copy from 
existing bitmap to a bitmap created with  
gdk_pixmap_new(window,pix_w,pix_h,1). 

After looking at a book by Barkakati, (X Window System Programming, 1991) he 
says that bitmaps should be copied into pixmaps by XCopyPlane(), not 
XCopyArea() (the latter being used by gdk_draw_pixmap()).


  Basically all I want to do is a binary OR between the data in the 2
  bitmaps.

 That isn't what gdk_draw_pixmap() normally does, it just copies the
 bits and overwrites the ones in dest. Look at gdk_gc_set_function(),
 I'm not sure it affects drawing a pixmap but I think it might.

Basically what I want is a transparency mask resulting from the combination 
of two (or more) pixmaps with different transparency masks. Which would be a 
binary AND between the data. I'll look at gdk_gc_set_function(), and see what 
I can do with it.

saludos,

Edscott

 

 Havoc
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Copying bitmaps into bitmaps

2002-01-17 Thread Havoc Pennington


Edscott Wilson García [EMAIL PROTECTED] writes: 
 After looking at a book by Barkakati, (X Window System Programming, 1991) he 
 says that bitmaps should be copied into pixmaps by XCopyPlane(), not 
 XCopyArea() (the latter being used by gdk_draw_pixmap()).


That's right, but I thought you were copying between two bitmaps. 
CopyArea() should work OK for that AFAIK.

The bad match is caused by copying between two pixmaps with a
different bit depth.
 
Havoc
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Copying bitmaps into bitmaps

2002-01-17 Thread Edscott Wilson García

On Thu 17 Jan 2002 13:38, Havoc Pennington wrote:
 Edscott Wilson García [EMAIL PROTECTED] writes:
  After looking at a book by Barkakati, (X Window System Programming, 1991)
  he says that bitmaps should be copied into pixmaps by XCopyPlane(), not
  XCopyArea() (the latter being used by gdk_draw_pixmap()).

 That's right, but I thought you were copying between two bitmaps.
 CopyArea() should work OK for that AFAIK.

But isn't a bitmap nothing more than a pixmap of depth 1? If 
gdk_pixmap_new(window,pix_w,pix_h,1);
is not the correct way to create an empty bitmap with gtk, how should it be 
created?

edscott


 The bad match is caused by copying between two pixmaps with a
 different bit depth.

 Havoc
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Copying bitmaps into bitmaps

2002-01-17 Thread Havoc Pennington


Edscott Wilson García [EMAIL PROTECTED] writes: 
 But isn't a bitmap nothing more than a pixmap of depth 1? If 
 gdk_pixmap_new(window,pix_w,pix_h,1);
 is not the correct way to create an empty bitmap with gtk, how should it be 
 created?

That is the right way. One of us is missing some detail.

Havoc
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Copying bitmaps into bitmaps

2002-01-17 Thread Edscott Wilson García

On Thu 17 Jan 2002 14:21, Havoc Pennington wrote:
 Edscott Wilson García [EMAIL PROTECTED] writes:
  But isn't a bitmap nothing more than a pixmap of depth 1? If
  gdk_pixmap_new(window,pix_w,pix_h,1);
  is not the correct way to create an empty bitmap with gtk, how should it
  be created?

 That is the right way. One of us is missing some detail.


Its as simple as the following code, where gPIM[0] is a valid and working 
GdkBitmap with width pix_w and height pix_h,  and h is a gtkdialog.

static GdkBitmap *gPM;

static void create_higher_bitmap(){
/* This should work, but it doesn't */
  GdkGC *gc; 
  gPM=gdk_pixmap_new (h-window,pix_w,pix_h,1);
  if (!gPIM){fprintf(stderr,xftree: error 3348\n);return;}
  gc = gdk_gc_new (h-window);
  gdk_draw_pixmap(gPM,gc,gPIM[0],0,0,0,0,pix_w,pix_h);
  gdk_gc_destroy (gc);
  return; 
}

gdk_pixmap_new does not return NULL. 
Maybe I'm screwing up with the gc which should have special considerations 
for bitmap working.
Maybe there's something particular with src_private-xwindow or 
drawable_private-xwindow:

  XCopyArea (drawable_private-xdisplay,
 src_private-xwindow,
 drawable_private-xwindow,
 gc_private-xgc,
 xsrc, ysrc,
 width, height,
 xdest, ydest);



edscott
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Copying bitmaps into bitmaps

2002-01-17 Thread Paul Davis

On Thu 17 Jan 2002 14:21, Havoc Pennington wrote:
 Edscott Wilson García [EMAIL PROTECTED] writes:
  But isn't a bitmap nothing more than a pixmap of depth 1? If
  gdk_pixmap_new(window,pix_w,pix_h,1);
  is not the correct way to create an empty bitmap with gtk, how should it
  be created?

 That is the right way. One of us is missing some detail.


Its as simple as the following code, where gPIM[0] is a valid and working 
GdkBitmap with width pix_w and height pix_h,  and h is a gtkdialog.

when are you calling this? i trust that is from an expose event handler?
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list



Re: Copying bitmaps into bitmaps

2002-01-17 Thread Havoc Pennington


Edscott Wilson García [EMAIL PROTECTED] writes:
   gc = gdk_gc_new (h-window);

Try using one of the bitmaps here instead of the window, the bad match
may be a GC/drawable issue rather than src/dest drawable.

Havoc
___
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list