OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TDC Class Reference

TDC is the root class for GDI DC wrappers. More...

#include <owl/dc.h>

Inheritance diagram for owl::TDC:
owl::TGdiBase owl::TCreatedDC owl::TMetaFileDC owl::TPaintDC owl::TWindowDC owl::TIC owl::TMemoryDC owl::TPrintDC owl::TClientDC owl::TDesktopDC owl::TNCPaintDC owl::TScreenDC owl::TDibDC owl::TPreviewDCBase ocf::TOleClientDC owl::TPrintPreviewDC

Public Types

enum  TFlag {
  Left = 0x0001 , Top = 0x0002 , Right = 0x0004 , Bottom = 0x0008 , TopLeft = Top | Left , TopRight = Top | Right , BottomLeft = Bottom | Left , BottomRight = Bottom | Right , Rect = Top | Left | Bottom | Right , Diagonal = 0x0010 ,
  Fill = 0x0800 , Soft = 0x1000 , Adjust = 0x2000 , Flat = 0x4000 , Mono = 0x8000
}
 Which edge(s) to draw. ctor defaults to all 4. More...
 
enum  TStyle {
  None , Plain , Raised , Recessed , Embossed , Grooved , ButtonUp , ButtonDn , WndRaised , WndRecessed ,
  WellSet , ButtonUp3x , ButtonDn3x
}
 Enumeration describing hilevel border styles. More...
 
enum  TEdge { RaisedOuter = 0x01 , SunkenOuter = 0x02 , RaisedInner = 0x04 , SunkenInner = 0x08 , EdgeOuter = 0x03 , EdgeInner = 0x0C , EdgeRaised = RaisedOuter | RaisedInner , EdgeSunken = SunkenOuter | SunkenInner , EdgeEtched = SunkenOuter | RaisedInner , EdgeBump = RaisedOuter | SunkenInner }
 Enumeration describing the type of edge to be drawn. More...
 

Public Member Functions

 TDC (HDC handle)
 use an existing DC, doesn't auto delete it
 
 TDC ()
 for derived classes only
 
virtual ~TDC ()
 Default dtor does not delete Handle Calls RestoreObjects.
 
 operator HDC () const
 Must assume const is OK.
 
bool IsDC () const
 Validation routine - used mainly for diagnostic purposes.
 
void SetDC (HDC hdc)
 
bool GetDCOrg (TPoint &point) const
 Obtains the final translation origin for this device context and places the value in point.
 
virtual int SaveDC () const
 Saves the current state of this DC on a context stack.
 
virtual bool RestoreDC (int savedDC=-1)
 Restores the given savedDC.
 
virtual int GetDeviceCaps (int index) const
 Used under WIN3.1 or later, GetDeviceCaps returns capability information about this DC.
 
virtual bool ResetDC (const DEVMODE &devMode)
 Updates this DC using data in the given devMode structure.
 
void SelectObject (const TBrush &brush)
 Selects the given GDI brush object into this DC.
 
void SelectObject (const TPen &pen)
 Selects the given GDI pen object into this DC.
 
virtual void SelectObject (const TFont &font)
 Selects the given GDI font object into this DC.
 
void SelectObject (const TPalette &palette, bool forceBackground=false)
 Selects the given GDI palette object into this DC.
 
void SelectObject (const TBitmap &bitmap)
 Selects the given GDI bitmap object into this DC.
 
virtual void SelectStockObject (int index)
 Selects into the DC a predefined stock pen, brush, font, or palette.
 
void RestoreBrush ()
 Restores the original GDI brush object to this DC.
 
void RestorePen ()
 Restores the original GDI pen object to this DC.
 
virtual void RestoreFont ()
 Restores the original GDI font object to this DC.
 
void RestorePalette ()
 Restores the original GDI palette object to this DC.
 
void RestoreBitmap ()
 Restores the original GDI bitmap object into this DC.
 
void RestoreTextBrush ()
 Restores the original GDI text brush object to this DC.
 
void RestoreObjects ()
 Restores all the original GDI objects to this DC.
 
HANDLE GetCurrentObject (uint objectType) const
 Returns a handle to the currently selected object of the given objectType associated with this DC.
 
bool GetBrushOrg (TPoint &point) const
 Places in point the current brush origin of this DC.
 
bool SetBrushOrg (const TPoint &origin, TPoint *oldOrg=0)
 Sets the origin of the currently selected brush of this DC with the given origin value.
 
int EnumObjects (uint objectType, GOBJENUMPROC proc, void *data) const
 Enumerates the pen or brush objects available for this DC.
 
TColor GetNearestColor (const TColor &color) const
 Returns the color nearest to the given Color argument for the current palette of this DC.
 
int RealizePalette ()
 Maps to the system palette the logical palette entries selected into this DC.
 
void UpdateColors ()
 Updates the client area of this DC by matching the current colors in the client area to the system palette on a pixel-by-pixel basis.
 
uint GetSystemPaletteEntries (int start, int num, PALETTEENTRY *entries) const
 Retrieves a range of up to num palette entries, starting at start, from the system palette to the entries array of PALETTEENTRY structures.
 
uint GetSystemPaletteUse () const
 Determines whether this DC has access to the full system palette.
 
int SetSystemPaletteUse (int usage)
 Changes the usage of this DC's system palette.
 
TColor GetBkColor () const
 Returns the current background color of this DC.
 
virtual TColor SetBkColor (const TColor &color)
 Sets the current background color of this DC to the given color value or the nearest available.
 
int GetBkMode () const
 Returns the background mode of this DC, either OPAQUE or TRANSPARENT.
 
int SetBkMode (int mode)
 Sets the background mode to the given mode argument, which can be either OPAQUE or TRANSPARENT.
 
int GetPolyFillMode () const
 Returns the current polygon-filling mode for this DC, either ALTERNATE or WINDING.
 
int SetPolyFillMode (int mode)
 Description Sets the polygon-filling mode for this DC to the given mode value, either ALTERNATE or WINDING.
 
int GetROP2 () const
 Returns the current drawing (raster operation) mode of this DC.
 
int SetROP2 (int mode)
 Sets the current foreground mix mode mode of this DC to the given mode value and returns the previous mode.
 
int GetStretchBltMode () const
 Returns the current stretching mode for this DC: BLACKONWHITE, COLORONCOLOR, or WHITEONBLACK.
 
int SetStretchBltMode (int mode)
 Sets the stretching mode of this DC to the given mode value and returns the previous mode.
 
TColor GetTextColor () const
 Returns the current text color of this DC.
 
virtual TColor SetTextColor (const TColor &color)
 Sets the current text color of this DC to the given color value.
 
bool SetMiterLimit (float newLimit, float *oldLimit=0)
 Sets the limit of miter joins to newLimit and puts the previous value in oldLimit.
 
int GetMapMode () const
 If successful, returns the current window mapping mode of this DC; otherwise, returns 0.
 
virtual int SetMapMode (int mode)
 Sets the current window mapping mode of this DC to mode.
 
bool SetWorldTransform (XFORM &xform)
 Sets a two-dimensional linear transformation, given by the xform structure, between world space and page space for this DC.
 
bool ModifyWorldTransform (XFORM &xform, uint32 mode)
 Changes the current world transformation for this DC using the given xform and mode arguments.
 
bool GetViewportOrg (TPoint &point) const
 The first version sets in the point argument the x- and y-extents (in device-units) of this DC's viewport.
 
TPoint GetViewportOrg () const
 The first version sets in the point argument the x- and y-extents (in device-units) of this DC's viewport.
 
virtual bool SetViewportOrg (const TPoint &origin, TPoint *oldOrg=0)
 Sets this DC's viewport origin to the given origin value, and saves the previous origin in oldOrg.
 
virtual bool OffsetViewportOrg (const TPoint &delta, TPoint *oldOrg=0)
 Modifies this DC's viewport origin relative to the current values.
 
bool GetViewportExt (TSize &extent) const
 The first version retrieves this DC's current viewport's x- and y-extents (in device units) and places the values in extent.
 
TSize GetViewportExt () const
 The first version retrieves this DC's current viewport's x- and y-extents (in device units) and places the values in extent.
 
virtual bool SetViewportExt (const TSize &extent, TSize *oldExtent=0)
 Sets this DC's viewport x- and y-extents to the given extent values.
 
virtual bool ScaleViewportExt (int xNum, int xDenom, int yNum, int yDenom, TSize *oldExtent=0)
 Modifies this DC's viewport extents relative to the current values.
 
bool GetWindowOrg (TPoint &point) const
 Places in point the x- and y-coordinates of the origin of the window associated with this DC.
 
TPoint GetWindowOrg () const
 Places in point the x- and y-coordinates of the origin of the window associated with this DC.
 
bool SetWindowOrg (const TPoint &origin, TPoint *oldOrg=0)
 Sets the origin of the window associated with this DC to the given origin value, and saves the previous origin in oldOrg.
 
bool OffsetWindowOrg (const TPoint &delta, TPoint *oldOrg=0)
 Modifies this DC's window origin relative to the current values.
 
bool GetWindowExt (TSize &extent) const
 Retrieves this DC's window current x- and y-extents (in device units).
 
TSize GetWindowExt () const
 Retrieves this DC's window current x- and y-extents (in device units).
 
virtual bool SetWindowExt (const TSize &extent, TSize *oldExtent=0)
 Sets this DC's window x- and y-extents to the given extent values.
 
virtual bool ScaleWindowExt (int xNum, int xDenom, int yNum, int yDenom, TSize *oldExtent=0)
 Modifies this DC's window extents relative to the current values.
 
bool DPtoLP (TPoint *points, int count=1) const
 Converts each of the count points in the points array from device points to logical points.
 
bool DPtoLP (TRect &rect) const
 
bool LPtoDP (TPoint *points, int count=1) const
 Converts each of the count points in the points array from logical points to device points.
 
bool LPtoDP (TRect &rect) const
 Converts each of the count points in the points array from logical points to device points.
 
int GetClipBox (TRect &rect) const
 Places the current clip box size of this DC in rect.
 
TRect GetClipBox () const
 Places the current clip box size of this DC in rect.
 
int ExcludeClipRect (const TRect &rect)
 Creates a new clipping region for this DC.
 
int ExcludeUpdateRgn (HWND wnd)
 Prevents drawing within invalid areas of a window by excluding an updated region of this DC's window from its clipping region.
 
int IntersectClipRect (const TRect &rect)
 Creates a new clipping region for this DC's window by forming the intersection of the current region with the rectangle specified by rect.
 
int OffsetClipRgn (const TPoint &delta)
 Moves the clipping region of this DC by the x- and y-offsets specified in delta.
 
int SelectClipRgn (const TRegion &region)
 Selects the given region as the current clipping region for this DC.
 
int SelectClipRgn (HRGN r=0)
 Selects the given region as the current clipping region for the device context.
 
int RemoveClipRgn ()
 Removes the device context's clipping region.
 
bool PtVisible (const TPoint &point) const
 Returns true if the given point lies within the clipping region of this DC; otherwise, returns false.
 
bool RectVisible (const TRect &rect) const
 Returns true if any part of the given rectangle, rect, lies within the clipping region of this DC; otherwise, returns false.
 
bool GetBoundsRect (TRect &bounds, uint16 flags) const
 Reports in bounds the current accumulated bounding rectangle of this DC or of the Windows manager, depending on the value of flags.
 
uint SetBoundsRect (TRect &bounds, uint flags)
 Controls the accumulation of bounding rectangle information for this DC.
 
int GetClipRgn (TRegion &region) const
 Retrieves this DC's current clip-region and, if successful, places a copy of it in the region argument.
 
int EnumMetaFile (const TMetaFilePict &metaFile, MFENUMPROC callback, void *data) const
 Enumerates the GDI calls within the given metaFile.
 
bool PlayMetaFile (const TMetaFilePict &metaFile)
 Plays the contents of the given metaFile on this DC.
 
void PlayMetaFileRecord (HANDLETABLE &handletable, METARECORD &metaRecord, int count)
 Plays the metafile record given in metaRecord to this DC by executing the GDI function call contained in that record.
 
int EnumEnhMetaFile (const TEnhMetaFilePict &metaFile, ENHMFENUMPROC callback, void *data, const TRect *rect) const
 Enumerate through the enhanced metafile records.
 
bool PlayEnhMetaFile (const TEnhMetaFilePict &metaFile, const TRect *rect)
 Play the enhanced metafile onto this device context.
 
void PlayEnhMetaFileRecord (HANDLETABLE &handletable, ENHMETARECORD &metaRecord, uint count)
 Play one record from the enhanced metafile onto this DC.
 
bool GetCurrentPosition (TPoint &point) const
 Reports in point the logical coordinates of this DC's current position.
 
bool MoveTo (int x, int y)
 Moves the current position of this DC to the given x- and y-coordinates or to the given point.
 
bool MoveTo (const TPoint &point)
 Moves the current position of this DC to the given x- and y-coordinates or to the given point.
 
bool MoveTo (const TPoint &point, TPoint &oldPoint)
 Moves the current position of this DC to the given x- and y-coordinates or to the given point.
 
bool DrawIcon (int x, int y, const TIcon &icon)
 Draws the given icon on this DC.
 
bool DrawIcon (const TPoint &point, const TIcon &icon)
 Draws the given icon on this DC.
 
bool DrawCursor (int x, int y, const TCursor &cursor)
 
bool DrawCursor (const TPoint &point, const TCursor &cursor)
 
bool DrawIcon (int x, int y, const TIcon &icon, int w, int h, int aniStep=0, HBRUSH bkBr=0, uint flags=DI_NORMAL)
 
bool DrawIcon (const TPoint &point, const TIcon &icon, const TSize &size, int aniStep=0, HBRUSH bkBr=0, uint flags=DI_NORMAL)
 
bool DrawCursor (int x, int y, const TCursor &cursor, int w, int h, int aniStep=0, HBRUSH bkBr=0, uint flags=DI_NORMAL)
 
bool DrawCursor (const TPoint &point, const TCursor &cursor, const TSize &size, int aniStep=0, HBRUSH bkBr=0, uint flags=DI_NORMAL)
 
bool FrameRect (int x1, int y1, int x2, int y2, const TBrush &brush)
 Draws a border on this DC around the given rectangle, rect, using the given brush, brush.
 
bool FrameRect (const TRect &rect, const TBrush &brush)
 Draws a border on this DC around the given rectangle, rect, using the given brush, brush.
 
bool FillRect (int x1, int y1, int x2, int y2, const TBrush &brush)
 Fills the given rectangle on this DC using the specified brush.
 
bool FillRect (const TRect &rect, const TBrush &brush)
 Fills the given rectangle on this DC using the specified brush.
 
bool InvertRect (int x1, int y1, int x2, int y2)
 Inverts the given rectangle, rect, on this DC.
 
bool InvertRect (const TRect &rect)
 Inverts the given rectangle, rect, on this DC.
 
bool DrawFocusRect (int x1, int y1, int x2, int y2)
 Draws the given rectangle on this DC in the style used to indicate focus.
 
bool DrawFocusRect (const TRect &rect)
 Draws the given rectangle on this DC in the style used to indicate focus.
 
bool DrawEdge (const TRect &frame, uint edge, uint flags)
 
void PaintFrame (const TRect &fr, uint flags, const TColor &tlColor, const TColor &brColor)
 
bool TextRect (int x1, int y1, int x2, int y2)
 Fills the given rectangle, clipping any text to the rectangle.
 
bool TextRect (const TRect &rect)
 Fills the given rectangle, clipping any text to the rectangle.
 
bool TextRect (int x1, int y1, int x2, int y2, const TColor &color)
 Fills the given rectangle, clipping any text to the rectangle.
 
bool TextRect (const TRect &rect, const TColor &color)
 Fills the given rectangle, clipping any text to the rectangle.
 
bool FillSolidRect (const TRect &r, const TColor &color)
 
void OWLFastWindowFrame (TBrush &brush, TRect &r, int xWidth, int yWidth, uint32 rop=PATCOPY)
 Draws a frame of the specified size and thickness with the given brush.
 
bool FrameRgn (const TRegion &region, const TBrush &brush, const TSize &brushSize)
 Draws a border on this DC around the given region, region, using the given brush, brush.
 
bool FillRgn (const TRegion &region, const TBrush &brush)
 Fills the given region on this DC using the specified brush.
 
bool InvertRgn (const TRegion &region)
 Inverts the given region, on this DC.
 
bool PaintRgn (const TRegion &region)
 Paints the given rectangle using the currently selected brush for this DC.
 
bool AngleArc (int x, int y, uint32 radius, float startAngle, float sweepAngle)
 Draws a line segment and an arc on this DC using the currently selected pen object.
 
bool AngleArc (const TPoint &center, uint32 radius, float startAngle, float sweepAngle)
 Draws a line segment and an arc on this DC using the currently selected pen object.
 
bool Arc (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
 Draws an elliptical arc on this DC using the currently selected pen object.
 
bool Arc (const TRect &r, const TPoint &start, const TPoint &end)
 Draws an elliptical arc on this DC using the currently selected pen object.
 
bool Chord (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
 Draws and fills a chord (a region bounded by the intersection of an ellipse and a line segment) on this DC using the currently selected pen and brush objects.
 
bool Chord (const TRect &R, const TPoint &Start, const TPoint &End)
 Draws and fills a chord (a region bounded by the intersection of an ellipse and a line segment) on this DC using the currently selected pen and brush objects.
 
bool Pie (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
 Using the currently selected pen and brush objects, draws and fills a pie-shaped wedge by drawing an elliptical arc whose center and end points are joined by lines.
 
bool Pie (const TRect &rect, const TPoint &start, const TPoint &end)
 Using the currently selected pen and brush objects, draws and fills a pie-shaped wedge by drawing an elliptical arc whose center and end points are joined by lines.
 
bool Ellipse (int x1, int y1, int x2, int y2)
 Draws and fills an ellipse on this DC using the currently selected pen and brush objects.
 
bool Ellipse (const TPoint &p1, const TPoint &p2)
 Draws and fills an ellipse on this DC using the currently selected pen and brush objects.
 
bool Ellipse (const TPoint &point, const TSize &size)
 Draws and fills an ellipse on this DC using the currently selected pen and brush objects.
 
bool Ellipse (const TRect &rect)
 Draws and fills an ellipse on this DC using the currently selected pen and brush objects.
 
bool LineTo (int x, int y)
 Draws a line on this DC using the current pen object.
 
bool LineTo (const TPoint &point)
 Draws a line on this DC using the current pen object.
 
bool Polyline (const TPoint *points, int count)
 Using the current pen object, draws on this DC a count of line segments (there must be at least 2).
 
bool Polygon (const TPoint *points, int count)
 
bool PolyPolygon (const TPoint *points, const int *PolyCounts, int count)
 Using the current pen and polygon-filling mode, draws and fills on this DC the number of closed polygons indicated in count (which must be >= 2).
 
bool PolyPolyline (const TPoint *points, const int *PolyCounts, int count)
 Using the currently selected pen object, draws on this DC the number of polylines (connected line segments) indicated in count.
 
bool PolyBezier (const TPoint *points, int count)
 Draws one or more connected cubic Bezier splines through the points specified in the points array using the currently selected pen object.
 
bool PolyBezierTo (const TPoint *points, int count)
 Draws one or more connected cubic Beziers splines through the points specified in the points array using the currently selected pen object.
 
bool PolyDraw (const TPoint *points, uint8 *types, int count)
 Using the currently selected pen object, draws one or more possibly disjoint sets of line segments or Bezier splines or both on this DC.
 
bool PolylineTo (const TPoint *points, int count)
 Draws one or more connected line segments on this DC using the currently selected pen object.
 
bool Rectangle (int x1, int y1, int x2, int y2)
 Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.
 
bool Rectangle (const TPoint &p1, const TPoint &p2)
 Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.
 
bool Rectangle (const TPoint &point, const TSize &s)
 Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.
 
bool Rectangle (const TRect &rect)
 Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.
 
bool RoundRect (int x1, int y1, int x2, int y2, int x3, int y3)
 Draws and fills a rounded rectangle of the given size on this DC with the current pen and brush objects.
 
bool RoundRect (const TPoint &p1, const TPoint &p2, const TPoint &rad)
 Draws and fills a rounded rectangle of the given size on this DC with the current pen and brush objects.
 
bool RoundRect (const TPoint &p, const TSize &s, const TPoint &rad)
 Draws and fills a rounded rectangle of the given size on this DC with the current pen and brush objects.
 
bool RoundRect (const TRect &rect, const TPoint &rad)
 Draws and fills a rounded rectangle of the given size on this DC with the current pen and brush objects.
 
TColor GetPixel (int x, int y) const
 Returns the color of the pixel at the given location.
 
TColor GetPixel (const TPoint &point) const
 Returns the color of the pixel at the given location.
 
TColor SetPixel (int x, int y, const TColor &color)
 Sets the color of the pixel at the given location to the given color and returns the pixel's previous color.
 
TColor SetPixel (const TPoint &p, const TColor &color)
 Sets the color of the pixel at the given location to the given color and returns the pixel's previous color.
 
bool BitBlt (int dstX, int dstY, int w, int h, const TDC &srcDC, int srcX, int srcY, uint32 rop=SRCCOPY)
 Performs a bit-block transfer from srcDc (the given source DC) to this DC (the destination DC).
 
bool BitBlt (const TRect &dst, const TDC &srcDC, const TPoint &src, uint32 rop=SRCCOPY)
 Performs a bit-block transfer from srcDc (the given source DC) to this DC (the destination DC).
 
bool PatBlt (int x, int y, int w, int h, uint32 rop=PATCOPY)
 
bool PatBlt (const TRect &dst, uint32 rop=PATCOPY)
 
bool ScrollDC (int x, int y, const TRect &scroll, const TRect &clip, TRegion &updateRgn, TRect &updateRect)
 Scrolls a rectangle of bits horizontally by x (or delta.x in the second version) device-units, and vertically by y (or delta.y) device-units on this DC.
 
bool ScrollDC (const TPoint &delta, const TRect &scroll, const TRect &clip, TRegion &updateRgn, TRect &updateRect)
 Scrolls a rectangle of bits horizontally by x (or delta.x in the second version) device-units, and vertically by y (or delta.y) device-units on this DC.
 
bool StretchBlt (int dstX, int dstY, int dstW, int dstH, const TDC &srcDC, int srcX, int srcY, int srcW, int srcH, uint32 rop=SRCCOPY)
 Copies a bitmap from the source DC to a destination rectangle on this DC specified either by upper left-corner coordinates (dstX, dstY), width dstW, and height dstH, or (in the second version) by a TRect object, dst.
 
bool StretchBlt (const TRect &dst, const TDC &srcDC, const TRect &src, uint32 rop=SRCCOPY)
 Copies a bitmap from the source DC to a destination rectangle on this DC specified either by upper left-corner coordinates (dstX, dstY), width dstW, and height dstH, or (in the second version) by a TRect object, dst.
 
bool MaskBlt (const TRect &dst, const TDC &srcDC, const TPoint &src, const TBitmap &maskBm, const TPoint &maskPos, uint32 rop=SRCCOPY)
 Copies a bitmap from the given source DC to this DC.
 
bool PlgBlt (const TPoint *points, const TDC &srcDC, const TRect &src, const TBitmap &maskBm, const TPoint &maskPos)
 Performs a bit-block transfer from the given source DC to this DC.
 
bool TransparentBlt (const TRect &dst, const TDC &srcDC, const TRect &src, const TColor &transparent)
 Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.
 
int GetDIBits (const TBitmap &bitmap, uint startScan, uint numScans, void *bits, const BITMAPINFO &info, uint16 usage)
 The first version retrieves some or all of the bits from the given bitmap on this DC and copies them to the bits buffer using the DIB (device-independent bitmap) format specified by the BITMAPINFO argument, info.
 
int GetDIBits (const TBitmap &bitmap, TDib &dib)
 The first version retrieves some or all of the bits from the given bitmap on this DC and copies them to the bits buffer using the DIB (device-independent bitmap) format specified by the BITMAPINFO argument, info.
 
int SetDIBits (TBitmap &bitmap, uint startScan, uint numScans, const void *bits, const BITMAPINFO &Info, uint16 usage)
 The first version sets the pixels in bitmap (the given destination bitmap on this DC) from the source DIB (device-independent bitmap) color data found in the byte array bits and the BITMAPINFO structure, Info.
 
int SetDIBits (TBitmap &bitmap, const TDib &dib)
 The first version sets the pixels in bitmap (the given destination bitmap on this DC) from the source DIB (device-independent bitmap) color data found in the byte array bits and the BITMAPINFO structure, Info.
 
int SetDIBitsToDevice (const TRect &dst, const TPoint &src, uint startScan, uint numScans, const void *bits, const BITMAPINFO &bitsInfo, uint16 usage)
 The first version sets the pixels in dst (the given destination rectangle on this DC) from the source DIB (device-independent bitmap) color data found in the byte array bits and the BITMAPINFO structure, bitsInfo.
 
int SetDIBitsToDevice (const TRect &dst, const TPoint &src, const TDib &dib)
 The first version sets the pixels in dst (the given destination rectangle on this DC) from the source DIB (device-independent bitmap) color data found in the byte array bits and the BITMAPINFO structure, bitsInfo.
 
int StretchDIBits (const TRect &dst, const TRect &src, const void *bits, const BITMAPINFO &bitsInfo, uint16 usage, uint32 rop=SRCCOPY)
 Copies the color data from src, the source rectangle of pixels in the given DIB (device-independent bitmap) on this DC, to dst, the destination rectangle.
 
int StretchDIBits (const TRect &dst, const TRect &src, const TDib &dib, uint32 rop=SRCCOPY)
 Copies the color data from src, the source rectangle of pixels in the given DIB (device-independent bitmap) on this DC, to dst, the destination rectangle.
 
HBITMAP CreateDIBSection (const BITMAPINFO &info, uint usage, void **bits, HANDLE section=0, uint32 offset=0)
 Create a fast DIB under Win32.
 
bool FloodFill (const TPoint &point, const TColor &color)
 Fills an area on this DC starting at point and using the currently selected brush object.
 
bool ExtFloodFill (const TPoint &point, const TColor &color, uint16 fillType)
 Fills an area on this DC starting at point and using the currently selected brush object.
 
virtual bool TextOut (int x, int y, const tstring &str, int count=-1)
 Draws up to count characters of the given null-terminated string in the current font on this DC.
 
bool TextOut (const TPoint &p, const tstring &str, int count=-1)
 Draws up to count characters of the given null-terminated string in the current font on this DC.
 
virtual bool ExtTextOut (int x, int y, uint16 options, const TRect *r, const tstring &str, int count=-1, const int *dx=0)
 Draws up to count characters of the given null-terminated string in the current font on this DC.
 
bool ExtTextOut (const TPoint &p, uint16 options, const TRect *r, const tstring &str, int count=-1, const int *dx=0)
 Draws up to count characters of the given null-terminated string in the current font on this DC.
 
virtual bool TabbedTextOut (const TPoint &p, const tstring &str, int count, int numPositions, const int *positions, int tabOrigin, TSize &size)
 Draws up to count characters of the given null-terminated string in the current font on this DC.
 
bool TabbedTextOut (const TPoint &p, const tstring &str, int count, int numPositions, const int *positions, int tabOrigin)
 Draws up to count characters of the given null-terminated string in the current font on this DC.
 
int DrawText (const tstring &str, int count, const TRect &, uint16 format=0)
 Overload for const TRect& For obvious reasons, this overload does not support the DT_CALCRECT format flag.
 
virtual int DrawText (const tstring &str, int count, TRect &, uint16 format=0)
 Formats and draws in the given rectangle, r, up to count characters of the null-terminated string using the current font for this DC.
 
virtual int DrawTextEx (TCHAR *str, int count, TRect *=0, uint format=0, LPDRAWTEXTPARAMS=0)
 Formats and draws in the given rectangle, r, up to count characters of the null-terminated string using the current font for this DC.
 
bool DrawFrameControl (TRect lpRect, UINT nType, UINT nState)
 
virtual bool GrayString (const TBrush &brush, GRAYSTRINGPROC outputFunc, const tstring &str, int count, const TRect &r)
 Draws in the given rectangle (r) up to count characters of gray text from string using the given brush, brush, and the current font for this DC.
 
bool GetTextExtent (const tstring &str, int stringLen, TSize &size) const
 Computes the extent (width and height) in logical units of the text line consisting of stringLen characters from the null-terminated string.
 
TSize GetTextExtent (const tstring &str, int stringLen) const
 Computes the extent (width and height) in logical units of the text line consisting of stringLen characters from the null-terminated string.
 
bool GetTabbedTextExtent (const tstring &str, int stringLen, int numPositions, const int *positions, TSize &size) const
 Computes the extent (width and height) in logical units of the text line consisting of stringLen characters from the null-terminated string.
 
TSize GetTabbedTextExtent (const tstring &str, int stringLen, int numPositions, const int *positions) const
 Computes the extent (width and height) in logical units of the text line consisting of stringLen characters from the null-terminated string.
 
uint GetTextAlign () const
 If successful, returns the current text-alignment flags for this DC; otherwise, returns the value GDI_ERROR.
 
uint SetTextAlign (uint flags)
 Sets the text-alignment flags for this DC.
 
int GetTextCharacterExtra () const
 If successful, returns the current intercharacter spacing, in logical units, for this DC; otherwise, returns INVALID_WIDTH.
 
int SetTextCharacterExtra (int extra)
 If successful, sets the current intercharacter spacing to extra, in logical units, for this DC, and returns the previous intercharacter spacing.
 
bool SetTextJustification (int breakExtra, int breakCount)
 When text strings are displayed using TDC::TextOut and TDC::ExtTextOut, sets the number of logical units specified in breakExtra as the total extra space to be added to the number of break characters specified in breakCount.
 
int GetTextFaceLength () const
 Retrieves the length of the typeface name for the current font on this DC.
 
int GetTextFace (int count, TCHAR *facename) const
 Retrieves the typeface name for the current font on this DC.
 
tstring GetTextFace () const
 
bool GetTextMetrics (TEXTMETRIC &metrics) const
 Fills the metrics structure with metrics data for the current font on this DC.
 
TEXTMETRIC GetTextMetrics () const
 Functional style overload.
 
uint32 GetGlyphOutline (uint chr, uint format, GLYPHMETRICS &gm, uint32 buffSize, void *buffer, const MAT2 &mat2)
 Retrieves TrueType metric and other data for the given character, chr, on this DC and places it in gm and buffer.
 
int GetKerningPairs (int pairs, KERNINGPAIR *krnPair)
 Retrieves kerning pairs for the current font of this DC up to the number specified in pairs and copies them into the krnPair array of KERNINGPAIR structures.
 
uint GetOutlineTextMetrics (uint data, OUTLINETEXTMETRIC &otm)
 Retrieves metric information for TrueType fonts on this DC and copies it to the given array of OUTLINETEXTMETRIC structures, otm.
 
bool GetCharWidth (uint firstChar, uint lastChar, int *buffer)
 Retrieves the widths in logical units for a consecutive sequence of characters in the current font for this DC.
 
uint32 SetMapperFlags (uint32 flag)
 Alters the algorithm used by the font mapper when mapping logical fonts to physical fonts on this DC.
 
bool GetAspectRatioFilter (TSize &size) const
 Retrieves the setting of the current aspect-ratio filter for this DC.
 
int EnumFonts (LPCTSTR faceName, OLDFONTENUMPROC callback, void *data) const
 Enumerates the fonts available on this DC for the given faceName.
 
int EnumFonts (const tstring &facename, OLDFONTENUMPROC callback, void *data) const
 
int EnumFontFamilies (LPCTSTR family, FONTENUMPROC proc, void *data) const
 Enumerates the fonts available to this DC in the font family specified by family.
 
int EnumFontFamilies (const tstring &family, FONTENUMPROC proc, void *data) const
 
uint32 GetFontData (uint32 table, uint32 offset, void *buffer, long data)
 Retrieves font-metric information from a scalable TrueType font file (specified by table and starting at offset into this table) and places it in the given buffer.
 
bool GetCharABCWidths (uint firstChar, uint lastChar, ABC *abc)
 Retrieves the widths of consecutive characters in the range firstChar to lastChar from the current TrueType font of this DC.
 
bool BeginPath ()
 Opens a new path bracket for this DC and discards any previous paths from this DC.
 
bool CloseFigure ()
 Closes an open figure in this DC's open path bracket by drawing a line from the current position to the first point of the figure (usually the point specified by the most recent TDC::MoveTo call), and connecting the lines using the current join style for this DC.
 
bool EndPath ()
 Closes the path bracket and selects the path it defines into this DC.
 
bool FlattenPath ()
 Transforms any curves in the currently selected path of this DC.
 
bool WidenPath ()
 Redefines the current, closed path on this DC as the area that would be painted if the path were stroked with this DC's current pen.
 
bool FillPath ()
 Closes any open figures in the current path of this DC and fills the path's interior using the current brush and polygon fill mode.
 
bool StrokePath ()
 Renders the current, closed path on this DC and uses the DC's current pen.
 
bool StrokeAndFillPath ()
 Closes any open figures in the current path of this DC, strokes the outline of the path using the current pen, and fills its interior using the current brush and polygon fill mode.
 
bool SelectClipPath (int mode)
 Selects the current path on this DC as a clipping region, combining any existing clipping region using the specified mode as shown in the following table:
 
HRGN PathToRegion ()
 If successful, returns a region created from the closed path in this DC; otherwise, returns 0.
 
virtual HDC GetAttributeHDC () const
 Returns the attributes of the DC object.
 
HDC GetHDC () const
 Return the handle of the device context.
 

Protected Member Functions

 TDC (HDC handle, TAutoDelete autoDelete)
 Constructor for use by derived classes only.
 
void Init ()
 Sets OrgBrush, OrgPen, OrgFont, OrgBitmap, and OrgPalette to 0, and sets ShouldDelete to true.
 
void CheckValid (uint resId=IDS_GDIFAILURE)
 
- Protected Member Functions inherited from owl::TGdiBase
void CheckValid (uint resId=IDS_GDIFAILURE)
 
 TGdiBase ()
 This default constructor sets Handle to 0 and ShouldDelete to true.
 
 TGdiBase (HANDLE handle, TAutoDelete autoDelete=NoAutoDelete)
 Initializes members to given values, and validates the handle.
 

Protected Attributes

HANDLE Handle
 < make this function available to derivatives
 
bool ShouldDelete
 < The handle of this DC. Uses the base class's handle (TGdiBase::Handle.)
 
- Protected Attributes inherited from owl::TGdiBase
HANDLE Handle
 GDI handle of this object.
 
bool ShouldDelete
 Should object delete GDI handle in dtor?
 

Additional Inherited Members

- Static Protected Member Functions inherited from owl::TGdiBase
static void _CheckValid (HANDLE handle, uint resId=IDS_GDIFAILURE)
 

Detailed Description

TDC is the root class for GDI DC wrappers.

Each TDC object inherits a Handle from TGdiBase and casts that Handle to an HDC using the HDC operator. Win API functions that take an HDC argument can therefore be called by a corresponding TDC member function without this explicit handle argument.

DC objects can be created directly with TDC constructors, or via the constructors of specialized subclasses (such as TWindowDC, TMemoryDC, TMetaFileDC, TDibDC, and TPrintDC) to get specific behavior. DC objects can be constructed with an already existing and borrowed HDC handle or from scratch by supplying device driver information, as with ::CreateDC. The class TCreateDC takes over much of the creation and deletion work from TDC.

TDC has four handles as protected data members: OrgBrush, OrgPen, OrgFont, and OrgPalette. These handles keep track of the stock GDI objects selected into each DC. As new GDI objects are selected with SelectObject or SelectPalette, these data members store the previous objects. The latter can be restored individually with RestoreBrush, RestorePen, and so on, or they can all be restored with RestoreObjects. When a TDC object is destroyed (via ~TDCTDC), all the originally selected objects are restored. The data member TDC::ShouldDelete controls the deletion of the TDC object.

Definition at line 64 of file dc.h.

Member Enumeration Documentation

◆ TEdge

Enumeration describing the type of edge to be drawn.

Enumerator
RaisedOuter 

Raised outer edge only.

SunkenOuter 

Sunken outer edge only.

RaisedInner 

Raised inner edge only.

SunkenInner 

Sunken inner edge only.

EdgeOuter 

Mask for outer edge bits.

EdgeInner 

Mask for inner edge bits.

EdgeRaised 

Both inner & outer raised.

EdgeSunken 

Both inner & outer sunken.

EdgeEtched 

Outer sunken, inner raised.

EdgeBump 

Outer raised, inner sunken.

Definition at line 107 of file dc.h.

◆ TFlag

Which edge(s) to draw. ctor defaults to all 4.

Enumerator
Left 
Top 
Right 
Bottom 
TopLeft 
TopRight 
BottomLeft 
BottomRight 
Rect 
Diagonal 

Draw diagonal edge (NotAvail intrnl)

Fill 

Fill in middle.

Soft 

Soft edge look for buttons.

Adjust 

Adjust passed rect to client (Not Applicable)

Flat 

Flat instead of 3d for use in non-3d windows.

Mono 

Monochrome.

Definition at line 67 of file dc.h.

◆ TStyle

Enumeration describing hilevel border styles.

Enumerator
None 

No border painted at all.

Plain 

Plain plain window frame.

Raised 

Status field style raised.

Recessed 

Status field style recessed.

Embossed 

Grouping raised emboss bead.

Grooved 

Grouping groove.

ButtonUp 

Button in up position.

ButtonDn 

Button in down position.

WndRaised 

Raised window outer+inner edge.

WndRecessed 

Input field & other window recessed.

WellSet 

Well option set (auto grows + 1) // !CQ W4 cant do.

ButtonUp3x 

Button in up position, Win 3.x style.

ButtonDn3x 

Button in down position, Win 3.x style.

Definition at line 88 of file dc.h.

Constructor & Destructor Documentation

◆ TDC() [1/3]

owl::TDC::TDC ( HDC handle)

use an existing DC, doesn't auto delete it

Creates a DC object "borrowing" the handle of an existing DC.

The Handle data member is set to the given handle argument.

Definition at line 35 of file dc.cpp.

References _T, Init(), OWL_CDLEVEL, and TRACEX.

◆ TDC() [2/3]

owl::TDC::TDC ( )

for derived classes only

Constructor for use by derived classes only.

Definition at line 49 of file dc.cpp.

References _T, Init(), OWL_CDLEVEL, and TRACEX.

◆ ~TDC()

owl::TDC::~TDC ( )
virtual

Default dtor does not delete Handle Calls RestoreObjects.

Definition at line 71 of file dc.cpp.

References _T, OWL_CDLEVEL, RestoreObjects(), and TRACEX.

◆ TDC() [3/3]

owl::TDC::TDC ( HDC handle,
TAutoDelete autoDelete )
protected

Constructor for use by derived classes only.

Definition at line 58 of file dc.cpp.

References _T, Init(), OWL_CDLEVEL, and TRACEX.

Member Function Documentation

◆ AngleArc() [1/2]

bool owl::TDC::AngleArc ( const TPoint & Center,
uint32 radius,
float StartAngle,
float SweepAngle )
inline

Draws a line segment and an arc on this DC using the currently selected pen object.

The line is drawn from the current position to the beginning of the arc. The arc is that part of the circle (with the center at logical coordinates (x, y) and positive radius, radius) starting at startAngle and ending at (startAngle + sweepAngle). Both angles are measured in degrees, counterclockwise from the x-axis (the default arc direction). The arc might appear to be elliptical, depending on the current transformation and mapping mode. AngleArc returns true if the figure is drawn successfully; otherwise, it returns false. If successful, the current position is moved to the end point of the arc.

Definition at line 2003 of file dc.h.

References GetHDC().

◆ AngleArc() [2/2]

bool owl::TDC::AngleArc ( int x,
int y,
uint32 radius,
float startAngle,
float sweepAngle )
inline

Draws a line segment and an arc on this DC using the currently selected pen object.

The line is drawn from the current position to the beginning of the arc. The arc is that part of the circle (with the center at logical coordinates (x, y) and positive radius, radius) starting at startAngle and ending at (startAngle + sweepAngle). Both angles are measured in degrees, counterclockwise from the x-axis (the default arc direction). The arc might appear to be elliptical, depending on the current transformation and mapping mode. AngleArc returns true if the figure is drawn successfully; otherwise, it returns false. If successful, the current position is moved to the end point of the arc.

Definition at line 1986 of file dc.h.

References GetHDC().

◆ Arc() [1/2]

bool owl::TDC::Arc ( const TRect & rect,
const TPoint & start,
const TPoint & end )
inline

Draws an elliptical arc on this DC using the currently selected pen object.

The center of the arc is the center of the bounding rectangle, specified either by (x1, y1)/(x2, y2) or by the rectangle r. The starting/ending points of the arc are specified either by (x3, y3)/(x4, y4) or by the points start and end. All points are specified in logical coordinates. Arc returns true if the arc is drawn successfully; otherwise, it returns false. The current position is neither used nor altered by this call. The drawing direction default is counterclockwise.

Definition at line 2033 of file dc.h.

References GetHDC().

◆ Arc() [2/2]

bool owl::TDC::Arc ( int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4 )
inline

Draws an elliptical arc on this DC using the currently selected pen object.

The center of the arc is the center of the bounding rectangle, specified either by (x1, y1)/(x2, y2) or by the rectangle r. The starting/ending points of the arc are specified either by (x3, y3)/(x4, y4) or by the points start and end. All points are specified in logical coordinates. Arc returns true if the arc is drawn successfully; otherwise, it returns false. The current position is neither used nor altered by this call. The drawing direction default is counterclockwise.

Definition at line 2018 of file dc.h.

References GetHDC().

◆ BeginPath()

bool owl::TDC::BeginPath ( )
inline

Opens a new path bracket for this DC and discards any previous paths from this DC.

Once a path bracket is open, an application can start calling draw functions on this DC to define the points that lie within that path. The draw functions that define points in a path are the following TDC members: AngleArc, Arc, Chord, CloseFigure, Ellipse, ExtTextOut, LineTo, MoveToEx, Pie, PolyBezier, PolyBezierTo, PolyDraw, Polygon, Polyline, PolylineTo, PolyPolygon, PolyPolyline, Rectangle, RoundRect, and TextOut. A path bracket can be closed by calling TDC::EndPath. BeginPath returns true if the call is successful; otherwise, it returns false.

Definition at line 3349 of file dc.h.

References GetHDC().

◆ BitBlt() [1/2]

bool owl::TDC::BitBlt ( const TRect & dst,
const TDC & srcDC,
const TPoint & src,
uint32 rop = SRCCOPY )
inline

Performs a bit-block transfer from srcDc (the given source DC) to this DC (the destination DC).

Color bits are copied from a source rectangle to a destination rectangle. The location of the source rectangle is specified either by its upper left-corner logical coordinates (srcX, srcY), or by the TPoint object, src. The destination rectangle can be specified either by its upper left-corner logical coordinates (dstX, dstY), width w, and height h, or by the TRect object, dst. The destination rectangle has the same width and height as the source. The rop argument specifies the raster operation used to combine the color data for each pixel. See TDC::MaskBlt for a detailed list of rop codes. When recording an enhanced metafile, an error occurs if the source DC identifies the enhanced metafile DC.

Definition at line 2440 of file dc.h.

References GetHDC().

◆ BitBlt() [2/2]

bool owl::TDC::BitBlt ( int dstX,
int dstY,
int w,
int h,
const TDC & srcDC,
int srcX,
int srcY,
uint32 rop = SRCCOPY )
inline

Performs a bit-block transfer from srcDc (the given source DC) to this DC (the destination DC).

Color bits are copied from a source rectangle to a destination rectangle. The location of the source rectangle is specified either by its upper left-corner logical coordinates (srcX, srcY), or by the TPoint object, src. The destination rectangle can be specified either by its upper left-corner logical coordinates (dstX, dstY), width w, and height h, or by the TRect object, dst. The destination rectangle has the same width and height as the source. The rop argument specifies the raster operation used to combine the color data for each pixel. See TDC::MaskBlt for a detailed list of rop codes. When recording an enhanced metafile, an error occurs if the source DC identifies the enhanced metafile DC.

Definition at line 2421 of file dc.h.

References GetHDC().

◆ CheckValid()

void owl::TGdiBase::CheckValid ( uint resId = IDS_GDIFAILURE)
protected

Definition at line 86 of file gdibase.cpp.

◆ Chord() [1/2]

bool owl::TDC::Chord ( const TRect & rect,
const TPoint & start,
const TPoint & end )
inline

Draws and fills a chord (a region bounded by the intersection of an ellipse and a line segment) on this DC using the currently selected pen and brush objects.

The ellipse is specified by a bounding rectangle given either by (x1, y1)/(x2, y2) or by the rectangle R. The starting/ending points of the chord are specified either by (x3, y3)/(x4, y4) or by the points Start and End. Chord returns true if the call is successful; otherwise, it returns false. The current position is neither used nor altered by this call.

Definition at line 2061 of file dc.h.

References GetHDC().

◆ Chord() [2/2]

bool owl::TDC::Chord ( int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4 )
inline

Draws and fills a chord (a region bounded by the intersection of an ellipse and a line segment) on this DC using the currently selected pen and brush objects.

The ellipse is specified by a bounding rectangle given either by (x1, y1)/(x2, y2) or by the rectangle R. The starting/ending points of the chord are specified either by (x3, y3)/(x4, y4) or by the points Start and End. Chord returns true if the call is successful; otherwise, it returns false. The current position is neither used nor altered by this call.

Definition at line 2047 of file dc.h.

References GetHDC().

◆ CloseFigure()

bool owl::TDC::CloseFigure ( )
inline

Closes an open figure in this DC's open path bracket by drawing a line from the current position to the first point of the figure (usually the point specified by the most recent TDC::MoveTo call), and connecting the lines using the current join style for this DC.

If you close a figure with TDC::LineTo instead of with CloseFigure, end caps (instead of a join) are used to create the corner. The call fails if there is no open path bracket on this DC. Any line or curve added to the path after a CloseFigure call starts a new figure. A figure in a path remains open until it is explicitly closed with CloseFigure even if its current position and start point happen to coincide. CloseFigure returns true if the call is successful; otherwise, it returns false.

Definition at line 3366 of file dc.h.

References GetHDC().

◆ CreateDIBSection()

HBITMAP owl::TDC::CreateDIBSection ( const BITMAPINFO & info,
uint usage,
void ** bits,
HANDLE section = 0,
uint32 offset = 0 )
inline

Create a fast DIB under Win32.

Definition at line 2843 of file dc.h.

References GetHDC().

◆ DPtoLP() [1/2]

bool owl::TDC::DPtoLP ( TPoint * points,
int count = 1 ) const
inline

Converts each of the count points in the points array from device points to logical points.

The conversion depends on this DC's current mapping mode and the settings of its window and viewport origins and extents. DPtoLP returns true if the call is successful; otherwise, it returns false.

Definition at line 1406 of file dc.h.

References GetAttributeHDC().

◆ DPtoLP() [2/2]

bool owl::TDC::DPtoLP ( TRect & rect) const
inline

Definition at line 1412 of file dc.h.

References GetAttributeHDC().

◆ DrawCursor() [1/4]

bool owl::TDC::DrawCursor ( const TPoint & point,
const TCursor & cursor )
inline

Definition at line 1743 of file dc.h.

References GetHDC().

◆ DrawCursor() [2/4]

bool owl::TDC::DrawCursor ( const TPoint & point,
const TCursor & cursor,
const TSize & size,
int aniStep = 0,
HBRUSH bkBr = 0,
uint flags = DI_NORMAL )
inline

Definition at line 1769 of file dc.h.

References GetHDC().

◆ DrawCursor() [3/4]

bool owl::TDC::DrawCursor ( int x,
int y,
const TCursor & cursor )
inline

Definition at line 1737 of file dc.h.

References GetHDC().

◆ DrawCursor() [4/4]

bool owl::TDC::DrawCursor ( int x,
int y,
const TCursor & cursor,
int w,
int h,
int aniStep = 0,
HBRUSH bkBr = 0,
uint flags = DI_NORMAL )
inline

Definition at line 1762 of file dc.h.

References GetHDC().

◆ DrawEdge()

◆ DrawFocusRect() [1/2]

bool owl::TDC::DrawFocusRect ( const TRect & rect)
inline

Draws the given rectangle on this DC in the style used to indicate focus.

Calling the function a second time with the same rect argument will remove the rectangle from the display. A rectangle drawn with DrawFocusRect cannot be scrolled. DrawFocusRect returns true if the call is successful; otherwise, it returns false.

Definition at line 1868 of file dc.h.

References DrawFocusRect(), and GetHDC().

◆ DrawFocusRect() [2/2]

bool owl::TDC::DrawFocusRect ( int x1,
int y1,
int x2,
int y2 )
inline

Draws the given rectangle on this DC in the style used to indicate focus.

Calling the function a second time with the same rect argument will remove the rectangle from the display. A rectangle drawn with DrawFocusRect cannot be scrolled. DrawFocusRect returns true if the call is successful; otherwise, it returns false.

Definition at line 1854 of file dc.h.

References DrawFocusRect(), and GetHDC().

◆ DrawFrameControl()

bool owl::TDC::DrawFrameControl ( TRect lpRect,
UINT nType,
UINT nState )

Definition at line 797 of file dc.cpp.

References Handle.

◆ DrawIcon() [1/4]

bool owl::TDC::DrawIcon ( const TPoint & point,
const TIcon & icon )
inline

Draws the given icon on this DC.

The upper left corner of the drawn icon can be specified by x- and y-coordinates or by the point argument. DrawIcon returns true if the call is successful; otherwise, it returns false.

Definition at line 1731 of file dc.h.

References GetHDC().

◆ DrawIcon() [2/4]

bool owl::TDC::DrawIcon ( const TPoint & point,
const TIcon & icon,
const TSize & size,
int aniStep = 0,
HBRUSH bkBr = 0,
uint flags = DI_NORMAL )
inline

Definition at line 1755 of file dc.h.

References GetHDC().

◆ DrawIcon() [3/4]

bool owl::TDC::DrawIcon ( int x,
int y,
const TIcon & icon )
inline

Draws the given icon on this DC.

The upper left corner of the drawn icon can be specified by x- and y-coordinates or by the point argument. DrawIcon returns true if the call is successful; otherwise, it returns false.

Definition at line 1720 of file dc.h.

References GetHDC().

◆ DrawIcon() [4/4]

bool owl::TDC::DrawIcon ( int x,
int y,
const TIcon & icon,
int w,
int h,
int aniStep = 0,
HBRUSH bkBr = 0,
uint flags = DI_NORMAL )
inline

Definition at line 1749 of file dc.h.

References GetHDC().

◆ DrawText() [1/2]

int owl::TDC::DrawText ( const tstring & str,
int count,
const TRect & rect,
uint16 format = 0 )

Overload for const TRect& For obvious reasons, this overload does not support the DT_CALCRECT format flag.

If the given format contains the DT_CALCRECT flag, the function returns 0. Otherwise, see the documentation for the overload for non-const TRect.

Definition at line 653 of file dc.cpp.

References DrawText().

◆ DrawText() [2/2]

int owl::TDC::DrawText ( const tstring & str,
int count,
TRect & rect,
uint16 format = 0 )
virtual

Formats and draws in the given rectangle, r, up to count characters of the null-terminated string using the current font for this DC.

If count is -1, the whole string is written. The rectangle must be specified in logical units. Formatting is controlled with the format argument, which can be various combinations of the following values:

  • DT_BOTTOM Specifies bottom-justified text. This value must be combined (bitwise OR'd) with DT_SINGLELINE.
  • DT_CALCRECT Determines the width and height of the rectangle. If there are multiple lines of text, DrawText uses the width of r (the rectangle argument) and extends the base of the rectangle to bound the last line of text. If there is only one line of text, DrawText uses a modified value for the right side of r so that it bounds the last character in the line. In both cases, DrawText returns the height of the formatted text but does not draw the text.
  • DT_CENTER Centers text horizontally.
  • DT_EXPANDTABS Expands tab characters. The default number of characters per tab is eight.
  • DT_EXTERNALLEADING Includes the font external leading in line height. Normally, external leading is not included in the height of a line of text.
  • DT_LEFT Aligns text flush-left.
  • DT_NOCLIP Draws without clipping. DrawText is somewhat faster when DT_NOCLIP is used.
  • DT_NOPREFIX Turns off processing of prefix characters. Normally, DrawText interprets the prefix character & as a directive to underscore the character that follows, and the prefix characters && as a directive to print a single &. By specifying DT_NOPREFIX, this processing is turned off.
  • DT_RIGHT Aligns text flush-right.
  • DT_SINGLELINE Specifies single line only. Carriage returns and linefeeds do not break the line.
  • DT_TABSTOP Sets tab stops. Bits 15-8 (the high-order byte of the low-order word) of the format argument are the number of characters for each tab. The default number of characters per tab is eight.
  • DT_TOP Specifies top-justified text (single line only).
  • DT_VCENTER Specifies vertically centered text (single line only).
  • DT_WORDBREAK Specifies word breaking. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by r. A carriage return/line sequence will also break the line.
Note
Note that the DT_CALCRECT, DT_EXTERNALLEADING, DT_INTERNAL, DT_NOCLIP, and DT_NOPREFIX values cannot be used with the DT_TABSTOP value. DrawText uses this DC's currently selected font, text color, and background color to draw the text. Unless the DT_NOCLIP format is used, DrawText clips the text so that it does not appear outside the given rectangle. All formatting is assumed to have multiple lines unless the DT_SINGLELINE format is given. If the selected font is too large for the specified rectangle, DrawText does not attempt to substitute a smaller font. If the function succeeds, the return value is the height of the text. If the function fails, the return value is zero.

Definition at line 710 of file dc.cpp.

References GetHDC().

◆ DrawTextEx()

int owl::TDC::DrawTextEx ( TCHAR * str,
int count,
TRect * rect = 0,
uint format = 0,
LPDRAWTEXTPARAMS params = 0 )
virtual

Formats and draws in the given rectangle, r, up to count characters of the null-terminated string using the current font for this DC.

If count is -1, the whole string is written. The rectangle must be specified in logical units. Formatting is controlled with the format argument, which can be various combinations of the following values:

  • DT_BOTTOM Specifies bottom-justified text. This value must be combined (bitwise OR'd) with DT_SINGLELINE.
  • DT_CALCRECT Determines the width and height of the rectangle. If there are multiple lines of text, DrawText uses the width of r (the rectangle argument) and extends the base of the rectangle to bound the last line of text. If there is only one line of text, DrawText uses a modified value for the right side of r so that it bounds the last character in the line. In both cases, DrawText returns the height of the formatted text but does not draw the text.
  • DT_CENTER Centers text horizontally.
  • DT_EDITCONTROL Duplicates the text-displaying characteristics of a multiline edit control. Specifically, the average character width is calculated in the same manner as for an edit control, and the function does not display a partially visible last line.
  • DT_END_ELLIPSIS or DT_PATH_ELLIPSIS Replaces part of the given string with ellipses, if necessary, so that the result fits in the specified rectangle. The given string is not modified unless the DT_MODIFYSTRING flag is specified.You can specify DT_END_ELLIPSIS to replace characters at the end of the string, or
  • DT_PATH_ELLIPSIS to replace characters in the middle of the string. If the string contains backslash () characters, DT_PATH_ELLIPSIS preserves as much as possible of the text after the last backslash.
  • DT_EXPANDTABS Expands tab characters. The default number of characters per tab is eight.
  • DT_EXTERNALLEADING Includes the font external leading in line height. Normally, external leading is not included in the height of a line of text.
  • DT_INTERNAL Uses the system font to calculate text metrics.
  • DT_LEFT Aligns text flush-left.
  • DT_MODIFYSTRING Modifies the given string to match the displayed text. This flag has no effect unless the DT_END_ELLIPSIS or DT_PATH_ELLIPSIS flag is specified.
  • DT_NOCLIP Draws without clipping. DrawText is somewhat faster when DT_NOCLIP is used.
  • DT_NOPREFIX Turns off processing of prefix characters. Normally, DrawText interprets the prefix character & as a directive to underscore the character that follows, and the prefix characters && as a directive to print a single &. By specifying DT_NOPREFIX, this processing is turned off.
  • DT_RIGHT Aligns text flush-right.
  • DT_RTLREADING Layout in right to left reading order for bi-directional text when the font selected into the hdc is a Hebrew or Arabic font. The default reading order for all text is left to right.
  • DT_SINGLELINE Specifies single line only. Carriage returns and linefeeds do not break the line.
  • DT_TABSTOP Sets tab stops. Bits 15-8 (the high-order byte of the low-order word) of the format argument are the number of characters for each tab. The default number of characters per tab is eight.
  • DT_TOP Specifies top-justified text (single line only).
  • DT_VCENTER Specifies vertically centered text (single line only).
  • DT_WORDBREAK Specifies word breaking. Lines are automatically broken between words if a word would extend past the edge of the rectangle specified by r. A carriage return/line sequence will also break the line.
  • DT_WORD_ELLIPSIS Truncates text that does not fit in the rectangle and adds ellipses.
Note
Note that the DT_CALCRECT, DT_EXTERNALLEADING, DT_INTERNAL, DT_NOCLIP, and DT_NOPREFIX values cannot be used with the DT_TABSTOP value. DrawText uses this DC's currently selected font, text color, and background color to draw the text. Unless the DT_NOCLIP format is used, DrawText clips the text so that it does not appear outside the given rectangle. All formatting is assumed to have multiple lines unless the DT_SINGLELINE format is given. If the selected font is too large for the specified rectangle, DrawText does not attempt to substitute a smaller font. If the function succeeds, the return value is the height of the text. If the function fails, the return value is zero. Windows NT: To get extended error information, call GetLastError.

Definition at line 785 of file dc.cpp.

References GetHDC().

◆ Ellipse() [1/4]

bool owl::TDC::Ellipse ( const TPoint & p1,
const TPoint & p2 )
inline

Draws and fills an ellipse on this DC using the currently selected pen and brush objects.

The center of the ellipse is the center of the bounding rectangle specified either by (x1, y1)/(x2, y2) or by the rect argument. Ellipse returns true if the call is successful; otherwise, it returns false. The current position is neither used nor altered by this call.

Definition at line 2113 of file dc.h.

References GetHDC().

◆ Ellipse() [2/4]

bool owl::TDC::Ellipse ( const TPoint & p,
const TSize & s )
inline

Draws and fills an ellipse on this DC using the currently selected pen and brush objects.

The center of the ellipse is the center of the bounding rectangle specified either by (x1, y1)/(x2, y2) or by the rect argument. Ellipse returns true if the call is successful; otherwise, it returns false. The current position is neither used nor altered by this call.

Definition at line 2125 of file dc.h.

References GetHDC().

◆ Ellipse() [3/4]

bool owl::TDC::Ellipse ( const TRect & rect)
inline

Draws and fills an ellipse on this DC using the currently selected pen and brush objects.

The center of the ellipse is the center of the bounding rectangle specified either by (x1, y1)/(x2, y2) or by the rect argument. Ellipse returns true if the call is successful; otherwise, it returns false. The current position is neither used nor altered by this call.

Definition at line 2137 of file dc.h.

References GetHDC().

◆ Ellipse() [4/4]

bool owl::TDC::Ellipse ( int x1,
int y1,
int x2,
int y2 )
inline

Draws and fills an ellipse on this DC using the currently selected pen and brush objects.

The center of the ellipse is the center of the bounding rectangle specified either by (x1, y1)/(x2, y2) or by the rect argument. Ellipse returns true if the call is successful; otherwise, it returns false. The current position is neither used nor altered by this call.

Definition at line 2101 of file dc.h.

References GetHDC().

◆ EndPath()

bool owl::TDC::EndPath ( )
inline

Closes the path bracket and selects the path it defines into this DC.

Returns true if the call is successful; otherwise, returns false.

Definition at line 3375 of file dc.h.

References GetHDC().

◆ EnumEnhMetaFile()

int owl::TDC::EnumEnhMetaFile ( const TEnhMetaFilePict & metaFile,
ENHMFENUMPROC callback,
void * data,
const TRect * rect ) const
inline

Enumerate through the enhanced metafile records.

Definition at line 1653 of file dc.h.

References GetHDC().

◆ EnumFontFamilies() [1/2]

int owl::TDC::EnumFontFamilies ( const tstring & family,
FONTENUMPROC proc,
void * data ) const
inline

Definition at line 515 of file dc.h.

◆ EnumFontFamilies() [2/2]

int owl::TDC::EnumFontFamilies ( LPCTSTR familyName,
FONTENUMPROC callback,
void * data ) const
inline

Enumerates the fonts available to this DC in the font family specified by family.

The given application-defined callback proc is called for each font in the family or until proc returns 0, and is defined as:

data lets you pass both application-specific data and font data to proc. If successful, the call returns the last value returned by proc.

Definition at line 3321 of file dc.h.

References GetAttributeHDC().

◆ EnumFonts() [1/2]

int owl::TDC::EnumFonts ( const tstring & facename,
OLDFONTENUMPROC callback,
void * data ) const
inline

Definition at line 509 of file dc.h.

◆ EnumFonts() [2/2]

int owl::TDC::EnumFonts ( LPCTSTR faceName,
OLDFONTENUMPROC callback,
void * data ) const
inline

Enumerates the fonts available on this DC for the given faceName.

The font type, LOGFONT, and TEXTMETRIC data retrieved for each available font is passed to the user-defined callback function together with any optional, user-supplied data placed in the data buffer. The callback function can process this data in any way desired. Enumeration continues until there are no more fonts or until the callback function returns 0. If faceName is 0, EnumFonts randomly selects and enumerates one font of each available typeface. EnumFonts returns the last value returned by the callback function. Note that OLDFONTENUMPROC is defined as FONTENUMPROC for Win32 only. FONTENUMPROC is a pointer to a user-defined function and has the following prototype:

where dwType specifies one of the following font types: DEVICE_FONTTYPE, RASTER_FONTTYPE, or TRUETYPE_FONTTYPE.

Definition at line 3294 of file dc.h.

References GetAttributeHDC().

◆ EnumMetaFile()

int owl::TDC::EnumMetaFile ( const TMetaFilePict & metafile,
MFENUMPROC callback,
void * data ) const
inline

Enumerates the GDI calls within the given metaFile.

Each such call is retrieved and passed to the given callback function, together with any client data from data, until all calls have been processed or a callback function returns 0. MFENUMPROC is defined as:

Definition at line 1623 of file dc.h.

References GetHDC().

◆ EnumObjects()

int owl::TDC::EnumObjects ( uint objectType,
GOBJENUMPROC proc,
void * data ) const
inline

Enumerates the pen or brush objects available for this DC.

The parameter objectType can be either OBJ_BRUSH or OBJ_PEN. For each pen or brush found, proc, a user-defined callback function, is called until there are no more objects found or the callback function returns 0. proc is defined as:

Parameter data specifies an application-defined value that is passed to proc.

Definition at line 1035 of file dc.h.

References GetHDC().

◆ ExcludeClipRect()

int owl::TDC::ExcludeClipRect ( const TRect & rect)
inline

Creates a new clipping region for this DC.

This new region consists of the current clipping region minus the given rectangle, rect. The return value indicates the new clipping region's type as follows:

  • COMPLEXREGION Clipping Region has overlapping borders.
  • ERROR Invalid DC.
  • NULLREGION Clipping region is empty.
  • SIMPLEREGION Clipping region has no overlapping borders.

Definition at line 1478 of file dc.h.

References GetHDC().

◆ ExcludeUpdateRgn()

int owl::TDC::ExcludeUpdateRgn ( HWND Wnd)
inline

Prevents drawing within invalid areas of a window by excluding an updated region of this DC's window from its clipping region.

The return value indicates the resulting clipping region's type as follows:

  • COMPLEXREGION Clipping Region has overlapping borders.
  • ERROR Invalid DC.
  • NULLREGION Clipping region is empty.
  • SIMPLEREGION Clipping region has no overlapping borders.

Definition at line 1492 of file dc.h.

References GetHDC().

◆ ExtFloodFill()

bool owl::TDC::ExtFloodFill ( const TPoint & point,
const TColor & color,
uint16 fillType )
inline

Fills an area on this DC starting at point and using the currently selected brush object.

The color argument specifies the color of the boundary or of the region to be filled. The fillType argument specifies the type of fill, as follows:

  • FLOODFILLBORDER The fill region is bounded by the given color. This style coincides with the filling method used by FloodFill().
  • FLOODFILLSURFACE The fill region is defined by the given color. Filling continues outward in all directions as long as this color is encountered. Use this style when filling regions with multicolored borders.

Not every device supports ExtFloodFill, so applications should test first with TDC::GetDeviceCaps. ExtFloodFill returns true if the call is successful; otherwise, it returns false.

Definition at line 2880 of file dc.h.

References GetHDC().

◆ ExtTextOut() [1/2]

bool owl::TDC::ExtTextOut ( const TPoint & p,
uint16 options,
const TRect * rect,
const tstring & str,
int count = -1,
const int * dx = 0 )
inline

Draws up to count characters of the given null-terminated string in the current font on this DC.

If count is -1, the whole string is written. An optional rectangle r can be specified for clipping, opaquing, or both, as determined by the options value. If options is set to ETO_CLIPPED, the rectangle is used for clipping the drawn text. If options is set to ETO_OPAQUE, the current background color is used to fill the rectangle. Both options can be used if ETO_CLIPPED is OR'd with ETO_OPAQUE. The (x, y) orp arguments specify the logical coordinates of the reference point that is used to align the first character. The current text-alignment mode can be inspected with TDC::GetTextAlign and changed with TDC::SetTextAlign. By default, the current position is neither used nor altered by ExtTextOut. However, if the align mode is set to TA_UPDATECP, ExtTextOut ignores the reference point argument(s) and uses or updates the current position as the reference point. The dx argument is an optional array of values used to set the distances between the origins (upper left corners) of adjacent character cells. For example, dx[i] represents the number of logical units separating the origins of character cells i and i+1. If dx is 0, ExtTextOut uses the default inter-character spacings. ExtTextOut returns true if the call is successful; otherwise, it returns false.

Definition at line 2923 of file dc.h.

References ExtTextOut().

◆ ExtTextOut() [2/2]

bool owl::TDC::ExtTextOut ( int x,
int y,
uint16 options,
const TRect * rect,
const tstring & str,
int count = -1,
const int * dx = 0 )
virtual

Draws up to count characters of the given null-terminated string in the current font on this DC.

If count is -1, the whole string is written. The count (or the string length, if count is -1) may not exceed 8192. An optional rectangle r can be specified for clipping, opaquing, or both, as determined by the options value. If options is set to ETO_CLIPPED, the rectangle is used for clipping the drawn text. If options is set to ETO_OPAQUE, the current background color is used to fill the rectangle. Both options can be used if ETO_CLIPPED is OR'd with ETO_OPAQUE. The (x, y) orp arguments specify the logical coordinates of the reference point that is used to align the first character. The current text-alignment mode can be inspected with TDC::GetTextAlign and changed with TDC::SetTextAlign. By default, the current position is neither used nor altered by ExtTextOut. However, if the align mode is set to TA_UPDATECP, ExtTextOut ignores the reference point argument(s) and uses or updates the current position as the reference point. The dx argument is an optional array of values used to set the distances between the origins (upper left corners) of adjacent character cells. For example, dx[i] represents the number of logical units separating the origins of character cells i and i+1. If dx is 0, ExtTextOut uses the default inter-character spacings. ExtTextOut returns true if the call is successful; otherwise, it returns false.

See also
http://msdn.microsoft.com/en-us/library/dd162713.aspx

Definition at line 603 of file dc.cpp.

References GetHDC(), and PRECONDITION.

◆ FillPath()

bool owl::TDC::FillPath ( )
inline

Closes any open figures in the current path of this DC and fills the path's interior using the current brush and polygon fill mode.

After filling the interior, FillPath discards the path from this DC. FillPath returns true if the call is successful; otherwise, it returns false.

Definition at line 3417 of file dc.h.

References GetHDC().

◆ FillRect() [1/2]

bool owl::TDC::FillRect ( const TRect & rect,
const TBrush & brush )
inline

Fills the given rectangle on this DC using the specified brush.

The fill covers the left and top borders but excludes the right and bottom borders. FillRect returns true if the call is successful; otherwise, it returns false.

Definition at line 1813 of file dc.h.

References GetHDC().

◆ FillRect() [2/2]

bool owl::TDC::FillRect ( int x1,
int y1,
int x2,
int y2,
const TBrush & brush )
inline

Fills the given rectangle on this DC using the specified brush.

The fill covers the left and top borders but excludes the right and bottom borders. FillRect returns true if the call is successful; otherwise, it returns false.

Definition at line 1802 of file dc.h.

References GetHDC().

◆ FillRgn()

bool owl::TDC::FillRgn ( const TRegion & region,
const TBrush & brush )
inline

Fills the given region on this DC using the specified brush.

FillRgn returns true if the call is successful; otherwise, it returns false.

Definition at line 1932 of file dc.h.

References GetHDC().

◆ FillSolidRect()

bool owl::TDC::FillSolidRect ( const TRect & r,
const TColor & color )
inline

Definition at line 318 of file dc.h.

◆ FlattenPath()

bool owl::TDC::FlattenPath ( )
inline

Transforms any curves in the currently selected path of this DC.

All such curves are changed to sequences of linear segments. Returns true if the call is successful; otherwise, returns false.

Definition at line 3385 of file dc.h.

References GetHDC().

◆ FloodFill()

bool owl::TDC::FloodFill ( const TPoint & point,
const TColor & color )
inline

Fills an area on this DC starting at point and using the currently selected brush object.

The color argument specifies the color of the boundary or of the area to be filled. Returns true if the call is successful; otherwise, returns false. FloodFill is maintained in the WIN32 API for compatibility with earlier APIs. New WIN32 applications should use TDC::ExtFloodFill.

Definition at line 2859 of file dc.h.

References GetHDC().

◆ FrameRect() [1/2]

bool owl::TDC::FrameRect ( const TRect & rect,
const TBrush & brush )
inline

Draws a border on this DC around the given rectangle, rect, using the given brush, brush.

The height and width of the border is one logical unit. Returns true if the call is successful; otherwise, it returns false.

Definition at line 1792 of file dc.h.

References GetHDC().

◆ FrameRect() [2/2]

bool owl::TDC::FrameRect ( int x1,
int y1,
int x2,
int y2,
const TBrush & brush )
inline

Draws a border on this DC around the given rectangle, rect, using the given brush, brush.

The height and width of the border is one logical unit. Returns true if the call is successful; otherwise, it returns false.

Definition at line 1781 of file dc.h.

References GetHDC().

◆ FrameRgn()

bool owl::TDC::FrameRgn ( const TRegion & region,
const TBrush & brush,
const TSize & brushSize )
inline

Draws a border on this DC around the given region, region, using the given brush, brush.

The width and height of the border is specified by the brushSize argument. Returns true if the call is successful; otherwise, returns false.

Definition at line 1923 of file dc.h.

References GetHDC().

◆ GetAspectRatioFilter()

bool owl::TDC::GetAspectRatioFilter ( TSize & size) const
inline

Retrieves the setting of the current aspect-ratio filter for this DC.

Definition at line 3271 of file dc.h.

References GetAttributeHDC().

◆ GetAttributeHDC()

HDC owl::TDC::GetAttributeHDC ( ) const
virtual

Returns the attributes of the DC object.

Reimplemented in owl::TPreviewDCBase.

Definition at line 81 of file dc.cpp.

References Handle.

◆ GetBkColor()

TColor owl::TDC::GetBkColor ( ) const
inline

Returns the current background color of this DC.

Definition at line 1099 of file dc.h.

References GetAttributeHDC().

◆ GetBkMode()

int owl::TDC::GetBkMode ( ) const
inline

Returns the background mode of this DC, either OPAQUE or TRANSPARENT.

Definition at line 1107 of file dc.h.

References GetAttributeHDC().

◆ GetBoundsRect()

bool owl::TDC::GetBoundsRect ( TRect & bounds,
uint16 flags ) const
inline

Reports in bounds the current accumulated bounding rectangle of this DC or of the Windows manager, depending on the value of flags.

Returns true if the call is successful; otherwise, returns false. The flags argument can be DCB_RESET or DCB_WINDOWMGR or both. The flags value work as follows:

  • DCB_RESET Forces the bounding rectangle to be cleared after being set in bounds.
  • DCB_WINDOWMGR Reports the Windows current bounding rectangle rather than that of this DC.

There are two bounding-rectangle accumulations, one for Windows and one for the application. GetBoundsRect returns screen coordinates for the Windows bounds, and logical units for the application bounds. The Windows accumulated bounds can be queried by an application but not altered. The application can both query and alter the DC's accumulated bounds.

Definition at line 1572 of file dc.h.

References GetHDC().

◆ GetBrushOrg()

bool owl::TDC::GetBrushOrg ( TPoint & point) const
inline

Places in point the current brush origin of this DC.

Returns true if successful; otherwise, returns false.

Definition at line 1010 of file dc.h.

References GetHDC().

◆ GetCharABCWidths()

bool owl::TDC::GetCharABCWidths ( uint firstChar,
uint lastChar,
ABC * abc )
inline

Retrieves the widths of consecutive characters in the range firstChar to lastChar from the current TrueType font of this DC.

The widths are reported in the array abc of ABC structures. Returns true if the call is successful; otherwise, returns false.

Definition at line 3305 of file dc.h.

References GetAttributeHDC().

◆ GetCharWidth()

bool owl::TDC::GetCharWidth ( uint firstChar,
uint lastChar,
int * buffer )
inline

Retrieves the widths in logical units for a consecutive sequence of characters in the current font for this DC.

The sequence is specified by the inclusive range, firstChar to lastChar, and the widths are copied to the given buffer. If a character in the range is not represented in the current font, the width of the default character is assigned. Returns true if the call is successful; otherwise, returns false.

Definition at line 3247 of file dc.h.

References GetAttributeHDC().

◆ GetClipBox() [1/2]

TRect owl::TDC::GetClipBox ( ) const
inline

Places the current clip box size of this DC in rect.

The clip box is defined as the smallest rectangle bounding the current clipping boundary. The return value indicates the clipping region's type as follows:

  • COMPLEXREGION Clipping Region has overlapping borders.
  • ERROR Invalid DC.
  • NULLREGION Clipping region is empty.
  • SIMPLEREGION Clipping region has no overlapping borders.

Definition at line 1462 of file dc.h.

References GetClipBox(), and GetHDC().

◆ GetClipBox() [2/2]

int owl::TDC::GetClipBox ( TRect & rect) const
inline

Places the current clip box size of this DC in rect.

The clip box is defined as the smallest rectangle bounding the current clipping boundary. The return value indicates the clipping region's type as follows:

  • COMPLEXREGION Clipping Region has overlapping borders.
  • ERROR Invalid DC.
  • NULLREGION Clipping region is empty.
  • SIMPLEREGION Clipping region has no overlapping borders.

Definition at line 1448 of file dc.h.

References GetHDC().

◆ GetClipRgn()

int owl::TDC::GetClipRgn ( TRegion & region) const
inline

Retrieves this DC's current clip-region and, if successful, places a copy of it in the region argument.

You can alter this copy without affecting the current clip-region. If the function succeeds and there is no clipping region for the given device context, the return value is zero. If the function succeeds and there is a clipping region for the given device context, the return value is 1. If an error occurs, the return value is -1.

Definition at line 1608 of file dc.h.

References GetHDC().

◆ GetCurrentObject()

HANDLE owl::TDC::GetCurrentObject ( uint objectType) const

Returns a handle to the currently selected object of the given objectType associated with this DC.

Returns 0 if the call fails. objectType can be OBJ_PEN, OBJ_BRUSH, OBJ_PAL, OBJ_FONT, or OBJ_BITMAP. Subset of Win32 GetCurrentObject , just a straight call for normal win32

Definition at line 319 of file dc.cpp.

References GetHDC().

◆ GetCurrentPosition()

bool owl::TDC::GetCurrentPosition ( TPoint & point) const
inline

Reports in point the logical coordinates of this DC's current position.

Returns true if the call is successful; otherwise, returns false.

Definition at line 1680 of file dc.h.

References GetHDC().

◆ GetDCOrg()

bool owl::TDC::GetDCOrg ( TPoint & point) const
inline

Obtains the final translation origin for this device context and places the value in point.

This value specifies the offset used to translate device coordinates to client coordinates for points in an application window. Returns true if the call is successful; otherwise, returns false.

Definition at line 1001 of file dc.h.

References GetAttributeHDC().

◆ GetDeviceCaps()

int owl::TDC::GetDeviceCaps ( int index) const
virtual

Used under WIN3.1 or later, GetDeviceCaps returns capability information about this DC.

The index argument specifies the type of information required.

Todo
Document the possible values for the index

Reimplemented in owl::TPrintPreviewDC.

Definition at line 373 of file dc.cpp.

References GetAttributeHDC().

◆ GetDIBits() [1/2]

int owl::TDC::GetDIBits ( const TBitmap & bitmap,
TDib & dib )
inline

The first version retrieves some or all of the bits from the given bitmap on this DC and copies them to the bits buffer using the DIB (device-independent bitmap) format specified by the BITMAPINFO argument, info.

numScan scanlines of the bitmap are retrieved, starting at scan line startScan. The usage argument determines the format of the bmiColors member of the BITMAPINFO structure, according to the following table:

  • DIB_PAL_COLORS The color table is an array of 16-bit indexes into the current logical palette.
  • DIB_RGB_COLORS The color table contains literal RGB values.
  • DIB_PAL_INDICES There is no color table for this bitmap. The DIB bits consist of indexes into the system palette. No color translation occurs. Only the BITMAPINFOHEADER portion of BITMAPINFO is filled in.

In the second version of GetDIBits, the bits are retrieved from bitmap and placed in the dib.Bits data member of the given TDib argument. The BITMAPINFO argument is supplied from dib.info. GetDIBits returns true if the call is successful; otherwise, it returns false.

Definition at line 2695 of file dc.h.

References GetHDC().

◆ GetDIBits() [2/2]

int owl::TDC::GetDIBits ( const TBitmap & bitmap,
uint startScan,
uint numScans,
void * bits,
const BITMAPINFO & info,
uint16 usage )
inline

The first version retrieves some or all of the bits from the given bitmap on this DC and copies them to the bits buffer using the DIB (device-independent bitmap) format specified by the BITMAPINFO argument, info.

numScan scanlines of the bitmap are retrieved, starting at scan line startScan. The usage argument determines the format of the bmiColors member of the BITMAPINFO structure, according to the following table:

  • DIB_PAL_COLORS The color table is an array of 16-bit indexes into the current logical palette.
  • DIB_RGB_COLORS The color table contains literal RGB values.
  • DIB_PAL_INDICES There is no color table for this bitmap. The DIB bits consist of indexes into the system palette. No color translation occurs. Only the BITMAPINFOHEADER portion of BITMAPINFO is filled in.

In the second version of GetDIBits, the bits are retrieved from bitmap and placed in the dib.Bits data member of the given TDib argument. The BITMAPINFO argument is supplied from dib.info. GetDIBits returns true if the call is successful; otherwise, it returns false.

Definition at line 2668 of file dc.h.

References GetHDC().

◆ GetFontData()

uint32 owl::TDC::GetFontData ( uint32 table,
uint32 offset,
void * buffer,
long data )
inline

Retrieves font-metric information from a scalable TrueType font file (specified by table and starting at offset into this table) and places it in the given buffer.

data specifies the size in bytes of the data to be retrieved. If the call is successful, it returns the number of bytes set in buffer; otherwise, -1 is returned.

Definition at line 3333 of file dc.h.

References GetAttributeHDC().

◆ GetGlyphOutline()

uint32 owl::TDC::GetGlyphOutline ( uint chr,
uint format,
GLYPHMETRICS & gm,
uint32 buffSize,
void * buffer,
const MAT2 & mat2 )
inline

Retrieves TrueType metric and other data for the given character, chr, on this DC and places it in gm and buffer.

The format argument specifies the format of the retrieved data as indicated in the following table. (A value of 0 simply fills in the GLYPHMETRICS structure but does not return glyph-outline data.)

  • 1 - Retrieves the glyph bitmap.
  • 2 - Retrieves the curve data points in the rasterizer's native format and uses the font's design units. With this value of format, the mat2 transformation argument is ignored.

The gm argument specifies the GLYPHMETRICS structure that describes the placement of the glyph in the character cell. buffSize specifies the size of buffer that receives data about the outline character. If either buffSize or buffer is 0, GetGlyphOutline returns the required buffer size. Applications can rotate characters retrieved in bitmap format (format = 1) by specifying a 2 x 2 transformation matrix via the mat2 argument. GetGlyphOutline returns a positive number if the call is successful; otherwise, it returns GDI_ERROR.

Definition at line 3199 of file dc.h.

References GetAttributeHDC().

◆ GetHDC()

HDC owl::TDC::GetHDC ( ) const
inline

Return the handle of the device context.

Definition at line 981 of file dc.h.

References Handle.

◆ GetKerningPairs()

int owl::TDC::GetKerningPairs ( int pairs,
KERNINGPAIR * krnPair )
inline

Retrieves kerning pairs for the current font of this DC up to the number specified in pairs and copies them into the krnPair array of KERNINGPAIR structures.

If successful, the function returns the actual number of pairs retrieved. If the font has more than pairs kerning pairs, the call fails and returns 0. The krnPair array must allow for at least pairs KERNINGPAIR structures. If krnPair is set to 0, GetKerningPairs returns the total number of kerning pairs for the current font.

Definition at line 3216 of file dc.h.

References GetAttributeHDC().

◆ GetMapMode()

int owl::TDC::GetMapMode ( ) const
inline

If successful, returns the current window mapping mode of this DC; otherwise, returns 0.

The mapping mode defines how logical coordinates are mapped to device coordinates. It also controls the orientation of the device's x- and y-axes. The mode values are shown in the following table:

  • MM_ANISOTROPIC Logical units are mapped to arbitrary units with arbitrarily scaled axes. SetWindowExtEx and SetViewportExtEx must be used to specify the desired units, orientation, and scaling.
  • MM_HIENGLISH Each logical unit is mapped to 0.001 inch. Positive x is to the right; positive y is at the top.
  • MM_HIMETRIC Each logical unit is mapped to 0.01 millimeter. Positive x is to the right; positive y is at the top.
  • MM_ISOTROPIC Logical units are mapped to arbitrary units with equally scaled axes; that is, one unit along the x-axis is equal to one unit along the y-axis. SetWindowExtEx and SetViewportExtEx must be used to specify the desired units and the orientation of the axes. GDI makes adjustments as necessary to ensure that the x and y units remain the same size (e.g., if you set the window extent, the viewport is adjusted to keep the units isotropic).
  • MM_LOENGLISH Each logical unit is mapped to 0.01 inch. Positive x is to the right; positive y is at the top.
  • MM_LOMETRIC Each logical unit is mapped to 0.1 millimeter. Positive x is to the right; positive y is at the top.
  • MM_TEXT Each logical unit is mapped to one device pixel. Positive x is to the right; positive y is at the bottom.
  • MM_TWIPS Each logical unit is mapped to one twentieth of a printer's point (1/1440 inch). Positive x is to the right; positive y is at the top.

Definition at line 1245 of file dc.h.

References GetAttributeHDC().

◆ GetNearestColor()

TColor owl::TDC::GetNearestColor ( const TColor & color) const
inline

Returns the color nearest to the given Color argument for the current palette of this DC.

Definition at line 1044 of file dc.h.

References GetAttributeHDC().

◆ GetOutlineTextMetrics()

uint owl::TDC::GetOutlineTextMetrics ( uint data,
OUTLINETEXTMETRIC & otm )
inline

Retrieves metric information for TrueType fonts on this DC and copies it to the given array of OUTLINETEXTMETRIC structures, otm.

This structure contains a TEXTMETRIC and several other metric members, as well as four string-pointer members for holding family, face, style, and full font names. Since memory must be allocated for these variable-length strings in addition to the font metric data, you must pass (with the data argument) the total number of bytes required for the retrieved data. If GetOutlineTextMetrics is called with otm = 0, the function returns the total buffer size required. You can then assign this value to data in subsequent calls. Returns nonzero if the call is successful; otherwise, returns 0.

Definition at line 3234 of file dc.h.

References GetAttributeHDC().

◆ GetPixel() [1/2]

TColor owl::TDC::GetPixel ( const TPoint & point) const
inline

Returns the color of the pixel at the given location.

Definition at line 2385 of file dc.h.

References GetHDC().

◆ GetPixel() [2/2]

TColor owl::TDC::GetPixel ( int x,
int y ) const
inline

Returns the color of the pixel at the given location.

Definition at line 2377 of file dc.h.

References GetHDC().

◆ GetPolyFillMode()

int owl::TDC::GetPolyFillMode ( ) const
inline

Returns the current polygon-filling mode for this DC, either ALTERNATE or WINDING.

Definition at line 1127 of file dc.h.

References GetAttributeHDC().

◆ GetROP2()

int owl::TDC::GetROP2 ( ) const
inline

Returns the current drawing (raster operation) mode of this DC.

Definition at line 1147 of file dc.h.

References GetAttributeHDC().

◆ GetStretchBltMode()

int owl::TDC::GetStretchBltMode ( ) const
inline

Returns the current stretching mode for this DC: BLACKONWHITE, COLORONCOLOR, or WHITEONBLACK.

The stretching mode determines how bitmaps are stretched or compressed by the StretchBlt function.

Definition at line 1192 of file dc.h.

References GetAttributeHDC().

◆ GetSystemPaletteEntries()

uint owl::TDC::GetSystemPaletteEntries ( int start,
int num,
PALETTEENTRY * entries ) const
inline

Retrieves a range of up to num palette entries, starting at start, from the system palette to the entries array of PALETTEENTRY structures.

Returns the actual number of entries transferred.

Definition at line 1073 of file dc.h.

References GetHDC().

◆ GetSystemPaletteUse()

uint owl::TDC::GetSystemPaletteUse ( ) const
inline

Determines whether this DC has access to the full system palette.

Returns SYSPAL_NOSTATIC or SYSPAL_STATIC.

Definition at line 1082 of file dc.h.

References GetHDC().

◆ GetTabbedTextExtent() [1/2]

TSize owl::TDC::GetTabbedTextExtent ( const tstring & str,
int strLen,
int numPositions,
const int * positions ) const
inline

Computes the extent (width and height) in logical units of the text line consisting of stringLen characters from the null-terminated string.

The extent is calculated from the metrics of the current font or this DC, but ignores the current clipping region. In the first version of GetTabbedTextExtent, the extent is returned in size; in the second version, the extent is the returned TSize object. Width is size.x and width is size.y. The width calculation includes the spaces implied by any tab codes in the string. Such tab codes are interpreted using the numPositions and positions arguments. The positions array specifies numPositions tab stops given in device units. The tab stops must have strictly increasing values in the array. If numPositions and positions are both 0, tabs are expanded to eight times the average character width. If numPositions is 1, all tab stops are taken to be positions[0] apart. If kerning is being applied, the sum of the extents of the characters in a string might not equal the extent of the string.

Definition at line 3032 of file dc.h.

References GetAttributeHDC(), and GetTabbedTextExtent().

◆ GetTabbedTextExtent() [2/2]

bool owl::TDC::GetTabbedTextExtent ( const tstring & str,
int strLen,
int numPositions,
const int * positions,
TSize & size ) const
inline

Computes the extent (width and height) in logical units of the text line consisting of stringLen characters from the null-terminated string.

The extent is calculated from the metrics of the current font or this DC, but ignores the current clipping region. In the first version of GetTabbedTextExtent, the extent is returned in size; in the second version, the extent is the returned TSize object. Width is size.x and width is size.y. The width calculation includes the spaces implied by any tab codes in the string. Such tab codes are interpreted using the numPositions and positions arguments. The positions array specifies numPositions tab stops given in device units. The tab stops must have strictly increasing values in the array. If numPositions and positions are both 0, tabs are expanded to eight times the average character width. If numPositions is 1, all tab stops are taken to be positions[0] apart. If kerning is being applied, the sum of the extents of the characters in a string might not equal the extent of the string.

Definition at line 3007 of file dc.h.

References GetAttributeHDC(), and GetTabbedTextExtent().

◆ GetTextAlign()

uint owl::TDC::GetTextAlign ( ) const
inline

If successful, returns the current text-alignment flags for this DC; otherwise, returns the value GDI_ERROR.

The text-alignment flags determine how TDC::TextOut and TDC::ExtTextOut align text strings in relation to the first character's screen position. GetTextAlign returns certain combinations of the flags listed in the following table:

  • TA_BASELINE The reference point will be on the baseline of the text.
  • TA_BOTTOM The reference point will be on the bottom edge of the bounding rectangle.
  • TA_TOP The reference point will be on the top edge of the bounding rectangle.
  • TA_CENTER The reference point will be aligned horizontally with the center of the bounding rectangle.
  • TA_LEFT The reference point will be on the left edge of the bounding rectangle.
  • TA_RIGHT The reference point will be on the right edge of the bounding rectangle.
  • TA_NOUPDATECP The current position is not updated after each text output call.
  • TA_UPDATECP The current position is updated after each text output call.

    When the current font has a vertical default baseline (as with Kanji) the following values replace TA_BASELINE and TA_CENTER:

  • VTA_BASELINE The reference point will be on the baseline of the text.
  • VTA_CENTER The reference point will be aligned vertically with the center of the bounding rectangle.

The text-alignment flags are not necessarily single bit-flags and might be equal to 0. The flags must be examined in groups of the following related flags:

  • TA_LEFT, TA_RIGHT, and TA_CENTER
  • TA_BOTTOM, TA_TOP, and TA_BASELINE
  • TA_NOUPDATECP and TA_UPDATECP

If the current font has a vertical default baseline (as with Kanji), these are groups of related flags:

  • TA_LEFT, TA_RIGHT, and VTA_BASELINE
  • TA_BOTTOM, TA_TOP, and VTA_CENTER
  • TA_NOUPDATECP and TA_UPDATECP

To verify that a particular flag is set in the return value of this function, the application must perform the following steps:

  • 1. Apply the bitwise OR operator to the flag and its related flags.
  • 2. Apply the bitwise AND operator to the result and the return value.
  • 3. Test for the equality of this result and the flag.

The following example shows a method for determining which horizontal alignment flag is set:

switch ((TA_LEFT | TA_RIGHT | TA_CENTER) & dc.GetTextAlign()) {
case TA_LEFT:
...
case TA_RIGHT:
...
case TA_CENTER:
...
}

Definition at line 3094 of file dc.h.

References GetAttributeHDC().

◆ GetTextCharacterExtra()

int owl::TDC::GetTextCharacterExtra ( ) const
inline

If successful, returns the current intercharacter spacing, in logical units, for this DC; otherwise, returns INVALID_WIDTH.

Definition at line 3117 of file dc.h.

References GetAttributeHDC().

◆ GetTextColor()

TColor owl::TDC::GetTextColor ( ) const
inline

Returns the current text color of this DC.

The text color determines the color displayed by TDC::TextOut and TDC::ExtTextOut.

Definition at line 1213 of file dc.h.

References GetAttributeHDC().

◆ GetTextExtent() [1/2]

TSize owl::TDC::GetTextExtent ( const tstring & str,
int stringLen ) const
inline

Computes the extent (width and height) in logical units of the text line consisting of stringLen characters from the null-terminated string.

The extent is calculated from the metrics of the current font or this DC, but ignores the current clipping region. In the first version of GetTextExtent the extent is returned in size; in the second version, the extent is the returned TSize object. Width is size.cx and height is size.cy. If kerning is being applied, the sum of the extents of the characters in a string might not equal the extent of the string.

Definition at line 2983 of file dc.h.

References GetTextExtent().

◆ GetTextExtent() [2/2]

bool owl::TDC::GetTextExtent ( const tstring & str,
int stringLen,
TSize & size ) const
inline

Computes the extent (width and height) in logical units of the text line consisting of stringLen characters from the null-terminated string.

The extent is calculated from the metrics of the current font or this DC, but ignores the current clipping region. In the first version of GetTextExtent the extent is returned in size; in the second version, the extent is the returned TSize object. Width is size.cx and height is size.cy. If kerning is being applied, the sum of the extents of the characters in a string might not equal the extent of the string.

Definition at line 2968 of file dc.h.

References GetAttributeHDC().

◆ GetTextFace() [1/2]

tstring owl::TDC::GetTextFace ( ) const

Definition at line 855 of file dc.cpp.

References owl::CopyText(), and GetTextFaceLength().

◆ GetTextFace() [2/2]

int owl::TDC::GetTextFace ( int count,
TCHAR * facename ) const
inline

Retrieves the typeface name for the current font on this DC.

Up to count characters of this name are copied to facename. If successful, GetTextFace returns the number of characters actually copied; otherwise, it returns 0.

Definition at line 3166 of file dc.h.

References GetAttributeHDC().

◆ GetTextFaceLength()

int owl::TDC::GetTextFaceLength ( ) const
inline

Retrieves the length of the typeface name for the current font on this DC.

The length is the number of characters excluding null-termination.

Definition at line 3156 of file dc.h.

References GetTextFace().

◆ GetTextMetrics() [1/2]

TEXTMETRIC owl::TDC::GetTextMetrics ( ) const

Functional style overload.

Definition at line 382 of file dc.cpp.

References GetHDC(), and GetTextMetrics().

◆ GetTextMetrics() [2/2]

bool owl::TDC::GetTextMetrics ( TEXTMETRIC & metrics) const
inline

Fills the metrics structure with metrics data for the current font on this DC.

Returns true if the call is successful; otherwise, returns false.

Definition at line 3175 of file dc.h.

References GetAttributeHDC().

◆ GetViewportExt() [1/2]

TSize owl::TDC::GetViewportExt ( ) const
inline

The first version retrieves this DC's current viewport's x- and y-extents (in device units) and places the values in extent.

This version returns true if the call is successful; otherwise, it returns false. The second version returns only these x- and y-extents. The extent value determines the amount of stretching or compression needed in the logical coordinate system to fit the device coordinate system. extent also determines the relative orientation of the two coordinate systems.

Definition at line 1345 of file dc.h.

References GetAttributeHDC().

◆ GetViewportExt() [2/2]

bool owl::TDC::GetViewportExt ( TSize & extent) const
inline

The first version retrieves this DC's current viewport's x- and y-extents (in device units) and places the values in extent.

This version returns true if the call is successful; otherwise, it returns false. The second version returns only these x- and y-extents. The extent value determines the amount of stretching or compression needed in the logical coordinate system to fit the device coordinate system. extent also determines the relative orientation of the two coordinate systems.

Definition at line 1330 of file dc.h.

References GetAttributeHDC().

◆ GetViewportOrg() [1/2]

TPoint owl::TDC::GetViewportOrg ( ) const
inline

The first version sets in the point argument the x- and y-extents (in device-units) of this DC's viewport.

It returns true if the call is successful; otherwise, it returns false. The second version returns the x- and y-extents (in device-units) of this DC's viewport.

Definition at line 1314 of file dc.h.

References GetAttributeHDC().

◆ GetViewportOrg() [2/2]

bool owl::TDC::GetViewportOrg ( TPoint & point) const
inline

The first version sets in the point argument the x- and y-extents (in device-units) of this DC's viewport.

It returns true if the call is successful; otherwise, it returns false. The second version returns the x- and y-extents (in device-units) of this DC's viewport.

Definition at line 1303 of file dc.h.

References GetAttributeHDC().

◆ GetWindowExt() [1/2]

TSize owl::TDC::GetWindowExt ( ) const
inline

Retrieves this DC's window current x- and y-extents (in device units).

The first version places the values in extent and returns true if the call is successful; otherwise, it returns false. The second version returns the current extent values. The extent value determines the amount of stretching or compression needed in the logical coordinate system to fit the device coordinate system. extent also determines the relative orientation of the two coordinate systems.

Definition at line 1393 of file dc.h.

References GetAttributeHDC().

◆ GetWindowExt() [2/2]

bool owl::TDC::GetWindowExt ( TSize & extent) const
inline

Retrieves this DC's window current x- and y-extents (in device units).

The first version places the values in extent and returns true if the call is successful; otherwise, it returns false. The second version returns the current extent values. The extent value determines the amount of stretching or compression needed in the logical coordinate system to fit the device coordinate system. extent also determines the relative orientation of the two coordinate systems.

Definition at line 1380 of file dc.h.

References GetAttributeHDC().

◆ GetWindowOrg() [1/2]

TPoint owl::TDC::GetWindowOrg ( ) const
inline

Places in point the x- and y-coordinates of the origin of the window associated with this DC.

Returns true if the call is successful; otherwise, returns false.

Definition at line 1365 of file dc.h.

References GetAttributeHDC().

◆ GetWindowOrg() [2/2]

bool owl::TDC::GetWindowOrg ( TPoint & point) const
inline

Places in point the x- and y-coordinates of the origin of the window associated with this DC.

Returns true if the call is successful; otherwise, returns false.

Definition at line 1356 of file dc.h.

References GetAttributeHDC().

◆ GrayString()

bool owl::TDC::GrayString ( const TBrush & brush,
GRAYSTRINGPROC outputFunc,
const tstring & str,
int count,
const TRect & rect )
virtual

Draws in the given rectangle (r) up to count characters of gray text from string using the given brush, brush, and the current font for this DC.

If count is -1 and string is null-terminated, the whole string is written. The rectangle must be specified in logical units. If brush is 0, the text is grayed with the same brush used to draw window text on this DC. Gray text is primarily used to indicate disabled commands and menu items. GrayString writes the selected text to a memory bitmap, grays the bitmap, then displays the result. The graying is performed regardless of the current brush and background color. The outputFunc pointer to a function can specify the procedure instance of an application-supplied drawing function and is defined as

If outputFunc is 0, GrayString uses TextOut and string is assumed to be a normal, null-terminated character string. If string cannot be handled by TextOut (for example, the string is stored as a bitmap), you must provide a suitable drawing function via outputFunc. If the device supports a solid gray color, it is possible to draw gray strings directly without using GraySring. Call GetSysColor to find the color value; for example, G of COLOR_GRAYTEXT. If G is nonzero (non-black), you can set the text color with SetTextColor(G) and then use any convenient text-drawing function. GrayString returns true if the call is successful; otherwise, it returns false. Failure can result if TextOut or outputFunc return false, or if there is insufficient memory to create the bitmap.

Definition at line 835 of file dc.cpp.

References GetHDC().

◆ Init()

void owl::TDC::Init ( )
protected

Sets OrgBrush, OrgPen, OrgFont, OrgBitmap, and OrgPalette to 0, and sets ShouldDelete to true.

This function is for internal use by the TDC constructors.

Definition at line 21 of file dc.cpp.

◆ IntersectClipRect()

int owl::TDC::IntersectClipRect ( const TRect & rect)
inline

Creates a new clipping region for this DC's window by forming the intersection of the current region with the rectangle specified by rect.

The return value indicates the resulting clipping region's type as follows:

  • COMPLEXREGION Clipping Region has overlapping borders.
  • ERROR Invalid DC.
  • NULLREGION Clipping region is empty.
  • SIMPLEREGION Clipping region has no overlapping borders.

Definition at line 1506 of file dc.h.

References GetHDC().

◆ InvertRect() [1/2]

bool owl::TDC::InvertRect ( const TRect & rect)
inline

Inverts the given rectangle, rect, on this DC.

On monochrome displays, black-and-white pixels are interchanged. On color displays, inversion depends on how the colors are generated for particular displays. Calling InvertRect an even number of times restores the original colors. InvertRect returns true if the call is successful; otherwise, it returns false.

Definition at line 1841 of file dc.h.

References GetHDC(), and InvertRect().

◆ InvertRect() [2/2]

bool owl::TDC::InvertRect ( int x1,
int y1,
int x2,
int y2 )
inline

Inverts the given rectangle, rect, on this DC.

On monochrome displays, black-and-white pixels are interchanged. On color displays, inversion depends on how the colors are generated for particular displays. Calling InvertRect an even number of times restores the original colors. InvertRect returns true if the call is successful; otherwise, it returns false.

Note
Rect must be normalized for inverRect

Definition at line 1827 of file dc.h.

References GetHDC(), and InvertRect().

◆ InvertRgn()

bool owl::TDC::InvertRgn ( const TRegion & region)
inline

Inverts the given region, on this DC.

On monochrome displays, black-and-white pixels are interchanged. On color displays, inversion depends on how the colors are generated for particular displays. Calling InvertRegion an even number (n>=2 ) of times restores the original colors. Returns true if the call is successful; otherwise, it returns false.

Definition at line 1944 of file dc.h.

References GetHDC().

◆ IsDC()

bool owl::TDC::IsDC ( ) const
inline

Validation routine - used mainly for diagnostic purposes.

Attempt to validate the device context handle and return true if the validation succeeded, or false otherwise.

Definition at line 990 of file dc.h.

References GetHDC().

◆ LineTo() [1/2]

bool owl::TDC::LineTo ( const TPoint & point)
inline

Draws a line on this DC using the current pen object.

The line is drawn from the current position up to, but not including, the given end point, which is specified by (x, y) or by point. If the call is successful, LineTo returns true and the current point is reset to point; otherwise, it returns false.

Definition at line 2159 of file dc.h.

References GetHDC().

◆ LineTo() [2/2]

bool owl::TDC::LineTo ( int x,
int y )
inline

Draws a line on this DC using the current pen object.

The line is drawn from the current position up to, but not including, the given end point, which is specified by (x, y) or by point. If the call is successful, LineTo returns true and the current point is reset to point; otherwise, it returns false.

Definition at line 2148 of file dc.h.

References GetHDC().

◆ LPtoDP() [1/2]

bool owl::TDC::LPtoDP ( TPoint * points,
int count = 1 ) const
inline

Converts each of the count points in the points array from logical points to device points.

The conversion depends on this DC's current mapping mode and the settings of its window and viewport origins and extents. Returns true if the call is successful; otherwise, it returns false.

Definition at line 1423 of file dc.h.

References GetAttributeHDC().

◆ LPtoDP() [2/2]

bool owl::TDC::LPtoDP ( TRect & rect) const
inline

Converts each of the count points in the points array from logical points to device points.

The conversion depends on this DC's current mapping mode and the settings of its window and viewport origins and extents. Returns true if the call is successful; otherwise, it returns false.

Definition at line 1434 of file dc.h.

References GetAttributeHDC().

◆ MaskBlt()

bool owl::TDC::MaskBlt ( const TRect & dst,
const TDC & srcDC,
const TPoint & src,
const TBitmap & maskBm,
const TPoint & maskPos,
uint32 rop = SRCCOPY )
inline

Copies a bitmap from the given source DC to this DC.

MaskBlt combines the color data from source and destination bitmaps using the given mask and raster operation. The srcDC argument specifies the DC from which the source bitmap will be copied. The destination bitmap is given by the rectangle, dst. The source bitmap has the same width and height as dst. The src argument specifies the logical coordinates of the upper left corner of the source bitmap. The maskBm argument specifies a monochrome mask bitmap. An error will occur if maskBm is not monochrome. The maskPos argument gives the upper left corner coordinates of the mask. The raster-operation code, rop, specifies how the source, mask, and destination bitmaps combine to produce the new destination bitmap. The raster-operation codes are as follows:

  • BLACKNESS Fill dst with index-0 color of physical palette (default is black).
  • DSTINVERT Invert dst.
  • MERGECOPY Merge the colors of source with mask with Boolean AND.
  • MERGEPAINT Merge the colors of inverted-source with the colors of dst using Boolean OR.
  • NOTSRCCOPY Copy inverted-source to dst.
  • NOTSRCERASE Combine the colors of source and dst using Boolean OR, then invert result.
  • PATCOPY Copy mask to dst.
  • PATINVERT Combine the colors of mask with the colors of dst using Boolean XOR.
  • PATPAINT Combine the colors of mask with the colors of inverted-source using Boolean OR, then combine the result with the colors of dst using Boolean OR.
  • SRCAND Combine the colors of source and dst using the Boolean AND.
  • SRCCOPY Copy source directly to dst.
  • SRCERASE Combine the inverted colors of dst with the colors of source using Boolean AND.
  • SRCPAINT Combine the colors of source and dst using Boolean OR.
  • WHITENESS Fill dst with index-1 color of physical palette (default is white).

If rop indicates an operation that excludes the source bitmap, the srcDC argument must be 0. A value of 1 in the mask indicates that the destination and source pixel colors should be combined using the high-order word of rop. A value of 0 in the mask indicates that the destination and source pixel colors should be combined using the low-order word of rop. If the mask rectangle is smaller than dst, the mask pattern will be suitably duplicated. When recording an enhanced metafile, an error occurs if the source DC identifies the enhanced metafile DC. If a rotation or shear transformation is in effect for the source DC when MaskBlt is called, an error occurs. Other transformations are allowed. If necessary, MaskBlt will adjust the destination and mask color formats to match that of the source bitmaps. Before using MaskBlt, an application should call GetDeviceCaps to determine if the source and destination DCs support MaskBlt. MaskBlt returns true if the call is successful; otherwise, it returns false.

Definition at line 2576 of file dc.h.

References GetHDC().

◆ ModifyWorldTransform()

bool owl::TDC::ModifyWorldTransform ( XFORM & xform,
uint32 mode )
inline

Changes the current world transformation for this DC using the given xform and mode arguments.

mode determines how the given XFORM structure is applied, as listed below:

  • MWT_IDENTITY Resets the current world transformation using the identity matrix. If this mode is specified, the XFORM structure pointed to by lpXform is ignored.
  • MWT_LEFTMULTIPLY Multiplies the current transformation by the data in the XFORM structure. (The data in the XFORM structure becomes the left multiplicand, and the data for the current transformation becomes the right multiplicand.)
  • MWT_RIGHTMULTIPLY Multiplies the current transformation by the data in the XFORM structure. (The data in the XFORM structure becomes the right multiplicand, and the data for the current transformation becomes the left multiplicand.) ModifyWorldTransform returns true if the call is successful; otherwise, it returns false.

Definition at line 1289 of file dc.h.

References GetAttributeHDC(), GetHDC(), and ModifyWorldTransform().

◆ MoveTo() [1/3]

bool owl::TDC::MoveTo ( const TPoint & point)
inline

Moves the current position of this DC to the given x- and y-coordinates or to the given point.

The third version sets the previous current position in oldPoint. Returns true if the call is successful; otherwise, returns false.

Definition at line 1700 of file dc.h.

References GetHDC().

◆ MoveTo() [2/3]

bool owl::TDC::MoveTo ( const TPoint & point,
TPoint & OldPoint )
inline

Moves the current position of this DC to the given x- and y-coordinates or to the given point.

The third version sets the previous current position in oldPoint. Returns true if the call is successful; otherwise, returns false.

Definition at line 1710 of file dc.h.

References GetHDC().

◆ MoveTo() [3/3]

bool owl::TDC::MoveTo ( int x,
int y )
inline

Moves the current position of this DC to the given x- and y-coordinates or to the given point.

The third version sets the previous current position in oldPoint. Returns true if the call is successful; otherwise, returns false.

Definition at line 1690 of file dc.h.

References GetHDC().

◆ OffsetClipRgn()

int owl::TDC::OffsetClipRgn ( const TPoint & delta)
inline

Moves the clipping region of this DC by the x- and y-offsets specified in delta.

The return value indicates the resulting clipping region's type as follows:

  • COMPLEXREGION Clipping region has overlapping borders.
  • ERROR Invalid DC.
  • NULLREGION Clipping region is empty.
  • SIMPLEREGION Clipping region has no overlapping borders.

Definition at line 1519 of file dc.h.

References GetHDC().

◆ OffsetViewportOrg()

bool owl::TDC::OffsetViewportOrg ( const TPoint & delta,
TPoint * oldOrg = 0 )
virtual

Modifies this DC's viewport origin relative to the current values.

The delta x- and y-components are added to the previous origin and the resulting point becomes the new viewport origin. The previous origin is saved in oldOrg. Returns true if the call is successful; otherwise, returns false.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 458 of file dc.cpp.

References GetAttributeHDC(), and GetHDC().

◆ OffsetWindowOrg()

bool owl::TDC::OffsetWindowOrg ( const TPoint & delta,
TPoint * oldOrg = 0 )

Modifies this DC's window origin relative to the current values.

The delta x- and y-components are added to the previous origin and the resulting point becomes the new window origin. The previous origin is saved in oldOrg. Returns true if the call is successful; otherwise, returns false.

Definition at line 520 of file dc.cpp.

References GetAttributeHDC(), and GetHDC().

◆ operator HDC()

owl::TDC::operator HDC ( ) const
inline

Must assume const is OK.

Return the handle of the device context.

Typecasting operator. Converts a pointer to type HDC (the data type representing the handle to a DC).

Definition at line 973 of file dc.h.

◆ OWLFastWindowFrame()

void owl::TDC::OWLFastWindowFrame ( TBrush & brush,
TRect & r,
int xThick,
int yThick,
uint32 rop = PATCOPY )

Draws a frame of the specified size and thickness with the given brush.

The old brush is restored after completion.

Definition at line 331 of file dc.cpp.

References PatBlt(), RestoreBrush(), and SelectObject().

◆ PaintFrame()

void owl::TDC::PaintFrame ( const TRect & fr,
uint flags,
const TColor & tlColor,
const TColor & brColor )

◆ PaintRgn()

bool owl::TDC::PaintRgn ( const TRegion & region)
inline

Paints the given rectangle using the currently selected brush for this DC.

The rectangle can be specified by its upper left coordinates (x, y), width w, and height h, or by a single TRect argument. The raster-operation code, rop, determines how the brush and surface color(s) are combined, as explained in the following table:

  • PATCOPY Copies pattern to destination bitmap.
  • PATINVERT Combines destination bitmap with pattern using the Boolean OR operator.
  • DSTINVERT Inverts the destination bitmap.
  • BLACKNESS Turns all output to binary 0s.
  • WHITENESS Turns all output to binary 1s.

The allowed values of rop for this function are a limited subset of the full 256 ternary raster-operation codes; in particular, an operation code that refers to a source cannot be used with PatBlt. Not all devices support the PatBlt function, so applications should call TDC::GetDeviceCaps to check the features supported by this DC. PatBlt returns true if the call is successful; otherwise, returns false.

Definition at line 1969 of file dc.h.

References GetHDC().

◆ PatBlt() [1/2]

bool owl::TDC::PatBlt ( const TRect & dst,
uint32 rop = PATCOPY )
inline

Definition at line 2454 of file dc.h.

References GetHDC().

◆ PatBlt() [2/2]

bool owl::TDC::PatBlt ( int x,
int y,
int w,
int h,
uint32 rop = PATCOPY )
inline

Definition at line 2448 of file dc.h.

References GetHDC().

◆ PathToRegion()

HRGN owl::TDC::PathToRegion ( )
inline

If successful, returns a region created from the closed path in this DC; otherwise, returns 0.

Definition at line 3466 of file dc.h.

References GetHDC().

◆ Pie() [1/2]

bool owl::TDC::Pie ( const TRect & rect,
const TPoint & start,
const TPoint & end )
inline

Using the currently selected pen and brush objects, draws and fills a pie-shaped wedge by drawing an elliptical arc whose center and end points are joined by lines.

The center of the ellipse is the center of the rectangle specified either by (x1, y1)/(x2, y2) or by the rect argument. The starting/ending points of pie are specified either by (x3, y3)/(x4, y4) or by the points Start and End. Returns true if the call is successful; otherwise, returns false. The current position is neither used nor altered by this call.

Definition at line 2089 of file dc.h.

References GetHDC().

◆ Pie() [2/2]

bool owl::TDC::Pie ( int x1,
int y1,
int x2,
int y2,
int x3,
int y3,
int x4,
int y4 )
inline

Using the currently selected pen and brush objects, draws and fills a pie-shaped wedge by drawing an elliptical arc whose center and end points are joined by lines.

The center of the ellipse is the center of the rectangle specified either by (x1, y1)/(x2, y2) or by the rect argument. The starting/ending points of pie are specified either by (x3, y3)/(x4, y4) or by the points Start and End. Returns true if the call is successful; otherwise, returns false. The current position is neither used nor altered by this call.

Definition at line 2075 of file dc.h.

References GetHDC().

◆ PlayEnhMetaFile()

bool owl::TDC::PlayEnhMetaFile ( const TEnhMetaFilePict & metaFile,
const TRect * rect )
inline

Play the enhanced metafile onto this device context.

Definition at line 1662 of file dc.h.

References GetHDC().

◆ PlayEnhMetaFileRecord()

void owl::TDC::PlayEnhMetaFileRecord ( HANDLETABLE & handletable,
ENHMETARECORD & metaRecord,
uint count )
inline

Play one record from the enhanced metafile onto this DC.

Definition at line 1670 of file dc.h.

References GetHDC(), and PlayEnhMetaFileRecord().

◆ PlayMetaFile()

bool owl::TDC::PlayMetaFile ( const TMetaFilePict & metafile)
inline

Plays the contents of the given metaFile on this DC.

The metafile can be played any number of times. Returns true if the call is successful; otherwise, returns false.

Definition at line 1634 of file dc.h.

References GetHDC().

◆ PlayMetaFileRecord()

void owl::TDC::PlayMetaFileRecord ( HANDLETABLE & handletable,
METARECORD & metaRecord,
int count )
inline

Plays the metafile record given in metaRecord to this DC by executing the GDI function call contained in that record.

Handletable specifies the object handle table to be used. count specifies the number of handles in the table.

Definition at line 1644 of file dc.h.

References GetHDC(), and PlayMetaFileRecord().

◆ PlgBlt()

bool owl::TDC::PlgBlt ( const TPoint * points,
const TDC & srcDC,
const TRect & src,
const TBitmap & maskBm,
const TPoint & maskPos )
inline

Performs a bit-block transfer from the given source DC to this DC.

Color bits are copied from the src rectangle on srcDC, the source DC, to the parallelogram dst on this DC. The dst array specifies three points A,B, and C as the corners of the destination parallelogram. The fourth point D is generated internally from the vector equation D = B + C - A. The upper left corner of src is mapped to A, the upper right corner to B, the lower left corner to C, and the lower right corner to D. An optional monochrome bitmap can be specified by the maskBm argument. (If maskBm specifies a valid monochrome bitmap, PlgBlt uses it to mask the colorbits in the source rectangle. An error occurs if maskBm is not a monochrome bitmap.) maskPos specifies the upper left corner coordinates of the mask bitmap. With a valid maskBm, a value of 1 in the mask causes the source color pixel to be copied to dst; a value of 0 in the mask indicates that the corresponding color pixel in dst will not be changed. If the mask rectangle is smaller than dst, the mask pattern will be suitably duplicated. The destination coordinates are transformed according to this DC (the destination DC). The source coordinates are transformed according to the source DC. If a rotation or shear transformation is in effect for the source DC when PlgBlt is called, an error occurs. Other transformations, such as scaling, translation, and reflection are allowed. The stretching mode of this DC (the destination DC) determines how PlgBlt will stretch or compress the pixels if necessary. When recording an enhanced metafile, an error occurs if the source DC identifies the enhanced metafile DC. If necessary, PlgBlt adjusts the source color formats to match that of the destination. An error occurs if the source and destination DCs are incompatible. Before using PlgBlt, an application should call GetDeviceCaps to determine if the source and destination DCs are compatible. PlgBlt returns true if the call is successful; otherwise, it returns false.

Definition at line 2615 of file dc.h.

References GetHDC().

◆ PolyBezier()

bool owl::TDC::PolyBezier ( const TPoint * points,
int count )
inline

Draws one or more connected cubic Bezier splines through the points specified in the points array using the currently selected pen object.

The first spline is drawn from the first to the fourth point of the array using the second and third points as controls. Subsequent splines, if any, each require three additional points in the array, since the previous end point is taken as the next spline's start point. The count argument ( >= 4 ) specifies the total number of points needed to specify the complete drawing. To draw n splines, count must be set to (3n + 1). Returns true if the call is successful; otherwise, returns false. The current position is neither used nor altered by this call. The resulting figure is not filled.

Definition at line 2221 of file dc.h.

References GetHDC().

◆ PolyBezierTo()

bool owl::TDC::PolyBezierTo ( const TPoint * points,
int count )
inline

Draws one or more connected cubic Beziers splines through the points specified in the points array using the currently selected pen object.

The first spline is drawn from the current position to the third point of the array using the first and second points as controls. Subsequent splines, if any, each require three additional points in the array, since the previous end point is taken as the next spline's start point. The count argument ( >= 4 ) specifies the total number of points needed to specify the complete drawing. To draw n splines, count must be set to 3n. Returns true if the call is successful; otherwise, returns false. The current position is moved to the end point of the final Bezier curve. The resulting figure is not filled.

Definition at line 2238 of file dc.h.

References GetHDC().

◆ PolyDraw()

bool owl::TDC::PolyDraw ( const TPoint * points,
uint8 * types,
int count )
inline

Using the currently selected pen object, draws one or more possibly disjoint sets of line segments or Bezier splines or both on this DC.

The count points in the points array provide the end points for each line segment or the end points and control points for each Bezier spline or both. The count BYTEs in the types array determine as follows how the corresponding point in points is to be interpreted:

  • PT_BEZIERTO This point is a control or end point for a Bezier spline. PT_BEZIERTO types must appear in sets of three: the current position is the Bezier start point; the first two PT_BEZIERTO points are the Bezier control points; and the third PT_BEZIERTO point is the Bezier end point, which becomes the new current point. An error occurs if the PT_BEZIERTO types do not appear in sets of three. An end-point PT_BEZIERTO can be bit-wise OR'd with PT_CLOSEFIGURE to indicate that the current figure is to be closed by drawing a spline from this end point to the start point of the most recent disjoint figure.
  • PT_CLOSEFIGURE Optional flag that can be bit-wise OR'd with PT_LINETO or PT_BEZIERTO, as explained above. Closure updates the current point to the new end point.
  • PT_LINETO A line is drawn from the current position to this point, which then becomes the new current point. PT_LINETO can be bit-wise OR'd with PT_CLOSEFIGURE to indicate that the current figure is to be closed by drawing a line segment from this point to the start point of the most recent disjoint figure.
  • PT_MOVETO This point starts a new (disjoint) figure and becomes the new current point.

PolyDraw is an alternative to consecutive calls to MoveTo, LineTo, Polyline, PolyBezier, and PolyBezierTo. If there is an active path invoked via BeginPath, PolyDraw will add to this path. Returns true if the call is successful; otherwise, returns false.

Definition at line 2274 of file dc.h.

References GetHDC().

◆ Polygon()

bool owl::TDC::Polygon ( const TPoint * points,
int count )
inline

Definition at line 2176 of file dc.h.

References GetHDC().

◆ Polyline()

bool owl::TDC::Polyline ( const TPoint * points,
int count )
inline

Using the current pen object, draws on this DC a count of line segments (there must be at least 2).

The points array specifies the sequence of points to be connected. The current position is neither used nor altered by Polyline. Returns true if the call is successful; otherwise, returns false.

Definition at line 2170 of file dc.h.

References GetHDC().

◆ PolylineTo()

bool owl::TDC::PolylineTo ( const TPoint * points,
int count )
inline

Draws one or more connected line segments on this DC using the currently selected pen object.

The first line is drawn from the current position to the first of the count points in the points array. Subsequent lines, if any, connect the remaining points in the array, with each end point providing the start point of the next segment. The final end point becomes the new current point. No filling occurs even if a closed figure is drawn. Returns true if the call is successful; otherwise, returns false.

Definition at line 2288 of file dc.h.

References GetHDC().

◆ PolyPolygon()

bool owl::TDC::PolyPolygon ( const TPoint * points,
const int * polyCounts,
int count )
inline

Using the current pen and polygon-filling mode, draws and fills on this DC the number of closed polygons indicated in count (which must be >= 2).

The polygons can overlap. The points array specifies the vertices of the polygons to be drawn. PolyCounts is an array of count integers specifying the number of vertices in each polygon. Each polygon must be a closed polygon. The current position is neither used nor altered by Polygon. Returns true if the call is successful; otherwise, returns false.

Definition at line 2190 of file dc.h.

References GetHDC().

◆ PolyPolyline()

bool owl::TDC::PolyPolyline ( const TPoint * points,
const int * polyCounts,
int count )
inline

Using the currently selected pen object, draws on this DC the number of polylines (connected line segments) indicated in count.

The resulting figures are not filled. The PolyCounts array provides count integers specifying the number of points (>= 2) in each polyline. The points array provides, consecutively, each of the points to be connected. Returns true if the call is successful; otherwise, returns false. The current position is neither used nor altered by this call.

Definition at line 2204 of file dc.h.

References GetHDC().

◆ PtVisible()

bool owl::TDC::PtVisible ( const TPoint & point) const
inline

Returns true if the given point lies within the clipping region of this DC; otherwise, returns false.

Definition at line 1542 of file dc.h.

References GetHDC().

◆ RealizePalette()

int owl::TDC::RealizePalette ( )
inline

Maps to the system palette the logical palette entries selected into this DC.

Returns the number of entries in the logical palette that were mapped to the system palette.

Definition at line 1054 of file dc.h.

References GetHDC().

◆ Rectangle() [1/4]

bool owl::TDC::Rectangle ( const TPoint & p1,
const TPoint & p2 )
inline

Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.

The current position is neither used nor altered by this call. Returns true if the call is successful; otherwise, returns false.

Definition at line 2308 of file dc.h.

References GetHDC().

◆ Rectangle() [2/4]

bool owl::TDC::Rectangle ( const TPoint & p,
const TSize & s )
inline

Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.

The current position is neither used nor altered by this call. Returns true if the call is successful; otherwise, returns false.

Definition at line 2318 of file dc.h.

References GetHDC().

◆ Rectangle() [3/4]

bool owl::TDC::Rectangle ( const TRect & rect)
inline

Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.

The current position is neither used nor altered by this call. Returns true if the call is successful; otherwise, returns false.

Definition at line 2328 of file dc.h.

References GetHDC().

◆ Rectangle() [4/4]

bool owl::TDC::Rectangle ( int x1,
int y1,
int x2,
int y2 )
inline

Draws and fills a rectangle of the given size on this DC with the current pen and brush objects.

The current position is neither used nor altered by this call. Returns true if the call is successful; otherwise, returns false.

Definition at line 2298 of file dc.h.

References GetHDC().

◆ RectVisible()

bool owl::TDC::RectVisible ( const TRect & rect) const
inline

Returns true if any part of the given rectangle, rect, lies within the clipping region of this DC; otherwise, returns false.

Definition at line 1551 of file dc.h.

References GetHDC().

◆ RemoveClipRgn()

int owl::TDC::RemoveClipRgn ( )
inline

Removes the device context's clipping region.

Has the same effect as calling SelectClipRgn with no argument (or NULL).

Definition at line 253 of file dc.h.

◆ ResetDC()

bool owl::TDC::ResetDC ( const DEVMODE & devMode)
virtual

Updates this DC using data in the given devMode structure.

Returns true if the call is successful; otherwise, returns false.

Definition at line 395 of file dc.cpp.

References GetHDC().

◆ RestoreBitmap()

void owl::TDC::RestoreBitmap ( )

Restores the original GDI bitmap object into this DC.

Definition at line 272 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), SelectObject(), and TRACEX.

◆ RestoreBrush()

void owl::TDC::RestoreBrush ( )

Restores the original GDI brush object to this DC.

Definition at line 233 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), SelectObject(), and TRACEX.

◆ RestoreDC()

bool owl::TDC::RestoreDC ( int savedIndex = -1)
virtual

Restores the given savedDC.

Returns true if the context is successfully restored; otherwise, returns false.

Definition at line 362 of file dc.cpp.

References GetHDC().

◆ RestoreFont()

void owl::TDC::RestoreFont ( )
virtual

Restores the original GDI font object to this DC.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 246 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), SelectObject(), and TRACEX.

◆ RestoreObjects()

void owl::TDC::RestoreObjects ( )

Restores all the original GDI objects to this DC.

Definition at line 298 of file dc.cpp.

References Handle, RestoreBitmap(), RestoreBrush(), RestoreFont(), RestorePalette(), RestorePen(), and RestoreTextBrush().

◆ RestorePalette()

void owl::TDC::RestorePalette ( )

Restores the original GDI palette object to this DC.

Definition at line 259 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), and TRACEX.

◆ RestorePen()

void owl::TDC::RestorePen ( )

Restores the original GDI pen object to this DC.

Definition at line 220 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), SelectObject(), and TRACEX.

◆ RestoreTextBrush()

void owl::TDC::RestoreTextBrush ( )

Restores the original GDI text brush object to this DC.

Definition at line 285 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), SelectObject(), and TRACEX.

◆ RoundRect() [1/4]

bool owl::TDC::RoundRect ( const TPoint & p,
const TSize & s,
const TPoint & rad )
inline

Draws and fills a rounded rectangle of the given size on this DC with the current pen and brush objects.

The current position is neither used nor altered by this call. Returns true if the call is successful; otherwise, returns false.

Definition at line 2358 of file dc.h.

References GetHDC().

◆ RoundRect() [2/4]

bool owl::TDC::RoundRect ( const TPoint & p1,
const TPoint & p2,
const TPoint & rad )
inline

Draws and fills a rounded rectangle of the given size on this DC with the current pen and brush objects.

The current position is neither used nor altered by this call. Returns true if the call is successful; otherwise, returns false.

Definition at line 2348 of file dc.h.

References GetHDC().

◆ RoundRect() [3/4]

bool owl::TDC::RoundRect ( const TRect & rect,
const TPoint & rad )
inline

Draws and fills a rounded rectangle of the given size on this DC with the current pen and brush objects.

The current position is neither used nor altered by this call. Returns true if the call is successful; otherwise, returns false.

Definition at line 2368 of file dc.h.

References GetHDC().

◆ RoundRect() [4/4]

bool owl::TDC::RoundRect ( int x1,
int y1,
int x2,
int y2,
int x3,
int y3 )
inline

Draws and fills a rounded rectangle of the given size on this DC with the current pen and brush objects.

The current position is neither used nor altered by this call. Returns true if the call is successful; otherwise, returns false.

Definition at line 2338 of file dc.h.

References GetHDC().

◆ SaveDC()

int owl::TDC::SaveDC ( ) const
virtual

Saves the current state of this DC on a context stack.

The saved state can be restored later with RestoreDC. Returns a value specifying the saved DC or 0 if the call fails.

Definition at line 352 of file dc.cpp.

References GetHDC().

◆ ScaleViewportExt()

bool owl::TDC::ScaleViewportExt ( int xNum,
int xDenom,
int yNum,
int yDenom,
TSize * oldExtent = 0 )
virtual

Modifies this DC's viewport extents relative to the current values.

The new extents are derived as follows:

The previous extents are saved in oldExtent. Returns true if the call is successful; otherwise, returns false.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 492 of file dc.cpp.

References GetAttributeHDC(), and GetHDC().

◆ ScaleWindowExt()

bool owl::TDC::ScaleWindowExt ( int xNum,
int xDenom,
int yNum,
int yDenom,
TSize * oldExtent = 0 )
virtual

Modifies this DC's window extents relative to the current values.

The new extents are derived as follows:

The previous extents are saved in oldExtent. Returns true if the call is successful; otherwise, returns false.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 554 of file dc.cpp.

References GetAttributeHDC(), and GetHDC().

◆ ScrollDC() [1/2]

bool owl::TDC::ScrollDC ( const TPoint & delta,
const TRect & scroll,
const TRect & clip,
TRegion & updateRgn,
TRect & updateRect )
inline

Scrolls a rectangle of bits horizontally by x (or delta.x in the second version) device-units, and vertically by y (or delta.y) device-units on this DC.

The scrolling and clipping rectangles are specified by scroll and clip. ScrollDC provides data in the updateRgn argument telling you the region (not necessarily rectangular) that was uncovered by the scroll. Similarly, ScrollDC reports in updateRect the rectangle (in client coordinates) that bounds the scrolling update region. This is the largest area that requires repainting. Returns true if the call is successful; otherwise, returns false.

Definition at line 2485 of file dc.h.

References GetHDC().

◆ ScrollDC() [2/2]

bool owl::TDC::ScrollDC ( int dx,
int dy,
const TRect & scroll,
const TRect & clip,
TRegion & updateRgn,
TRect & updateRect )
inline

Scrolls a rectangle of bits horizontally by x (or delta.x in the second version) device-units, and vertically by y (or delta.y) device-units on this DC.

The scrolling and clipping rectangles are specified by scroll and clip. ScrollDC provides data in the updateRgn argument telling you the region (not necessarily rectangular) that was uncovered by the scroll. Similarly, ScrollDC reports in updateRect the rectangle (in client coordinates) that bounds the scrolling update region. This is the largest area that requires repainting. Returns true if the call is successful; otherwise, returns false.

Definition at line 2469 of file dc.h.

References GetHDC().

◆ SelectClipPath()

bool owl::TDC::SelectClipPath ( int mode)
inline

Selects the current path on this DC as a clipping region, combining any existing clipping region using the specified mode as shown in the following table:

  • RGN_AND The new clipping region includes the overlapping areas of the current clipping region and the current path (intersection).
  • RGN_COPY The new clipping region is the current path.
  • RGN_DIFF The new clipping region includes the areas of the current clipping region with those of the current path excluded.
  • RGN_OR The new clipping region includes the combined areas of the current clipping region and the current path (union).
  • RGN_XOR The new clipping region includes the combined areas of the current clipping region and the current path but without the overlapping areas.

Returns true if the call is successful; otherwise, returns false.

Definition at line 3457 of file dc.h.

References GetHDC().

◆ SelectClipRgn() [1/2]

int owl::TDC::SelectClipRgn ( const TRegion & region)
inline

Selects the given region as the current clipping region for this DC.

A copy of the given region is used, letting you select the same region for other DC objects. The return value indicates the new clipping region's type as follows:

  • COMPLEXREGION Clipping Region has overlapping borders.
  • ERROR Invalid DC.
  • NULLREGION Clipping region is empty.
  • SIMPLEREGION Clipping region has no overlapping borders.

Definition at line 1533 of file dc.h.

References GetHDC().

◆ SelectClipRgn() [2/2]

int owl::TDC::SelectClipRgn ( HRGN r = 0)
inline

Selects the given region as the current clipping region for the device context.

The default argument 0 has the effect of removing the device context's clipping region.

Definition at line 247 of file dc.h.

◆ SelectObject() [1/5]

void owl::TDC::SelectObject ( const TBitmap & bitmap)

Selects the given GDI bitmap object into this DC.

The previously selected bitmap is saved in the protected data member OrgBitmap, and can be restored by a call to RestoreBitmap.

Definition at line 183 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), owl::TGdiObject::RefInc(), SelectObject(), and TRACEX.

◆ SelectObject() [2/5]

void owl::TDC::SelectObject ( const TBrush & brush)

Selects the given GDI brush object into this DC.

The previously selected brush is saved in the protected data member OrgBrush, and can be restored by a call to RestoreBrush.

Definition at line 113 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), owl::TGdiObject::RefInc(), SelectObject(), and TRACEX.

◆ SelectObject() [3/5]

void owl::TDC::SelectObject ( const TFont & font)
virtual

Selects the given GDI font object into this DC.

The previously selected font is saved in the protected data member OrgFont, and can be restored by a call to RestoreFont.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 135 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), owl::TGdiObject::RefInc(), SelectObject(), and TRACEX.

◆ SelectObject() [4/5]

void owl::TDC::SelectObject ( const TPalette & palette,
bool forceBackground = false )

Selects the given GDI palette object into this DC.

The previously selected palette is saved in the protected data member OrgPalette, and can be restored by a call to RestorePalette.

If forceBackgound is set to false (the default), the selected logical palette is a foreground palette when the window has input focus. If forceBackground is true, the selected palette is always a background palette, whether the window has focus or not.

Definition at line 161 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), owl::TGdiObject::RefInc(), and TRACEX.

◆ SelectObject() [5/5]

void owl::TDC::SelectObject ( const TPen & pen)

Selects the given GDI pen object into this DC.

The previously selected pen is saved in the protected data member OrgPen, and can be restored by a call to RestorePen.

Definition at line 91 of file dc.cpp.

References _T, GetHDC(), owl::TGdiObject::RefDec(), owl::TGdiObject::RefInc(), SelectObject(), and TRACEX.

◆ SelectStockObject()

void owl::TDC::SelectStockObject ( int index)
virtual

Selects into the DC a predefined stock pen, brush, font, or palette.

For more information about the available stock objects and their indexes, see MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/dd144925.aspx

Reimplemented in owl::TPrintPreviewDC.

Definition at line 206 of file dc.cpp.

References _T, GetHDC(), PRECONDITION, owl::TGdiObject::RefDec(), SelectObject(), and TRACEX.

◆ SetBkColor()

TColor owl::TDC::SetBkColor ( const TColor & color)
virtual

Sets the current background color of this DC to the given color value or the nearest available.

Returns 0x80000000 if the call fails.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 405 of file dc.cpp.

References GetAttributeHDC(), GetHDC(), and SetBkColor().

◆ SetBkMode()

int owl::TDC::SetBkMode ( int mode)
inline

Sets the background mode to the given mode argument, which can be either OPAQUE or TRANSPARENT.

Returns the previous background mode.

Definition at line 1116 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetBkMode().

◆ SetBoundsRect()

uint owl::TDC::SetBoundsRect ( TRect & bounds,
uint flags )
inline

Controls the accumulation of bounding rectangle information for this DC.

Depending on the value of flags, the given bounds rectangle (possibly NULL) can combine with or replace the existing accumulated rectangle. flags can be any appropriate combination of the following values:

  • DCB_ACCUMULATE Add bounds (rectangular union) to the current accumulated rectangle.
  • DCB_DISABLE Turn off bounds accumulation.
  • DCB_ENABLE Turn on bounds accumulation (the default setting for bounds accumulation is disabled).
  • DCB_RESET Set the bounding rectangle to empty.
  • DCB_SET Set the bounding rectangle to bounds.

There are two bounding-rectangle accumulations, one for Windows and one for the application. The Windows-accumulated bounds can be queried by an application but not altered. The application can both query and alter the DC's accumulated bounds.

Definition at line 1595 of file dc.h.

References GetHDC().

◆ SetBrushOrg()

bool owl::TDC::SetBrushOrg ( const TPoint & org,
TPoint * oldOrg = 0 )
inline

Sets the origin of the currently selected brush of this DC with the given origin value.

The previous origin is passed to oldOrg. Returns true if successful; otherwise, returns false.

Definition at line 1020 of file dc.h.

References GetHDC().

◆ SetDC()

void owl::TDC::SetDC ( HDC hdc)
inline

Definition at line 139 of file dc.h.

◆ SetDIBits() [1/2]

int owl::TDC::SetDIBits ( TBitmap & bitmap,
const TDib & dib )
inline

The first version sets the pixels in bitmap (the given destination bitmap on this DC) from the source DIB (device-independent bitmap) color data found in the byte array bits and the BITMAPINFO structure, Info.

numScan scanlines are taken from the DIB, starting at scanline startScan. The usage argument specifies how the bmiColors member of BITMAPINFO is interpreted, as explained in TDC::GetDIBits. In the second version of SetDIBits, the pixels are set in bitmap from the given source TDib argument. SetDIBits returns true if the call is successful; otherwise, it returns false.

Definition at line 2732 of file dc.h.

References GetHDC().

◆ SetDIBits() [2/2]

int owl::TDC::SetDIBits ( TBitmap & bitmap,
uint startScan,
uint numScans,
const void * bits,
const BITMAPINFO & info,
uint16 usage )
inline

The first version sets the pixels in bitmap (the given destination bitmap on this DC) from the source DIB (device-independent bitmap) color data found in the byte array bits and the BITMAPINFO structure, Info.

numScan scanlines are taken from the DIB, starting at scanline startScan. The usage argument specifies how the bmiColors member of BITMAPINFO is interpreted, as explained in TDC::GetDIBits. In the second version of SetDIBits, the pixels are set in bitmap from the given source TDib argument. SetDIBits returns true if the call is successful; otherwise, it returns false.

Definition at line 2712 of file dc.h.

References GetHDC().

◆ SetDIBitsToDevice() [1/2]

int owl::TDC::SetDIBitsToDevice ( const TRect & dst,
const TPoint & src,
const TDib & dib )
inline

The first version sets the pixels in dst (the given destination rectangle on this DC) from the source DIB (device-independent bitmap) color data found in the byte array bits and the BITMAPINFO structure, bitsInfo.

The DIB origin is specified by the point src. numScan scanlines are taken from the DIB, starting at scanline startScan. The usage argument determines how the bmiColors member of BITMAPINFO is interpreted, as explained in TDC::GetDIBits. In the second version of SetDIBitsToDevice, the pixels are set in dst from dib, the given source TDib argument. SetDIBitsToDevice returns true if the call is successful; otherwise, it returns false.

Definition at line 2776 of file dc.h.

References GetHDC().

◆ SetDIBitsToDevice() [2/2]

int owl::TDC::SetDIBitsToDevice ( const TRect & dst,
const TPoint & src,
uint startScan,
uint numScans,
const void * bits,
const BITMAPINFO & info,
uint16 usage )
inline

The first version sets the pixels in dst (the given destination rectangle on this DC) from the source DIB (device-independent bitmap) color data found in the byte array bits and the BITMAPINFO structure, bitsInfo.

The DIB origin is specified by the point src. numScan scanlines are taken from the DIB, starting at scanline startScan. The usage argument determines how the bmiColors member of BITMAPINFO is interpreted, as explained in TDC::GetDIBits. In the second version of SetDIBitsToDevice, the pixels are set in dst from dib, the given source TDib argument. SetDIBitsToDevice returns true if the call is successful; otherwise, it returns false.

Definition at line 2751 of file dc.h.

References GetHDC().

◆ SetMapMode()

int owl::TDC::SetMapMode ( int mode)
virtual

Sets the current window mapping mode of this DC to mode.

Returns the previous mapping mode value. The mapping mode defines how logical coordinates are mapped to device coordinates. It also controls the orientation of the device's x- and y-axes. See TDC::GetMapMode for a complete list of mapping modes.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 431 of file dc.cpp.

References GetAttributeHDC(), GetHDC(), and SetMapMode().

◆ SetMapperFlags()

uint32 owl::TDC::SetMapperFlags ( uint32 flag)
inline

Alters the algorithm used by the font mapper when mapping logical fonts to physical fonts on this DC.

If successful, the function sets the current font-mapping flag to flag and returns the previous mapping flag; otherwise GDI_ERROR is returned. The mapping flag determines whether the font mapper will attempt to match a font's aspect ratio to this DC's aspect ratio. If bit 0 of flag is set to 1, the mapper selects only matching fonts. If no matching fonts exist, a new aspect ratio is chosen and a font is retrieved to match this ratio.

Definition at line 3261 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetMapperFlags().

◆ SetMiterLimit()

bool owl::TDC::SetMiterLimit ( float newLimit,
float * oldLimit = 0 )
inline

Sets the limit of miter joins to newLimit and puts the previous value in oldLimit.

Returns true if successful; otherwise, returns false.

Definition at line 1255 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetMiterLimit().

◆ SetPixel() [1/2]

TColor owl::TDC::SetPixel ( const TPoint & p,
const TColor & color )
inline

Sets the color of the pixel at the given location to the given color and returns the pixel's previous color.

Definition at line 2403 of file dc.h.

References GetHDC().

◆ SetPixel() [2/2]

TColor owl::TDC::SetPixel ( int x,
int y,
const TColor & color )
inline

Sets the color of the pixel at the given location to the given color and returns the pixel's previous color.

Definition at line 2394 of file dc.h.

References GetHDC().

◆ SetPolyFillMode()

int owl::TDC::SetPolyFillMode ( int mode)
inline

Description Sets the polygon-filling mode for this DC to the given mode value, either ALTERNATE or WINDING.

Returns the previous fill mode.

Definition at line 1137 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetPolyFillMode().

◆ SetROP2()

int owl::TDC::SetROP2 ( int mode)
inline

Sets the current foreground mix mode mode of this DC to the given mode value and returns the previous mode.

The mode argument determines how the brush, pen, and existing screen image combine when filling and drawing. mode can be one of the following values:

  • R2_BLACK Pixel is always binary 0.
  • R2_COPYPEN Pixel is the pen color.
  • R2_MASKNOTPEN Pixel is a combination of the colors common to both the display and the inverse of the pen.
  • R2_MASKPEN Pixel is a combination of the colors common to both the pen and the display.
  • R2_MASKPENNOT Pixel is a combination of the colors common to both the pen and the inverse of the display.
  • R2_MERGEPEN Pixel is a combination of the pen color and the display color.
  • R2_MERGENOTPEN Pixel is a combination of the display color and the inverse of the pen color.
  • R2_MERGEPENNOT Pixel is a combination of the pen color and the inverse of the display color.
  • R2_NOP Pixel remains unchanged.
  • R2_NOT Pixel is the inverse of the display color.
  • R2_NOTCOPYPEN Pixel is the inverse of the pen color.
  • R2_NOTMASKPEN Pixel is the inverse of the R2_MASKPEN color.
  • R2_NOTMERGEPEN Pixel is the inverse of the R2_MERGEPEN color.
  • R2_NOTXORPEN Pixel is the inverse of the R2_XORPEN color.
  • R2_WHITE Pixel is always binary 1.
  • R2_XORPEN Pixel is a combination of the colors in the pen and in the display, but not in both.

Definition at line 1180 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetROP2().

◆ SetStretchBltMode()

int owl::TDC::SetStretchBltMode ( int mode)
inline

Sets the stretching mode of this DC to the given mode value and returns the previous mode.

The mode argument (BLACKONWHITE, COLORONCOLOR, or WHITEONBLACK) defines which scan lines or columns or both are eliminated by TDC::StretchBlt.

Definition at line 1202 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetStretchBltMode().

◆ SetSystemPaletteUse()

int owl::TDC::SetSystemPaletteUse ( int usage)
inline

Changes the usage of this DC's system palette.

The usage argument can be SYSPAL_NOSTATIC or SYSPAL_STATIC. Returns the previous usage value.

Definition at line 1091 of file dc.h.

References GetHDC().

◆ SetTextAlign()

uint owl::TDC::SetTextAlign ( uint flags)
inline

Sets the text-alignment flags for this DC.

If successful, SetTextAlign returns the previous text-alignment flags; otherwise, it returns GDI_ERROR. The flag values are as listed for the TDC::GetTextAlign function. The text-alignment flags determine how TDC::TextOut and TDC::ExtTextOut align text strings in relation to the first character's screen position.

Definition at line 3106 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetTextAlign().

◆ SetTextCharacterExtra()

int owl::TDC::SetTextCharacterExtra ( int extra)
inline

If successful, sets the current intercharacter spacing to extra, in logical units, for this DC, and returns the previous intercharacter spacing.

Otherwise, returns 0. If the current mapping mode is not MM_TEXT, the extra value is transformed and rounded to the nearest pixel.

Definition at line 3128 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetTextCharacterExtra().

◆ SetTextColor()

TColor owl::TDC::SetTextColor ( const TColor & color)
virtual

Sets the current text color of this DC to the given color value.

The text color determines the color displayed by TDC::TextOut and TDC::ExtTextOut.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 417 of file dc.cpp.

References GetAttributeHDC(), GetHDC(), and SetTextColor().

◆ SetTextJustification()

bool owl::TDC::SetTextJustification ( int breakExtra,
int breakCount )
inline

When text strings are displayed using TDC::TextOut and TDC::ExtTextOut, sets the number of logical units specified in breakExtra as the total extra space to be added to the number of break characters specified in breakCount.

The extra space is distributed evenly between the break characters. The break character is usually ASCII 32 (space), but some fonts define other characters. TDC::GetTextMetrics can be used to retrieve the value of the break character. If the current mapping mode is not MM_TEXT, the extra value is transformed and rounded to the nearest pixel. SetTextJustification returns true if the call is successful; otherwise, it returns false.

Definition at line 3147 of file dc.h.

References GetAttributeHDC().

◆ SetViewportExt()

bool owl::TDC::SetViewportExt ( const TSize & extent,
TSize * oldExtent = 0 )
virtual

Sets this DC's viewport x- and y-extents to the given extent values.

The previous extents are saved in oldExtent. Returns true if the call is successful; otherwise, returns false. The extent value determines the amount of stretching or compression needed in the logical coordinate system to fit the device coordinate system. extent also determines the relative orientation of the two coordinate systems.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 474 of file dc.cpp.

References GetAttributeHDC(), and GetHDC().

◆ SetViewportOrg()

bool owl::TDC::SetViewportOrg ( const TPoint & point,
TPoint * oldOrg = 0 )
virtual

Sets this DC's viewport origin to the given origin value, and saves the previous origin in oldOrg.

Returns true if the call is successful; otherwise, returns false.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 444 of file dc.cpp.

References GetAttributeHDC(), and GetHDC().

◆ SetWindowExt()

bool owl::TDC::SetWindowExt ( const TSize & extent,
TSize * oldExtent = 0 )
virtual

Sets this DC's window x- and y-extents to the given extent values.

The previous extents are saved in oldExtent. Returns true if the call is successful; otherwise, returns false. The extent value determines the amount of stretching or compression needed in the logical coordinate system to fit the device coordinate system. extent also determines the relative orientation of the two coordinate systems.

Reimplemented in owl::TPrintPreviewDC.

Definition at line 536 of file dc.cpp.

References GetAttributeHDC(), and GetHDC().

◆ SetWindowOrg()

bool owl::TDC::SetWindowOrg ( const TPoint & point,
TPoint * oldOrg = 0 )

Sets the origin of the window associated with this DC to the given origin value, and saves the previous origin in oldOrg.

Returns true if the call is successful; otherwise, returns false.

Definition at line 506 of file dc.cpp.

References GetAttributeHDC(), and GetHDC().

◆ SetWorldTransform()

bool owl::TDC::SetWorldTransform ( XFORM & xform)
inline

Sets a two-dimensional linear transformation, given by the xform structure, between world space and page space for this DC.

Returns true if the call is successful; otherwise, returns false.

Definition at line 1267 of file dc.h.

References GetAttributeHDC(), GetHDC(), and SetWorldTransform().

◆ StretchBlt() [1/2]

bool owl::TDC::StretchBlt ( const TRect & dst,
const TDC & srcDC,
const TRect & src,
uint32 rop = SRCCOPY )
inline

Copies a bitmap from the source DC to a destination rectangle on this DC specified either by upper left-corner coordinates (dstX, dstY), width dstW, and height dstH, or (in the second version) by a TRect object, dst.

The source bitmap is similarly specified with (srcX, srcY), srcW, and srcH, or by a TRect object, src. StretchBlt stretches or compresses the source according to the stretching mode currently set in this DC (the destination DC). The raster-operation code, rop, specifies how the colors are combined in output operations that involve a brush, a source bitmap, and a destination bitmap. The rop codes are described in the entry for TDC::MaskBlt

Definition at line 2521 of file dc.h.

References GetHDC().

◆ StretchBlt() [2/2]

bool owl::TDC::StretchBlt ( int dstX,
int dstY,
int dstW,
int dstH,
const TDC & srcDC,
int srcX,
int srcY,
int srcW,
int srcH,
uint32 rop = SRCCOPY )
inline

Copies a bitmap from the source DC to a destination rectangle on this DC specified either by upper left-corner coordinates (dstX, dstY), width dstW, and height dstH, or (in the second version) by a TRect object, dst.

The source bitmap is similarly specified with (srcX, srcY), srcW, and srcH, or by a TRect object, src. StretchBlt stretches or compresses the source according to the stretching mode currently set in this DC (the destination DC). The raster-operation code, rop, specifies how the colors are combined in output operations that involve a brush, a source bitmap, and a destination bitmap. The rop codes are described in the entry for TDC::MaskBlt

Definition at line 2502 of file dc.h.

References GetHDC().

◆ StretchDIBits() [1/2]

int owl::TDC::StretchDIBits ( const TRect & dst,
const TRect & src,
const TDib & dib,
uint32 rop = SRCCOPY )
inline

Copies the color data from src, the source rectangle of pixels in the given DIB (device-independent bitmap) on this DC, to dst, the destination rectangle.

The DIB bits and color data are specified in either the byte array bits and the BITMAPINFO structure bitsInfo or in the TDib object, dib. The rows and columns of color data are stretched or compressed to match the size of the destination rectangle. The usage argument specifies how the bmiColors member of BITMAPINFO is interpreted, as explained in TDC::GetDIBits The raster operation code, rop, specifies how the source pixels, the current brush for this DC, and the destination pixels are combined to produce the new image. See TDC::MaskBlt for a detailed list of rop codes.

Definition at line 2826 of file dc.h.

References GetHDC().

◆ StretchDIBits() [2/2]

int owl::TDC::StretchDIBits ( const TRect & dst,
const TRect & src,
const void * bits,
const BITMAPINFO & info,
uint16 usage,
uint32 rop = SRCCOPY )
inline

Copies the color data from src, the source rectangle of pixels in the given DIB (device-independent bitmap) on this DC, to dst, the destination rectangle.

The DIB bits and color data are specified in either the byte array bits and the BITMAPINFO structure bitsInfo or in the TDib object, dib. The rows and columns of color data are stretched or compressed to match the size of the destination rectangle. The usage argument specifies how the bmiColors member of BITMAPINFO is interpreted, as explained in TDC::GetDIBits The raster operation code, rop, specifies how the source pixels, the current brush for this DC, and the destination pixels are combined to produce the new image. See TDC::MaskBlt for a detailed list of rop codes.

Definition at line 2801 of file dc.h.

References GetHDC().

◆ StrokeAndFillPath()

bool owl::TDC::StrokeAndFillPath ( )
inline

Closes any open figures in the current path of this DC, strokes the outline of the path using the current pen, and fills its interior using the current brush and polygon fill mode.

Returns true if the call is successful; otherwise, returns false.

Definition at line 3437 of file dc.h.

References GetHDC().

◆ StrokePath()

bool owl::TDC::StrokePath ( )
inline

Renders the current, closed path on this DC and uses the DC's current pen.

Definition at line 3426 of file dc.h.

References GetHDC().

◆ TabbedTextOut() [1/2]

bool owl::TDC::TabbedTextOut ( const TPoint & p,
const tstring & str,
int count,
int numPositions,
const int * positions,
int tabOrigin )
inline

Draws up to count characters of the given null-terminated string in the current font on this DC.

If count is -1, the whole string is written. Tabs are expanded according to the given arguments. The positions array specifies numPositions tab stops given in device units. The tab stops must have strictly increasing values in the array. If numPositions and positions are both 0, tabs are expanded to eight times the average character width. If numPositions is 1, all tab stops are taken to be positions[0] apart. tabOrigin specifies the x-coordinate in logical units from which tab expansion will start. The p argument specifies the logical coordinates of the reference point that is used to align the first character depending on the current text-alignment mode. This mode can be inspected with TDC::GetTextAlign and changed with TDC::SetTextAlign. By default, the current position is neither used nor altered by TabbedTextOut. However, if the align mode is set to TA_UPDATECP, TabbedTextOut ignores the reference point argument(s) and uses/updates the current position as the reference point. The size argument in the second version of TabbedTextOut reports the dimensions (size.y = height and size.x = width) of the string in logical units. TabbedTextOut returns true if the call is successful; otherwise, it returns false.

Definition at line 2950 of file dc.h.

References TabbedTextOut().

◆ TabbedTextOut() [2/2]

bool owl::TDC::TabbedTextOut ( const TPoint & p,
const tstring & str,
int count,
int numPositions,
const int * positions,
int tabOrigin,
TSize & size )
virtual

Draws up to count characters of the given null-terminated string in the current font on this DC.

If count is -1, the whole string is written. Tabs are expanded according to the given arguments. The positions array specifies numPositions tab stops given in device units. The tab stops must have strictly increasing values in the array. If numPositions and positions are both 0, tabs are expanded to eight times the average character width. If numPositions is 1, all tab stops are taken to be positions[0] apart. tabOrigin specifies the x-coordinate in logical units from which tab expansion will start. The p argument specifies the logical coordinates of the reference point that is used to align the first character depending on the current text-alignment mode. This mode can be inspected with TDC::GetTextAlign and changed with TDC::SetTextAlign. By default, the current position is neither used nor altered by TabbedTextOut. However, if the align mode is set to TA_UPDATECP, TabbedTextOut ignores the reference point argument(s) and uses/updates the current position as the reference point. The size argument in the second version of TabbedTextOut reports the dimensions (size.y = height and size.x = width) of the string in logical units. TabbedTextOut returns true if the call is successful; otherwise, it returns false.

Definition at line 634 of file dc.cpp.

References GetHDC(), and TabbedTextOut().

◆ TextOut() [1/2]

bool owl::TDC::TextOut ( const TPoint & p,
const tstring & str,
int count = -1 )
inline

Draws up to count characters of the given null-terminated string in the current font on this DC.

If count is -1 (the default), the entire string is written. The (x, y) or p arguments specify the logical coordinates of the reference point that is used to align the first character, depending on the current text-alignment mode. This mode can be inspected with TDC::GetTextAlign and changed with TDC::SetTextAlign. By default, the current position is neither used nor altered by TextOut. However, the align mode can be set to TA_UPDATECP, which makes Windows use and update the current position. In this mode, TextOut ignores the reference point argument(s). TextOut returns true if the call is successful; otherwise, it returns false.

Definition at line 2897 of file dc.h.

References TextOut().

◆ TextOut() [2/2]

bool owl::TDC::TextOut ( int x,
int y,
const tstring & str,
int count = -1 )
virtual

Draws up to count characters of the given null-terminated string in the current font on this DC.

If count is -1 (the default), the entire string is written. The (x, y) or p arguments specify the logical coordinates of the reference point that is used to align the first character, depending on the current text-alignment mode. This mode can be inspected with TDC::GetTextAlign and changed with TDC::SetTextAlign. By default, the current position is neither used nor altered by TextOut. However, the align mode can be set to TA_UPDATECP, which makes Windows use and update the current position. In this mode, TextOut ignores the reference point argument(s). TextOut returns true if the call is successful; otherwise, it returns false.

Definition at line 574 of file dc.cpp.

References GetHDC().

◆ TextRect() [1/4]

bool owl::TDC::TextRect ( const TRect & rect)
inline

Fills the given rectangle, clipping any text to the rectangle.

Returns true if the call is successful.

Definition at line 1888 of file dc.h.

References GetHDC().

◆ TextRect() [2/4]

bool owl::TDC::TextRect ( const TRect & rect,
const TColor & color )
inline

Fills the given rectangle, clipping any text to the rectangle.

If no color argument is supplied, the current backgound color is used. If a color argument is supplied, that color is set to the current background color which is then used for filling. TextRect returns true if the call is successful; otherwise, it returns false.

Definition at line 1912 of file dc.h.

References GetHDC(), and SetBkColor().

◆ TextRect() [3/4]

bool owl::TDC::TextRect ( int x1,
int y1,
int x2,
int y2 )
inline

Fills the given rectangle, clipping any text to the rectangle.

Returns true if the call is successful.

Definition at line 1878 of file dc.h.

References GetHDC().

◆ TextRect() [4/4]

bool owl::TDC::TextRect ( int x1,
int y1,
int x2,
int y2,
const TColor & color )
inline

Fills the given rectangle, clipping any text to the rectangle.

The given color is used to set to the background color before filling. Returns true if the call is successful.

Definition at line 1898 of file dc.h.

References GetHDC(), and SetBkColor().

◆ TransparentBlt()

bool owl::TDC::TransparentBlt ( const TRect & dst,
const TDC & srcDC,
const TRect & src,
const TColor & transparent )
inline

Performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.

Returns true on success; otherwise false. This function is a wrapper for the Windows API TransparentBlt function. http://msdn.microsoft.com/en-us/library/dd145141

Definition at line 2641 of file dc.h.

References GetHDC().

◆ UpdateColors()

void owl::TDC::UpdateColors ( )
inline

Updates the client area of this DC by matching the current colors in the client area to the system palette on a pixel-by-pixel basis.

Definition at line 1063 of file dc.h.

References GetHDC(), and UpdateColors().

◆ WidenPath()

bool owl::TDC::WidenPath ( )
inline

Redefines the current, closed path on this DC as the area that would be painted if the path were stroked with this DC's current pen.

The current pen must have been created under the following conditions: If the TPen(int Style, int Width, TColor Color) constructor, or the TPen(const LOGPEN* LogPen) constructor is used, the width of the pen in device units must be greater than 1. If the TPen(uint32 PenStyle, uint32 Width, const TBrush& Brush, uint32 StyleCount, LPDWORD pSTyle) constructor, or the TPen(uint32 PenStyle, uint32 Width, const LOGBRUSH& logBrush, uint32 StyleCount, LPDWORD pSTyle) constructor is used, the pen must be a geometric pen. Any Bezier curves in the path are converted to sequences of linear segments approximating the widened curves, so no Bezier curves remain in the path after a WidenPath call. WidenPath returns true if the call is successful; otherwise, it returns false.

Definition at line 3406 of file dc.h.

References GetHDC().

Member Data Documentation

◆ Handle

HANDLE owl::TGdiBase::Handle
protected

< make this function available to derivatives

Definition at line 81 of file gdibase.h.

◆ ShouldDelete

bool owl::TGdiBase::ShouldDelete
protected

< The handle of this DC. Uses the base class's handle (TGdiBase::Handle.)

Definition at line 82 of file gdibase.h.


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