📄 gdiplusheaders.h
字号:
/**************************************************************************\
*
* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* GdiplusHeaders.h
*
* Abstract:
*
* GDI+ Native C++ public header file
*
\**************************************************************************/
#ifndef _GDIPLUSHEADERS_H
#define _GDIPLUSHEADERS_H
//--------------------------------------------------------------------------
// Abstract base class for regions
//--------------------------------------------------------------------------
// Include the class declarations here and have inline class implementation
// in separate file to avoid circular references.
class Region : public GdiplusBase
{
public:
friend class Graphics;
Region();
Region(IN const RectF& rect);
Region(IN const Rect& rect);
Region(IN const GraphicsPath* path);
Region(IN const BYTE* regionData, IN INT size);
Region(IN HRGN hRgn);
static Region* FromHRGN(IN HRGN hRgn);
~Region();
Region* Clone() const;
Status MakeInfinite();
Status MakeEmpty();
// Get the size of the buffer needed for the GetData method
UINT GetDataSize() const;
// buffer - where to put the data
// bufferSize - how big the buffer is (should be at least as big as GetDataSize())
// sizeFilled - if not NULL, this is an OUT param that says how many bytes
// of data were written to the buffer.
Status GetData(OUT BYTE* buffer,
IN UINT bufferSize,
OUT UINT* sizeFilled = NULL) const;
Status Intersect(IN const Rect& rect);
Status Intersect(IN const RectF& rect);
Status Intersect(IN const GraphicsPath* path);
Status Intersect(IN const Region* region);
Status Union(IN const Rect& rect);
Status Union(IN const RectF& rect);
Status Union(IN const GraphicsPath* path);
Status Union(IN const Region* region);
Status Xor(IN const Rect& rect);
Status Xor(IN const RectF& rect);
Status Xor(IN const GraphicsPath* path);
Status Xor(IN const Region* region);
Status Exclude(IN const Rect& rect);
Status Exclude(IN const RectF& rect);
Status Exclude(IN const GraphicsPath* path);
Status Exclude(IN const Region* region);
Status Complement(IN const Rect& rect);
Status Complement(IN const RectF& rect);
Status Complement(IN const GraphicsPath* path);
Status Complement(IN const Region* region);
Status Translate(IN REAL dx,
IN REAL dy);
Status Translate(IN INT dx,
IN INT dy);
Status Transform(IN const Matrix* matrix);
Status GetBounds(OUT Rect* rect,
IN const Graphics* g) const;
Status GetBounds(OUT RectF* rect,
IN const Graphics* g) const;
HRGN GetHRGN (IN const Graphics * g) const;
BOOL IsEmpty(IN const Graphics *g) const;
BOOL IsInfinite(IN const Graphics *g) const;
BOOL IsVisible(IN INT x,
IN INT y,
IN const Graphics* g = NULL) const
{
return IsVisible(Point(x, y), g);
}
BOOL IsVisible(IN const Point& point,
IN const Graphics* g = NULL) const;
BOOL IsVisible(IN REAL x,
IN REAL y,
IN const Graphics* g = NULL) const
{
return IsVisible(PointF(x, y), g);
}
BOOL IsVisible(IN const PointF& point,
IN const Graphics* g = NULL) const;
BOOL IsVisible(IN INT x,
IN INT y,
IN INT width,
IN INT height,
IN const Graphics* g) const
{
return IsVisible(Rect(x, y, width, height), g);
}
BOOL IsVisible(IN const Rect& rect,
IN const Graphics* g = NULL) const;
BOOL IsVisible(IN REAL x,
IN REAL y,
IN REAL width,
IN REAL height,
IN const Graphics* g = NULL) const
{
return IsVisible(RectF(x, y, width, height), g);
}
BOOL IsVisible(IN const RectF& rect,
IN const Graphics* g = NULL) const;
BOOL Equals(IN const Region* region,
IN const Graphics* g) const;
UINT GetRegionScansCount(IN const Matrix* matrix) const;
Status GetRegionScans(IN const Matrix* matrix,
OUT RectF* rects,
OUT INT* count) const;
Status GetRegionScans(IN const Matrix* matrix,
OUT Rect* rects,
OUT INT* count) const;
Status GetLastStatus() const;
protected:
#ifdef DCR_USE_NEW_250932
private:
Region(const Region ®ion);
Region& operator=(const Region ®ion);
protected:
#else
Region(const Region ®ion)
{
region; // reference parameter
SetStatus(NotImplemented);
}
Region& operator=(const Region ®ion)
{
region; // reference parameter
SetStatus(NotImplemented);
return *this;
}
#endif
Status SetStatus(Status status) const
{
if (status != Ok)
return (lastResult = status);
else
return status;
}
Region(GpRegion* nativeRegion);
VOID SetNativeRegion(GpRegion* nativeRegion);
protected:
GpRegion* nativeRegion;
mutable Status lastResult;
};
//--------------------------------------------------------------------------
// Abstract base class for FontFamily
//--------------------------------------------------------------------------
class FontFamily : public GdiplusBase
{
public:
friend class Font;
friend class Graphics;
friend class GraphicsPath;
friend class FontCollection;
FontFamily();
FontFamily(
IN const WCHAR *name,
IN const FontCollection *fontCollection = NULL
);
~FontFamily();
static const FontFamily *GenericSansSerif();
static const FontFamily *GenericSerif();
static const FontFamily *GenericMonospace();
Status GetFamilyName(
OUT WCHAR name[LF_FACESIZE],
IN LANGID language = 0
) const;
// Copy operator
FontFamily * Clone() const;
BOOL IsAvailable() const
{
return (nativeFamily != NULL);
};
BOOL IsStyleAvailable(IN INT style) const;
UINT16 GetEmHeight (IN INT style) const;
UINT16 GetCellAscent (IN INT style) const;
UINT16 GetCellDescent (IN INT style) const;
UINT16 GetLineSpacing (IN INT style) const;
///////////////////////////////////////////////////////////
Status GetLastStatus() const;
#ifdef DCR_USE_NEW_250932
private:
FontFamily(const FontFamily &);
FontFamily& operator=(const FontFamily &);
#endif
protected:
Status SetStatus(Status status) const;
// private constructor for copy
FontFamily(GpFontFamily * nativeFamily, Status status);
///////////////////////////////////////
// Data members
protected:
GpFontFamily *nativeFamily;
mutable Status lastResult;
};
static FontFamily *GenericSansSerifFontFamily = NULL;
static FontFamily *GenericSerifFontFamily = NULL;
static FontFamily *GenericMonospaceFontFamily = NULL;
static BYTE GenericSansSerifFontFamilyBuffer[sizeof(FontFamily)] = {0};
static BYTE GenericSerifFontFamilyBuffer [sizeof(FontFamily)] = {0};
static BYTE GenericMonospaceFontFamilyBuffer[sizeof(FontFamily)] = {0};
//--------------------------------------------------------------------------
// Abstract base class for fonts
//--------------------------------------------------------------------------
class Font : public GdiplusBase
{
public:
friend class Graphics;
Font(IN HDC hdc);
Font(IN HDC hdc,
IN const LOGFONTA* logfont);
Font(IN HDC hdc,
IN const LOGFONTW* logfont);
#ifdef DCR_USE_NEW_127084
Font(IN HDC hdc,
IN const HFONT hfont);
#endif
Font(
IN const FontFamily * family,
IN REAL emSize,
IN INT style = FontStyleRegular,
IN Unit unit = UnitPoint
);
Font(
IN const WCHAR * familyName,
IN REAL emSize,
IN INT style = FontStyleRegular,
IN Unit unit = UnitPoint,
IN const FontCollection * fontCollection = NULL
);
Status GetLogFontA(IN const Graphics* g,
OUT LOGFONTA * logfontA) const;
Status GetLogFontW(IN const Graphics* g,
OUT LOGFONTW * logfontW) const;
Font* Clone() const;
~Font();
BOOL IsAvailable() const;
INT GetStyle() const;
REAL GetSize() const;
Unit GetUnit() const;
Status GetLastStatus() const;
REAL GetHeight(IN const Graphics *graphics = NULL) const;
#ifdef DCR_USE_NEW_125467
REAL GetHeight(IN REAL dpi) const;
#endif
Status GetFamily(OUT FontFamily *family) const;
#ifdef DCR_USE_NEW_250932
private:
Font(const Font &);
Font& operator=(const Font &);
#endif
protected:
Font(GpFont* font, Status status);
VOID SetNativeFont(GpFont *Font);
Status SetStatus(Status status) const;
protected:
/*
* handle to native line texture object
*/
GpFont* nativeFont;
mutable Status lastResult;
};
//--------------------------------------------------------------------------
// Abstract base classes for font collections
//--------------------------------------------------------------------------
class FontCollection : public GdiplusBase
{
public:
friend class FontFamily;
FontCollection();
virtual ~FontCollection();
INT GetFamilyCount() const; // number of enumerable families in the collection
Status GetFamilies( // enumerate the fonts in a collection
IN INT numSought,
OUT FontFamily * gpfamilies,
OUT INT * numFound
) const;
Status GetLastStatus() const;
#ifdef DCR_USE_NEW_250932
private:
FontCollection(const FontCollection &);
FontCollection& operator=(const FontCollection &);
#endif
protected:
Status SetStatus(Status status) const ;
GpFontCollection *nativeFontCollection;
mutable Status lastResult;
};
class InstalledFontCollection : public FontCollection
{
public:
InstalledFontCollection();
~InstalledFontCollection();
#ifdef DCR_USE_NEW_250932
private:
InstalledFontCollection(const InstalledFontCollection &);
InstalledFontCollection& operator=(const InstalledFontCollection &);
#endif
protected:
#ifndef DCR_USE_NEW_235072
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -