![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * B i t m a p O b j e c t * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2004 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXBitmap.h,v 1.27 2004/02/08 17:17:33 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXBITMAP_H 00025 #define FXBITMAP_H 00026 00027 #ifndef FXDRAWABLE_H 00028 #include "FXDrawable.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 // Image rendering hints 00034 enum { 00035 BITMAP_KEEP = 0x00000001, // Keep pixel data in client 00036 BITMAP_OWNED = 0x00000002, // Pixel data is owned by image 00037 BITMAP_SHMI = 0x00000020, // Using shared memory image 00038 BITMAP_SHMP = 0x00000040 // Using shared memory pixmap 00039 }; 00040 00041 00042 // Forward declarations 00043 class FXDC; 00044 class FXDCWindow; 00045 class FXDrawable; 00046 class FXTopWindow; 00047 00048 00049 /** 00050 * Bitmap is a one bit/pixel image used for patterning and 00051 * stippling operations. 00052 */ 00053 class FXAPI FXBitmap : public FXDrawable { 00054 FXDECLARE(FXBitmap) 00055 friend class FXDC; 00056 friend class FXDCWindow; 00057 friend class FXDrawable; 00058 friend class FXTopWindow; 00059 private: 00060 #ifdef WIN32 00061 virtual FXID GetDC() const; 00062 virtual int ReleaseDC(FXID) const; 00063 #endif 00064 protected: 00065 FXuchar *data; // Pixel data 00066 FXuint options; // Options 00067 protected: 00068 FXBitmap(); 00069 private: 00070 FXBitmap(const FXBitmap&); 00071 FXBitmap &operator=(const FXBitmap&); 00072 public: 00073 00074 /// Create an image 00075 FXBitmap(FXApp* a,const void *pix=NULL,FXuint opts=0,FXint w=1,FXint h=1); 00076 00077 /// Create bitmap 00078 virtual void create(); 00079 00080 /// Detach from bitmap 00081 virtual void detach(); 00082 00083 /// Destroy bitmap 00084 virtual void destroy(); 00085 00086 /// Render pixels 00087 virtual void render(); 00088 00089 /// Release the client-side pixels buffer, freeing it if it was owned. 00090 virtual void release(); 00091 00092 /// Get pixel at x,y 00093 FXbool getPixel(FXint x,FXint y) const; 00094 00095 /// Change pixel at x,y 00096 void setPixel(FXint x,FXint y,FXbool color); 00097 00098 /// Resize bitmap to the specified width and height; the contents become undefined 00099 virtual void resize(FXint w,FXint h); 00100 00101 /// Save object to stream 00102 virtual void save(FXStream& store) const; 00103 00104 /// Load object from stream 00105 virtual void load(FXStream& store); 00106 00107 /// Save pixel data only 00108 virtual FXbool savePixels(FXStream& store) const; 00109 00110 /// Load pixel data only 00111 virtual FXbool loadPixels(FXStream& store); 00112 00113 /// Cleanup 00114 virtual ~FXBitmap(); 00115 }; 00116 00117 } 00118 00119 #endif
![]() |