iwin8.h

Go to the documentation of this file.
00001 
00007 /*
00008 Copyright (C) 1998 Jeffrey S. Freedman
00009 
00010 This library is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU Library General Public
00012 License as published by the Free Software Foundation; either
00013 version 2 of the License, or (at your option) any later version.
00014 
00015 This library is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 Library General Public License for more details.
00019 
00020 You should have received a copy of the GNU Library General Public
00021 License along with this library; if not, write to the
00022 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023 Boston, MA  02111-1307, USA.
00024 */
00025 
00026 #ifndef INCL_IWIN8
00027 #define INCL_IWIN8  1
00028 
00029 #include "imagewin.h"
00030 #include "ibuf8.h"
00031 
00032 template <class T> class GammaTable;
00033 
00034 
00035 /*
00036  *  Here's an 8-bit color-depth window (faster than the generic).
00037  */
00038 class Image_window8 : public Image_window
00039   {
00040   unsigned char colors[768];  // Palette.
00041   Image_buffer8 *ib8;   // Cast to 8-bit buffer.
00042 
00043   static GammaTable<unsigned char>  GammaRed;
00044   static GammaTable<unsigned char>  GammaGreen;
00045   static GammaTable<unsigned char>  GammaBlue;
00046 public:
00047   Image_window8(unsigned int w, unsigned int h, int scl = 1, 
00048               bool fs = false, int sclr = point);
00049   ~Image_window8();
00050 
00051   Image_buffer8 *get_ib8() const
00052     { return ib8; }
00053           // Set palette.
00054   virtual void set_palette(unsigned char *rgbs, int maxval, 
00055             int brightness = 100);
00056           // Rotate palette colors.
00057   virtual void rotate_colors(int first, int num, int upd);
00058   /*
00059    *  8-bit color methods:
00060    */
00061           // Fill with given (8-bit) value.
00062   void fill8(unsigned char val)
00063     { ib8->Image_buffer8::fill8(val); }
00064           // Fill rect. wth pixel.
00065   void fill8(unsigned char val, int srcw, int srch,
00066             int destx, int desty)
00067     { IF_OPENGL(opengl_fill8(val, srcw, srch, destx, desty),
00068       ib8->Image_buffer8::fill8(val, srcw, srch, destx, desty)); }
00069           // Fill line with pixel.
00070   void fill_line8(unsigned char val, int srcw,
00071             int destx, int desty)
00072     { ib8->Image_buffer8::fill_line8(val, srcw, destx, desty); }
00073           // Copy rectangle into here.
00074   void copy8(unsigned char *src_pixels,
00075         int srcw, int srch, int destx, int desty)
00076     { ib8->Image_buffer8::copy8(src_pixels, srcw, srch, 
00077               destx, desty); }
00078           // Copy line to here.
00079   void copy_line8(unsigned char *src_pixels, int srcw,
00080             int destx, int desty)
00081     { ib8->Image_buffer8::copy_line8(src_pixels, srcw, 
00082               destx, desty); }
00083           // Copy with translucency table.
00084   void copy_line_translucent8(
00085     unsigned char *src_pixels, int srcw,
00086     int destx, int desty, int first_translucent,
00087     int last_translucent, Xform_palette *xforms)
00088     { ib8->Image_buffer8::copy_line_translucent8(src_pixels, srcw,
00089       destx, desty,
00090         first_translucent, last_translucent, xforms); }
00091           // Apply translucency to a line.
00092   void fill_line_translucent8(unsigned char val,
00093       int srcw, int destx, int desty, Xform_palette& xform)
00094     { ib8->Image_buffer8::fill_line_translucent8(val, 
00095           srcw, destx, desty, xform); }
00096           // Copy rect. with transp. color.
00097   void copy_transparent8(unsigned char *src_pixels, int srcw,
00098           int srch, int destx, int desty)
00099     { ib8->Image_buffer8::copy_transparent8(src_pixels, srcw, srch,
00100               destx, desty); }
00101           // Get/put a single pixel.
00102   unsigned char get_pixel8(int x, int y)
00103     { return ib8->Image_buffer8::get_pixel8(x, y); }
00104   void put_pixel8(unsigned char pix, int x, int y)
00105     { ib8->Image_buffer8::put_pixel8(pix, x, y); }
00106 
00107   static void get_gamma (float &r, float &g, float &b);
00108   static void set_gamma (float r, float g, float b);
00109 
00110   unsigned char* mini_screenshot();
00111   };
00112 
00113 #endif

Generated on Mon Jul 9 14:42:47 2007 for ExultEngine by  doxygen 1.5.1