CFx SDK Documentation  2022 SP0
GiRasterWrappers.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 #ifndef __OD_GI_RASTER_WRAPPERS__
25 #define __OD_GI_RASTER_WRAPPERS__
26 
27 #include "Gi/GiExport.h"
28 #include "Gi/GiRasterImage.h"
29 #include "Gi/GiImage.h"
30 #include "UInt8Array.h"
31 
32 #include "TD_PackPush.h"
33 
45 {
46  OdUInt32 m_pixelWidth, m_pixelHeight, m_colorDepth, m_palSize, m_alignment;
48  Units m_units;
49  double m_xPelsPerUnit, m_yPelsPerUnit;
50  OdUInt8* m_pPal;
51  OdGiRasterImage::ImageSource m_imageSource;
52  OdGiRasterImage::TransparencyMode m_transparencyMode;
53  OdString m_fileName;
54 public:
57 
69  static OdGiRasterImagePtr createObject(OdUInt32 pixelWidth, OdUInt32 pixelHeight, Units units = kNone, double xPelsPerUnit = 0.0, double yPelsPerUnit = 0.0);
70 
82  static OdGiRasterImagePtr createObject(OdUInt32 pixelWidth, OdUInt32 pixelHeight, OdUInt32 colorDepth, Units units = kNone, double xPelsPerUnit = 0.0, double yPelsPerUnit = 0.0);
83 
91  static OdGiRasterImagePtr createObject(const OdGiRasterImage *pSourceImage);
92 
97  void setFrom(const OdGiRasterImage *pSourceImage);
107  void copyFrom(const OdRxObject *pSource);
128  ODCOLORREF color(OdUInt32 colorIndex) const;
140  void paletteData(OdUInt8* bytes) const;
153  const OdUInt8* scanLines() const;
174  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
199  Units defaultResolution(double& xPelsPerUnit, double& yPelsPerUnit) const;
200 
205  void setPixelWidth(OdUInt32 pixelWidth);
210  void setPixelHeight(OdUInt32 pixelHeight);
211 
216  void setColorDepth(OdUInt32 colorDepth);
226 
232  void setPalette(OdUInt32 paletteSize, OdUInt8* paletteData);
233 
241 
248  void setDefaultResolution(Units units, double xPelsPerUnit, double yPelsPerUnit);
265  const OdString &sourceFileName() const;
270  void setSourceFileName(const OdString &fileName);
280 };
281 
282 class OdGiImageBGRA32;
283 
293 {
294 protected:
297 public:
300 
329  ODCOLORREF color(OdUInt32 colorIndex) const;
341  void paletteData(OdUInt8* bytes) const;
362  const OdUInt8* scanLines() const;
380  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
404  OdGiRasterImage::Units defaultResolution(double& xPelsPerUnit, double& yPelsPerUnit) const;
431  void copyFrom(const OdRxObject *pSource);
432 };
433 
440 {
441 protected:
443 public:
446 
464  void copyFrom(const OdRxObject *pSource);
465 };
466 
473 {
474 private:
475  OdGiPixelBGRA32Array m_pxArray;
476 public:
479 
497  void copyFrom(const OdRxObject *pSource);
498 };
499 
506 {
507  OdUInt32 m_pixelWidth, m_pixelHeight, m_colorDepth, m_alignment;
509  Units m_units;
510  double m_xPelsPerUnit, m_yPelsPerUnit;
511  OdGiRasterImage::ImageSource m_imageSource;
512  OdString m_fileName;
513  OdGiRasterImage::TransparencyMode m_transparencyMode;
514  int m_transparentColor;
515  OdUInt8Array m_palData;
516  OdUInt8Array m_pixData;
517 public:
520 
525  void setFrom(const OdGiRasterImage* pOrig);
526 
550  Units defaultResolution(double& xPelsPerUnit, double& yPelsPerUnit) const;
563  ODCOLORREF color(OdUInt32 colorIndex) const;
571  void paletteData(OdUInt8* bytes) const;
598  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
610  const OdUInt8* scanLines() const;
633  int transparentColor() const;
641  const OdString &sourceFileName() const;
659  void setSourceFileName(const OdString &fileName);
674  void copyFrom(const OdRxObject *pSource);
675 };
676 
691 {
692  OdGiRasterImagePtr m_pOrig;
693 public:
696 
701  void setOriginal(const OdGiRasterImage* pOrig);
705  const OdGiRasterImage *original() const;
726  Units defaultResolution(double& xPelsPerUnit, double& yPelsPerUnit) const;
739  ODCOLORREF color(OdUInt32 colorIndex) const;
747  void paletteData(OdUInt8* bytes) const;
774  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
786  const OdUInt8* scanLines() const;
808  int transparentColor() const;
816  const OdString &sourceFileName() const;
834  void setSourceFileName(const OdString &fileName);
845  void* imp() const;
855  void copyFrom(const OdRxObject *pSource);
856 };
857 
869 {
870  RGBQUAD m_palette[2];
871  int m_transpColor;
872 public:
875 
883  static OdGiRasterImagePtr createObject(const OdGiRasterImage* pOrig, ODCOLORREF foregroundColor, ODCOLORREF backgroundColor, bool transparent);
884 
892  void setOriginal(const OdGiRasterImage* pOrig, ODCOLORREF foregroundColor, ODCOLORREF backgroundColor, bool transparent);
893 
903  ODCOLORREF color(OdUInt32 colorIndex) const;
915  void paletteData(OdUInt8* bytes) const;
929  int transparentColor() const;
939  void copyFrom(const OdRxObject *pSource);
940 };
941 
953 {
954 public:
957 
980  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
992  const OdUInt8* scanLines() const;
1002  void copyFrom(const OdRxObject *pSource);
1003 };
1004 
1016 {
1017 public:
1020 
1043  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
1055  const OdUInt8* scanLines() const;
1065  void copyFrom(const OdRxObject *pSource);
1066 };
1067 
1079 {
1080 public:
1083 
1094  ODCOLORREF color(OdUInt32 colorIndex) const;
1102  void paletteData(OdUInt8* bytes) const;
1103 
1121  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
1133  const OdUInt8* scanLines() const;
1143  void copyFrom(const OdRxObject *pSource);
1144 protected:
1145  virtual ODCOLORREF colorXform(ODCOLORREF color) const;
1146 };
1147 
1159 {
1160 public:
1163 
1178  void copyFrom(const OdRxObject *pSource);
1179 protected:
1180  virtual ODCOLORREF colorXform(ODCOLORREF color) const;
1181 };
1182 
1194 {
1195  int m_threshold;
1196 public:
1199 
1205  static OdGiRasterImagePtr createObject(const OdGiRasterImage* pOrig, int threshold = 127);
1215  void copyFrom(const OdRxObject *pSource);
1221  void setThreshold(OdUInt8 treshold) { m_threshold = treshold; if (m_threshold > 254) m_threshold = 254; };
1225  int threshold() const { return m_threshold; }
1226 protected:
1227  virtual ODCOLORREF colorXform(ODCOLORREF color) const;
1228 };
1229 
1239 {
1240 protected:
1244 public:
1247 
1256  static OdGiRasterImagePtr createObject( const OdGiRasterImage* pOrig, ODCOLORREF cutColor, OdUInt8 threshold = 0 );
1257 
1278  const OdUInt8* scanLines() const;
1296  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
1297 
1318  ODCOLORREF color(OdUInt32 colorIndex) const;
1330  void paletteData(OdUInt8* bytes) const;
1354  OdGiRasterImage::Units defaultResolution(double& xPelsPerUnit, double& yPelsPerUnit) const;
1381  void copyFrom(const OdRxObject *pSource);
1382 
1383 protected:
1385 };
1386 
1387 #if 0 // @@@TODO: implement at least nearest, bilinear and bicubic resamplers
1398 class ODGI_EXPORT OdGiNearestRasterResampler : public OdGiRasterImageWrapper
1399 {
1400  OdUInt32 m_newPixWidth, m_newPixHeight;
1401 public:
1402  OdGiNearestRasterResampler();
1403  virtual ~OdGiNearestRasterResampler();
1404 
1411  static OdGiRasterImagePtr createObject(const OdGiRasterImage* pOrig, OdUInt32 newPixWidth, OdUInt32 newPixHeight);
1429  void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
1430 
1442  const OdUInt8* scanLines() const;
1446  OdRxObjectPtr clone() const;
1452  void copyFrom(const OdRxObject *pSource);
1453 };
1454 #endif
1455 
1456 #include "TD_PackPop.h"
1457 
1458 #endif // __OD_GI_RASTER_WRAPPERS__
#define ODGI_EXPORT
Definition: GiExport.h:35
#define ODCOLORREF
Definition: OdPlatform.h:883
unsigned int OdUInt32
unsigned char OdUInt8
OdUInt32 numColors() const
OdUInt32 paletteDataSize() const
ODCOLORREF color(OdUInt32 colorIndex) const
void setOriginal(const OdGiRasterImage *pOrig, ODCOLORREF foregroundColor, ODCOLORREF backgroundColor, bool transparent)
PixelFormatInfo pixelFormat() const
void copyFrom(const OdRxObject *pSource)
void paletteData(OdUInt8 *bytes) const
OdRxObjectPtr clone() const
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pOrig, ODCOLORREF foregroundColor, ODCOLORREF backgroundColor, bool transparent)
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pOrig)
void copyFrom(const OdRxObject *pSource)
OdRxObjectPtr clone() const
virtual ODCOLORREF colorXform(ODCOLORREF color) const
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pOrig)
ODCOLORREF color(OdUInt32 colorIndex) const
virtual ODCOLORREF colorXform(ODCOLORREF color) const
OdRxObjectPtr clone() const
const OdUInt8 * scanLines() const
void paletteData(OdUInt8 *bytes) const
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
void copyFrom(const OdRxObject *pSource)
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pOrig)
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
void copyFrom(const OdRxObject *pSource)
const OdUInt8 * scanLines() const
OdRxObjectPtr clone() const
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pOrig, int threshold=127)
virtual ODCOLORREF colorXform(ODCOLORREF color) const
void copyFrom(const OdRxObject *pSource)
OdGiRasterImage::PixelFormatInfo pixelFormat() const
OdUInt32 scanLinesAlignment() const
void setTransparencyMode(OdGiRasterImage::TransparencyMode mode)
OdRxObjectPtr clone() const
void paletteData(OdUInt8 *bytes) const
OdGiRasterImage::ImageSource imageSource() const
void copyFrom(const OdRxObject *pSource)
OdGiRasterImage::Units defaultResolution(double &xPelsPerUnit, double &yPelsPerUnit) const
const OdGiRasterImage * m_pOrigImage
const OdUInt8 * scanLines() const
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
OdGiRasterImage::TransparencyMode transparencyMode() const
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pOrig, ODCOLORREF cutColor, OdUInt8 threshold=0)
OdUInt8 getAlphaValue(OdUInt8 red, OdUInt8 green, OdUInt8 blue) const
ODCOLORREF color(OdUInt32 colorIndex) const
void copyFrom(const OdRxObject *pSource)
static OdGiRasterImagePtr createObject(OdGiImageBGRA32 *pImage, OdGiRasterImage::TransparencyMode transparencyMode=OdGiRasterImage::kTransparency8Bit)
OdRxObjectPtr clone() const
void copyFrom(const OdRxObject *pSource)
static OdGiRasterImagePtr createObject(OdGiImageBGRA32 *pImage, OdGiRasterImage::TransparencyMode transparencyMode=OdGiRasterImage::kTransparency8Bit)
OdRxObjectPtr clone() const
OdGiRasterImage::Units defaultResolution(double &xPelsPerUnit, double &yPelsPerUnit) const
OdGiRasterImage::TransparencyMode transparencyMode() const
void setTransparencyMode(OdGiRasterImage::TransparencyMode mode)
OdUInt32 numColors() const
OdUInt32 pixelHeight() const
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
OdGiRasterImage::TransparencyMode m_transparencyMode
OdUInt32 pixelWidth() const
OdUInt32 scanLinesAlignment() const
ODCOLORREF color(OdUInt32 colorIndex) const
OdUInt32 scanLineSize() const
void paletteData(OdUInt8 *bytes) const
OdUInt32 paletteDataSize() const
OdRxObjectPtr clone() const
static OdGiRasterImagePtr createObject(OdGiImageBGRA32 *pImage, OdGiRasterImage::TransparencyMode transparencyMode=OdGiRasterImage::kTransparency8Bit)
virtual ~OdGiRasterImageBGRA32()
const OdUInt8 * scanLines() const
OdUInt32 supportedParams() const
OdGiRasterImage::PixelFormatInfo pixelFormat() const
OdUInt32 colorDepth() const
void copyFrom(const OdRxObject *pSource)
OdGiImageBGRA32 * m_pBGRAImage
OdGiRasterImage::ImageSource imageSource() const
OdUInt32 supportedParams() const
ODCOLORREF color(OdUInt32 colorIndex) const
OdUInt32 scanLinesAlignment() const
void setSourceFileName(const OdString &fileName)
static OdGiRasterImagePtr createObject(OdUInt32 pixelWidth, OdUInt32 pixelHeight, Units units=kNone, double xPelsPerUnit=0.0, double yPelsPerUnit=0.0)
virtual ~OdGiRasterImageDesc()
void setPixelWidth(OdUInt32 pixelWidth)
OdUInt32 numColors() const
void setDefaultResolution(Units units, double xPelsPerUnit, double yPelsPerUnit)
const OdString & sourceFileName() const
OdRxObjectPtr clone() const
OdGiRasterImage::TransparencyMode transparencyMode() const
OdGiRasterImage::ImageSource imageSource() const
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pSourceImage)
const OdUInt8 * scanLines() const
void setFrom(const OdGiRasterImage *pSourceImage)
Units defaultResolution(double &xPelsPerUnit, double &yPelsPerUnit) const
void setImageSource(OdGiRasterImage::ImageSource source)
void setScanLinesAlignment(OdUInt32 alignment)
OdUInt32 pixelHeight() const
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
OdUInt32 scanLineSize() const
PixelFormatInfo pixelFormat() const
OdGiRasterImage::PixelFormatInfo & pixelFormat()
void setTransparencyMode(OdGiRasterImage::TransparencyMode mode)
static OdGiRasterImagePtr createObject(OdUInt32 pixelWidth, OdUInt32 pixelHeight, OdUInt32 colorDepth, Units units=kNone, double xPelsPerUnit=0.0, double yPelsPerUnit=0.0)
void paletteData(OdUInt8 *bytes) const
void setPixelHeight(OdUInt32 pixelHeight)
void setPalette(OdUInt32 paletteSize, OdUInt8 *paletteData)
void copyFrom(const OdRxObject *pSource)
OdUInt32 paletteDataSize() const
OdUInt32 colorDepth() const
void setColorDepth(OdUInt32 colorDepth)
OdUInt32 pixelWidth() const
OdUInt32 supportedParams() const
ImageSource imageSource() const
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
OdUInt32 colorDepth() const
TransparencyMode transparencyMode() const
const OdUInt8 * scanLines() const
void setTransparencyMode(TransparencyMode mode)
PixelFormatInfo pixelFormat() const
int transparentColor() const
ODCOLORREF color(OdUInt32 colorIndex) const
virtual ~OdGiRasterImageHolder()
OdUInt32 paletteDataSize() const
OdUInt32 pixelHeight() const
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pImage)
void setImageSource(ImageSource source)
Units defaultResolution(double &xPelsPerUnit, double &yPelsPerUnit) const
OdRxObjectPtr clone() const
OdUInt32 scanLinesAlignment() const
void setSourceFileName(const OdString &fileName)
void setFrom(const OdGiRasterImage *pOrig)
void paletteData(OdUInt8 *bytes) const
OdUInt32 pixelWidth() const
OdUInt32 numColors() const
const OdString & sourceFileName() const
OdUInt32 scanLineSize() const
void copyFrom(const OdRxObject *pSource)
OdUInt32 paletteDataSize() const
void setSourceFileName(const OdString &fileName)
Units defaultResolution(double &xPelsPerUnit, double &yPelsPerUnit) const
virtual ~OdGiRasterImageWrapper()
void setOriginal(const OdGiRasterImage *pOrig)
OdUInt32 colorDepth() const
OdUInt32 scanLineSize() const
OdRxObjectPtr clone() const
PixelFormatInfo pixelFormat() const
void setTransparencyMode(TransparencyMode mode)
OdUInt32 numColors() const
OdUInt32 scanLinesAlignment() const
const OdGiRasterImage * original() const
OdUInt32 pixelHeight() const
const OdUInt8 * scanLines() const
void * imp() const
TransparencyMode transparencyMode() const
void paletteData(OdUInt8 *bytes) const
void copyFrom(const OdRxObject *pSource)
OdGiRasterImagePtr cloneOriginal() const
ODCOLORREF color(OdUInt32 colorIndex) const
const OdString & sourceFileName() const
OdUInt32 supportedParams() const
void setImageSource(ImageSource source)
OdUInt32 pixelWidth() const
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
int transparentColor() const
ImageSource imageSource() const
static OdGiRasterImagePtr createObject(const OdGiRasterImage *pOrig)
void copyFrom(const OdRxObject *pSource)
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
OdRxObjectPtr clone() const
const OdUInt8 * scanLines() const
GLsizei GLsizei GLchar * source
Definition: gles2_ext.h:282
GLfloat GLfloat blue
Definition: gles2_ext.h:147
GLfloat green
Definition: gles2_ext.h:147
@ kNone
Light mode is inherited from the annotation.