Re: [gtk-list] Re: clip origin, and **clip mask origion** ??
- From: Travis Loyd <lelandg usa net>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: clip origin, and **clip mask origion** ??
- Date: Fri, 14 May 1999 11:18:53 -0500 (CDT)
On Fri, 14 May 1999, Paul Barton-Davis wrote:
> >
> >HOW DO YOU CREATE A MASK FOR EACH ONE!!!!!!!!!!!!!!! :)
>
> Ah yes. Well, there is a way, although it rather ugly.
>
> Create the composite pixmap. Create a GdkBitmap of the right size (any
> way you can think of). Create a GC with a depth of 2. Draw the
> relevant section into the bitmap with the GC. Voila.
I'm amazed with what I've created so far using GTK considering my lack of
fundamental understanding. I don't know what a GC actually is although
I've used them quite a bit. I don't know how to create a GC with a depth
of 2.
And if I don't have the mask yet doesn't it make sense that when I draw
the mask that it will copy a square because in order to copy we need to
already have the mask?
I'm trying to implement your suggesting and getting this error:
Gdk-ERROR **: BadMatch (invalid parameter attributes)
serial 2192 error_code 8 request_code 62 minor_code 0
I don't know how to make a GC of 2, that might be the problem.
I've attached one of the functions I'm trying to do this in, but if you
know exactly what I'm asking I suspect you don't need it.
Could you please give an example. Later on I believe my program might be
well used as an example for future GTK programmers.
Travis Loyd
[email: lelandg@usa.net Encrypt your email too: ]
[other: s201635@mail.nwmissouri.edu http://www.pgp.com ]
[ pgp: send email with subject: sendmepgp ]
void add_walls(struct reference_hold *sister) {
gint x, y, z, ptr;
GdkBitmap *the_mask;
GdkGC *the_gc;
the_mask = gdk_pixmap_new(sister->main_window->window, 40, 40, 1);
the_gc = gdk_gc_new(sister->main_window->window);
for(ptr = 0; ptr < sister->factory_tile_size; ptr ++) {
if(sister->factory_tile_layout[ptr] == 0xd2) {
for(++ptr;ptr < sister->factory_tile_size; ptr ++) {
if(sister->factory_tile_layout[ptr] >= 0xd0) {
/* We are out of walls */
// ptr--;
break;
}
x = sister->factory_tile_layout[ptr];
y = sister->factory_tile_layout[++ptr];
z = sister->factory_tile_layout[++ptr];
/* This adds the walls */
switch(z) {
case 0:
gdk_draw_pixmap(
the_mask, the_gc,
sister->tileset_xpm, WALL_NORTH_X, WALL_NORTH_Y,
(x*TILE_SIZE), (y*TILE_SIZE), TILE_SIZE, TILE_SIZE);
gdk_gc_set_clip_mask(sister->tileset_gc, the_mask);
// my_set_gc_clip_mask(sister,
// (WALL_NORTH_X), (WALL_NORTH_Y));
gdk_gc_set_clip_origin(sister->tileset_gc,
(x*TILE_SIZE), (y*TILE_SIZE));
gdk_draw_pixmap(
sister->factory_tile_xpm, sister->tileset_gc,
sister->tileset_xpm, WALL_NORTH_X, WALL_NORTH_Y,
(x*TILE_SIZE), (y*TILE_SIZE), TILE_SIZE, TILE_SIZE);
break;
}
}
break;
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]