00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <gtk/gtk.h>
00024 #include <gdk/gdkrgb.h>
00025 #include <tiffio.h>
00026 #include <freetype2/freetype/freetype.h>
00027 #ifndef __FREETYPE_H__
00028 #error no freetype
00029 #endif
00030 #include <Alloc.hh>
00031
00032 #include "Config.h"
00033 #include "Palette.hh"
00034
00035
00036 #ifndef FRAMEBUF_HH
00037 #define FRAMEBUF_HH
00038
00039 #define FB_TIFF_MODE "w" // w = write, a = append
00040 #define FB_TIFF_RESOLUTION 100 // dpi
00041 #define FB_TIFF_FONTSIZE 12 // points
00042 #define FB_TIFF_DATELEN 19 // characters
00043
00044
00048 enum
00049 {
00050 FB_TYPE_NONE = 0,
00051 FB_TYPE_LINE = 1,
00052 FB_TYPE_COLUMN = 2
00053 };
00054
00058 enum
00059 {
00060 FB_TIFF_COMPRESS_NONE = COMPRESSION_NONE,
00061 FB_TIFF_COMPRESS_RLE = COMPRESSION_CCITTRLE,
00062 FB_TIFF_COMPRESS_LZW = COMPRESSION_LZW,
00063 FB_TIFF_COMPRESS_JPEG = COMPRESSION_JPEG,
00064 FB_TIFF_COMPRESS_DEFLATE = COMPRESSION_ADOBE_DEFLATE
00065 };
00066
00070 enum
00071 {
00072 FB_TIFF_CONT_NO,
00073 FB_TIFF_CONT_VERTICAL,
00074 FB_TIFF_CONT_HORIZONTAL
00075 };
00076
00077
00087 class clFrameBuf : public clPalette
00088 {
00089 bool bSaving;
00090 int iType;
00091 int iWidth;
00092 int iHeight;
00093 int iCurPos;
00094 int iPixFontSize;
00095 int iMaxFontWidth;
00096 char cpDateTime[FB_TIFF_DATELEN + 1];
00097 unsigned int *upFrameBuf;
00098 uint32 *upScanBuf;
00099 uint32 uiStripSize;
00100 tstrip_t uiContStrip;
00101 TIFF *tiffImg;
00102 FT_Library ftLib;
00103 FT_Face ftFace;
00104 clAlloc FrameBuf;
00105 clAlloc ScanBuf;
00106 void RGBA2RGB (unsigned char *, const unsigned int *, int, int,
00107 int, int, int, int);
00108 bool SetTiffTags (const char *, int, int, const char *, int,
00109 int, int);
00110 bool WriteTiffData ();
00111 bool WriteTiffData (int, int, double, double, double, double);
00112 bool WriteTiffScanData ();
00113 void DrawHLine (unsigned char *, int, int, int, int, int);
00114 void DrawVLine (unsigned char *, int, int, int, int, int);
00115 bool DrawText (unsigned char *, int, int, int, int, const char *);
00116 public:
00117 clFrameBuf ();
00118 ~clFrameBuf ();
00127 void SetSize (int, int);
00131 void Clear ();
00137 unsigned int *GetFBPtr () { return upFrameBuf; }
00143 unsigned int *GetPalPtr () { return upPalette; }
00151 guchar *GetCurPtr (int, int);
00159 gint GetRowStride () { return (iWidth * sizeof(unsigned int)); }
00165 int GetNumColors () { return iPalSize; }
00171 int GetWidth () { return iWidth; }
00177 int GetHeight () { return iHeight; }
00186 void DrawLine (unsigned int *);
00191 void DrawLine (GDT *);
00200 void DrawColumn (unsigned int *);
00205 void DrawColumn (GDT *);
00211 unsigned int operator [] (int iPix)
00212 { return upFrameBuf[iPix]; }
00216 void PalGenBW () { GenBW(); }
00220 void PalGenHSV () { GenHSV(); }
00224 void PalGenLight () { GenLight(); }
00228 void PalGenTemp () { GenTemp(); }
00232 void PalGenDir () { GenDir(); }
00236 void PalGenGreen () { GenGreen(); }
00240 void PalGenGreen2 () { GenGreen2(); }
00244 void PalGenGreen3 () { GenGreen3(); }
00248 void PalGenGreen4 () { GenGreen4(); }
00252 void PalGenPureGreen () { GenPureGreen(); }
00256 void PalGenWB () { GenWB(); }
00270 bool SaveToFile (const char *, int, int, const char *);
00271 bool SaveToFile (const char *, int, int, const char *,
00272 double, double, double, double);
00274
00286 bool StartSaveToFile (const char *, int, int, const char *, int);
00290 void StopSaveToFile ();
00291 };
00292
00293 #endif
00294