CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
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 OdGiTintRasterTransformer 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 double millimetersInUnit (Units units)
 
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 ODA Platform vectorization framework. Corresponding C++ library: TD_Gi

<group OdGi_Classes>

See also
<link gi_raster_images, Work with Raster Images>

Definition at line 40 of file GiRasterImage.h.

Member Typedef Documentation

◆ PixelFormatInfo

Represents data for pixel formatting.

Member Enumeration Documentation

◆ ImageSource

This enumeration represents sources for raster images.

Enumerator
kUndefinedSource 

Flag not set (unknown source).

kFromDwg 

Raster image loaded from raster image definition.

kFromOleObject 

Raster image generated from OLE data source.

kFromRender 

Raster image generated from rendering.

kFromUnderlay 

Raster image is a part of underlay.

kFromImageBGRA32 

Raster image wraps an OdGiImageBGRA32 image.

kFromPdfUnderlay 

Raster image generated from PdfUnderlay.

kFromFile 

Raster image generated from a disk file.

Definition at line 157 of file GiRasterImage.h.

◆ TransparencyMode

This enumeration represents transparency modes.

Enumerator
kTransparencyDef 

Default for native raster image (alpha 0 is transparent, 1-255 is opaque).

kTransparencyOff 

Alpha ignored for 32bpp formats.

kTransparency1Bit 

Alpha 0-254 is transparent, 255 is opaque.

kTransparency8Bit 

Complete alpha level support for 32bpp formats.

Definition at line 183 of file GiRasterImage.h.

◆ Units

This enumeration represents measurement units.

Enumerator
kNone 

No measurement units are used.

kMillimeter 

Millimeters are used.

kCentimeter 

Centimeters are used.

kMeter 

Meters are used.

kKilometer 

Kilometers are used.

kInch 

Inches are used.

kFoot 

Foots are used.

kYard 

Yards are used.

kMile 

Miles are used.

kMicroinches 

Microinches are used.

kMils 

Mils (thousandths of an inch) are used.

kAngstroms 

Angstroms (10^-10 of a meter or ten-billionths of a meter) are used.

kNanometers 

Nanometers are used.

kMicrons 

Microns are used.

kDecimeters 

Decimeters are used.

kDekameters 

Dekameters (10 meters) are used.

kHectometers 

Hectometers (10^2 meters) are used.

kGigameters 

Gigameters (10^9 meters) are used.

kAstronomical 

Astronominal units (149597870700 meters) are used.

kLightYears 

Light years (9460730472580800 meters) are used.

kParsecs 

Parsecs (approx 3.261563777 light years) are used.

Definition at line 50 of file GiRasterImage.h.

Member Function Documentation

◆ calcBMPScanLineSize()

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

Retrieves 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.
Returns
The size of a single scanline in BMP format as an OdUInt32 value.

◆ calcColorMask()

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

Retrieves 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.
Returns
Color mask as an OdUInt32 value.

◆ 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
Smart pointer to the image with the 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
Smart pointer to the image with the 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
Smart pointer to the image with new transparency mode.

◆ color()

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

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

Parameters
colorIndex[in] Color index.
Returns
Color at the specified index as an ODCOLORREF (OdUInt32) value.

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

◆ colorDepth()

virtual OdUInt32 OdGiRasterImage::colorDepth ( ) const
pure virtual

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

Returns
Number of bits per pixel that represents color depth.

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

◆ 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
Smart pointer 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 the start point.
y[in] Y-coordinate of the start point.
width[in] Width of the crop rectangle.
height[in] Height of the crop rectangle.
Returns
Smart pointer to the cropped image.
Remarks
All arguments are in pixels.

◆ defaultResolution()

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

Retrieves 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).
Returns
Units that are used to measure image dimensions.
Remarks
If the returned value is kNone, then xPelsPerUnit and yPelsPerUnit are not set.

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

◆ imageSource()

virtual ImageSource OdGiRasterImage::imageSource ( ) const
virtual

Retrieves the image source.

Returns
Image source represented by a value from the ImageSource enumeration.

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

◆ imp()

virtual void * OdGiRasterImage::imp ( ) const
virtual

Retrieves a user-end implementation of the raster image.

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

Reimplemented in OdGiRasterImageWrapper.

◆ millimetersInUnit()

static double OdGiRasterImage::millimetersInUnit ( Units  units)
inlinestatic

Returns number of millimeters in a given unit.

Parameters
units[in] Input measurement unit.
Returns
Number of millimeters in the given measurement unit.

Definition at line 103 of file GiRasterImage.h.

◆ numColors()

virtual OdUInt32 OdGiRasterImage::numColors ( ) const
pure virtual

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

Returns
Number of colors in the palette.

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

◆ ODRX_DECLARE_MEMBERS()

OdGiRasterImage::ODRX_DECLARE_MEMBERS ( OdGiRasterImage  )

◆ paletteData()

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

Retrieves 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 OdGiRasterImageDesc, OdGiRasterImageBGRA32, OdGiRasterImageHolder, OdGiRasterImageWrapper, OdGiBitonalRasterTransformer, OdGiInversionRasterTransformer, and OdGiRasterImageAlphaChannelAdder.

◆ paletteDataSize()

virtual OdUInt32 OdGiRasterImage::paletteDataSize ( ) const
pure virtual

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

Returns
Number of bytes that represent palette data size.

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

◆ pixelFormat()

virtual PixelFormatInfo OdGiRasterImage::pixelFormat ( ) const
pure virtual

Retrieves the pixel format for this RasterImage object.

Returns
Pixel format of a palette or raster image.
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 OdGiRasterImageDesc, OdGiRasterImageBGRA32, OdGiRasterImageHolder, OdGiRasterImageWrapper, OdGiBitonalRasterTransformer, and OdGiRasterImageAlphaChannelAdder.

◆ pixelHeight()

virtual OdUInt32 OdGiRasterImage::pixelHeight ( ) const
pure virtual

Retrieves the image height in pixels of this RasterImage object.

Returns
Number of pixels as an OdUInt32 value that represents height of this raster image.

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

◆ pixelWidth()

virtual OdUInt32 OdGiRasterImage::pixelWidth ( ) const
pure virtual

Retrieves the image width in pixels of this RasterImage object.

Returns
Number of pixels as an OdUInt32 value that represents width of this raster image.

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

◆ scanLines() [1/2]

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

Retrieves the set of scanlines.

Returns
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 the second version of the scanLines() method with arguments where a memory buffer for scanline data is preallocated by the caller.

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

◆ scanLines() [2/2]

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

Retrieves 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 the 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 OdGiRasterImageDesc, OdGiRasterImageBGRA32, OdGiRasterImageHolder, OdGiRasterImageWrapper, OdGiUpsideDownRasterTransformer, OdGiLeftToRightRasterTransformer, OdGiInversionRasterTransformer, and OdGiRasterImageAlphaChannelAdder.

◆ scanLinesAlignment()

virtual OdUInt32 OdGiRasterImage::scanLinesAlignment ( ) const
pure virtual

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

Returns
Scanline alignment as an OdUInt32 value.

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

◆ scanLineSize()

virtual OdUInt32 OdGiRasterImage::scanLineSize ( ) const
virtual

Retrieves the scanline size of this RasterImage object.

Returns
Number of bytes between the beginning of the scanline N and the beginning of the scanline N+1 (taking into account any padding that is added to the end of the scanline).

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

◆ sourceFileName()

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

Retrieves the image source file name.

Returns
Full path to the file from which the image is loaded.

Reimplemented in OdGiRasterImageDesc, OdGiRasterImageHolder, and OdGiRasterImageWrapper.

◆ transparencyMode()

virtual TransparencyMode OdGiRasterImage::transparencyMode ( ) const
virtual

Retrieves the transparency mode for 32bpp formats.

Returns
Transparency mode represented by a value from the TransparencyMode enumeration.

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

◆ transparentColor()

virtual int OdGiRasterImage::transparentColor ( ) const
virtual

Retrieves the index of transparent color in the image.

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

Reimplemented in OdGiRasterImageHolder, OdGiRasterImageWrapper, and OdGiBitonalRasterTransformer.


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