CFx SDK Documentation  2023 SP0
GiImage.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 __ODGIIMAGE_H__
25 #define __ODGIIMAGE_H__
26 
27 #include "GiExport.h"
28 #include "UInt32Array.h"
29 #include "RxObject.h"
30 
31 #include "TD_PackPush.h"
32 
33 // ODCOLORREF is RGBA32
34 
44 {
45  public:
47  {
48  m_bgra = ODRGBA(0, 0, 0, 255);
49  }
50 
52  : m_bgra(bgra)
53  {
54  }
55 
57  {
58  m_bgra = ODRGBA(blue, green, red, alpha);
59  }
60 
61  OdUInt32 getBGRA() const;
62  OdUInt32 getRGBA() const;
63  OdUInt8 blue() const;
64  OdUInt8 green() const;
65  OdUInt8 red() const;
66  OdUInt8 alpha() const;
67 
68  void setBGRA(OdUInt32 bgra);
69  void setBGRA(OdUInt8 blue,
70  OdUInt8 green,
71  OdUInt8 red,
72  OdUInt8 alpha);
73  void setRGBA(OdUInt32 rgba);
74  void setRGBA(OdUInt8 red,
75  OdUInt8 green,
76  OdUInt8 blue,
77  OdUInt8 alpha);
78  void setBlue(OdUInt8 blue);
79  void setGreen(OdUInt8 green);
80  void setRed(OdUInt8 red);
81  void setAlpha(OdUInt8 alpha);
82  private:
83  OdUInt32 m_bgra;
84 };
85 
90 {
91  return m_bgra;
92 }
93 
98 {
99  return ODRGBA(ODGETBLUE(m_bgra), ODGETGREEN(m_bgra), ODGETRED(m_bgra), ODGETALPHA(m_bgra));
100 }
101 
106 {
107  return ODGETRED(m_bgra);
108 }
109 
114 {
115  return ODGETGREEN(m_bgra);
116 }
117 
122 {
123  return ODGETBLUE(m_bgra);
124 }
125 
130 {
131  return ODGETALPHA(m_bgra);
132 }
133 
138 {
139  m_bgra = bgra;
140 }
141 
146  OdUInt8 green,
147  OdUInt8 red,
148  OdUInt8 alpha)
149 {
150  m_bgra = ODRGBA(blue, green, red, alpha);
151 }
152 
157 {
158  m_bgra = ODRGBA(ODGETBLUE(rgba), ODGETGREEN(rgba), ODGETRED(rgba), ODGETALPHA(rgba));
159 }
160 
165  OdUInt8 green,
166  OdUInt8 blue,
167  OdUInt8 alpha)
168 {
169  m_bgra = ODRGBA(blue, green, red, alpha);
170 }
171 
176 {
177  m_bgra = ODRGBA(blue, ODGETGREEN(m_bgra), ODGETBLUE(m_bgra), ODGETALPHA(m_bgra));
178 }
179 
184 {
185  m_bgra = ODRGBA(ODGETRED(m_bgra), green, ODGETBLUE(m_bgra), ODGETALPHA(m_bgra));
186 }
187 
192 {
193  m_bgra = ODRGBA(ODGETRED(m_bgra), ODGETGREEN(m_bgra), red, ODGETALPHA(m_bgra));
194 }
195 
200 {
201  m_bgra = ODRGBA(ODGETRED(m_bgra), ODGETGREEN(m_bgra), ODGETBLUE(m_bgra), alpha);
202 }
203 
213 {
214  public:
216  : m_pImageData(NULL)
217  , m_nImageWidth(0)
218  , m_nImageHeight(0)
219  {
220  }
221 
222  OdGiImageBGRA32(OdUInt32 imageWidth, OdUInt32 imageHeight, OdGiPixelBGRA32* imageData)
223  : m_pImageData(imageData)
224  , m_nImageWidth(imageWidth)
225  , m_nImageHeight(imageHeight)
226  {
227  }
228 
229  OdGiPixelBGRA32* image() const;
230  OdUInt32 width() const;
231  OdUInt32 height() const;
232 
233  void setImage(OdUInt32 imageWidth,
234  OdUInt32 imageHeight,
235  OdGiPixelBGRA32* imageData);
236  private:
237  OdGiPixelBGRA32* m_pImageData;
238  OdUInt32 m_nImageWidth;
239  OdUInt32 m_nImageHeight;
240 };
241 
246 {
247  return m_pImageData;
248 }
249 
254 {
255  return m_nImageWidth;
256 }
257 
262 {
263  return m_nImageHeight;
264 }
265 
269 inline void OdGiImageBGRA32::setImage(OdUInt32 imageWidth,
270  OdUInt32 imageHeight,
271  OdGiPixelBGRA32* imageData)
272 {
273  m_nImageWidth = imageWidth;
274  m_nImageHeight = imageHeight;
275  m_pImageData = imageData;
276 }
277 
282 
283 #include "TD_PackPop.h"
284 
285 #endif // __ODGIIMAGE_H__
OdArray< OdGiPixelBGRA32, OdMemoryAllocator< OdGiPixelBGRA32 > > OdGiPixelBGRA32Array
Definition: GiImage.h:281
#define NULL
Definition: GsProperties.h:177
#define ODGETBLUE(rgb)
Definition: OdPlatform.h:889
#define ODGETGREEN(rgb)
Definition: OdPlatform.h:888
#define ODRGBA(r, g, b, a)
Definition: OdPlatform.h:885
#define ODGETALPHA(rgba)
Definition: OdPlatform.h:890
#define ODGETRED(rgb)
Definition: OdPlatform.h:887
unsigned int OdUInt32
unsigned char OdUInt8
OdUInt32 height() const
Definition: GiImage.h:261
void setImage(OdUInt32 imageWidth, OdUInt32 imageHeight, OdGiPixelBGRA32 *imageData)
Definition: GiImage.h:269
OdGiImageBGRA32(OdUInt32 imageWidth, OdUInt32 imageHeight, OdGiPixelBGRA32 *imageData)
Definition: GiImage.h:222
OdUInt32 width() const
Definition: GiImage.h:253
OdGiPixelBGRA32 * image() const
Definition: GiImage.h:245
OdUInt8 green() const
Definition: GiImage.h:113
OdUInt8 alpha() const
Definition: GiImage.h:129
void setGreen(OdUInt8 green)
Definition: GiImage.h:183
OdGiPixelBGRA32(OdUInt8 blue, OdUInt8 green, OdUInt8 red, OdUInt8 alpha)
Definition: GiImage.h:56
OdGiPixelBGRA32(OdUInt32 bgra)
Definition: GiImage.h:51
OdUInt8 red() const
Definition: GiImage.h:121
void setBGRA(OdUInt32 bgra)
Definition: GiImage.h:137
void setRGBA(OdUInt32 rgba)
Definition: GiImage.h:156
void setAlpha(OdUInt8 alpha)
Definition: GiImage.h:199
void setRed(OdUInt8 red)
Definition: GiImage.h:191
void setBlue(OdUInt8 blue)
Definition: GiImage.h:175
OdUInt8 blue() const
Definition: GiImage.h:105
OdUInt32 getBGRA() const
Definition: GiImage.h:89
OdUInt32 getRGBA() const
Definition: GiImage.h:97
GLfloat GLfloat GLfloat alpha
Definition: gles2_ext.h:147
GLfloat GLfloat blue
Definition: gles2_ext.h:147
GLfloat green
Definition: gles2_ext.h:147