CFx SDK Documentation  2023 SP0
RxRasterServices.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 // RxRasterServices.h - interface of module, performing different operations on raster images
25 
26 #ifndef __OD_RASTER_MODULE__
27 #define __OD_RASTER_MODULE__
28 
29 #include "RxModule.h"
30 #include "DbRootExport.h"
31 #include "UInt32Array.h"
32 #include "TDVersion.h"
33 class OdGiRasterImage;
35 
36 #include "TD_PackPush.h"
37 
39 #ifndef lit_
40 #define lit_ 0x20 // ' '
41 #define lit_0 0x30 // '0'
42 #define lit_1 0x31 // '1'
43 #define lit_2 0x32 // '2'
44 #define lit_3 0x33 // '3'
45 #define lit_4 0x34 // '4'
46 #define lit_5 0x35 // '5'
47 #define lit_6 0x36 // '6'
48 #define lit_7 0x37 // '7'
49 #define lit_8 0x38 // '8'
50 #define lit_9 0x39 // '9'
51 #define lit_A 0x41 // 'A'
52 #define lit_B 0x42 // 'B'
53 #define lit_C 0x43 // 'C'
54 #define lit_D 0x44 // 'D'
55 #define lit_E 0x45 // 'E'
56 #define lit_F 0x46 // 'F'
57 #define lit_G 0x47 // 'G'
58 #define lit_H 0x48 // 'H'
59 #define lit_I 0x49 // 'I'
60 #define lit_J 0x4A // 'J'
61 #define lit_K 0x4B // 'K'
62 #define lit_L 0x4C // 'L'
63 #define lit_M 0x4D // 'M'
64 #define lit_N 0x4E // 'N'
65 #define lit_O 0x4F // 'O'
66 #define lit_P 0x50 // 'P'
67 #define lit_Q 0x51 // 'Q'
68 #define lit_R 0x52 // 'R'
69 #define lit_S 0x53 // 'S'
70 #define lit_T 0x54 // 'T'
71 #define lit_U 0x55 // 'U'
72 #define lit_V 0x56 // 'V'
73 #define lit_W 0x57 // 'W'
74 #define lit_X 0x58 // 'X'
75 #define lit_Y 0x59 // 'Y'
76 #define lit_Z 0X5A // 'Z'
77 #define lit_a 0x61 // 'a'
78 #define lit_b 0x62 // 'b'
79 #define lit_c 0x63 // 'c'
80 #define lit_d 0x64 // 'd'
81 #define lit_e 0x65 // 'e'
82 #define lit_f 0x66 // 'f'
83 #define lit_g 0x67 // 'g'
84 #define lit_h 0x68 // 'h'
85 #define lit_i 0x69 // 'i'
86 #define lit_j 0x6A // 'j'
87 #define lit_k 0x6B // 'k'
88 #define lit_l 0x6C // 'l'
89 #define lit_m 0x6D // 'm'
90 #define lit_n 0x6E // 'n'
91 #define lit_o 0x6F // 'o'
92 #define lit_p 0x70 // 'p'
93 #define lit_q 0x71 // 'q'
94 #define lit_r 0x72 // 'r'
95 #define lit_s 0x73 // 's'
96 #define lit_t 0x74 // 't'
97 #define lit_u 0x75 // 'u'
98 #define lit_v 0x76 // 'v'
99 #define lit_w 0x77 // 'w'
100 #define lit_x 0x78 // 'x'
101 #define lit_y 0x79 // 'y'
102 #define lit_z 0x7A // 'z'
103 #endif // lit_
105 
106 #ifndef OD_FOURCC
107 #ifndef ODA_BIGENDIAN
108 #if defined(OD_SWIGCSHARP) || defined(OD_SWIGJAVA)
109 #define OD_FOURCC(a, b, c, d) (((long)(d) << 24) | ((long)(c) << 16) | ((long)(b) << 8) | ((long)(a)))
110 #else
111  #define OD_FOURCC(a, b, c, d) (((OdUInt32)(d) << 24) | ((OdUInt32)(c) << 16) | ((OdUInt32)(b) << 8) | ((OdUInt32)(a)))
112 #endif
113 #else
114  #define OD_FOURCC(a, b, c, d) (((OdUInt32)(a) << 24) | ((OdUInt32)(b) << 16) | ((OdUInt32)(c) << 8) | ((OdUInt32)(d)))
115 #endif
116 #endif // OD_FOURCC
117 
125 {
126 public:
127  // Predefined image types
129  {
130  kUnknown = -1,
167  };
168 
169  // Loading flags
171  {
172  // Specify loading format explicitly
173  kLoadFmt = OD_FOURCC(lit_F, lit_M, lit_T, lit_ ),
174  // Avoids post-reorientation of TIFF format images
175  kNoTIFFRotation = OD_FOURCC(lit_N, lit_T, lit_F, lit_R)
176  };
177 
178  // Saving flags
180  {
181  // Specify palette index of transparent color (-1 - by default)
182  kTransparentColor = OD_FOURCC(lit_T, lit_C, lit_L, lit_R),
183 
184  // Jpeg compression quality (default depends from implementation)
185  kJpegQuality = OD_FOURCC(lit_J, lit_Q, lit_T, lit_Y),
186 
187  // Tiff compression format (no compression by default)
188  kTiffCompression = OD_FOURCC(lit_T, lit_C, lit_M, lit_P),
189  kTiffCompressionDeflate = OD_FOURCC(lit_Z, lit_I, lit_P, lit_ ),
190  kTiffCompressionLzw = OD_FOURCC(lit_L, lit_Z, lit_W, lit_ ),
191  kTiffCompressionJpeg = OD_FOURCC(lit_J, lit_P, lit_E, lit_G),
192  kTiffCompressionCCITTFax3 = OD_FOURCC(lit_F, lit_A, lit_X, lit_3),
193  kTiffCompressionCCITTFax4 = OD_FOURCC(lit_F, lit_A, lit_X, lit_4),
194  kTiffCompressionEmbedded = OD_FOURCC(lit_E, lit_M, lit_B, lit_D), // ODA extension for IbEnabler, actually it is CCITFax4 compression
195 
196  //dithering flag
197  kDithering = OD_FOURCC(lit_D, lit_I, lit_T, lit_H),
198  kDitheringFS = OD_FOURCC(lit_D, lit_T, lit_F, lit_S), // Floyd & Steinberg error diffusion
199  kDitheringBayer4x4 = OD_FOURCC(lit_B, lit_Y, lit_R, lit_4), // Bayer ordered dispersed dot dithering (order 2 dithering matrix)
200  kDitheringBayer8x8 = OD_FOURCC(lit_B, lit_Y, lit_R, lit_8), // Bayer ordered dispersed dot dithering (order 3 dithering matrix)
201  kDitheringBayer16x16 = OD_FOURCC(lit_B, lit_R, lit_1, lit_6), // Bayer ordered dispersed dot dithering (order 4 dithering matrix)
202  kDitheringCluster6x6 = OD_FOURCC(lit_C, lit_L, lit_R, lit_6), // Ordered clustered dot dithering (order 3 - 6x6 matrix)
203  kDitheringCluster8x8 = OD_FOURCC(lit_C, lit_L, lit_R, lit_8), // Ordered clustered dot dithering (order 4 - 8x8 matrix)
204  kDitheringCluster16x16 = OD_FOURCC(lit_C, lit_L, lit_1, lit_6), // Ordered clustered dot dithering (order 8 - 16x16 matrix)
205 
206  //rescale flags
207  kRescale = OD_FOURCC(lit_R, lit_S, lit_C, lit_L),
208  kRescaleBox = OD_FOURCC(lit_B, lit_O, lit_X, lit_ ), // Box, pulse, Fourier window, 1st order (constant) b-spline
209  kRescaleBicubic = OD_FOURCC(lit_B, lit_C, lit_B, lit_C), // Mitchell & Netravali's two-param cubic filter
210  kRescaleBilinear = OD_FOURCC(lit_B, lit_L, lit_N, lit_R), // Bilinear filter
211  kRescaleBspline = OD_FOURCC(lit_B, lit_S, lit_P, lit_L), // 4th order (cubic) b-spline
212  kRescaleCatmullrom = OD_FOURCC(lit_C, lit_T, lit_M, lit_L), // Catmull-Rom spline, Overhauser spline
213  kRescaleLanczos3 = OD_FOURCC(lit_L, lit_N, lit_C, lit_Z), // Lanczos3 filter
214  kRescaleWidth = OD_FOURCC(lit_W, lit_D, lit_T, lit_H),
215  kRescaleHeight = OD_FOURCC(lit_H, lit_G, lit_H, lit_T),
216  //Note: rescaling converts bitional images to 8-bit images, so to keep the image bitional after rescale, the dithering flags must be in flag chain.
217 
218  // color quantization algorithm flag (is usable for FIF_GIF with colorDepth() > 8)
219  kQuantizeNone = OD_FOURCC(lit_C, lit_T, lit_O, lit_8),
220  kQuantizeWU = OD_FOURCC(lit_W, lit_U, lit_C, lit_Q), // Xiaolin Wu color quantization algorithm (is default)
221  kQuantizeNN = OD_FOURCC(lit_N, lit_N, lit_Q, lit_ ), // NeuQuant neural-net quantization algorithm by Anthony Dekker
222  kQuantizeLFP = OD_FOURCC(lit_L, lit_F, lit_P, lit_Q) // Lossless Fast Pseudo-Quantization Algorithm by Carsten Klein
223  };
224 
226 
235  virtual OdGiRasterImagePtr loadRasterImage(const OdString &filename, const OdUInt32 *pFlagsChain = NULL) = 0;
236 
246  virtual OdGiRasterImagePtr loadRasterImage(OdStreamBuf *pStreamBuf, const OdUInt32 *pFlagsChain = NULL) = 0;
247 
256 
263  virtual bool saveRasterImage(const OdGiRasterImage* rasterImage, const OdString& filename,
264  const OdUInt32 *pFlagsChain = NULL) = 0;
265 
273  virtual bool saveRasterImage(const OdGiRasterImage* rasterImage, const OdString& filename,
274  OdUInt32 type, const OdUInt32 *pFlagsChain = NULL) = 0;
275 
283  virtual bool convertRasterImage(const OdGiRasterImage* pRaster, OdUInt32 type,
284  OdStreamBuf* pStreamBuf, const OdUInt32 *pFlagsChain = NULL) = 0;
285 
294  virtual bool convertRasterImage(OdStreamBuf* pSrcStream, OdStreamBuf* pDstStream, OdUInt32 type,
295  const OdUInt32 *pFlagsChainSrc = NULL, const OdUInt32 *pFlagsChainDst = NULL) = 0;
296 
300  virtual OdUInt32Array getRasterImageTypes() const = 0;
301 
307 
313  virtual OdString mapTypeToExtension(OdUInt32 type, OdString* psFilterName) const = 0;
314 
319  virtual OdUInt32 mapExtensionToType(const OdString& extension) const = 0;
320 
325  virtual OdUInt32 getImageFormat(const OdString &filename) const = 0;
326 
331  virtual OdUInt32 getImageFormat(OdStreamBuf* pStreamBuf) const = 0;
332 };
333 
338 
340 #ifdef lit_
341 #undef lit_ // ' '
342 #undef lit_0 // '0'
343 #undef lit_1 // '1'
344 #undef lit_2 // '2'
345 #undef lit_3 // '3'
346 #undef lit_4 // '4'
347 #undef lit_5 // '5'
348 #undef lit_6 // '6'
349 #undef lit_7 // '7'
350 #undef lit_8 // '8'
351 #undef lit_9 // '9'
352 #undef lit_A // 'A'
353 #undef lit_B // 'B'
354 #undef lit_C // 'C'
355 #undef lit_D // 'D'
356 #undef lit_E // 'E'
357 #undef lit_F // 'F'
358 #undef lit_G // 'G'
359 #undef lit_H // 'H'
360 #undef lit_I // 'I'
361 #undef lit_J // 'J'
362 #undef lit_K // 'K'
363 #undef lit_L // 'L'
364 #undef lit_M // 'M'
365 #undef lit_N // 'N'
366 #undef lit_O // 'O'
367 #undef lit_P // 'P'
368 #undef lit_Q // 'Q'
369 #undef lit_R // 'R'
370 #undef lit_S // 'S'
371 #undef lit_T // 'T'
372 #undef lit_U // 'U'
373 #undef lit_V // 'V'
374 #undef lit_W // 'W'
375 #undef lit_X // 'X'
376 #undef lit_Y // 'Y'
377 #undef lit_Z // 'Z'
378 #undef lit_a // 'a'
379 #undef lit_b // 'b'
380 #undef lit_c // 'c'
381 #undef lit_d // 'd'
382 #undef lit_e // 'e'
383 #undef lit_f // 'f'
384 #undef lit_g // 'g'
385 #undef lit_h // 'h'
386 #undef lit_i // 'i'
387 #undef lit_j // 'j'
388 #undef lit_k // 'k'
389 #undef lit_l // 'l'
390 #undef lit_m // 'm'
391 #undef lit_n // 'n'
392 #undef lit_o // 'o'
393 #undef lit_p // 'p'
394 #undef lit_q // 'q'
395 #undef lit_r // 'r'
396 #undef lit_s // 's'
397 #undef lit_t // 't'
398 #undef lit_u // 'u'
399 #undef lit_v // 'v'
400 #undef lit_w // 'w'
401 #undef lit_x // 'x'
402 #undef lit_y // 'y'
403 #undef lit_z // 'z'
404 #endif // lit_
406 
407 #include "TD_PackPop.h"
408 
409 #endif // __OD_RASTER_MODULE__
#define NULL
Definition: GsProperties.h:177
unsigned int OdUInt32
#define ODRX_ABSTRACT
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
#define lit_C
OdSmartPtr< OdGiRasterImage > OdGiRasterImagePtr
#define lit_R
#define lit_6
#define lit_H
#define lit_D
#define lit_T
#define lit_Z
OdSmartPtr< OdRxRasterServices > OdRxRasterServicesPtr
#define lit_3
#define lit_O
#define lit_X
#define lit_J
#define lit_G
#define lit_8
#define lit_4
#define lit_B
#define lit_2
#define lit_S
#define lit_P
#define lit_A
#define lit_L
#define lit_W
#define OD_FOURCC(a, b, c, d)
#define lit_F
#define lit_N
#define lit_1
#define lit_
#define lit_M
#define lit_K
#define lit_Q
#define lit_Y
#define lit_U
#define lit_I
#define lit_E
virtual bool saveRasterImage(const OdGiRasterImage *rasterImage, const OdString &filename, OdUInt32 type, const OdUInt32 *pFlagsChain=NULL)=0
virtual OdString mapTypeToExtension(OdUInt32 type, OdString *psFilterName) const =0
virtual OdUInt32 getImageFormat(OdStreamBuf *pStreamBuf) const =0
virtual OdGiRasterImagePtr loadRasterImage(const OdString &filename, const OdUInt32 *pFlagsChain=NULL)=0
virtual bool convertRasterImage(OdStreamBuf *pSrcStream, OdStreamBuf *pDstStream, OdUInt32 type, const OdUInt32 *pFlagsChainSrc=NULL, const OdUInt32 *pFlagsChainDst=NULL)=0
virtual OdGiRasterImagePtr createRasterImage(void *pImp)
virtual OdUInt32 getImageFormat(const OdString &filename) const =0
ODRX_DECLARE_MEMBERS(OdRxRasterServices)
virtual bool isRasterImageTypeSupported(OdUInt32 type) const
virtual OdGiRasterImagePtr loadRasterImage(OdStreamBuf *pStreamBuf, const OdUInt32 *pFlagsChain=NULL)=0
virtual bool saveRasterImage(const OdGiRasterImage *rasterImage, const OdString &filename, const OdUInt32 *pFlagsChain=NULL)=0
virtual bool convertRasterImage(const OdGiRasterImage *pRaster, OdUInt32 type, OdStreamBuf *pStreamBuf, const OdUInt32 *pFlagsChain=NULL)=0
virtual OdUInt32 mapExtensionToType(const OdString &extension) const =0
virtual OdUInt32Array getRasterImageTypes() const =0
GLuint GLsizei GLsizei GLint GLenum * type
Definition: gles2_ext.h:274
@ kPPMRAW
A .ppm image.
@ kSGI
A .faxg3 image.
@ kRAW
A .pict image.
@ kLBM
A .koala image.
@ kKOALA
A .jng image.
@ kICO
A bitmap image.
@ kJPEG
An icon image.
@ kRAS
A raw .ppm image.
@ kWBMP
A .tiff image.
@ kJNG
A .jpeg image.
@ kFAXG3
A .hdr image.
@ kCUT
A .psd (Adobe Photoshop) image.
@ kPBMRAW
A .pbm image.
@ kPGMRAW
A .pgm image.
@ kPNG
A raw .pgm image.
@ kPCD
A raw .pbm image.
@ kBMP
The format is unknown.
@ kMNG
An .iff image.
@ kTIFF
A .targa image.
@ kPSD
A .wbmp image.
@ kTARGA
A .ras image.
@ kPICT
A .pfm image.