00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef __XSHMIMG_H
00029 #define __XSHMIMG_H
00030
00031 #include <stdio.h>
00032 #include <stdlib.h>
00033
00034 #include <libgnome/libgnome.h>
00035 #include <libgnomecanvas/libgnomecanvas.h>
00036 # include <gdk-pixbuf/gdk-pixbuf.h>
00037
00038 #define IMGMAXCOLORENTRYS 1024
00039
00040
00041
00042
00043
00044
00045 #define UUS24(N) ((U24*)((char*)uus+(3*N)))->rgb
00046
00047 typedef union { unsigned long rgb:24; } U24;
00048
00049 class ShmImage2D{
00050 public:
00051 ShmImage2D(GtkWidget *area,
00052 int Width, int Height,
00053 int xorigin, int yorigin
00054 );
00055 ~ShmImage2D();
00056
00057 void Resize(int Width, int Height);
00058 GnomeCanvasItem *GetGimg(){ return gitem_image; };
00059
00060 unsigned long GetMaxCol(){ return maxcol; };
00061 void MkPalette(char *name=NULL);
00062
00063 void saveimage(gchar *name);
00064
00065 void SetZoomFac(int zf){ ZoomFac = zf; };
00066
00067 void PutPixel(unsigned long x, unsigned long y, unsigned long val);
00068
00069 void ShowPic(int xs=0, int ys=0);
00070 void ShowSubPic(int xs, int ys, int w, int h);
00071
00072 private:
00073
00074
00075 unsigned long ULColorTable[IMGMAXCOLORENTRYS+2];
00076
00077 GnomeCanvasPoints *red_line_points;
00078 GdkPixbuf *gdk_pixbuf;
00079
00080 GtkWidget *imgarea;
00081 GnomeCanvasItem *gitem_image;
00082 GnomeCanvasItem *gitem_red_line;
00083
00084 unsigned int maxcol;
00085 int rowstride, bpp, width, height, x0, y0;
00086 guchar *pixels;
00087
00088 int ZoomFac;
00089 };
00090
00091 #endif