Base class for general drawing "device". More...
#include <mi32/mgd2.h>

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::CONTEXT * | CreateContext () |
| ERRVALUE | DepthInit (UINT16 FrameBuffer) |
| ERRVALUE | DepthInit () |
| void | DepthRelease (UINT16 FrameBuffer) |
| void | DepthRelease () |
| PIXEL | GetAllPlanesMask () const |
| CAPABILITY | GetCapabilities () const |
| const COLOR_ARRAY * | GetColorMap () const |
| DEPRECATED PIXEL | GetColorPixel (const COLOR &color) |
| COLORSPACE | GetColorSpace () const |
| float | GetDepth (INT32 x, INT32 y, UINT16 FrameBuffer) const |
| const DISPLAYINFO & | GetDeviceInfo () const |
| const LRECT2D & | GetExtents () const |
| INT32 | GetHeight () const |
| const PROFILE & | GetICMDestProfile () const |
| PROFILE::INTENT | GetICMIntent () const |
| int | GetImageBytesPerPixel () const |
| UINT8 * | GetImagePointer (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer) |
| UINT8 * | GetImagePointer (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 DEVICE & | GetNull () |
Protected Member Functions | |
| DEVICE () | |
| float * | GetDepthBuffer (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer, bool UseVirtualWindow) |
| const UINT8 * | GetImagePointerConst (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer) |
| const UINT8 * | GetImagePointerConst (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer, bool UseVirtualWindow) |
| UINT8 * | GetImagePointerNoRead (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer) |
| UINT8 * | GetImagePointerNoRead (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer, bool UseVirtualWindow) |
| const LPOINT2D & | GetRealSize () const |
| const LPOINT2D & | GetVirtualOffset () 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::CONTEXT * | v_CreateContext () |
| virtual ERRVALUE | v_FillSpan (MGD::CONTEXT *gc, INT32 x1, INT32 x2, INT32 y) |
| virtual const COLOR_ARRAY * | v_GetColorMap () const |
| virtual PIXEL | v_GetColorPixel (const COLOR &color) |
| virtual COLORSPACE | v_GetColorSpace () const |
| virtual UINT8 * | v_GetImagePointer (INT32 x, INT32 y, INT32 len, UINT16 FrameBuffer) |
| virtual UINT8 * | v_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) |
Base class for general drawing "device".
| 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...
| 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
| 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.
| 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.
| value | Value to convert | |
| iunits | Input units (SCREENUNIT_...) | |
| ounits | Output units (SCREENUNIT_...) |
| MGD::CONTEXT* MGD::DEVICE::CreateContext | ( | ) |
Create a context for drawing.
Initialize depth buffer for specified frame buffer.
| 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.
| 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.
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
| 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
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.
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.
Given a pixel value, return the color it represents.
| 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.
| 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()
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.
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 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.
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.
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.
| 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.
1.6.1