MGD::DEVICE Class Reference

Base class for general drawing "device". More...

#include <mi32/mgd2.h>

Inheritance diagram for MGD::DEVICE:
Inheritance graph
[legend]

List of all members.

Public Member Functions

virtual ~DEVICE ()
bool AvoidFillSpans () const
ERRVALUE Clear (const COLOR &color)
void ClearICMDestProfile ()
void ClearICMProofProfile ()
ERRVALUE ComputeRegion (BINARYTOREGIONINTERFACE &bintoreg, COMPONENT component=COMPONENT_Alpha, int threshold=128, bool above=true) const
double ConvertScreenUnits (double value, int iunits, int ounits) const
MGD::CONTEXTCreateContext ()
ERRVALUE DepthInit (UINT16 FrameBuffer)
ERRVALUE DepthInit ()
void DepthRelease (UINT16 FrameBuffer)
void DepthRelease ()
PIXEL GetAllPlanesMask () const
CAPABILITY GetCapabilities () const
const COLOR_ARRAYGetColorMap () const
DEPRECATED PIXEL GetColorPixel (const COLOR &color)
COLORSPACE GetColorSpace () const
float GetDepth (INT32 x, INT32 y, UINT16 FrameBuffer) const
const DISPLAYINFOGetDeviceInfo () const
const LRECT2DGetExtents () const
INT32 GetHeight () const
const PROFILEGetICMDestProfile () const
PROFILE::INTENT GetICMIntent () const
int GetImageBytesPerPixel () const
UINT8GetImagePointer (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer)
UINT8GetImagePointer (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer, bool UseVirtualWindow)
bool GetNeedFullImageLine () const
UINT16 GetNumFrameBuffers () const
DEPRECATED void GetPixelColor (PIXEL pixel, COLOR &color) const
void GetPixelSizeDPI (double &xsize, double &ysize) const
double GetPixelSizeDPI () const
void GetPixelSizeMM (double &xsize, double &ysize) const
double GetPixelSizeMM () const
UINT32 GetTypeId () const
INT32 GetWidth () const
bool HasCapability (MGD::CAPABILITY capability) const
bool HasDepth (UINT16 FrameBuffer) const
void ResetVirtualWindow ()
void SetDepth (INT32 x, INT32 y, float z, UINT16 FrameBuffer)
void SetICMDestProfile (const PROFILEPARMS_PRINTER &profile)
void SetICMDestProfile (const PROFILE &profile, PROFILE::INTENT intent=PROFILE::INTENT_Perceptual)
void SetICMDestProfileScreen ()
void SetICMProofProfile (const PROFILEPARMS_PRINTER &profile)
void SetPixelSizeMM (double xsize, double ysize)
void SetVirtualWindow (INT32 dx, INT32 dy, INT32 fullwidth, INT32 fullheight)
bool SupportsOpacityBlendMode (MGD::OPACITY_MODE mode) const

Static Public Member Functions

static DEVICEGetNull ()

Protected Member Functions

 DEVICE ()
float * GetDepthBuffer (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer, bool UseVirtualWindow)
const UINT8GetImagePointerConst (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer)
const UINT8GetImagePointerConst (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer, bool UseVirtualWindow)
UINT8GetImagePointerNoRead (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer)
UINT8GetImagePointerNoRead (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer, bool UseVirtualWindow)
const LPOINT2DGetRealSize () const
const LPOINT2DGetVirtualOffset () const
bool HasVirtualWindow () const
void SetDeviceColorSpace (COLORSPACE colorspace)
ERRVALUE SetDeviceInfo (const DISPLAYINFO &dispinfo)
void SetRealSize (int height, int width)
void SetTypeId (UINT32 TypeId)
virtual CAPABILITY v_GetCapabilities () const
ERRVALUE WriteDepthBuffer (INT32 x, INT32 y, INT32 len, const float *zbuf, UINT16 FrameBuffer)
ERRVALUE WriteImageBuffer (INT32 x, INT32 y, INT32 len, UINT8 *buf, UINT16 FrameBuffer)

Static Protected Member Functions

static UINT32 AllocTypeId ()

Private Member Functions

virtual bool v_AvoidFillSpans () const
virtual ERRVALUE v_Clear (const COLOR &color)
virtual MGD::CONTEXTv_CreateContext ()
virtual ERRVALUE v_FillSpan (MGD::CONTEXT *gc, INT32 x1, INT32 x2, INT32 y)
virtual const COLOR_ARRAYv_GetColorMap () const
virtual PIXEL v_GetColorPixel (const COLOR &color)
virtual COLORSPACE v_GetColorSpace () const
virtual UINT8v_GetImagePointer (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer)
virtual UINT8v_GetImagePointerNoRead (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer)
virtual bool v_GetNeedFullImageLine () const
virtual UINT16 v_GetNumFrameBuffers () const
virtual void v_GetPixelColor (PIXEL pixel, COLOR &color) const
virtual bool v_SupportsOpacityBlendMode (MGD::OPACITY_MODE) const
virtual bool v_UseAntiAliasing () const
virtual ERRVALUE v_WriteImageBuffer (INT32 x, INT32 y, INT32 len, UINT8 *buf, UINT16 FrameBuffer)

Detailed Description

Base class for general drawing "device".


Constructor & Destructor Documentation

virtual MGD::DEVICE::~DEVICE (  )  [virtual]

Destructor.

MGD::DEVICE::DEVICE (  )  [protected]

Constructor.

Because we could get an error while allocating an MGD::DEVICE, and we don't deal with exception handling code, the constructor should only initialize the class members. Each derived class should have a Create() method to actually allocate memory. That would be a pure-virtual function, but the parameters necessary are implementation dependant. For example, the raster implementation would need to take an RVC::RASTER object or something. An X implementation would require a Drawable, etc...


Member Function Documentation

static UINT32 MGD::DEVICE::AllocTypeId (  )  [inline, static, protected]

Allocate device type ID.

bool MGD::DEVICE::AvoidFillSpans (  )  const [inline]

Returns true if the derived class is based on an implementation where fill spans are considered "bad".

This is used by the implementation of text drawing functions to know if they should be drawn as fillspans of call FillPolygons

ERRVALUE MGD::DEVICE::Clear ( const COLOR color  )  [inline]
void MGD::DEVICE::ClearICMDestProfile (  )  [inline]

Clear the ICM Profile of the destination device.

void MGD::DEVICE::ClearICMProofProfile (  )  [inline]

Clear the ICM Profile of the proofing device.

ERRVALUE MGD::DEVICE::ComputeRegion ( BINARYTOREGIONINTERFACE bintoreg,
COMPONENT  component = COMPONENT_Alpha,
int  threshold = 128,
bool  above = true 
) const

Compute a region which encloses all pixels with alpha above or below some treshold.

Note: this method only works on devices having 8 bits per component. Binary devices have their own implementation.

Parameters:
bintoreg The interface to use to create the region
component Color component
threshold The threshold value to compare to
above If true, the region will include all pixels with value greater than the threshold. If false, the region will include all pixels with value less than the threshold
double MGD::DEVICE::ConvertScreenUnits ( double  value,
int  iunits,
int  ounits 
) const [inline]

Change value from one SCREENUNIT to another using display for pixel size.

Returns:
Converted value.
Parameters:
value Value to convert
iunits Input units (SCREENUNIT_...)
ounits Output units (SCREENUNIT_...)
MGD::CONTEXT* MGD::DEVICE::CreateContext (  ) 

Create a context for drawing.

ERRVALUE MGD::DEVICE::DepthInit ( UINT16  FrameBuffer  ) 

Initialize depth buffer for specified frame buffer.

Parameters:
FrameBuffer Frame buffer index
ERRVALUE MGD::DEVICE::DepthInit (  ) 

Initialize depth buffer for each frame buffer.

void MGD::DEVICE::DepthRelease ( UINT16  FrameBuffer  ) 

Release depth buffer for specified frame buffer.

Parameters:
FrameBuffer Frame buffer index
void MGD::DEVICE::DepthRelease (  ) 

Release depth buffer for each frame buffer.

PIXEL MGD::DEVICE::GetAllPlanesMask (  )  const [inline]

Get pixel mask for all planes.

CAPABILITY MGD::DEVICE::GetCapabilities (  )  const [inline]

Return capabilities of this device.

Reimplemented in MGD::DEVICE_MEM24.

const COLOR_ARRAY* MGD::DEVICE::GetColorMap (  )  const [inline]

Get the ColorMap for the device.

Will return NULL if the device doesn't use one.

DEPRECATED PIXEL MGD::DEVICE::GetColorPixel ( const COLOR color  )  [inline]

Return (closest) matching PIXEL value for COLOR.

Does NOT take ICM into account. The one in context does. Deprecated because you should call the one in the context

Deprecated:
Call the version in the context
COLORSPACE MGD::DEVICE::GetColorSpace (  )  const [inline]

Return the "native" COLORSPACE used by the display Image operations using this colorspace will be more efficient.

Default implementation determines the colorspace from the DeviceInfo

float MGD::DEVICE::GetDepth ( INT32  x,
INT32  y,
UINT16  FrameBuffer 
) const

Return the depth at a given pixel location.

float* MGD::DEVICE::GetDepthBuffer ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer,
bool  UseVirtualWindow 
) [protected]

Get a pointer to the depth buffer for a given location.

Since this is protected, it's assumed that you've already validated the coordinates. If the depth buffer is all in memory, this returns a pointer into that buffer. If it's being spooled to a temporary file, it reads the requested part into a buffer and returns that buffer. In the temporary raster case, each call to GetDepthBuffer() reuses the same buffer. After modifying the depth buffer, you should call WriteDepthBuffer(). WriteDepthBuffer() does nothing unless the depth buffer is from a temporary raster, in which case it writes it back out. This function will return NULL if the depth buffer is not initialized or if reading from the temporary raster would cause an error.

const DISPLAYINFO& MGD::DEVICE::GetDeviceInfo (  )  const [inline]
const LRECT2D& MGD::DEVICE::GetExtents (  )  const [inline]

Get device extents.

INT32 MGD::DEVICE::GetHeight (  )  const [inline]

Get device height in pixels.

const PROFILE& MGD::DEVICE::GetICMDestProfile (  )  const [inline]
PROFILE::INTENT MGD::DEVICE::GetICMIntent (  )  const [inline]
int MGD::DEVICE::GetImageBytesPerPixel (  )  const [inline]

Get number of bytes per image pixel.

UINT8* MGD::DEVICE::GetImagePointer ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer 
) [inline]

Return a pointer to a piece of the image buffer.

UINT8* MGD::DEVICE::GetImagePointer ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer,
bool  UseVirtualWindow 
) [inline]

Return a pointer to a piece of the image buffer with option to use virtual window.

This only has to be implemented if HasCapability(CAPABILITY_GetImage) returns true. The CopyRect() routines use it to read the source image. Note that this may return a pointer directly into the screen buffer or a temporary buffer into which it has read the requested data. It's up to the implementation to decide how to handle this.

const UINT8* MGD::DEVICE::GetImagePointerConst ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer 
) [inline, protected]

Same as GetImagePointer() but returns a const pointer.

const UINT8* MGD::DEVICE::GetImagePointerConst ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer,
bool  UseVirtualWindow 
) [inline, protected]

Same as GetImagePointer() but returns a const pointer.

UINT8* MGD::DEVICE::GetImagePointerNoRead ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer 
) [inline, protected]
UINT8* MGD::DEVICE::GetImagePointerNoRead ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer,
bool  UseVirtualWindow 
) [inline, protected]

Get image pointer without reading current contents.

bool MGD::DEVICE::GetNeedFullImageLine (  )  const [inline]

Determine if full image lines are needed (no tiled output).

static DEVICE& MGD::DEVICE::GetNull (  )  [static]

Get reference to "null" device.

A null device is useful for creating CONTEXT instances used for calculation of text size, etc. Any attempt to draw using the null device will be ignored.

UINT16 MGD::DEVICE::GetNumFrameBuffers (  )  const [inline]

Get number of display frame buffers.

DEPRECATED void MGD::DEVICE::GetPixelColor ( PIXEL  pixel,
COLOR color 
) const [inline]

Given a pixel value, return the color it represents.

Deprecated:
Call the one in the context instead
void MGD::DEVICE::GetPixelSizeDPI ( double &  xsize,
double &  ysize 
) const [inline]

Return the pixel size in DPI without assuming squareness.

double MGD::DEVICE::GetPixelSizeDPI (  )  const [inline]

Return the pixel size in DPI, assuming square pixels.

void MGD::DEVICE::GetPixelSizeMM ( double &  xsize,
double &  ysize 
) const

Return the pixel size in millimeters without assuming squareness.

This method will cope with "this" being NULL by returning the pixel size of a NULL device

double MGD::DEVICE::GetPixelSizeMM (  )  const

Return the pixel size in millimeters, assuming square pixels.

This method will cope with "this" being NULL by returning the pixel size of a NULL device

const LPOINT2D& MGD::DEVICE::GetRealSize (  )  const [inline, protected]
UINT32 MGD::DEVICE::GetTypeId (  )  const [inline]

Get device type ID.

const LPOINT2D& MGD::DEVICE::GetVirtualOffset (  )  const [inline, protected]
INT32 MGD::DEVICE::GetWidth (  )  const [inline]
bool MGD::DEVICE::HasCapability ( MGD::CAPABILITY  capability  )  const [inline]
bool MGD::DEVICE::HasDepth ( UINT16  FrameBuffer  )  const [inline]

Determine if has depth buffer for specified frame buffer.

Parameters:
FrameBuffer Frame buffer index
bool MGD::DEVICE::HasVirtualWindow (  )  const [inline, protected]
void MGD::DEVICE::ResetVirtualWindow (  ) 

Reset any virtual window set on the device.

This clears the effects of SetVirtualWindow()

void MGD::DEVICE::SetDepth ( INT32  x,
INT32  y,
float  z,
UINT16  FrameBuffer 
)

Set the depth at a given pixel location.

void MGD::DEVICE::SetDeviceColorSpace ( COLORSPACE  colorspace  )  [protected]

Sets the bits, shift, and mask parameters of the DEVICEINFO.

ERRVALUE MGD::DEVICE::SetDeviceInfo ( const DISPLAYINFO dispinfo  )  [protected]

To be called by Create() method to set stuff up.

void MGD::DEVICE::SetICMDestProfile ( const PROFILEPARMS_PRINTER profile  ) 

Set the ICM Profile of the destination device.

void MGD::DEVICE::SetICMDestProfile ( const PROFILE profile,
PROFILE::INTENT  intent = PROFILE::INTENT_Perceptual 
)

Set the ICM Profile of the destination device.

void MGD::DEVICE::SetICMDestProfileScreen (  ) 

Set the ICM Profile of the destination device to the currently selected Screen profile (Selected in the TNTmips preferences).

void MGD::DEVICE::SetICMProofProfile ( const PROFILEPARMS_PRINTER profile  ) 

Set the ICM Profile of the proofing device If set, will cause images and colors to be mapped to the gamut of the proofing device (printer) before being mapped to the gamut of the Dest device.

This way, the Dest device (screen) won't show any colors which the Proofing device (printer) is incapable of rendering.

void MGD::DEVICE::SetPixelSizeMM ( double  xsize,
double  ysize 
) [inline]

Set the pixel size in millimeters without assuming squareness.

void MGD::DEVICE::SetRealSize ( int  height,
int  width 
) [inline, protected]
void MGD::DEVICE::SetTypeId ( UINT32  TypeId  )  [inline, protected]

Set device type ID.

Should only be done in constructor.

void MGD::DEVICE::SetVirtualWindow ( INT32  dx,
INT32  dy,
INT32  fullwidth,
INT32  fullheight 
)

Setup a virtual window.

Allows an MGD::DEVICE to behave as a subset of a larger device even though the real buffer only covers a part of it. dx and dy should be the coordinates of the upper-left corner of the raster in the virtual space and fullheight/fullwidth is the size of the virtual space.

bool MGD::DEVICE::SupportsOpacityBlendMode ( MGD::OPACITY_MODE  mode  )  const [inline]

Determine if this device supports a specific opacity blending mode.

virtual bool MGD::DEVICE::v_AvoidFillSpans (  )  const [private, virtual]

Returns true if the derived class is based on an implementation where fill spans are considered "bad".

This is used by the implementation of text drawing functions to know if they should be drawn as fillspans of call FillPolygons. Default implementation returns false.

virtual ERRVALUE MGD::DEVICE::v_Clear ( const COLOR color  )  [private, virtual]
virtual MGD::CONTEXT* MGD::DEVICE::v_CreateContext (  )  [private, virtual]

Create CONTEXT for drawing.

Derived classes may override this and make it return anything derived from MGD::CONTEXT. MGD::CONTEXT's constructor is private, so this is the only way for calling code to create a GC.

Reimplemented in MGD::DEVICE_MEM8G, MGD::DEVICE_RASTER_RGB24, MGD::DEVICE_RASTER_GRAY8, MGD::DEVICE_RASTER_COLORMAPPED, and MGD::DEVICE_SIMPLE.

virtual ERRVALUE MGD::DEVICE::v_FillSpan ( MGD::CONTEXT gc,
INT32  x1,
INT32  x2,
INT32  y 
) [private, virtual]

Fill a horizontal span.

Many of the default method implementations call this to do all the work. Derived classes that implement this do not need to worry about clipping, as the default implementation in CONTEXT does clipping and then calls this version.

If your implementation handles bitmap pattern fills in a way that's optimized for your dest device, you should return CAPABALITY_BitmapFill in GetCapabilities. Default implementation does nothing.

Reimplemented in MGD::DEVICE_MEM16, MGD::DEVICE_MEM24, MGD::DEVICE_MEM8G, and MGD::DEVICE_SIMPLE.

virtual CAPABILITY MGD::DEVICE::v_GetCapabilities (  )  const [protected, virtual]

Return a list of the capabilities of this device.

Derived class should bitwise-OR with result of base method.

Reimplemented in MGD::DEVICE_MEM16, MGD::DEVICE_MEM24, MGD::DEVICE_MEM32, MGD::DEVICE_MEM8G, and MGD::DEVICE_X.

virtual const COLOR_ARRAY* MGD::DEVICE::v_GetColorMap (  )  const [private, virtual]

Get color palette, default implementation returns NULL.

Reimplemented in MGD::DEVICE_RASTER_COLORMAPPED.

virtual PIXEL MGD::DEVICE::v_GetColorPixel ( const COLOR color  )  [private, virtual]

Get closest matching PIXEL to COLOR.

This should NOT take ICM into account. The context will have already translated the color through the ICM transform (if any) before calling this function. This method is not const because some derived classes may update a color map or something in the process.

Reimplemented in MGD::DEVICE_MEM8G, and MGD::DEVICE_RASTER_COLORMAPPED.

virtual COLORSPACE MGD::DEVICE::v_GetColorSpace (  )  const [private, virtual]

Return the "native" COLORSPACE used by the display.

Image operations using this colorspace will be more efficient. Default implementation determines the colorspace from the DeviceInfo

Reimplemented in MGD::DEVICE_MEM8G, MGD::DEVICE_RASTER_COLORMAPPED, and MGD::DEVICE_SIMPLE.

virtual UINT8* MGD::DEVICE::v_GetImagePointer ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer 
) [private, virtual]

Return a pointer to a piece of the image buffer.

This only has to be implemented if HasCapability(CAPABILITY_GetImage) returns true. The CopyRect() routines use it to read the source image. Note that this may return a pointer directly into the screen buffer or a temporary buffer into which it has read the requested data. It's up to the implementation to decide how to handle this.

Reimplemented in MGD::DEVICE_MEM8G, MGD::DEVICE_RASTER_RGB24, MGD::DEVICE_RASTER_RGB32, MGD::DEVICE_RASTER_GRAY8, and MGD::DEVICE_RASTER_TRANS_MASK.

virtual UINT8* MGD::DEVICE::v_GetImagePointerNoRead ( INT32  x,
INT32  y,
INT32  len,
UINT16  FrameBuffer 
) [private, virtual]

If GetImagePointer returns a pointer directly into the frame buffer.

this function does not need to be overridden. If GetImagePointer has to actually read something (say via an X call to the display or reading out of a raster, then this version should just return a temporary buffer big enough to hold a single line.

Reimplemented in MGD::DEVICE_RASTER_RGB24, MGD::DEVICE_RASTER_RGB32, MGD::DEVICE_RASTER_GRAY8, and MGD::DEVICE_RASTER_TRANS_MASK.

virtual bool MGD::DEVICE::v_GetNeedFullImageLine (  )  const [private, virtual]

Determine if full image lines are needed (no tiled output).

Default implementation returns false.

virtual UINT16 MGD::DEVICE::v_GetNumFrameBuffers (  )  const [private, virtual]

Get number of frame buffers.

Default implementation returns 1.

virtual void MGD::DEVICE::v_GetPixelColor ( PIXEL  pixel,
COLOR color 
) const [private, virtual]

Given a pixel value, return the color it represents.

This should NOT take ICM into account. The context will translate the color back through the inverse ICM transform (if any)

Reimplemented in MGD::DEVICE_MEM8G, and MGD::DEVICE_RASTER_COLORMAPPED.

virtual bool MGD::DEVICE::v_SupportsOpacityBlendMode ( MGD::OPACITY_MODE   )  const [private, virtual]
virtual bool MGD::DEVICE::v_UseAntiAliasing (  )  const [private, virtual]

Determine if the device wants low-level drawing code to anti-alias using transparency.

Returns:
true if you want anti-aliased drawing, false if not. Default implementation returns true. Binary devices should override this to return false.
virtual ERRVALUE MGD::DEVICE::v_WriteImageBuffer ( INT32  x,
INT32  y,
INT32  len,
UINT8 buf,
UINT16  FrameBuffer 
) [private, virtual]

Write an image buffer to the display.

If GetImagePointer reutrns a pointer directly into the frame buffer, this method can just return 0. If GetImagePointer has to actually read something, this method is used to write the result back out. Typically used when drawing to a raster

Reimplemented in MGD::DEVICE_RASTER_RGB24, MGD::DEVICE_RASTER_RGB32, MGD::DEVICE_RASTER_GRAY8, and MGD::DEVICE_RASTER_TRANS_MASK.

ERRVALUE MGD::DEVICE::WriteDepthBuffer ( INT32  x,
INT32  y,
INT32  len,
const float *  zbuf,
UINT16  FrameBuffer 
) [protected]

Update the Depth Buffer.

Does nothing unless the Depth Buffer is initialized and is using a raster for depth buffering.

ERRVALUE MGD::DEVICE::WriteImageBuffer ( INT32  x,
INT32  y,
INT32  len,
UINT8 buf,
UINT16  FrameBuffer 
) [inline, protected]

Write an image buffer to the display.

Should be called after using GetImagePointer... if contents are changed.


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

Generated on Sun Oct 7 21:35:10 2012 for TNTsdk 2012 by  doxygen 1.6.1