xshmimg.h

Go to the documentation of this file.
00001 /* Gxsm - Gnome X Scanning Microscopy
00002  * universal STM/AFM/SARLS/SPALEED/... controlling and
00003  * data analysis software
00004  * 
00005  * Copyright (C) 1999,2000,2001,2002,2003 Percy Zahl
00006  *
00007  * Authors: Percy Zahl <zahl@users.sf.net>
00008  * additional features: Andreas Klust <klust@users.sf.net>
00009  * WWW Home: http://gxsm.sf.net
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License as published by
00013  * the Free Software Foundation; either version 2 of the License, or
00014  * (at your option) any later version.
00015  *
00016  * This program is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License
00022  * along with this program; if not, write to the Free Software
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
00024  */
00025 
00026 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 8 c-style: "K&R" -*- */
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  * XShm Image Object
00042  * ============================================================
00043  */
00044 
00045 #define UUS24(N) ((U24*)((char*)uus+(3*N)))->rgb
00046 
00047 typedef union { unsigned long rgb:24; } U24; /* Achtung sizof( U24 ) == 4 !!! */
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 /*my palette of greys / LookUp Table*/
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

Generated on Sat Apr 1 09:04:07 2006 for GXSM by  doxygen 1.4.6