CFx SDK Documentation  2020SP3
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
OdGiRasterImage Class Referenceabstract

#include <GiRasterImage.h>

Inheritance diagram for OdGiRasterImage:
OdRxObject OdGiRasterImageParam CFxRasterImage OdGiRasterImageAlphaChannelAdder OdGiRasterImageBGRA32 OdGiRasterImageDesc OdGiRasterImageHolder OdGiRasterImageWrapper OdGiRasterImageBGRA32Holder OdGiBitonalRasterTransformer OdGiInversionRasterTransformer OdGiLeftToRightRasterTransformer OdGiUpsideDownRasterTransformer OdGiRasterImageBGRA32Copy OdGiGrayscaleRasterTransformer OdGiMonochromaticRasterTransformer

Classes

struct  tagPixelFormatInfo
 

Public Types

enum  Units {
  kNone = 0, kMillimeter, kCentimeter, kMeter,
  kKilometer, kInch, kFoot, kYard,
  kMile, kMicroinches, kMils, kAngstroms,
  kNanometers, kMicrons, kDecimeters, kDekameters,
  kHectometers, kGigameters, kAstronomical, kLightYears,
  kParsecs
}
 
enum  ImageSource {
  kUndefinedSource = -1, kFromDwg = 0, kFromOleObject = 1, kFromRender = 2,
  kFromUnderlay = 10, kFromImageBGRA32 = 11, kFromPdfUnderlay = kFromOleObject, kFromFile = kFromDwg
}
 
enum  TransparencyMode { kTransparencyDef = -1, kTransparencyOff = 0, kTransparency1Bit = 1, kTransparency8Bit = 2 }
 
typedef struct OdGiRasterImage::tagPixelFormatInfo PixelFormatInfo
 

Public Member Functions

 ODRX_DECLARE_MEMBERS (OdGiRasterImage)
 
virtual OdUInt32 pixelWidth () const =0
 
virtual OdUInt32 pixelHeight () const =0
 
virtual Units defaultResolution (double &xPelsPerUnit, double &yPelsPerUnit) const
 
virtual OdUInt32 colorDepth () const =0
 
virtual OdUInt32 numColors () const =0
 
virtual int transparentColor () const
 
virtual ODCOLORREF color (OdUInt32 colorIndex) const =0
 
virtual OdUInt32 paletteDataSize () const =0
 
virtual void paletteData (OdUInt8 *bytes) const =0
 
virtual OdUInt32 scanLineSize () const
 
virtual const OdUInt8scanLines () const =0
 
virtual void scanLines (OdUInt8 *scnLines, OdUInt32 firstScanline, OdUInt32 numLines=1) const =0
 
virtual PixelFormatInfo pixelFormat () const =0
 
virtual OdUInt32 scanLinesAlignment () const =0
 
virtual ImageSource imageSource () const
 
virtual const OdStringsourceFileName () const
 
virtual TransparencyMode transparencyMode () const
 
OdSmartPtr< OdGiRasterImagechangeImageSource (ImageSource source, const OdChar *pFileName=NULL)
 
OdSmartPtr< OdGiRasterImagechangeSourceFileName (const OdString &fileName)
 
OdSmartPtr< OdGiRasterImagechangeTransparencyMode (TransparencyMode mode)
 
OdSmartPtr< OdGiRasterImageconvert (bool convertPaletteToRGB, double brightness=50.0, double contrast=50.0, double fade=0.0, ODCOLORREF backgroundColor=0, bool flipX=false, bool flipY=false, bool rotate90=false, const OdGiRasterImage *pDestDesc=0, bool transparency=false) const
 
virtual OdSmartPtr< OdGiRasterImagecrop (OdUInt32 x, OdUInt32 y, OdUInt32 width, OdUInt32 height) const
 
virtual voidimp () const
 
- Public Member Functions inherited from OdRxObject
 ODRX_HEAP_OPERATORS ()
 
 OdRxObject ()
 
virtual ~OdRxObject ()
 
virtual OdRxObjectqueryX (const OdRxClass *pClass) const
 
virtual OdRxObjectx (const OdRxClass *pClass) const
 
virtual OdRxClassisA () const
 
virtual void addRef ()=0
 
virtual void release ()=0
 
virtual long numRefs () const
 
bool isKindOf (const OdRxClass *pClass) const
 
virtual OdRxObjectPtr clone () const
 
virtual void copyFrom (const OdRxObject *pSource)
 
virtual OdRx::Ordering comparedTo (const OdRxObject *pOther) const
 
virtual bool isEqualTo (const OdRxObject *pOther) const
 

Static Public Member Functions

static OdUInt32 calcBMPScanLineSize (OdUInt32 pixelWidth, int colorDepth)
 
static OdUInt32 calcColorMask (OdUInt8 numColorBits, OdUInt8 colorOffset=0)
 
- Static Public Member Functions inherited from OdRxObject
static OdRxObjectPtr cast (const OdRxObject *pointer)
 
static OdRxClassdesc ()
 

Detailed Description

This class represents a raster image within the Teigha vectorization framework. Corresponding C++ library: TD_Gi <group OdGi_Classes>

Definition at line 36 of file GiRasterImage.h.

Member Typedef Documentation

◆ PixelFormatInfo

Member Enumeration Documentation

◆ ImageSource

Enumerator
kUndefinedSource 
kFromDwg 
kFromOleObject 
kFromRender 
kFromUnderlay 
kFromImageBGRA32 
kFromPdfUnderlay 
kFromFile 

Definition at line 66 of file GiRasterImage.h.

◆ TransparencyMode

Enumerator
kTransparencyDef 
kTransparencyOff 
kTransparency1Bit 
kTransparency8Bit 

Definition at line 81 of file GiRasterImage.h.

◆ Units

Enumerator
kNone 
kMillimeter 
kCentimeter 
kMeter 
kKilometer 
kInch 
kFoot 
kYard 
kMile 
kMicroinches 
kMils 
kAngstroms 
kNanometers 
kMicrons 
kDecimeters 
kDekameters 
kHectometers 
kGigameters 
kAstronomical 
kLightYears 
kParsecs 

Definition at line 41 of file GiRasterImage.h.

Member Function Documentation

◆ calcBMPScanLineSize()

static OdUInt32 OdGiRasterImage::calcBMPScanLineSize ( OdUInt32  pixelWidth,
int  colorDepth 
)
static

Returns the size of a single scanline in BMP format for this RasterImage object.

Parameters
pixelWidth[in] Image width in pixels.
colorDepth[in] Number of bits per pixel.

◆ calcColorMask()

static OdUInt32 OdGiRasterImage::calcColorMask ( OdUInt8  numColorBits,
OdUInt8  colorOffset = 0 
)
static

Returns the 32-bit mask for the requested number of color bits and offset.

Parameters
numColorBits[in] Number of color bits.
colorOffset[in] Offset of color bits.

◆ changeImageSource()

OdSmartPtr<OdGiRasterImage> OdGiRasterImage::changeImageSource ( ImageSource  source,
const OdChar pFileName = NULL 
)

Sets an image source and (optionally) source file name.

Parameters
source[in] New image source value.
pFileName[in] Optional value for source file name.
Returns
Returns image with new image source.

◆ changeSourceFileName()

OdSmartPtr<OdGiRasterImage> OdGiRasterImage::changeSourceFileName ( const OdString fileName)

Sets an image source file name.

Parameters
fileName[in] New value for source file name.
Returns
Returns image with new image source file name.

◆ changeTransparencyMode()

OdSmartPtr<OdGiRasterImage> OdGiRasterImage::changeTransparencyMode ( TransparencyMode  mode)

Sets transparency mode for 32bpp formats.

Parameters
mode[in] New transparency mode.
Returns
Returns image with new transparency mode.

◆ color()

virtual ODCOLORREF OdGiRasterImage::color ( OdUInt32  colorIndex) const
pure virtual

Returns the color for the specified index from the palette of this RasterImage object.

Parameters
colorIndex[in] Color index.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiInversionRasterTransformer, OdGiBitonalRasterTransformer, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ colorDepth()

virtual OdUInt32 OdGiRasterImage::colorDepth ( ) const
pure virtual

Returns the number of bits per pixel used for colors by this RasterImage object.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ convert()

OdSmartPtr<OdGiRasterImage> OdGiRasterImage::convert ( bool  convertPaletteToRGB,
double  brightness = 50.0,
double  contrast = 50.0,
double  fade = 0.0,
ODCOLORREF  backgroundColor = 0,
bool  flipX = false,
bool  flipY = false,
bool  rotate90 = false,
const OdGiRasterImage pDestDesc = 0,
bool  transparency = false 
) const

Converts this raster image as specified.

Parameters
convertPaletteToRGB[in] Color is converted to RGB if and only if true.
brightness[in] Image brightness [0 .. 100].
contrast[in] Image contrast [0 .. 100].
fade[in] Image fade value [0 .. 100].
backgroundColor[in] Background color.
flipX[in] Image is flipped about the X-axis if and only if true.
flipY[in] Image is flipped about the Y-axis if and only if true.
rotate90[in] Image is rotated 90° if and only if true.
pDestDesc[in] Pointer to an OdGiRasterImageDesc object to receive the image parameters.
transparency[in] Image is transparent if true.
Returns
Returns a SmartPointer to the converted image.

◆ crop()

virtual OdSmartPtr<OdGiRasterImage> OdGiRasterImage::crop ( OdUInt32  x,
OdUInt32  y,
OdUInt32  width,
OdUInt32  height 
) const
virtual

Crops this raster image using a rectangle. The format of returned raster image is identical to the format of the source raster image.

Parameters
x[in] X-coordinate of start point.
y[in] Y-coordinate of start point.
width[in] Width of the crop rectangle.
height[in] Height of the crop rectangle.
Remarks
All arguments are in pixels.

◆ defaultResolution()

virtual Units OdGiRasterImage::defaultResolution ( double &  xPelsPerUnit,
double &  yPelsPerUnit 
) const
virtual

Returns the default image resolution in pixels per unit of this RasterImage object.

Parameters
xPelsPerUnit[out] Receives the pixels per unit value (x direction).
yPelsPerUnit[out] Receives the pixels per unit value (y direction).
Remarks
If the returned value is kNone, then xPelsPerUnit and yPelsPerUnit are not set.

Reimplemented in OdGiRasterImageAlphaChannelAdder, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ imageSource()

virtual ImageSource OdGiRasterImage::imageSource ( ) const
virtual

◆ imp()

virtual void* OdGiRasterImage::imp ( ) const
virtual

Returns user-end implementation of raster image.

Remarks
If not overridden by user-end raster image implementation, always returns null.

Reimplemented in OdGiRasterImageWrapper.

◆ numColors()

virtual OdUInt32 OdGiRasterImage::numColors ( ) const
pure virtual

Returns the number of colors in the palette of this RasterImage object.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiBitonalRasterTransformer, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ ODRX_DECLARE_MEMBERS()

OdGiRasterImage::ODRX_DECLARE_MEMBERS ( OdGiRasterImage  )

◆ paletteData()

virtual void OdGiRasterImage::paletteData ( OdUInt8 bytes) const
pure virtual

Returns the palette in BMP format of this RasterImage object.

Parameters
bytes[out] Receives the palette data.
Remarks
It is up to the caller to allocate sufficient memory for the palette data.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiInversionRasterTransformer, OdGiBitonalRasterTransformer, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ paletteDataSize()

virtual OdUInt32 OdGiRasterImage::paletteDataSize ( ) const
pure virtual

Returns the size (in bytes) of the palette data of this RasterImage object.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiBitonalRasterTransformer, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ pixelFormat()

virtual PixelFormatInfo OdGiRasterImage::pixelFormat ( ) const
pure virtual

Returns the pixel format for this RasterImage object.

Remarks
This function returns the pixel format of the palette, unless there is no palette, in which case it returns the pixel format of the image itself.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiBitonalRasterTransformer, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ pixelHeight()

virtual OdUInt32 OdGiRasterImage::pixelHeight ( ) const
pure virtual

Returns the image height in pixels of this RasterImage object.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ pixelWidth()

virtual OdUInt32 OdGiRasterImage::pixelWidth ( ) const
pure virtual

Returns the image width in pixels of this RasterImage object.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ scanLines() [1/2]

virtual const OdUInt8* OdGiRasterImage::scanLines ( ) const
pure virtual

Returns the set of scanlines.

Remarks
Implementation of this function is optional; NULL can be returned if it is inconvenient to implement. The caller must take into account that the return value can be NULL. If this method returns NULL, scanlines can be accessed by a second version of the scanLines() method with arguments where a memory buffer for scanline data is preallocated by the caller.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiInversionRasterTransformer, OdGiLeftToRightRasterTransformer, OdGiUpsideDownRasterTransformer, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ scanLines() [2/2]

virtual void OdGiRasterImage::scanLines ( OdUInt8 scnLines,
OdUInt32  firstScanline,
OdUInt32  numLines = 1 
) const
pure virtual

Returns the specified set of scanlines in BMP format from this RasterImage object, or the pixel data in BMP format for this RasterImage object.

Parameters
scnLines[out] Receives the scanline data.
firstScanline[in] Index of first scanline to retrieve.
numLines[in] Number of scanlines to retrieve.
Remarks
The number of accessible scanlines is equal to the value returned by pixelHeight(). The number of accessible bytes in a scanline is equal to the value returned by scanLineSize(). The scanline returned by firstScanline == 0 is the first scanline in the image. The scanline returned by firstScanline == (pixelHeight() - 1) is the last scanline in the image.
It us up to the caller to allocate sufficient memory for the scanline data.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiInversionRasterTransformer, OdGiLeftToRightRasterTransformer, OdGiUpsideDownRasterTransformer, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ scanLinesAlignment()

virtual OdUInt32 OdGiRasterImage::scanLinesAlignment ( ) const
pure virtual

Returns the scanline alignment, in bytes, for this RasterImage object. Example: scanLinesAlignment() returns 4 for Windows BMP.

Implemented in OdGiRasterImageAlphaChannelAdder, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ scanLineSize()

virtual OdUInt32 OdGiRasterImage::scanLineSize ( ) const
virtual

Returns the scanline size of this RasterImage object.

Remarks
This function returns the number of bytes between the beginning of scanline N and the beginning of scanline N+1 (taking into account any padding that is added to the end of the scanline).

Reimplemented in OdGiRasterImageAlphaChannelAdder, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ sourceFileName()

virtual const OdString& OdGiRasterImage::sourceFileName ( ) const
virtual

Returns the image source file name.

Reimplemented in OdGiRasterImageWrapper, OdGiRasterImageHolder, and OdGiRasterImageDesc.

◆ transparencyMode()

virtual TransparencyMode OdGiRasterImage::transparencyMode ( ) const
virtual

Returns the transparency mode for 32bpp formats.

Reimplemented in OdGiRasterImageAlphaChannelAdder, OdGiRasterImageWrapper, OdGiRasterImageHolder, OdGiRasterImageBGRA32, and OdGiRasterImageDesc.

◆ transparentColor()

virtual int OdGiRasterImage::transparentColor ( ) const
virtual

Returns the index of transparent color in the image.

Remarks
If there is no transparent color, -1 should be returned.
The default implementation of this function returns -1.

Reimplemented in OdGiBitonalRasterTransformer, OdGiRasterImageWrapper, and OdGiRasterImageHolder.


The documentation for this class was generated from the following file: