• Main Page
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

im_imageview.h

Go to the documentation of this file.
00001 
00005 #ifndef __IMAGEVIEW_H
00006 #define __IMAGEVIEW_H
00007 
00008 #include <cd.h>
00009 #include <iup.h>
00010 #include <im.h>
00011 #include <im_image.h>
00012 
00018 #if defined(__cplusplus)
00019 extern "C" {
00020 #endif
00021 
00022 typedef struct _imBitmapView
00023 {
00024   imImage* image;
00025   int cnv2bitmap; /* image is a new bitmap converted image */
00026 
00027   int cpx2real;
00028   double gamma;
00029   int absolute;
00030   int cast_mode;
00031 } imBitmapView;
00032 
00033 void imBitmapViewInit(imBitmapView* BitmapView);
00034 int imBitmapViewUpdateImage(imBitmapView* BitmapView, imImage* image);
00035 void imBitmapViewRelease(imBitmapView* BitmapView);
00036 
00037 
00040 typedef struct _imImageView
00041 {
00042   cdCanvas* cd_canvas;
00043   Ihandle* canvas;
00044 
00045   const imBitmapView* BitmapView;
00046 
00047   /* CD cd_canvas size */
00048   int Width;
00049   int Height;
00050 
00051   int ViewMode;
00052   double ZoomFactor;
00053   int ZoomIndex;
00054   int repaint;
00055   int drag_x, drag_y;
00056 
00057   /* CD coordinates of the view area inside the cd_canvas,
00058      it is centered in the cd_canvas and 
00059      proportional to the image dimensions multiplied by the zoom.
00060      It is exactly where the PutImage should happen */
00061   int ViewX;
00062   int ViewY;
00063   int ViewWidth;
00064   int ViewHeight;
00065 } imImageView;
00066                    
00069 imImageView* imImageViewCreate(Ihandle* canvas, const imBitmapView* BitmapView);
00070                    
00073 void imImageViewDestroy(imImageView* image_view);
00074                    
00077 void imImageViewChangeImage(imImageView* image_view, imImage* image);
00078                    
00081 enum {IM_VIEW_NORMAL, IM_VIEW_FIT};
00082                    
00085 int imImageViewMode(imImageView* image_view);
00086                    
00089 void imImageViewFit(imImageView* image_view);
00090                    
00093 void imImageViewZoom(imImageView* image_view,int index);
00094                    
00097 void imImageViewZoomIn(imImageView* image_view);
00098                    
00101 void imImageViewZoomOut(imImageView* image_view);
00102                    
00105 int imImageViewZoomIndex1(imImageView* image_view);
00106                    
00109 int imImageViewZoomIndex2(imImageView* image_view);
00110                    
00113 int imImageViewZoomPercent(imImageView* image_view);
00114                    
00117 int imImageViewPutImage(imImageView* image_view);
00118                    
00121 enum {IM_VIEW_MOUSEMOVE, IM_VIEW_MOUSEDOWN, IM_VIEW_MOUSEUP};
00122                    
00125 typedef int (*_imImageViewMouseCB)(imImageView* image_view, int x, int y, int mode);
00126                    
00129 typedef int (*_imImageViewRepaintCB)(imImageView* image_view);
00130                    
00133 typedef int (*_imImageViewResizeCB)(imImageView* image_view);
00134                    
00137 void imImageViewSetCallbacks(_imImageViewRepaintCB repaint, _imImageViewResizeCB resize, _imImageViewMouseCB mouse);
00138                    
00141 void imImageViewFitRect(int wc, int hc, int wi, int hi, int *w, int *h);
00142                    
00145 void imImageViewDrawImage(cdCanvas* cd_canvas, imImage* image, int x, int y, int w, int h);
00146                    
00149 imImage* imImageViewImportImage(void* driver, void* data);
00150                    
00153 int imImageViewExportImage(void* driver, imImage* image, const char* filename);
00154 
00155 int imImageViewData2Str(char* str, const void* data, int index, int data_type, int more_prec);
00156 int imImageViewStr2Data(const char* str, void* data, int index, int data_type);
00157 double imDataGetDouble(const void* data, int index, int data_type);
00158 void imDataSetDouble(const void* data, int index, int data_type, double value);
00159 
00160 
00161 #if defined(__cplusplus)
00162 }
00163 #endif
00164 
00165 #endif

Generated on Wed Jan 9 2019 09:48:59 for IMLAB by  doxygen 1.7.1