CFx SDK Documentation 2026 SP0
Loading...
Searching...
No Matches
GiCubeMap.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2024, 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 Open Design Alliance software pursuant to a license
16// agreement with Open Design Alliance.
17// Open Design Alliance Copyright (C) 2002-2024 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_CUBE_MAP__
25#define __OD_GI_CUBE_MAP__
26
27#include "Gi/GiExport.h"
28#include "Gi/GiRasterImage.h"
29#include "OdArray.h"
30
31#include "TD_PackPush.h"
32
46{
47 OdUInt32 m_nWidth, m_nHeight;
48 OdString m_fileName;
49 ImageSource m_imSrc;
50 TransparencyMode m_trMode;
51 ODCOLORREF m_backgroundColor;
52 OdUInt8 m_bkColorEncoded[4] = {};
53 struct RIEntry { OdGiRasterImagePtr m_pOrig; OdInt32 m_nPosX = 0, m_nPosY = 0; OdUInt32 m_pixWidth = 0, m_pixHeight = 0;
54 bool isInside(OdUInt32 nScanline, OdUInt32 nPix) const { return OdInt32(nScanline) >= m_nPosY && nScanline < m_nPosY + m_pixHeight &&
55 OdInt32(nPix) >= m_nPosX && nPix < m_nPosX + m_pixHeight; }
56 OdUInt32 yLoc(OdUInt32 nScanline) const { return nScanline - m_nPosY; }
57 OdUInt32 xLoc(OdUInt32 nPix) const { return nPix - m_nPosX; } };
58 OdArray<RIEntry> m_rasterImages;
59protected:
60 const RIEntry *findEntry(OdUInt32 nScanline, OdUInt32 nPixel) const;
62public:
71
80 static OdGiRasterImagePtr createObject(OdUInt32 nWidth, OdUInt32 nHeight, ODCOLORREF bkColor = 0);
81
87 void setRasterDimensions(OdUInt32 uWidth, OdUInt32 uHeight) { m_nWidth = uWidth; m_nHeight = uHeight; }
88
93 void setBackgroundColor(ODCOLORREF bkColor) { m_backgroundColor = bkColor; if (!m_rasterImages.empty()) encodeBkColor(); }
98 ODCOLORREF backgroundColor() const { return m_backgroundColor; }
99
106 void addRasterImage(const OdGiRasterImage* pRaster, OdInt32 nPosX, OdInt32 nPosY);
111 void removeRasterImage(const OdGiRasterImage *pRaster);
112
117 OdUInt32 numRasterImages() const { return m_rasterImages.size(); }
123 const OdGiRasterImage *getRasterImage(OdUInt32 nRaster, OdInt32 *pPosX = nullptr, OdInt32 *pPosY = nullptr) const
124 {
125 if (pPosX) *pPosX = m_rasterImages[nRaster].m_nPosX;
126 if (pPosY) *pPosY = m_rasterImages[nRaster].m_nPosY;
127 return m_rasterImages[nRaster].m_pOrig;
128 }
129
151 Units defaultResolution(double& xPelsPerUnit, double& yPelsPerUnit) const;
170 ODCOLORREF color(OdUInt32 colorIndex) const;
184 void paletteData(OdUInt8* bytes) const;
211 void scanLines(OdUInt8* scnLines, OdUInt32 firstScanline, OdUInt32 numLines = 1) const;
225 const OdUInt8* scanLines() const;
250 int transparentColor() const;
262 const OdString &sourceFileName() const;
284 void setSourceFileName(const OdString &fileName);
295 void* imp() const;
307 void copyFrom(const OdRxObject *pSource);
308};
309
318{
319 public:
324 {
332 virtual OdGiRasterImagePtr load(const OdString &fileName) = 0;
333 };
334 protected:
335 OdGiRasterImagePtr loadRastrec(const OdString &streamName, const OdString &fileName, RasterLoader *pLoader);
336 public:
337 static OdString substituteFileName(const OdString &streamName, const OdString &fileName);
338 public:
347 OdGiRasterImagePtr load(OdStreamBuf &pStreamBuf, RasterLoader *pLoader = nullptr);
348};
349
350#include "TD_PackPop.h"
351
352#endif // __OD_GI_CUBE_MAP__
OdSmartPtr< OdGiRasterImage > OdGiRasterImagePtr
Definition DbLayout.h:36
#define ODGI_EXPORT
Definition GiExport.h:35
#define ODCOLORREF
unsigned int OdUInt32
int OdInt32
unsigned char OdUInt8
static OdString substituteFileName(const OdString &streamName, const OdString &fileName)
OdGiRasterImagePtr loadRastrec(const OdString &streamName, const OdString &fileName, RasterLoader *pLoader)
OdGiRasterImagePtr load(OdStreamBuf &pStreamBuf, RasterLoader *pLoader=nullptr)
PixelFormatInfo pixelFormat() const
OdUInt32 pixelHeight() const
const OdString & sourceFileName() const
void setBackgroundColor(ODCOLORREF bkColor)
Definition GiCubeMap.h:93
void setImageSource(ImageSource source)
const OdGiRasterImage * getRasterImage(OdUInt32 nRaster, OdInt32 *pPosX=nullptr, OdInt32 *pPosY=nullptr) const
Definition GiCubeMap.h:123
void addRasterImage(const OdGiRasterImage *pRaster, OdInt32 nPosX, OdInt32 nPosY)
OdRxObjectPtr clone() const
void setRasterDimensions(OdUInt32 uWidth, OdUInt32 uHeight)
Definition GiCubeMap.h:87
const OdUInt8 * scanLines() const
OdUInt32 scanLinesAlignment() const
OdUInt32 supportedParams() const
void scanLines(OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const
static OdGiRasterImagePtr createObject(OdUInt32 nWidth, OdUInt32 nHeight, ODCOLORREF bkColor=0)
OdUInt32 colorDepth() const
void paletteData(OdUInt8 *bytes) const
void setSourceFileName(const OdString &fileName)
TransparencyMode transparencyMode() const
void removeRasterImage(const OdGiRasterImage *pRaster)
OdUInt32 numColors() const
ODCOLORREF backgroundColor() const
Definition GiCubeMap.h:98
OdUInt32 numRasterImages() const
Definition GiCubeMap.h:117
ImageSource imageSource() const
void setTransparencyMode(TransparencyMode mode)
int transparentColor() const
OdUInt32 paletteDataSize() const
virtual ~OdGiPatchworkRasterImage()
void copyFrom(const OdRxObject *pSource)
OdUInt32 scanLineSize() const
Units defaultResolution(double &xPelsPerUnit, double &yPelsPerUnit) const
OdUInt32 pixelWidth() const
const RIEntry * findEntry(OdUInt32 nScanline, OdUInt32 nPixel) const
ODCOLORREF color(OdUInt32 colorIndex) const
struct OdGiRasterImage::tagPixelFormatInfo PixelFormatInfo
GLsizei GLsizei GLchar * source
Definition gles2_ext.h:282
virtual OdGiRasterImagePtr load(const OdString &fileName)=0