Pixmaps AGAIN .... PLEASE HELP!!!



Sorry to bother you  again but I am still trying to solve this problem
I mean --> The transparent PIXMAP

Well Now i am attaching some code!!!

I have one Pixmap and I set it as the BG of the main
window after that (and here comes my problem) I have other
Pixmap, and and I will do some drawing on top of it and I
want to keep the stuff I draw and the rest to be transparent
and just see the BG of the window .. I am storing the Pixmap
in a gtk_pixmap as in the wheelbarrow example of the DOCUMENTATION
but everything I have tryed so far is eather ends with a core dump
or something wierd .  =(


I know the BG pixmap is there because I can see it when
I increase the size of the WINDOW  ....

HOW CAN I INITIALIZE THE TOP Pixmap as transparent and after that
do the drawing, or if you have a better IDEA I would be really
happy to read it ...

PLEASE SOMEONE OUT THERE HELP ME ...


Thanks in advance LIST!!!

Julio

ps ..  Sorry for the mess of my code
       but it is one of the 1000s attemps

-------------------------------------------------------------------
#include <gtk/gtk.h>
#include <stdlib.h>



void close_application( GtkWidget *widget, GdkEvent *event, gpointer data) {
    gtk_main_quit();
}

int main (int argc, char *argv[])
{
    GtkWidget *window, *pixmap, *fixed;
        GdkPixmap *bk_pixmap,  *p;
    GdkColor *color2;
    GdkGC *gccc;
        GdkColor *color;
    GdkGC *gcc;


        int sizeX = 300;
        int sizeY = 300;


    gtk_init (&argc, &argv);
    window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (close_application), NULL);
    gtk_widget_show (window);


    bk_pixmap =  gdk_pixmap_new ( window->window, sizeX, sizeY, -1);

   /*Just to define a color*/
        gcc = gdk_gc_new(window->window);
    color = (GdkColor *) malloc(sizeof(GdkColor));
    color->red = 0xffff;
    color->green = 0xffff;
    color->blue = 0xffff;
    color->pixel = (gulong)(0);
    gdk_color_alloc(gtk_widget_get_colormap(window), color);
   /*------*/

     gdk_gc_set_foreground (gcc, color);
     gdk_draw_rectangle ( bk_pixmap, gcc, TRUE,0, 0, sizeX,sizeY);

        gtk_widget_set_app_paintable(window, TRUE);
    gdk_window_set_back_pixmap(window -> window, bk_pixmap, 0);

    p =  gdk_pixmap_new ( window->window, sizeX, sizeY, -1);

        /*Just to define a color*/
        gccc = gdk_gc_new(window->window);
    color2 = (GdkColor *) malloc(sizeof(GdkColor));
    color2->red = 0;
    color2->green = 0;
    color2->blue = 0;
    color2->pixel = (gulong)(0);
    gdk_color_alloc(gtk_widget_get_colormap(window), color2);
    gdk_gc_set_foreground (gccc, color2);
         /*-----*/

         gdk_draw_rectangle ( p, gccc, TRUE,150, 150, 15, 15);
     gdk_draw_rectangle ( p, gccc, TRUE,0, 0, 50, 50);
     gdk_draw_rectangle ( p, gccc, TRUE,50, 50, 100, 100);

        pixmap = gtk_pixmap_new( p, NULL );
        gtk_widget_show( pixmap );


    fixed = gtk_fixed_new();
    gtk_widget_set_usize( fixed, sizeX, sizeY );
    gtk_fixed_put( GTK_FIXED(fixed), pixmap, 0, 0 );
    gtk_container_add( GTK_CONTAINER(window), fixed );
    gtk_widget_show( fixed );




   gtk_widget_show( window );
    gtk_main ();

    return 0;
}





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