Gfx: Add comments

This commit is contained in:
Birunthan Mohanathas 2013-04-09 20:54:40 +03:00
parent 0b3a4d86c4
commit 507e0294fe
4 changed files with 15 additions and 0 deletions

View File

@ -26,6 +26,7 @@
namespace Gfx {
// Provides methods for drawing text, bitmaps, etc.
class __declspec(novtable) Canvas
{
public:
@ -34,6 +35,8 @@ public:
int GetW() const { return m_W; }
int GetH() const { return m_H; }
// Resize the draw area of the Canvas. This function must not be called if BeginDraw() has been
// called and has not yet been matched by a correspoding call to EndDraw.
virtual void Resize(int w, int h);
// BeginDraw() must be matched by a corresponding call to EndDraw(). Drawing functions must be
@ -54,6 +57,7 @@ public:
virtual HDC GetDC() = 0;
virtual void ReleaseDC(HDC dc) = 0;
// The Create* functions allocate objects specific to this Canvas object.
virtual FontCollection* CreateFontCollection() = 0;
virtual TextFormat* CreateTextFormat() = 0;

View File

@ -39,17 +39,24 @@ enum class VerticalAlignment : BYTE
Bottom
};
// Represents the logical font properties used to format text.
class __declspec(novtable) TextFormat
{
public:
virtual ~TextFormat();
// Returns true if this TextFormat object is valid for use in draw operations.
virtual bool IsInitialized() const = 0;
// Sets the logical properties of the font to use. If the font is not found in the system font
// collection, the given |fontCollection| is also searched. |fontCollection| may be nullptr.
virtual void SetProperties(
const WCHAR* fontFamily, int size, bool bold, bool italic,
const FontCollection* fontCollection) = 0;
// Sets the trimming and wrapping of the text. If |trim| is true, subsequent draws using this
// TextFormat object will produce clipped text with an ellipsis if the text overflows the
// bounding rectangle.
virtual void SetTrimming(bool trim) = 0;
virtual void SetHorizontalAlignment(HorizontalAlignment alignment);

View File

@ -25,6 +25,7 @@
namespace Gfx {
// Provides a Direct2D/DirectWrite implementation of TextFormat for use with CanvasD2D.
class TextFormatD2D : public TextFormat
{
public:
@ -38,6 +39,7 @@ public:
const FontCollection* fontCollection) override;
virtual void SetTrimming(bool trim) override;
virtual void SetHorizontalAlignment(HorizontalAlignment alignment) override;
virtual void SetVerticalAlignment(VerticalAlignment alignment) override;

View File

@ -24,6 +24,7 @@
namespace Gfx {
// Provides a GDI+ implementation of TextFormat for use with CanvasGDIP.
class TextFormatGDIP : public TextFormat
{
public:
@ -37,6 +38,7 @@ public:
const FontCollection* fontCollection) override;
virtual void SetTrimming(bool trim) override;
virtual void SetHorizontalAlignment(HorizontalAlignment alignment) override;
virtual void SetVerticalAlignment(VerticalAlignment alignment) override;