Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

FrameBuf.hh

Go to the documentation of this file.
00001 /*
00002 
00003     Framebuffer class
00004     Copyright (C) 1999-2002 Jussi Laako
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 

Generated on Sun Oct 26 19:11:20 2003 for HASAS by doxygen 1.3.3