TSP: The Transport Sample Protocol



Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

cutnpast.c

00001 
00002 
00003 #include <stdlib.h>
00004 #include <stdio.h>
00005 #include <unistd.h>
00006 #include <libgen.h>
00007 
00008 #include <gtk/gtk.h>
00009 #include <gdk/gdk.h>
00010 #include <glib.h>
00011 
00012 #include "cutnpast.h"
00013 
00014 cutnpast_t* cutnpast_new(GdkWindow* window, GdkPixmap* target, GdkGC* clear_gc, gint width, gint height)
00015 {
00016   
00017   cutnpast_t* h = (cutnpast_t*)g_malloc0(sizeof(cutnpast_t));
00018 
00019   h->buf = gdk_pixmap_new(window, width, height, -1);
00020   h->target = target;
00021   h->clear_gc = clear_gc;
00022   
00023   h->buf_gc = gdk_gc_new(h->buf);
00024   h->target_gc = gdk_gc_new(h->target);
00025   
00026   h->width = width;
00027   h->height = height;
00028 
00029 
00030 }
00031 
00032 void  cutnpast_destroy(cutnpast_t* h)
00033 {
00034   gdk_gc_unref( h->buf_gc );
00035   gdk_gc_unref( h->target_gc );
00036   gdk_pixmap_unref(h->buf);
00037   g_free(h);
00038 }
00039 
00040 void cutnpast_cut_and_paste(cutnpast_t* h, gint xsrc, gint ysrc, gint xdest, gint ydest)
00041 {
00042 
00043   /* Copy area on buf, and from buf to target */
00044 
00045         /*gdk_draw_pixmap (h->buf,
00046                          h->buf_gc,
00047                          h->target,
00048                          xsrc,ysrc,
00049                          0, 0,
00050                          h->width,
00051                          h->height);
00052 
00053         gdk_draw_rectangle(h->target,
00054                           h->clear_gc,
00055                           TRUE,
00056                           xsrc,ysrc,
00057                          h->width,
00058                          h->height);
00059 
00060         gdk_draw_pixmap (h->target,
00061                          h->target_gc,
00062                          h->buf,
00063                          0,0,
00064                          xdest, ydest,
00065                          -1,
00066                          -1);*/
00067 
00068   gdk_draw_pixmap (h->target,
00069                    h->target_gc,
00070                    h->target,
00071                    xsrc,ysrc,
00072                    xdest, ydest,
00073                    h->width,
00074                    h->height);
00075 
00076 
00077 }
Framework Home Page.

Beware !! TSP wave is coming...