Led 3.0 Class Library Documentation

Module LedGDI

Classes and Global Functions Index

Module Description:

Graphix Library support. This code encapsulates access to underlying GDI for modularity sake. For historical reasons - as of Led 3.0 - there is still some direct access to underlying GDI in parts of Led but that will gradually (hopefully right after 3.0) be eliminated.

Also - no class library dependencies (ie no MFC dependencies). So we can build MFC-Free Win32 apps more easily.

Class: Led_Color [public]


This class is a portable representation of a color. It can be constructed either from its basic RGB componets, or from the native color representations on a particular platform.

Class: Led_Coordinate [public]


Led_Coordinate is the signed analog of Led_Distance. Led_Point is a tuple of Led_Coordinatess (vertical and horizontal).

Class: Led_DIB [public]


Led_DIB is a MS-Windows DIB (device independent bitmap) object. Much like Led_Picture, it has a host of accessor routines to get at its size, etc. But slightly better than Led_Picture, Led_DIB can be rendered on the Mac without assuming any special software (ie no analog to QT) is available. The downside is that I only support a few types of DIBs, but I appear to have most that windows currently generates. And it wouldn't be too hard to extend the code to support a few more types, if I knew what they were.

Class: Led_Distance [public]


Led_Distance is an unsigned type, specifying the distance (always non-negative) between two graphics locations. Led_Size is a tuple of Led_Distances (vertical and horizontal).

Class: Led_FontMetrics [public]


Led_FontMetrics is a portable wrapper class on the Macintosh FontInfo structure, or the Windows TEXTMETRIC structure. It provides portable access to things like GetLineHeight (), and GetAscent (), etc...

Class: Led_FontSpecification [public]


Led_FontSpecification is a utility class which portably represents a user font choice. This largely corresponds to the MS-Windows LOGFONT structure or the Macintosh txFace, txSize, txStyle.

In addition to being a portable represenation of this information, it also contains handy wrapper accessors, and extra information like subscript, superscript, and font color.

See also, Led_IncrementalFontSpecification

Member Details

Led_FontSpecification::GetFontName [public]

Led_SDK_String Led_FontSpecification::GetFontName () const

Retrieve the 'FontName' attribute of the given font specification. This name is a string, and corresponds to the font family name.

See also Led_FontSpecification::SetFontName.

Led_FontSpecification::GetStyle_Plain [public]

bool Led_FontSpecification::GetStyle_Plain () const

Checks all the various font 'style' attributes, such as 'bold', or 'italic'. Returns true iff all of these styles are not set.

See also Led_FontSpecification::SetStyle_Plain.

Led_FontSpecification::SetFontName [public]

void Led_FontSpecification::SetFontName (const Led_SDK_String& fontName)

See also Led_FontSpecification::GetFontName.

Led_FontSpecification::SetStyle_Plain [public]

void Led_FontSpecification::SetStyle_Plain ()

Clears all 'style' attributes, such as 'bold', or 'italic'.

See also Led_FontSpecification::GetStyle_Plain.

Class: Led_GDIGlobals [public]


Something of a hack version of GDI global variables. We want to keep certain GDI global variables computed ONCE, for speed reasons. And yet - if we get a certain windows message, we must refresh our cached global variables. The compromise is that all these globals are associated with this class, so that there is one place to call to refresh those globals.

Class: Led_GDI_Obj_Selector [public]


Led_GDI_Obj_Selector is a stack-based class designed to help out selecting objects into a Led_Tablet (windows DC, grafport, etc).

The constructor takes a tablet, and object to select into it (HGDIObject, etc), and selects it into the tablet. It saves gthe results of the SelectObject calls (old values). And on its destructor, it restores the old values.

This is useful when you want to make sure that an object you've selected into a tablet (HDC) will be released, and restored to its original state through all paths through the code, including in the even of exceptions.

Class: Led_IncrementalFontSpecification [public]


Led_IncrementalFontSpecification is a simple subclass of Led_FontSpecification which adds a bool flag for each font attribute indicating whether or not it is really specified. With this, and the Led_FontSpecification::MergeIn method, you can specify just one or two changes to a font record, pass them around, and apply them to an existing font choice.

See also, Led_FontSpecification

Class: Led_Justification [public]


Led defines several kinds of justification, but doesn't implement all of them.

These extra unimplemented enums are provided so you can more easily write code and read/write files etc which keep track of this information, and even show the styles in the UI. They just aren't reflected in how the text is drawn yet. That should come in the next major Led release.

Class: Led_LineSpacing [public]


Support at least all the crazy formats/options in the Win32 PARAFORMAT2 structure, and the ill-documented RTF 1.5 SPEC \sl options.

Class: Led_Pen [public]


Helper class to keep track of GDI information used for drawing. Very different implementations befween Mac and Windows.

Note - this class is used in conjunction with Led_GDI_Obj_Selector.

Class: Led_Picture [public]


Led_Picture is a portable abstraction of a Macintosh Picture object. It can be displayed both on windows, and on the Mac (on Windows, it is only displayed if Apples QuickTime is installed). There are a bunch of routines (e.g Led_GetMacPictTop) which portable allow access to the size of the picture (even on windows if QT not available). And there are portable routines to draw the picture (again, with the windows QT caveat).

Class: Led_Point [public]


Class: Led_Rect [public]

Member Details

Led_Rect::GetBottom [public]

Led_Coordinate Led_Rect::GetBottom () const

Retrieve bottom of rectangle.

Led_Rect::GetHeight [public]

Led_Distance Led_Rect::GetHeight () const

Asserts height is non-negative, and then returns height.

Led_Rect::GetLeft [public]

Led_Coordinate Led_Rect::GetLeft () const

Retrieve left of rectangle.

Led_Rect::GetRight [public]

Led_Coordinate Led_Rect::GetRight () const

Retrieve right of rectangle.

Led_Rect::GetTop [public]

Led_Coordinate Led_Rect::GetTop () const

Retrieve top of rectangle.

Led_Rect::GetWidth [public]

Led_Distance Led_Rect::GetWidth () const

Asserts width is non-negative, and then returns width.

Led_Rect::IsEmpty [public]

bool Led_Rect::IsEmpty () const

Returns true if either horizontal or vertical dimentions are less or equal to zero.

Led_Rect::Led_Rect [public]

Led_Rect::Led_Rect () { }

No-argument constructor leaves object uninitialized (garbage data).

Led_Rect::Led_Rect (overload 1) [public]

Led_Rect::Led_Rect (Led_Coordinate newTop, Led_Coordinate newLeft, Led_Distance newHeight, Led_Distance newWidth)

Initialize with argument top, left, height, width.

Led_Rect::operator*= [public]

const Led_Rect& Led_Rect::operator*= (const Led_Rect& intersectWith)

Intersects this rect with the argument rectangle.

Class: Led_Region [public]


Portable GDI abstraction for 'Region' object.

Class: Led_Size [public]


Class: Led_TWIPS [public]


Many distances are specified in Led in TWIPS - 1/20 of a printers point. This means - 1/1440 of an inch.

This size refers to the size when printed on a page. So it can be scaled - depnding on screen resolution. Led will often save this internally - and scale it at the last minute to the resolution of the Led_Tablet being printed on.

NB: This marks a change from Led 2.3 and earlier - where most distances were stored in pixels (still many are).

NB: declard as a class instead of a typedef so we get better type checking. Shouldn't affect sizes or code generation - I would hope!

Class: Led_TWIPS_Point [public]

A point object (x,y coordinate) in Led_TWIPS units.

Class: Led_TabStopList [public]


Even though WinSDK supports GetTabbedTextExtent/TabbedTextOut () - they do a bad job. In particular, they offer no (obvious) way to specify the tab origin for GetTabbedTextExtent(). This makes proper text display nearly impossible.

Also, the Mac provides NO tab support at all. Because of the Mac - we NEED to implement our own tab support. Given we are doing that anyhow, may as well use our portable support on both platforms.

For both calculating widths, and doing imaging, we follow essentially the same algorithm.

Class: Led_Tablet [public]


A pointer to a Led_Tablet_ structure. These pointers are used throughout Led.

In versions of Led prior to Led 3.0 - this typedef refered directly to a Mac GrafPort or MFC CDC.

Now it refers to a structure which wraps those lower level concepts (and doesnt depend on MFC anymore).

Class: Led_Tablet_ [public]


See also Led_Tablet - since that is what Led tends to make use of directly.

This class is used to wrap a low level graphics drawing device. On Windows - this is an HDC. On the Mac - a GrafPtr (also CGrafPtr and GWorldPtr). On X-Windows - a drawable and display, and GC.

This class right now is a very thin wrapper on those drawing prodedures (mostly for backward compatability reasons. Eventually - it may do a better job of wrapping those concepts/APIs genericly.

Member Details

Led_Tablet_::CvtFromTWIPSH [public]

Led_Coordinate Led_Tablet_::CvtFromTWIPSH (Led_TWIPS from) const

See also Led_Tablet_::CvtFromTWIPSV, Led_Tablet_::CvtToTWIPSV, Led_Tablet_::CvtToTWIPSH.

Led_Tablet_::CvtFromTWIPSV [public]

Led_Coordinate Led_Tablet_::CvtFromTWIPSV (Led_TWIPS from) const

See also Led_Tablet_::CvtFromTWIPSH, Led_Tablet_::CvtToTWIPSV, Led_Tablet_::CvtToTWIPSH.

Led_Tablet_::CvtToTWIPSH [public]

Led_TWIPS Led_Tablet_::CvtToTWIPSH (Led_Coordinate from) const

Utility routine to convert from logical coordinates (usually pixels) to TWIPS.

See also Led_Tablet_::CvtFromTWIPSV, Led_Tablet_::CvtFromTWIPSH, Led_Tablet_::CvtToTWIPSV.

Led_Tablet_::CvtToTWIPSV [public]

Led_TWIPS Led_Tablet_::CvtToTWIPSV (Led_Coordinate from) const

Utility routine to convert from logical coordinates (usually pixels) to TWIPS.

See also Led_Tablet_::CvtFromTWIPSV, Led_Tablet_::CvtFromTWIPSH, Led_Tablet_::CvtToTWIPSH.

Led_Tablet_::EraseBackground_SolidHelper [public]

void Led_Tablet_::EraseBackground_SolidHelper (const Led_Rect& eraseRect, const Led_Color& eraseColor)

EraseBackground_SolidHelper () is simple helper function - usually called from subclasses which override TextImager::EraseBackground.

Led_Tablet_::FrameRegion [public]

void Led_Tablet_::FrameRegion (const Led_Region& r, const Led_Color& c)

Draw the outline of the given region 'r' in color 'c'.

Led_Tablet_::GetFontMetrics [public]

Led_FontMetrics Led_Tablet_::GetFontMetrics () const

Retrieve the (Led_FontMetrics) associated with the current tablet (based on the last SetFont call).

Led_Tablet_::HilightARectangle__SolidHelper [public]

void Led_Tablet_::HilightARectangle_SolidHelper (const Led_Rect& hiliteRect, Led_Color hilightBackColor, Led_Color hilightForeColor, Led_Color oldBackColor, Led_Color oldForeColor)

HilightARectangle__SolidHelper () is simple helper function - usually called from subclasses which override TextImager::HilightARectangle.

Note the backColor and foreColor are advisory - and maybe ignored if the GDI better supports (or the platform UI conventionally calls for) inverting the text via a simple XOR.

Led_Tablet_::MeasureText [public]

void Led_Tablet_::MeasureText (const Led_FontMetrics& precomputedFontMetrics,

Measure the widths of the given argument Led_tChars. Assign those widths into the array 'charLocations'. (EXPLAIN CAREFULLY REQUIREMENTS ABOUT BUFSIZE of charLocations and handling of zero case and offset rules, handling of tabs, etc)

Led_Tablet_::ScrollBitsAndInvalRevealed [public]

void Led_Tablet_::ScrollBitsAndInvalRevealed (const Led_Rect& windowRect, Led_Coordinate scrollVBy)

Scroll the given 'windowRect' by 'scrollVBy localical units. The area of the window exposed by this action is invalidated (so a later update event will fix it).

Led_Tablet_::TabbedTextOut [public]

void Led_Tablet_::TabbedTextOut (const Led_FontMetrics& precomputedFontMetrics, const Led_tChar* text, size_t nBytes,

Draw the given text (Led_tChars) to this tablet object, at the given logical coordinates. Use the given tabstop origin, and tabStopList object to compute where tabs go. Return the amountDrawn (number of pixels used by draw). (EXPLAIN CAREFULLY REQUIREMENTS ABOUT BUFSIZE of charLocations and handling of zero case and offset rules, handling of tabs, AND MUCH MORE etc)

Class: Led_Tablet_::ClipNarrowAndRestore [public]


Further narrow the existing clip region in the given tablet to the constructor. Then restore the clip region for the tablet to what it was when the contructor was called.

Class: Led_Win_Obj_Selector [public]


Alias for newer Led_GDI_Obj_Selector.

Class: ListStyle [public]


Different styles of bullet / list markers for list items in the WordProcessor.

Numeric values come from RTF 1.5 Spec \levelnfc (except for eListStyle_None which is special)

Class: OffscreenTablet [public]


An offscreen tablet is a helper object used to do offscreen imaging. This is useful in avoidance of flicker. Also, by encapsulating this procedure into a class, it becomes easier to add the functionality to several places in Led, yet with very different underlying implementations on each platform.

Member Details

OffscreenTablet::BlastBitmapToOrigTablet [public]

void OffscreenTablet::BlastBitmapToOrigTablet ()

Copy the bits which have been saved away into this offscreen tablet back to the original tablet specified in OffscreenTablet::Setup and to coordinates specified in the last call to OffscreenTablet::PrepareRect.

OffscreenTablet::PrepareRect [public]

Led_Tablet OffscreenTablet::PrepareRect (const Led_Rect& currentRowRect, Led_Distance extraToAddToBottomOfRect)

Prepare the offscreen drawing environment for the given 'currentRowRect'. This can only be safely called after the call to OffscreenTablet::Setup - but can be called multiple times. Note that calls to this will typically 'destroy' the bits in the offscreen tablet.

OffscreenTablet::Setup [public]

void OffscreenTablet::Setup (Led_Tablet origTablet)

Prepare a new offscreen drawing environment given the starting basis 'originalTablet' (typically from a window).

Later call OffscreenTablet::PrepareRect before any actual drawing can be done. This should be called once before calling OffscreenTablet::PrepareRect.

Config Variable: qWorkAroundWin95UNICODECharImagingBugs [public]


Contrary to the MSDEV 50 online docs, many of the Win32 UNICODE versions of GDI functions don't work, or worse - only half-way work.

For example, GetTextExtentExPointW DOESN'T WORK AT ALL, TextOutW works pretty well, but draws underlines the wrong width...(for proportional fonts).

Turning this feature on makes the code work under Win95/Win98 and NT, but makes the NT code a little slower.

NB: This has NO EFFECT unless you have built for UNICODE (qLed_CharacterSet == qUNICODE_CharacterSet).

Turn ON by default.

Config Variable: qWorkAroundWin98UNICODECharImagingBugs [public]


See qWorkAroundWin95UNICODECharImagingBugs.

This is very similar, but a strict subset of the problems in @qWorkAroundWin95UNICODECharImagingBugs'. In other words, some were fixed, and some weren't.

Turn ON by default.

EnsureRectInRect [public]

Led_Rect EnsureRectInRect (const Led_Rect& r, Led_Rect enlosingR)

Utility routine to ensure the first rect is entirely enclosed in the second (enclosing) rectangle. Pin the edges so it fits.

EnsureRectOnScreen [public]

Led_Rect EnsureRectOnScreen (Led_Rect& r)

Utility routine to ensure the first rect (typically used for a window) fits on the sceen. Pin the edges so it fits. See also EnsureRectInRect.

InsetRect [public]

Led_Rect InsetRect (const Led_Rect& r, int vBy, int hBy)

Utility routine to convert shrink (if vBy/hBy posative), or expand (if negative) the given Led_Rect. NB: This routine pins the minimum output rect size (in each dimention) to be zero.

Led_CloneDIB [public]

Led_DIB* Led_CloneDIB (const Led_DIB* dib)

Make a copy of the given Led_DIB object using ::operator new (). Just use normal C++ ::operator delete () to destroy the result.

Led_CvtScreenPixelsFromTWIPSH [public]

Led_Coordinate Led_CvtScreenPixelsFromTWIPSH (Led_TWIPS from)

Utility routine to convert from TWIPS to logical coordinates (usually pixels).

See also Led_CvtScreenPixelsFromTWIPSV.

Led_CvtScreenPixelsFromTWIPSV [public]

Led_Coordinate Led_CvtScreenPixelsFromTWIPSV (Led_TWIPS from)

Utility routine to convert from TWIPS to logical coordinates (usually pixels).

See also Led_CvtScreenPixelsFromTWIPSH.

Led_CvtScreenPixelsToTWIPSH [public]

Led_TWIPS Led_CvtScreenPixelsToTWIPSH (Led_Coordinate from)

Utility routine to convert from logical coordinates (usually pixels) to TWIPS.

See also Led_CvtScreenPixelsToTWIPSV.

Led_CvtScreenPixelsToTWIPSV [public]

Led_TWIPS Led_CvtScreenPixelsToTWIPSV (Led_Coordinate from)

Utility routine to convert from logical coordinates (usually pixels) to TWIPS.

See also Led_CvtScreenPixelsToTWIPSH.

Led_GetDIBImageByteCount [public]

size_t Led_GetDIBImageByteCount (const Led_DIB* dib)

Return the size in bytes of the given argument DIB. DIBs are consequetive chunks of RAM.

Led_GetDIBImageSize [public]

Led_Size Led_GetDIBImageSize (const Led_DIB* dib)

Return the size in pixels of the given argument DIB

Return to Led Page Return to Led ClassLib Documentation Index Return to Led Reference Manual Index
Last Updated 2001-10-20