00001 /* 00002 Copyright (C) 1999 Carsten Winkelholz 00003 00004 Address: FGAN Forschungsgesellschaft fr Angewandte Naturwissenschaften e. V. 00005 Neuenahrer Str. 20 00006 D - 53343 Wachtberg 00007 00008 Email: winkelholz@fgan.de 00009 00010 This program is free software; you can redistribute it and/or 00011 modify it under the terms of the GNU General Public License 00012 as published by the Free Software Foundation; either version 2 00013 of the License, or (at your option) any later version. 00014 00015 This program 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 00018 GNU General Public License for more details. 00019 00020 You should have received a copy of the GNU General Public License 00021 along with this program; if not, write to the Free Software 00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00025 00026 #ifndef CYBPIXELIMAGEC_H 00027 #define CYBPIXELIMAGEC_H 00028 00029 #include <fstream> 00030 #include "oaw/misc/urlc.h" 00031 #include "../oawconfig.h" 00032 00033 OAW_BEGIN_NAMESPACE 00034 00035 00036 class CybTextureManagerC; 00037 00038 class OAW_DLLMAPPING CybPixelImageC{ 00039 friend class CybTextureManagerC; 00040 private: 00041 long m_Width; 00042 long m_Height; 00043 long m_Channels; 00044 long m_BitDepth; 00045 CybTextureManagerC* m_pTexManager; 00046 // ### gilt fr m_PixData : void* void* m_PixData; 00047 unsigned char* m_PixData; 00048 protected: 00049 bool p_ExtractFromVRML(char*&, const char* VRMLSource, long& Line, long& Result, char* EndMarks); // extrahiert einen Integer-Wert aus dem bergebenen Stream eines VRML-Files 00050 void p_LoadFromPNG(FILE* Dateizeiger); // Lie˙t die Bilddaten aus einer PNG Grafikdatei aus 00051 void LoadFromJPEG(FILE* Dateizeiger); // Lie˙t die Bilddaten aus einer JPEG Grafikdatei aus 00052 void p_Init(); //Standard-Initialisierung 00053 //public: 00054 // Konstruktoren 00055 CybPixelImageC(CybTextureManagerC*); // Standardkonstruktor 00056 CybPixelImageC(char*&, const char* VRMLSource, long& Line); // Erzeugt Bilddaten aus einem VRML Quelltextfile 00057 CybPixelImageC(UrlC& Grafikdatei); // Erzeugt Bilddaten aus einer Grafikdatei (PNG oder JPEG) 00058 00059 // Destruktor 00060 CybPixelImageC(const CybPixelImageC&); 00061 00062 public: 00063 virtual ~CybPixelImageC(); 00064 CybPixelImageC& operator = (const CybPixelImageC&); 00065 00066 // Funktionen fr Laden von Bildinformationen 00067 void LoadFromVRML(char*&, const char* VRMLSource, long& Line); // Ldt Bilddaten aus VRML Datei 00068 void LoadFromUrl(UrlC& Grafikdatei); // Ldt Bilddaten aus einer Grafikdatei (PNG oder JPEG) 00069 00070 // Funktionen, liefern Bildgeometrie und Daten 00071 long GetWidth(); // Gibt die Breite des gespeicherten Bildes in Pixeln zurck 00072 long GetHeight(); // Gibt die H÷he des gespeicherten Bildes in Pixeln zurck 00073 long GetChannels(); // Liefert die Anzahl der Farbkanle des gespeicherten Bildes: 00074 /* 1 - Paletteninformation, extern 00075 2 - Paletteninformation im ersten (high) Byte, Alpha Information im zweiten (low) Byte. Alpha von 255 bedeutet deckend, 0 bedeutet vollstndig transparent 00076 3 - rgb (rot, grn, blau) 00077 4 - rgba (rot, grn, blau, alpha wie unter 2) 00078 */ 00079 //long GetBitDepth(); // Liefert die Anzahl der verwendeten Bits pro Farbpixel zurck 00080 // ### gilt fr m_PixData : void* void* GetPixelData(); // Liefert einen Zeiger auf die Bilddaten im Rohformat (Anzahl der Kanle [GetNumberOfChannels] beachten) 00081 const unsigned char* GetPixel(); 00082 void SetPixel(const unsigned char*,long,long,long,long); 00083 }; 00084 00085 OAW_END_NAMESPACE 00086 00087 00088 #endif // SFIMAGEC_H 00089 00090 00091 00092 00093
1.3-rc2