From 3f3b45cc74b0499912409f766a595945dbbfc4c5 Mon Sep 17 00:00:00 2001 From: John Abd-El-Malek Date: Fri, 23 May 2014 17:28:10 -0700 Subject: Convert all line endings to LF. --- core/src/fxge/Microsoft SDK/include/DWrite.h | 10012 +++++++++---------- core/src/fxge/Microsoft SDK/include/Dcommon.h | 130 +- core/src/fxge/Microsoft SDK/include/GdiPlus.h | 312 +- core/src/fxge/Microsoft SDK/include/GdiPlusBase.h | 80 +- .../src/fxge/Microsoft SDK/include/GdiPlusBitmap.h | 2008 ++-- core/src/fxge/Microsoft SDK/include/GdiPlusBrush.h | 1902 ++-- .../Microsoft SDK/include/GdiPlusCachedBitmap.h | 142 +- core/src/fxge/Microsoft SDK/include/GdiPlusColor.h | 418 +- .../Microsoft SDK/include/GdiPlusColorMatrix.h | 126 +- core/src/fxge/Microsoft SDK/include/GdiPlusEnums.h | 2504 ++--- core/src/fxge/Microsoft SDK/include/GdiPlusFlat.h | 5480 +++++----- core/src/fxge/Microsoft SDK/include/GdiPlusFont.h | 598 +- .../Microsoft SDK/include/GdiPlusFontCollection.h | 298 +- .../fxge/Microsoft SDK/include/GdiPlusFontFamily.h | 542 +- .../fxge/Microsoft SDK/include/GdiPlusGpStubs.h | 214 +- .../fxge/Microsoft SDK/include/GdiPlusGraphics.h | 5452 +++++----- .../fxge/Microsoft SDK/include/GdiPlusHeaders.h | 1586 +-- .../fxge/Microsoft SDK/include/GdiPlusImageCodec.h | 146 +- .../fxge/Microsoft SDK/include/GdiPlusImaging.h | 1080 +- .../fxge/Microsoft SDK/include/GdiPlusLineCaps.h | 506 +- .../src/fxge/Microsoft SDK/include/GdiPlusMatrix.h | 618 +- core/src/fxge/Microsoft SDK/include/GdiPlusMem.h | 98 +- .../fxge/Microsoft SDK/include/GdiPlusMetaFile.h | 748 +- .../fxge/Microsoft SDK/include/GdiPlusMetaHeader.h | 426 +- core/src/fxge/Microsoft SDK/include/GdiPlusPath.h | 3372 +++---- core/src/fxge/Microsoft SDK/include/GdiPlusPen.h | 1038 +- .../Microsoft SDK/include/GdiPlusPixelFormats.h | 402 +- .../src/fxge/Microsoft SDK/include/GdiPlusRegion.h | 996 +- .../Microsoft SDK/include/GdiPlusStringFormat.h | 762 +- core/src/fxge/Microsoft SDK/include/GdiPlusTypes.h | 1652 +-- .../Microsoft SDK/include/GdiPlusimageAttributes.h | 794 +- core/src/fxge/Microsoft SDK/include/GdiplusInit.h | 208 +- core/src/fxge/Microsoft SDK/include/sal.h | 1458 +-- core/src/fxge/Microsoft SDK/include/specstrings.h | 1956 ++-- 34 files changed, 24032 insertions(+), 24032 deletions(-) (limited to 'core/src/fxge/Microsoft SDK') diff --git a/core/src/fxge/Microsoft SDK/include/DWrite.h b/core/src/fxge/Microsoft SDK/include/DWrite.h index 70f998a437..0374694f74 100644 --- a/core/src/fxge/Microsoft SDK/include/DWrite.h +++ b/core/src/fxge/Microsoft SDK/include/DWrite.h @@ -1,5006 +1,5006 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Abstract: -// DirectX Typography Services public API definitions. -// -//---------------------------------------------------------------------------- - -#ifndef DWRITE_H_INCLUDED -#define DWRITE_H_INCLUDED - -#if _MSC_VER > 1000 -#pragma once -#endif - -#ifndef DWRITE_NO_WINDOWS_H - -#include "specstrings.h" -#include "unknwn.h" - -#endif // DWRITE_NO_WINDOWS_H - -#include "dcommon.h" - -#if _FX_COMPILER_ == _FX_VC6_ -typedef signed char INT8, *PINT8; -typedef signed short INT16, *PINT16; -typedef signed int INT32, *PINT32; -typedef signed __int64 INT64, *PINT64; -typedef unsigned char UINT8, *PUINT8; -typedef unsigned short UINT16, *PUINT16; -typedef unsigned int UINT32, *PUINT32; -typedef unsigned __int64 UINT64, *PUINT64; -#endif - -#ifndef DWRITE_DECLARE_INTERFACE -#define DWRITE_DECLARE_INTERFACE(iid) DECLSPEC_UUID(iid) DECLSPEC_NOVTABLE -#endif - -#ifndef DWRITE_EXPORT -#define DWRITE_EXPORT __declspec(dllimport) WINAPI -#endif - -/// -/// The type of a font represented by a single font file. -/// Font formats that consist of multiple files, e.g. Type 1 .PFM and .PFB, have -/// separate enum values for each of the file type. -/// -enum DWRITE_FONT_FILE_TYPE -{ - /// - /// Font type is not recognized by the DirectWrite font system. - /// - DWRITE_FONT_FILE_TYPE_UNKNOWN, - - /// - /// OpenType font with CFF outlines. - /// - DWRITE_FONT_FILE_TYPE_CFF, - - /// - /// OpenType font with TrueType outlines. - /// - DWRITE_FONT_FILE_TYPE_TRUETYPE, - - /// - /// OpenType font that contains a TrueType collection. - /// - DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION, - - /// - /// Type 1 PFM font. - /// - DWRITE_FONT_FILE_TYPE_TYPE1_PFM, - - /// - /// Type 1 PFB font. - /// - DWRITE_FONT_FILE_TYPE_TYPE1_PFB, - - /// - /// Vector .FON font. - /// - DWRITE_FONT_FILE_TYPE_VECTOR, - - /// - /// Bitmap .FON font. - /// - DWRITE_FONT_FILE_TYPE_BITMAP -}; - -/// -/// The file format of a complete font face. -/// Font formats that consist of multiple files, e.g. Type 1 .PFM and .PFB, have -/// a single enum entry. -/// -enum DWRITE_FONT_FACE_TYPE -{ - /// - /// OpenType font face with CFF outlines. - /// - DWRITE_FONT_FACE_TYPE_CFF, - - /// - /// OpenType font face with TrueType outlines. - /// - DWRITE_FONT_FACE_TYPE_TRUETYPE, - - /// - /// OpenType font face that is a part of a TrueType collection. - /// - DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION, - - /// - /// A Type 1 font face. - /// - DWRITE_FONT_FACE_TYPE_TYPE1, - - /// - /// A vector .FON format font face. - /// - DWRITE_FONT_FACE_TYPE_VECTOR, - - /// - /// A bitmap .FON format font face. - /// - DWRITE_FONT_FACE_TYPE_BITMAP, - - /// - /// Font face type is not recognized by the DirectWrite font system. - /// - DWRITE_FONT_FACE_TYPE_UNKNOWN -}; - -/// -/// Specifies algorithmic style simulations to be applied to the font face. -/// Bold and oblique simulations can be combined via bitwise OR operation. -/// -enum DWRITE_FONT_SIMULATIONS -{ - /// - /// No simulations are performed. - /// - DWRITE_FONT_SIMULATIONS_NONE = 0x0000, - - /// - /// Algorithmic emboldening is performed. - /// - DWRITE_FONT_SIMULATIONS_BOLD = 0x0001, - - /// - /// Algorithmic italicization is performed. - /// - DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002 -}; - -#ifdef DEFINE_ENUM_FLAG_OPERATORS -DEFINE_ENUM_FLAG_OPERATORS(DWRITE_FONT_SIMULATIONS); -#endif - -/// -/// The font weight enumeration describes common values for degree of blackness or thickness of strokes of characters in a font. -/// Font weight values less than 1 or greater than 999 are considered to be invalid, and they are rejected by font API functions. -/// -enum DWRITE_FONT_WEIGHT -{ - /// - /// Predefined font weight : Thin (100). - /// - DWRITE_FONT_WEIGHT_THIN = 100, - - /// - /// Predefined font weight : Extra-light (200). - /// - DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200, - - /// - /// Predefined font weight : Ultra-light (200). - /// - DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200, - - /// - /// Predefined font weight : Light (300). - /// - DWRITE_FONT_WEIGHT_LIGHT = 300, - - /// - /// Predefined font weight : Normal (400). - /// - DWRITE_FONT_WEIGHT_NORMAL = 400, - - /// - /// Predefined font weight : Regular (400). - /// - DWRITE_FONT_WEIGHT_REGULAR = 400, - - /// - /// Predefined font weight : Medium (500). - /// - DWRITE_FONT_WEIGHT_MEDIUM = 500, - - /// - /// Predefined font weight : Demi-bold (600). - /// - DWRITE_FONT_WEIGHT_DEMI_BOLD = 600, - - /// - /// Predefined font weight : Semi-bold (600). - /// - DWRITE_FONT_WEIGHT_SEMI_BOLD = 600, - - /// - /// Predefined font weight : Bold (700). - /// - DWRITE_FONT_WEIGHT_BOLD = 700, - - /// - /// Predefined font weight : Extra-bold (800). - /// - DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800, - - /// - /// Predefined font weight : Ultra-bold (800). - /// - DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800, - - /// - /// Predefined font weight : Black (900). - /// - DWRITE_FONT_WEIGHT_BLACK = 900, - - /// - /// Predefined font weight : Heavy (900). - /// - DWRITE_FONT_WEIGHT_HEAVY = 900, - - /// - /// Predefined font weight : Extra-black (950). - /// - DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950, - - /// - /// Predefined font weight : Ultra-black (950). - /// - DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950 -}; - -/// -/// The font stretch enumeration describes relative change from the normal aspect ratio -/// as specified by a font designer for the glyphs in a font. -/// Values less than 1 or greater than 9 are considered to be invalid, and they are rejected by font API functions. -/// -enum DWRITE_FONT_STRETCH -{ - /// - /// Predefined font stretch : Not known (0). - /// - DWRITE_FONT_STRETCH_UNDEFINED = 0, - - /// - /// Predefined font stretch : Ultra-condensed (1). - /// - DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1, - - /// - /// Predefined font stretch : Extra-condensed (2). - /// - DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2, - - /// - /// Predefined font stretch : Condensed (3). - /// - DWRITE_FONT_STRETCH_CONDENSED = 3, - - /// - /// Predefined font stretch : Semi-condensed (4). - /// - DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4, - - /// - /// Predefined font stretch : Normal (5). - /// - DWRITE_FONT_STRETCH_NORMAL = 5, - - /// - /// Predefined font stretch : Medium (5). - /// - DWRITE_FONT_STRETCH_MEDIUM = 5, - - /// - /// Predefined font stretch : Semi-expanded (6). - /// - DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6, - - /// - /// Predefined font stretch : Expanded (7). - /// - DWRITE_FONT_STRETCH_EXPANDED = 7, - - /// - /// Predefined font stretch : Extra-expanded (8). - /// - DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8, - - /// - /// Predefined font stretch : Ultra-expanded (9). - /// - DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9 -}; - -/// -/// The font style enumeration describes the slope style of a font face, such as Normal, Italic or Oblique. -/// Values other than the ones defined in the enumeration are considered to be invalid, and they are rejected by font API functions. -/// -enum DWRITE_FONT_STYLE -{ - /// - /// Font slope style : Normal. - /// - DWRITE_FONT_STYLE_NORMAL, - - /// - /// Font slope style : Oblique. - /// - DWRITE_FONT_STYLE_OBLIQUE, - - /// - /// Font slope style : Italic. - /// - DWRITE_FONT_STYLE_ITALIC - -}; - -/// -/// The informational string enumeration identifies a string in a font. -/// -enum DWRITE_INFORMATIONAL_STRING_ID -{ - /// - /// Unspecified name ID. - /// - DWRITE_INFORMATIONAL_STRING_NONE, - - /// - /// Copyright notice provided by the font. - /// - DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, - - /// - /// String containing a version number. - /// - DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, - - /// - /// Trademark information provided by the font. - /// - DWRITE_INFORMATIONAL_STRING_TRADEMARK, - - /// - /// Name of the font manufacturer. - /// - DWRITE_INFORMATIONAL_STRING_MANUFACTURER, - - /// - /// Name of the font designer. - /// - DWRITE_INFORMATIONAL_STRING_DESIGNER, - - /// - /// URL of font designer (with protocol, e.g., http://, ftp://). - /// - DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, - - /// - /// Description of the font. Can contain revision information, usage recommendations, history, features, etc. - /// - DWRITE_INFORMATIONAL_STRING_DESCRIPTION, - - /// - /// URL of font vendor (with protocol, e.g., http://, ftp://). If a unique serial number is embedded in the URL, it can be used to register the font. - /// - DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, - - /// - /// Description of how the font may be legally used, or different example scenarios for licensed use. This field should be written in plain language, not legalese. - /// - DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, - - /// - /// URL where additional licensing information can be found. - /// - DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, - - /// - /// GDI-compatible family name. Because GDI allows a maximum of four fonts per family, fonts in the same family may have different GDI-compatible family names - /// (e.g., "Arial", "Arial Narrow", "Arial Black"). - /// - DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, - - /// - /// GDI-compatible subfamily name. - /// - DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, - - /// - /// Family name preferred by the designer. This enables font designers to group more than four fonts in a single family without losing compatibility with - /// GDI. This name is typically only present if it differs from the GDI-compatible family name. - /// - DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES, - - /// - /// Subfamily name preferred by the designer. This name is typically only present if it differs from the GDI-compatible subfamily name. - /// - DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES, - - /// - /// Sample text. This can be the font name or any other text that the designer thinks is the best example to display the font in. - /// - DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT -}; - - -/// -/// The DWRITE_FONT_METRICS structure specifies the metrics of a font face that -/// are applicable to all glyphs within the font face. -/// -struct DWRITE_FONT_METRICS -{ - /// - /// The number of font design units per em unit. - /// Font files use their own coordinate system of font design units. - /// A font design unit is the smallest measurable unit in the em square, - /// an imaginary square that is used to size and align glyphs. - /// The concept of em square is used as a reference scale factor when defining font size and device transformation semantics. - /// The size of one em square is also commonly used to compute the paragraph identation value. - /// - UINT16 designUnitsPerEm; - - /// - /// Ascent value of the font face in font design units. - /// Ascent is the distance from the top of font character alignment box to English baseline. - /// - UINT16 ascent; - - /// - /// Descent value of the font face in font design units. - /// Descent is the distance from the bottom of font character alignment box to English baseline. - /// - UINT16 descent; - - /// - /// Line gap in font design units. - /// Recommended additional white space to add between lines to improve legibility. The recommended line spacing - /// (baseline-to-baseline distance) is thus the sum of ascent, descent, and lineGap. The line gap is usually - /// positive or zero but can be negative, in which case the recommended line spacing is less than the height - /// of the character alignment box. - /// - INT16 lineGap; - - /// - /// Cap height value of the font face in font design units. - /// Cap height is the distance from English baseline to the top of a typical English capital. - /// Capital "H" is often used as a reference character for the purpose of calculating the cap height value. - /// - UINT16 capHeight; - - /// - /// x-height value of the font face in font design units. - /// x-height is the distance from English baseline to the top of lowercase letter "x", or a similar lowercase character. - /// - UINT16 xHeight; - - /// - /// The underline position value of the font face in font design units. - /// Underline position is the position of underline relative to the English baseline. - /// The value is usually made negative in order to place the underline below the baseline. - /// - INT16 underlinePosition; - - /// - /// The suggested underline thickness value of the font face in font design units. - /// - UINT16 underlineThickness; - - /// - /// The strikethrough position value of the font face in font design units. - /// Strikethrough position is the position of strikethrough relative to the English baseline. - /// The value is usually made positive in order to place the strikethrough above the baseline. - /// - INT16 strikethroughPosition; - - /// - /// The suggested strikethrough thickness value of the font face in font design units. - /// - UINT16 strikethroughThickness; -}; - -/// -/// The DWRITE_GLYPH_METRICS structure specifies the metrics of an individual glyph. -/// The units depend on how the metrics are obtained. -/// -struct DWRITE_GLYPH_METRICS -{ - /// - /// Specifies the X offset from the glyph origin to the left edge of the black box. - /// The glyph origin is the current horizontal writing position. - /// A negative value means the black box extends to the left of the origin (often true for lowercase italic 'f'). - /// - INT32 leftSideBearing; - - /// - /// Specifies the X offset from the origin of the current glyph to the origin of the next glyph when writing horizontally. - /// - UINT32 advanceWidth; - - /// - /// Specifies the X offset from the right edge of the black box to the origin of the next glyph when writing horizontally. - /// The value is negative when the right edge of the black box overhangs the layout box. - /// - INT32 rightSideBearing; - - /// - /// Specifies the vertical offset from the vertical origin to the top of the black box. - /// Thus, a positive value adds whitespace whereas a negative value means the glyph overhangs the top of the layout box. - /// - INT32 topSideBearing; - - /// - /// Specifies the Y offset from the vertical origin of the current glyph to the vertical origin of the next glyph when writing vertically. - /// (Note that the term "origin" by itself denotes the horizontal origin. The vertical origin is different. - /// Its Y coordinate is specified by verticalOriginY value, - /// and its X coordinate is half the advanceWidth to the right of the horizontal origin). - /// - UINT32 advanceHeight; - - /// - /// Specifies the vertical distance from the black box's bottom edge to the advance height. - /// Positive when the bottom edge of the black box is within the layout box. - /// Negative when the bottom edge of black box overhangs the layout box. - /// - INT32 bottomSideBearing; - - /// - /// Specifies the Y coordinate of a glyph's vertical origin, in the font's design coordinate system. - /// The y coordinate of a glyph's vertical origin is the sum of the glyph's top side bearing - /// and the top (i.e. yMax) of the glyph's bounding box. - /// - INT32 verticalOriginY; -}; - -/// -/// Optional adjustment to a glyph's position. An glyph offset changes the position of a glyph without affecting -/// the pen position. Offsets are in logical, pre-transform units. -/// -struct DWRITE_GLYPH_OFFSET -{ - /// - /// Offset in the advance direction of the run. A positive advance offset moves the glyph to the right - /// (in pre-transform coordinates) if the run is left-to-right or to the left if the run is right-to-left. - /// - FLOAT advanceOffset; - - /// - /// Offset in the ascent direction, i.e., the direction ascenders point. A positive ascender offset moves - /// the glyph up (in pre-transform coordinates). - /// - FLOAT ascenderOffset; -}; - -/// -/// Specifies the type of DirectWrite factory object. -/// DirectWrite factory contains internal state such as font loader registration and cached font data. -/// In most cases it is recommended to use the shared factory object, because it allows multiple components -/// that use DirectWrite to share internal DirectWrite state and reduce memory usage. -/// However, there are cases when it is desirable to reduce the impact of a component, -/// such as a plug-in from an untrusted source, on the rest of the process by sandboxing and isolating it -/// from the rest of the process components. In such cases, it is recommended to use an isolated factory for the sandboxed -/// component. -/// -enum DWRITE_FACTORY_TYPE -{ - /// - /// Shared factory allow for re-use of cached font data across multiple in process components. - /// Such factories also take advantage of cross process font caching components for better performance. - /// - DWRITE_FACTORY_TYPE_SHARED, - - /// - /// Objects created from the isolated factory do not interact with internal DirectWrite state from other components. - /// - DWRITE_FACTORY_TYPE_ISOLATED -}; - -// Creates an OpenType tag as a 32bit integer such that -// the first character in the tag is the lowest byte, -// (least significant on little endian architectures) -// which can be used to compare with tags in the font file. -// This macro is compatible with DWRITE_FONT_FEATURE_TAG. -// -// Example: DWRITE_MAKE_OPENTYPE_TAG('c','c','m','p') -// Dword: 0x706D6363 -// -#define DWRITE_MAKE_OPENTYPE_TAG(a,b,c,d) ( \ - (static_cast(static_cast(d)) << 24) | \ - (static_cast(static_cast(c)) << 16) | \ - (static_cast(static_cast(b)) << 8) | \ - static_cast(static_cast(a))) - -interface IDWriteFontFileStream; - -/// -/// Font file loader interface handles loading font file resources of a particular type from a key. -/// The font file loader interface is recommended to be implemented by a singleton object. -/// IMPORTANT: font file loader implementations must not register themselves with DirectWrite factory -/// inside their constructors and must not unregister themselves in their destructors, because -/// registration and unregistraton operations increment and decrement the object reference count respectively. -/// Instead, registration and unregistration of font file loaders with DirectWrite factory should be performed -/// outside of the font file loader implementation as a separate step. -/// -interface DWRITE_DECLARE_INTERFACE("727cad4e-d6af-4c9e-8a08-d695b11caa49") IDWriteFontFileLoader : public IUnknown -{ - /// - /// Creates a font file stream object that encapsulates an open file resource. - /// The resource is closed when the last reference to fontFileStream is released. - /// - /// Font file reference key that uniquely identifies the font file resource - /// within the scope of the font loader being used. - /// Size of font file reference key in bytes. - /// Pointer to the newly created font file stream. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateStreamFromKey)( - __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, - UINT32 fontFileReferenceKeySize, - __out IDWriteFontFileStream** fontFileStream - ) PURE; -}; - -/// -/// A built-in implementation of IDWriteFontFileLoader interface that operates on local font files -/// and exposes local font file information from the font file reference key. -/// Font file references created using CreateFontFileReference use this font file loader. -/// -interface DWRITE_DECLARE_INTERFACE("b2d9f3ec-c9fe-4a11-a2ec-d86208f7c0a2") IDWriteLocalFontFileLoader : public IDWriteFontFileLoader -{ - /// - /// Obtains the length of the absolute file path from the font file reference key. - /// - /// Font file reference key that uniquely identifies the local font file - /// within the scope of the font loader being used. - /// Size of font file reference key in bytes. - /// Length of the file path string not including the terminated NULL character. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFilePathLengthFromKey)( - __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, - UINT32 fontFileReferenceKeySize, - __out UINT32* filePathLength - ) PURE; - - /// - /// Obtains the absolute font file path from the font file reference key. - /// - /// Font file reference key that uniquely identifies the local font file - /// within the scope of the font loader being used. - /// Size of font file reference key in bytes. - /// Character array that receives the local file path. - /// Size of the filePath array in character count including the terminated NULL character. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFilePathFromKey)( - __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, - UINT32 fontFileReferenceKeySize, - __out_ecount_z(filePathSize) WCHAR* filePath, - UINT32 filePathSize - ) PURE; - - /// - /// Obtains the last write time of the file from the font file reference key. - /// - /// Font file reference key that uniquely identifies the local font file - /// within the scope of the font loader being used. - /// Size of font file reference key in bytes. - /// Last modified time of the font file. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetLastWriteTimeFromKey)( - __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, - UINT32 fontFileReferenceKeySize, - __out FILETIME* lastWriteTime - ) PURE; -}; - -/// -/// The interface for loading font file data. -/// -interface DWRITE_DECLARE_INTERFACE("6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0") IDWriteFontFileStream : public IUnknown -{ - /// - /// Reads a fragment from a file. - /// - /// Receives the pointer to the start of the font file fragment. - /// Offset of the fragment from the beginning of the font file. - /// Size of the fragment in bytes. - /// The client defined context to be passed to the ReleaseFileFragment. - /// - /// Standard HRESULT error code. - /// - /// - /// IMPORTANT: ReadFileFragment() implementations must check whether the requested file fragment - /// is within the file bounds. Otherwise, an error should be returned from ReadFileFragment. - /// - STDMETHOD(ReadFileFragment)( - __deref_out_bcount(fragmentSize) void const** fragmentStart, - UINT64 fileOffset, - UINT64 fragmentSize, - __out void** fragmentContext - ) PURE; - - /// - /// Releases a fragment from a file. - /// - /// The client defined context of a font fragment returned from ReadFileFragment. - STDMETHOD_(void, ReleaseFileFragment)( - void* fragmentContext - ) PURE; - - /// - /// Obtains the total size of a file. - /// - /// Receives the total size of the file. - /// - /// Standard HRESULT error code. - /// - /// - /// Implementing GetFileSize() for asynchronously loaded font files may require - /// downloading the complete file contents, therefore this method should only be used for operations that - /// either require complete font file to be loaded (e.g., copying a font file) or need to make - /// decisions based on the value of the file size (e.g., validation against a persisted file size). - /// - STDMETHOD(GetFileSize)( - __out UINT64* fileSize - ) PURE; - - /// - /// Obtains the last modified time of the file. The last modified time is used by DirectWrite font selection algorithms - /// to determine whether one font resource is more up to date than another one. - /// - /// Receives the last modifed time of the file in the format that represents - /// the number of 100-nanosecond intervals since January 1, 1601 (UTC). - /// - /// Standard HRESULT error code. For resources that don't have a concept of the last modified time, the implementation of - /// GetLastWriteTime should return E_NOTIMPL. - /// - STDMETHOD(GetLastWriteTime)( - __out UINT64* lastWriteTime - ) PURE; -}; - -/// -/// The interface that represents a reference to a font file. -/// -interface DWRITE_DECLARE_INTERFACE("739d886a-cef5-47dc-8769-1a8b41bebbb0") IDWriteFontFile : public IUnknown -{ - /// - /// This method obtains the pointer to the reference key of a font file. The pointer is only valid until the object that refers to it is released. - /// - /// Pointer to the font file reference key. - /// IMPORTANT: The pointer value is valid until the font file reference object it is obtained from is released. - /// Size of font file reference key in bytes. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetReferenceKey)( - __deref_out_bcount(*fontFileReferenceKeySize) void const** fontFileReferenceKey, - __out UINT32* fontFileReferenceKeySize - ) PURE; - - /// - /// Obtains the file loader associated with a font file object. - /// - /// The font file loader associated with the font file object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetLoader)( - __out IDWriteFontFileLoader** fontFileLoader - ) PURE; - - /// - /// Analyzes a file and returns whether it represents a font, and whether the font type is supported by the font system. - /// - /// TRUE if the font type is supported by the font system, FALSE otherwise. - /// The type of the font file. Note that even if isSupportedFontType is FALSE, - /// the fontFileType value may be different from DWRITE_FONT_FILE_TYPE_UNKNOWN. - /// The type of the font face that can be constructed from the font file. - /// Note that even if isSupportedFontType is FALSE, the fontFaceType value may be different from - /// DWRITE_FONT_FACE_TYPE_UNKNOWN. - /// Number of font faces contained in the font file. - /// - /// Standard HRESULT error code if there was a processing error during analysis. - /// - /// - /// IMPORTANT: certain font file types are recognized, but not supported by the font system. - /// For example, the font system will recognize a file as a Type 1 font file, - /// but will not be able to construct a font face object from it. In such situations, Analyze will set - /// isSupportedFontType output parameter to FALSE. - /// - STDMETHOD(Analyze)( - __out BOOL* isSupportedFontType, - __out DWRITE_FONT_FILE_TYPE* fontFileType, - __out_opt DWRITE_FONT_FACE_TYPE* fontFaceType, - __out UINT32* numberOfFaces - ) PURE; -}; - -/// -/// Represents the internal structure of a device pixel (i.e., the physical arrangement of red, -/// green, and blue color components) that is assumed for purposes of rendering text. -/// -#ifndef DWRITE_PIXEL_GEOMETRY_DEFINED -enum DWRITE_PIXEL_GEOMETRY -{ - /// - /// The red, green, and blue color components of each pixel are assumed to occupy the same point. - /// - DWRITE_PIXEL_GEOMETRY_FLAT, - - /// - /// Each pixel comprises three vertical stripes, with red on the left, green in the center, and - /// blue on the right. This is the most common pixel geometry for LCD monitors. - /// - DWRITE_PIXEL_GEOMETRY_RGB, - - /// - /// Each pixel comprises three vertical stripes, with blue on the left, green in the center, and - /// red on the right. - /// - DWRITE_PIXEL_GEOMETRY_BGR -}; -#define DWRITE_PIXEL_GEOMETRY_DEFINED -#endif - -/// -/// Represents a method of rendering glyphs. -/// -enum DWRITE_RENDERING_MODE -{ - /// - /// Specifies that the rendering mode is determined automatically based on the font and size. - /// - DWRITE_RENDERING_MODE_DEFAULT, - - /// - /// Specifies that no anti-aliasing is performed. Each pixel is either set to the foreground - /// color of the text or retains the color of the background. - /// - DWRITE_RENDERING_MODE_ALIASED, - - /// - /// Specifies ClearType rendering with the same metrics as aliased text. Glyphs can only - /// be positioned on whole-pixel boundaries. - /// - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC, - - /// - /// Specifies ClearType rendering with the same metrics as text rendering using GDI using a font - /// created with CLEARTYPE_NATURAL_QUALITY. Glyph metrics are closer to their ideal values than - /// with aliased text, but glyphs are still positioned on whole-pixel boundaries. - /// - DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL, - - /// - /// Specifies ClearType rendering with anti-aliasing in the horizontal dimension only. This is - /// typically used with small to medium font sizes (up to 16 ppem). - /// - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL, - - /// - /// Specifies ClearType rendering with anti-aliasing in both horizontal and vertical dimensions. - /// This is typically used at larger sizes to makes curves and diagonal lines look smoother, at - /// the expense of some softness. - /// - DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC, - - /// - /// Specifies that rendering should bypass the rasterizer and use the outlines directly. This is - /// typically used at very large sizes. - /// - DWRITE_RENDERING_MODE_OUTLINE -}; - -/// -/// The DWRITE_MATRIX structure specifies the graphics transform to be applied -/// to rendered glyphs. -/// -struct DWRITE_MATRIX -{ - /// - /// Horizontal scaling / cosine of rotation - /// - FLOAT m11; - - /// - /// Vertical shear / sine of rotation - /// - FLOAT m12; - - /// - /// Horizontal shear / negative sine of rotation - /// - FLOAT m21; - - /// - /// Vertical scaling / cosine of rotation - /// - FLOAT m22; - - /// - /// Horizontal shift (always orthogonal regardless of rotation) - /// - FLOAT dx; - - /// - /// Vertical shift (always orthogonal regardless of rotation) - /// - FLOAT dy; -}; - -/// -/// The interface that represents text rendering settings for glyph rasterization and filtering. -/// -interface DWRITE_DECLARE_INTERFACE("2f0da53a-2add-47cd-82ee-d9ec34688e75") IDWriteRenderingParams : public IUnknown -{ - /// - /// Gets the gamma value used for gamma correction. Valid values must be - /// greater than zero and cannot exceed 256. - /// - STDMETHOD_(FLOAT, GetGamma)() PURE; - - /// - /// Gets the amount of contrast enhancement. Valid values are greater than - /// or equal to zero. - /// - STDMETHOD_(FLOAT, GetEnhancedContrast)() PURE; - - /// - /// Gets the ClearType level. Valid values range from 0.0f (no ClearType) - /// to 1.0f (full ClearType). - /// - STDMETHOD_(FLOAT, GetClearTypeLevel)() PURE; - - /// - /// Gets the pixel geometry. - /// - STDMETHOD_(DWRITE_PIXEL_GEOMETRY, GetPixelGeometry)() PURE; - - /// - /// Gets the rendering mode. - /// - STDMETHOD_(DWRITE_RENDERING_MODE, GetRenderingMode)() PURE; -}; - -// Forward declarations of D2D types -interface ID2D1SimplifiedGeometrySink; - -typedef ID2D1SimplifiedGeometrySink IDWriteGeometrySink; - -/// -/// The interface that represents an absolute reference to a font face. -/// It contains font face type, appropriate file references and face identification data. -/// Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace. -/// -interface DWRITE_DECLARE_INTERFACE("5f49804d-7024-4d43-bfa9-d25984f53849") IDWriteFontFace : public IUnknown -{ - /// - /// Obtains the file format type of a font face. - /// - STDMETHOD_(DWRITE_FONT_FACE_TYPE, GetType)() PURE; - - /// - /// Obtains the font files representing a font face. - /// - /// The number of files representing the font face. - /// User provided array that stores pointers to font files representing the font face. - /// This parameter can be NULL if the user is only interested in the number of files representing the font face. - /// This API increments reference count of the font file pointers returned according to COM conventions, and the client - /// should release them when finished. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFiles)( - __inout UINT32* numberOfFiles, - __out_ecount_opt(*numberOfFiles) IDWriteFontFile** fontFiles - ) PURE; - - /// - /// Obtains the zero-based index of the font face in its font file or files. If the font files contain a single face, - /// the return value is zero. - /// - STDMETHOD_(UINT32, GetIndex)() PURE; - - /// - /// Obtains the algorithmic style simulation flags of a font face. - /// - STDMETHOD_(DWRITE_FONT_SIMULATIONS, GetSimulations)() PURE; - - /// - /// Determines whether the font is a symbol font. - /// - STDMETHOD_(BOOL, IsSymbolFont)() PURE; - - /// - /// Obtains design units and common metrics for the font face. - /// These metrics are applicable to all the glyphs within a fontface and are used by applications for layout calculations. - /// - /// Points to a DWRITE_FONT_METRICS structure to fill in. - /// The metrics returned by this function are in font design units. - STDMETHOD_(void, GetMetrics)( - __out DWRITE_FONT_METRICS* fontFaceMetrics - ) PURE; - - /// - /// Obtains the number of glyphs in the font face. - /// - STDMETHOD_(UINT16, GetGlyphCount)() PURE; - - /// - /// Obtains ideal glyph metrics in font design units. Design glyphs metrics are used for glyph positioning. - /// - /// An array of glyph indices to compute the metrics for. - /// The number of elements in the glyphIndices array. - /// Array of DWRITE_GLYPH_METRICS structures filled by this function. - /// The metrics returned by this function are in font design units. - /// Indicates whether the font is being used in a sideways run. - /// This can affect the glyph metrics if the font has oblique simulation - /// because sideways oblique simulation differs from non-sideways oblique simulation. - /// - /// Standard HRESULT error code. If any of the input glyph indices are outside of the valid glyph index range - /// for the current font face, E_INVALIDARG will be returned. - /// - STDMETHOD(GetDesignGlyphMetrics)( - __in_ecount(glyphCount) UINT16 const* glyphIndices, - UINT32 glyphCount, - __out_ecount(glyphCount) DWRITE_GLYPH_METRICS* glyphMetrics, - BOOL isSideways = FALSE - ) PURE; - - /// - /// Returns the nominal mapping of UCS4 Unicode code points to glyph indices as defined by the font 'CMAP' table. - /// Note that this mapping is primarily provided for line layout engines built on top of the physical font API. - /// Because of OpenType glyph substitution and line layout character substitution, the nominal conversion does not always correspond - /// to how a Unicode string will map to glyph indices when rendering using a particular font face. - /// Also, note that Unicode Variant Selectors provide for alternate mappings for character to glyph. - /// This call will always return the default variant. - /// - /// An array of USC4 code points to obtain nominal glyph indices from. - /// The number of elements in the codePoints array. - /// Array of nominal glyph indices filled by this function. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetGlyphIndices)( - __in_ecount(codePointCount) UINT32 const* codePoints, - UINT32 codePointCount, - __out_ecount(codePointCount) UINT16* glyphIndices - ) PURE; - - /// - /// Finds the specified OpenType font table if it exists and returns a pointer to it. - /// The function accesses the underling font data via the IDWriteFontStream interface - /// implemented by the font file loader. - /// - /// Four character tag of table to find. - /// Use the DWRITE_MAKE_OPENTYPE_TAG() macro to create it. - /// Unlike GDI, it does not support the special TTCF and null tags to access the whole font. - /// - /// Pointer to base of table in memory. - /// The pointer is only valid so long as the FontFace used to get the font table still exists - /// (not any other FontFace, even if it actually refers to the same physical font). - /// - /// Byte size of table. - /// - /// Opaque context which must be freed by calling ReleaseFontTable. - /// The context actually comes from the lower level IDWriteFontFileStream, - /// which may be implemented by the application or DWrite itself. - /// It is possible for a NULL tableContext to be returned, especially if - /// the implementation directly memory maps the whole file. - /// Nevertheless, always release it later, and do not use it as a test for function success. - /// The same table can be queried multiple times, - /// but each returned context can be different, so release each separately. - /// - /// True if table exists. - /// - /// Standard HRESULT error code. - /// If a table can not be found, the function will not return an error, but the size will be 0, table NULL, and exists = FALSE. - /// The context does not need to be freed if the table was not found. - /// - /// - /// The context for the same tag may be different for each call, - /// so each one must be held and released separately. - /// - STDMETHOD(TryGetFontTable)( - __in UINT32 openTypeTableTag, - __deref_out_bcount(*tableSize) const void** tableData, - __out UINT32* tableSize, - __out void** tableContext, - __out BOOL* exists - ) PURE; - - /// - /// Releases the table obtained earlier from TryGetFontTable. - /// - /// Opaque context from TryGetFontTable. - /// - /// Standard HRESULT error code. - /// - STDMETHOD_(void, ReleaseFontTable)( - __in void* tableContext - ) PURE; - - /// - /// Computes the outline of a run of glyphs by calling back to the outline sink interface. - /// - /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. - /// Array of glyph indices. - /// Optional array of glyph advances in DIPs. - /// Optional array of glyph offsets. - /// Number of glyphs. - /// If true, specifies that glyphs are rotated 90 degrees to the left and vertical metrics are used. - /// A client can render a vertical run by specifying isSideways = true and rotating the resulting geometry 90 degrees to the - /// right using a transform. The isSideways and isRightToLeft parameters cannot both be true. - /// If true, specifies that the advance direction is right to left. By default, the advance direction - /// is left to right. - /// Interface the function calls back to draw each element of the geometry. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetGlyphRunOutline)( - FLOAT emSize, - __in_ecount(glyphCount) UINT16 const* glyphIndices, - __in_ecount_opt(glyphCount) FLOAT const* glyphAdvances, - __in_ecount_opt(glyphCount) DWRITE_GLYPH_OFFSET const* glyphOffsets, - UINT32 glyphCount, - BOOL isSideways, - BOOL isRightToLeft, - IDWriteGeometrySink* geometrySink - ) PURE; - - /// - /// Determines the recommended rendering mode for the font given the specified size and rendering parameters. - /// - /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. - /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this - /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. - /// Specifies measuring method that will be used for glyphs in the font. - /// Renderer implementations may choose different rendering modes for given measuring methods, but - /// best results are seen when the corresponding modes match: - /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL - /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC - /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL - /// - /// Rendering parameters object. This parameter is necessary in case the rendering parameters - /// object overrides the rendering mode. - /// Receives the recommended rendering mode to use. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetRecommendedRenderingMode)( - FLOAT emSize, - FLOAT pixelsPerDip, - DWRITE_MEASURING_MODE measuringMode, - IDWriteRenderingParams* renderingParams, - __out DWRITE_RENDERING_MODE* renderingMode - ) PURE; - - /// - /// Obtains design units and common metrics for the font face. - /// These metrics are applicable to all the glyphs within a fontface and are used by applications for layout calculations. - /// - /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. - /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this - /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. - /// Optional transform applied to the glyphs and their positions. This transform is applied after the - /// scaling specified by the font size and pixelsPerDip. - /// Points to a DWRITE_FONT_METRICS structure to fill in. - /// The metrics returned by this function are in font design units. - STDMETHOD(GetGdiCompatibleMetrics)( - FLOAT emSize, - FLOAT pixelsPerDip, - __in_opt DWRITE_MATRIX const* transform, - __out DWRITE_FONT_METRICS* fontFaceMetrics - ) PURE; - - - /// - /// Obtains glyph metrics in font design units with the return values compatible with what GDI would produce. - /// Glyphs metrics are used for positioning of individual glyphs. - /// - /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. - /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this - /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. - /// Optional transform applied to the glyphs and their positions. This transform is applied after the - /// scaling specified by the font size and pixelsPerDip. - /// - /// When set to FALSE, the metrics are the same as the metrics of GDI aliased text. - /// When set to TRUE, the metrics are the same as the metrics of text measured by GDI using a font - /// created with CLEARTYPE_NATURAL_QUALITY. - /// - /// An array of glyph indices to compute the metrics for. - /// The number of elements in the glyphIndices array. - /// Array of DWRITE_GLYPH_METRICS structures filled by this function. - /// The metrics returned by this function are in font design units. - /// Indicates whether the font is being used in a sideways run. - /// This can affect the glyph metrics if the font has oblique simulation - /// because sideways oblique simulation differs from non-sideways oblique simulation. - /// - /// Standard HRESULT error code. If any of the input glyph indices are outside of the valid glyph index range - /// for the current font face, E_INVALIDARG will be returned. - /// - STDMETHOD(GetGdiCompatibleGlyphMetrics)( - FLOAT emSize, - FLOAT pixelsPerDip, - __in_opt DWRITE_MATRIX const* transform, - BOOL useGdiNatural, - __in_ecount(glyphCount) UINT16 const* glyphIndices, - UINT32 glyphCount, - __out_ecount(glyphCount) DWRITE_GLYPH_METRICS* glyphMetrics, - BOOL isSideways = FALSE - ) PURE; -}; - -interface IDWriteFactory; -interface IDWriteFontFileEnumerator; - -/// -/// The font collection loader interface is used to construct a collection of fonts given a particular type of key. -/// The font collection loader interface is recommended to be implemented by a singleton object. -/// IMPORTANT: font collection loader implementations must not register themselves with a DirectWrite factory -/// inside their constructors and must not unregister themselves in their destructors, because -/// registration and unregistraton operations increment and decrement the object reference count respectively. -/// Instead, registration and unregistration of font file loaders with DirectWrite factory should be performed -/// outside of the font file loader implementation as a separate step. -/// -interface DWRITE_DECLARE_INTERFACE("cca920e4-52f0-492b-bfa8-29c72ee0a468") IDWriteFontCollectionLoader : public IUnknown -{ - /// - /// Creates a font file enumerator object that encapsulates a collection of font files. - /// The font system calls back to this interface to create a font collection. - /// - /// Factory associated with the loader. - /// Font collection key that uniquely identifies the collection of font files within - /// the scope of the font collection loader being used. - /// Size of the font collection key in bytes. - /// Pointer to the newly created font file enumerator. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateEnumeratorFromKey)( - IDWriteFactory* factory, - __in_bcount(collectionKeySize) void const* collectionKey, - UINT32 collectionKeySize, - __out IDWriteFontFileEnumerator** fontFileEnumerator - ) PURE; -}; - -/// -/// The font file enumerator interface encapsulates a collection of font files. The font system uses this interface -/// to enumerate font files when building a font collection. -/// -interface DWRITE_DECLARE_INTERFACE("72755049-5ff7-435d-8348-4be97cfa6c7c") IDWriteFontFileEnumerator : public IUnknown -{ - /// - /// Advances to the next font file in the collection. When it is first created, the enumerator is positioned - /// before the first element of the collection and the first call to MoveNext advances to the first file. - /// - /// Receives the value TRUE if the enumerator advances to a file, or FALSE if - /// the enumerator advanced past the last file in the collection. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(MoveNext)( - __out BOOL* hasCurrentFile - ) PURE; - - /// - /// Gets a reference to the current font file. - /// - /// Pointer to the newly created font file object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetCurrentFontFile)( - __out IDWriteFontFile** fontFile - ) PURE; -}; - -/// -/// Represents a collection of strings indexed by locale name. -/// -interface DWRITE_DECLARE_INTERFACE("08256209-099a-4b34-b86d-c22b110e7771") IDWriteLocalizedStrings : public IUnknown -{ - /// - /// Gets the number of language/string pairs. - /// - STDMETHOD_(UINT32, GetCount)() PURE; - - /// - /// Gets the index of the item with the specified locale name. - /// - /// Locale name to look for. - /// Receives the zero-based index of the locale name/string pair. - /// Receives TRUE if the locale name exists or FALSE if not. - /// - /// Standard HRESULT error code. If the specified locale name does not exist, the return value is S_OK, - /// but *index is UINT_MAX and *exists is FALSE. - /// - STDMETHOD(FindLocaleName)( - __in_z WCHAR const* localeName, - __out UINT32* index, - __out BOOL* exists - ) PURE; - - /// - /// Gets the length in characters (not including the null terminator) of the locale name with the specified index. - /// - /// Zero-based index of the locale name. - /// Receives the length in characters, not including the null terminator. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetLocaleNameLength)( - UINT32 index, - __out UINT32* length - ) PURE; - - /// - /// Copies the locale name with the specified index to the specified array. - /// - /// Zero-based index of the locale name. - /// Character array that receives the locale name. - /// Size of the array in characters. The size must include space for the terminating - /// null character. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetLocaleName)( - UINT32 index, - __out_ecount_z(size) WCHAR* localeName, - UINT32 size - ) PURE; - - /// - /// Gets the length in characters (not including the null terminator) of the string with the specified index. - /// - /// Zero-based index of the string. - /// Receives the length in characters, not including the null terminator. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetStringLength)( - UINT32 index, - __out UINT32* length - ) PURE; - - /// - /// Copies the string with the specified index to the specified array. - /// - /// Zero-based index of the string. - /// Character array that receives the string. - /// Size of the array in characters. The size must include space for the terminating - /// null character. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetString)( - UINT32 index, - __out_ecount_z(size) WCHAR* stringBuffer, - UINT32 size - ) PURE; -}; - -interface IDWriteFontFamily; -interface IDWriteFont; - -/// -/// The IDWriteFontCollection encapsulates a collection of fonts. -/// -interface DWRITE_DECLARE_INTERFACE("a84cee02-3eea-4eee-a827-87c1a02a0fcc") IDWriteFontCollection : public IUnknown -{ - /// - /// Gets the number of font families in the collection. - /// - STDMETHOD_(UINT32, GetFontFamilyCount)() PURE; - - /// - /// Creates a font family object given a zero-based font family index. - /// - /// Zero-based index of the font family. - /// Receives a pointer the newly created font family object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontFamily)( - UINT32 index, - __out IDWriteFontFamily** fontFamily - ) PURE; - - /// - /// Finds the font family with the specified family name. - /// - /// Name of the font family. The name is not case-sensitive but must otherwise exactly match a family name in the collection. - /// Receives the zero-based index of the matching font family if the family name was found or UINT_MAX otherwise. - /// Receives TRUE if the family name exists or FALSE otherwise. - /// - /// Standard HRESULT error code. If the specified family name does not exist, the return value is S_OK, but *index is UINT_MAX and *exists is FALSE. - /// - STDMETHOD(FindFamilyName)( - __in_z WCHAR const* familyName, - __out UINT32* index, - __out BOOL* exists - ) PURE; - - /// - /// Gets the font object that corresponds to the same physical font as the specified font face object. The specified physical font must belong - /// to the font collection. - /// - /// Font face object that specifies the physical font. - /// Receives a pointer to the newly created font object if successful or NULL otherwise. - /// - /// Standard HRESULT error code. If the specified physical font is not part of the font collection the return value is DWRITE_E_NOFONT. - /// - STDMETHOD(GetFontFromFontFace)( - IDWriteFontFace* fontFace, - __out IDWriteFont** font - ) PURE; -}; - -/// -/// The IDWriteFontList interface represents a list of fonts. -/// -interface DWRITE_DECLARE_INTERFACE("1a0d8438-1d97-4ec1-aef9-a2fb86ed6acb") IDWriteFontList : public IUnknown -{ - /// - /// Gets the font collection that contains the fonts. - /// - /// Receives a pointer to the font collection object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontCollection)( - __out IDWriteFontCollection** fontCollection - ) PURE; - - /// - /// Gets the number of fonts in the font list. - /// - STDMETHOD_(UINT32, GetFontCount)() PURE; - - /// - /// Gets a font given its zero-based index. - /// - /// Zero-based index of the font in the font list. - /// Receives a pointer to the newly created font object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFont)( - UINT32 index, - __out IDWriteFont** font - ) PURE; -}; - -/// -/// The IDWriteFontFamily interface represents a set of fonts that share the same design but are differentiated -/// by weight, stretch, and style. -/// -interface DWRITE_DECLARE_INTERFACE("da20d8ef-812a-4c43-9802-62ec4abd7add") IDWriteFontFamily : public IDWriteFontList -{ - /// - /// Creates an localized strings object that contains the family names for the font family, indexed by locale name. - /// - /// Receives a pointer to the newly created localized strings object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFamilyNames)( - __out IDWriteLocalizedStrings** names - ) PURE; - - /// - /// Gets the font that best matches the specified properties. - /// - /// Requested font weight. - /// Requested font stretch. - /// Requested font style. - /// Receives a pointer to the newly created font object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFirstMatchingFont)( - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - __out IDWriteFont** matchingFont - ) PURE; - - /// - /// Gets a list of fonts in the font family ranked in order of how well they match the specified properties. - /// - /// Requested font weight. - /// Requested font stretch. - /// Requested font style. - /// Receives a pointer to the newly created font list object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetMatchingFonts)( - DWRITE_FONT_WEIGHT weight, - DWRITE_FONT_STRETCH stretch, - DWRITE_FONT_STYLE style, - __out IDWriteFontList** matchingFonts - ) PURE; -}; - -/// -/// The IDWriteFont interface represents a physical font in a font collection. -/// -interface DWRITE_DECLARE_INTERFACE("acd16696-8c14-4f5d-877e-fe3fc1d32737") IDWriteFont : public IUnknown -{ - /// - /// Gets the font family to which the specified font belongs. - /// - /// Receives a pointer to the font family object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontFamily)( - __out IDWriteFontFamily** fontFamily - ) PURE; - - /// - /// Gets the weight of the specified font. - /// - STDMETHOD_(DWRITE_FONT_WEIGHT, GetWeight)() PURE; - - /// - /// Gets the stretch (aka. width) of the specified font. - /// - STDMETHOD_(DWRITE_FONT_STRETCH, GetStretch)() PURE; - - /// - /// Gets the style (aka. slope) of the specified font. - /// - STDMETHOD_(DWRITE_FONT_STYLE, GetStyle)() PURE; - - /// - /// Returns TRUE if the font is a symbol font or FALSE if not. - /// - STDMETHOD_(BOOL, IsSymbolFont)() PURE; - - /// - /// Gets a localized strings collection containing the face names for the font (e.g., Regular or Bold), indexed by locale name. - /// - /// Receives a pointer to the newly created localized strings object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFaceNames)( - __out IDWriteLocalizedStrings** names - ) PURE; - - /// - /// Gets a localized strings collection containing the specified informational strings, indexed by locale name. - /// - /// Identifies the string to get. - /// Receives a pointer to the newly created localized strings object. - /// Receives the value TRUE if the font contains the specified string ID or FALSE if not. - /// - /// Standard HRESULT error code. If the font does not contain the specified string, the return value is S_OK but - /// informationalStrings receives a NULL pointer and exists receives the value FALSE. - /// - STDMETHOD(GetInformationalStrings)( - DWRITE_INFORMATIONAL_STRING_ID informationalStringID, - __out IDWriteLocalizedStrings** informationalStrings, - __out BOOL* exists - ) PURE; - - /// - /// Gets a value that indicates what simulation are applied to the specified font. - /// - STDMETHOD_(DWRITE_FONT_SIMULATIONS, GetSimulations)() PURE; - - /// - /// Gets the metrics for the font. - /// - /// Receives the font metrics. - STDMETHOD_(void, GetMetrics)( - __out DWRITE_FONT_METRICS* fontMetrics - ) PURE; - - /// - /// Determines whether the font supports the specified character. - /// - /// Unicode (UCS-4) character value. - /// Receives the value TRUE if the font supports the specified character or FALSE if not. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(HasCharacter)( - UINT32 unicodeValue, - __out BOOL* exists - ) PURE; - - /// - /// Creates a font face object for the font. - /// - /// Receives a pointer to the newly created font face object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateFontFace)( - __out IDWriteFontFace** fontFace - ) PURE; -}; - -/// -/// Direction for how reading progresses. -/// -enum DWRITE_READING_DIRECTION -{ - /// - /// Reading progresses from left to right. - /// - DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, - - /// - /// Reading progresses from right to left. - /// - DWRITE_READING_DIRECTION_RIGHT_TO_LEFT -}; - -/// -/// Direction for how lines of text are placed relative to one another. -/// -enum DWRITE_FLOW_DIRECTION -{ - /// - /// Text lines are placed from top to bottom. - /// - DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM -}; - -/// -/// Alignment of paragraph text along the reading direction axis relative to -/// the leading and trailing edge of the layout box. -/// -enum DWRITE_TEXT_ALIGNMENT -{ - /// - /// The leading edge of the paragraph text is aligned to the layout box's leading edge. - /// - DWRITE_TEXT_ALIGNMENT_LEADING, - - /// - /// The trailing edge of the paragraph text is aligned to the layout box's trailing edge. - /// - DWRITE_TEXT_ALIGNMENT_TRAILING, - - /// - /// The center of the paragraph text is aligned to the center of the layout box. - /// - DWRITE_TEXT_ALIGNMENT_CENTER -}; - -/// -/// Alignment of paragraph text along the flow direction axis relative to the -/// flow's beginning and ending edge of the layout box. -/// -enum DWRITE_PARAGRAPH_ALIGNMENT -{ - /// - /// The first line of paragraph is aligned to the flow's beginning edge of the layout box. - /// - DWRITE_PARAGRAPH_ALIGNMENT_NEAR, - - /// - /// The last line of paragraph is aligned to the flow's ending edge of the layout box. - /// - DWRITE_PARAGRAPH_ALIGNMENT_FAR, - - /// - /// The center of the paragraph is aligned to the center of the flow of the layout box. - /// - DWRITE_PARAGRAPH_ALIGNMENT_CENTER -}; - -/// -/// Word wrapping in multiline paragraph. -/// -enum DWRITE_WORD_WRAPPING -{ - /// - /// Words are broken across lines to avoid text overflowing the layout box. - /// - DWRITE_WORD_WRAPPING_WRAP, - - /// - /// Words are kept within the same line even when it overflows the layout box. - /// This option is often used with scrolling to reveal overflow text. - /// - DWRITE_WORD_WRAPPING_NO_WRAP -}; - -/// -/// The method used for line spacing in layout. -/// -enum DWRITE_LINE_SPACING_METHOD -{ - /// - /// Line spacing depends solely on the content, growing to accomodate the size of fonts and inline objects. - /// - DWRITE_LINE_SPACING_METHOD_DEFAULT, - - /// - /// Lines are explicitly set to uniform spacing, regardless of contained font sizes. - /// This can be useful to avoid the uneven appearance that can occur from font fallback. - /// - DWRITE_LINE_SPACING_METHOD_UNIFORM -}; - -/// -/// Text granularity used to trim text overflowing the layout box. -/// -enum DWRITE_TRIMMING_GRANULARITY -{ - /// - /// No trimming occurs. Text flows beyond the layout width. - /// - DWRITE_TRIMMING_GRANULARITY_NONE, - - /// - /// Trimming occurs at character cluster boundary. - /// - DWRITE_TRIMMING_GRANULARITY_CHARACTER, - - /// - /// Trimming occurs at word boundary. - /// - DWRITE_TRIMMING_GRANULARITY_WORD -}; - -/// -/// Typographic feature of text supplied by the font. -/// -enum DWRITE_FONT_FEATURE_TAG -{ - DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = 0x63726661, // 'afrc' - DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = 0x63703263, // 'c2pc' - DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = 0x63733263, // 'c2sc' - DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = 0x746c6163, // 'calt' - DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = 0x65736163, // 'case' - DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, // 'ccmp' - DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = 0x67696c63, // 'clig' - DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = 0x70737063, // 'cpsp' - DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = 0x68777363, // 'cswh' - DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = 0x73727563, // 'curs' - DWRITE_FONT_FEATURE_TAG_DEFAULT = 0x746c6664, // 'dflt' - DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = 0x67696c64, // 'dlig' - DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = 0x74707865, // 'expt' - DWRITE_FONT_FEATURE_TAG_FRACTIONS = 0x63617266, // 'frac' - DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = 0x64697766, // 'fwid' - DWRITE_FONT_FEATURE_TAG_HALF_FORMS = 0x666c6168, // 'half' - DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = 0x6e6c6168, // 'haln' - DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = 0x746c6168, // 'halt' - DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = 0x74736968, // 'hist' - DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = 0x616e6b68, // 'hkna' - DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = 0x67696c68, // 'hlig' - DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = 0x64697768, // 'hwid' - DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = 0x6f6a6f68, // 'hojo' - DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = 0x3430706a, // 'jp04' - DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = 0x3837706a, // 'jp78' - DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = 0x3338706a, // 'jp83' - DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = 0x3039706a, // 'jp90' - DWRITE_FONT_FEATURE_TAG_KERNING = 0x6e72656b, // 'kern' - DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = 0x6167696c, // 'liga' - DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = 0x6d756e6c, // 'lnum' - DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = 0x6c636f6c, // 'locl' - DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = 0x6b72616d, // 'mark' - DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = 0x6b72676d, // 'mgrk' - DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = 0x6b6d6b6d, // 'mkmk' - DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = 0x746c616e, // 'nalt' - DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = 0x6b636c6e, // 'nlck' - DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = 0x6d756e6f, // 'onum' - DWRITE_FONT_FEATURE_TAG_ORDINALS = 0x6e64726f, // 'ordn' - DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = 0x746c6170, // 'palt' - DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = 0x70616370, // 'pcap' - DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = 0x6d756e70, // 'pnum' - DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = 0x64697770, // 'pwid' - DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = 0x64697771, // 'qwid' - DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = 0x67696c72, // 'rlig' - DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = 0x79627572, // 'ruby' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = 0x746c6173, // 'salt' - DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = 0x666e6973, // 'sinf' - DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = 0x70636d73, // 'smcp' - DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = 0x6c706d73, // 'smpl' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = 0x31307373, // 'ss01' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = 0x32307373, // 'ss02' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = 0x33307373, // 'ss03' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = 0x34307373, // 'ss04' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = 0x35307373, // 'ss05' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = 0x36307373, // 'ss06' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = 0x37307373, // 'ss07' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = 0x38307373, // 'ss08' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = 0x39307373, // 'ss09' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = 0x30317373, // 'ss10' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = 0x31317373, // 'ss11' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = 0x32317373, // 'ss12' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = 0x33317373, // 'ss13' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = 0x34317373, // 'ss14' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = 0x35317373, // 'ss15' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = 0x36317373, // 'ss16' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = 0x37317373, // 'ss17' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = 0x38317373, // 'ss18' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = 0x39317373, // 'ss19' - DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = 0x30327373, // 'ss20' - DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = 0x73627573, // 'subs' - DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = 0x73707573, // 'sups' - DWRITE_FONT_FEATURE_TAG_SWASH = 0x68737773, // 'swsh' - DWRITE_FONT_FEATURE_TAG_TITLING = 0x6c746974, // 'titl' - DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = 0x6d616e74, // 'tnam' - DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = 0x6d756e74, // 'tnum' - DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = 0x64617274, // 'trad' - DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = 0x64697774, // 'twid' - DWRITE_FONT_FEATURE_TAG_UNICASE = 0x63696e75, // 'unic' - DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = 0x6f72657a, // 'zero' -}; - -/// -/// The DWRITE_TEXT_RANGE structure specifies a range of text positions where format is applied. -/// -struct DWRITE_TEXT_RANGE -{ - /// - /// The start text position of the range. - /// - UINT32 startPosition; - - /// - /// The number of text positions in the range. - /// - UINT32 length; -}; - -/// -/// The DWRITE_FONT_FEATURE structure specifies properties used to identify and execute typographic feature in the font. -/// -struct DWRITE_FONT_FEATURE -{ - /// - /// The feature OpenType name identifier. - /// - DWRITE_FONT_FEATURE_TAG nameTag; - - /// - /// Execution parameter of the feature. - /// - /// - /// The parameter should be non-zero to enable the feature. Once enabled, a feature can't be disabled again within - /// the same range. Features requiring a selector use this value to indicate the selector index. - /// - UINT32 parameter; -}; - -/// -/// Defines a set of typographic features to be applied during shaping. -/// Notice the character range which this feature list spans is specified -/// as a separate parameter to GetGlyphs. -/// -struct DWRITE_TYPOGRAPHIC_FEATURES -{ - /// - /// Array of font features. - /// - __field_ecount(featureCount) DWRITE_FONT_FEATURE* features; - - /// - /// The number of features. - /// - UINT32 featureCount; -}; - -/// -/// The DWRITE_TRIMMING structure specifies the trimming option for text overflowing the layout box. -/// -struct DWRITE_TRIMMING -{ - /// - /// Text granularity of which trimming applies. - /// - DWRITE_TRIMMING_GRANULARITY granularity; - - /// - /// Character code used as the delimiter signaling the beginning of the portion of text to be preserved, - /// most useful for path ellipsis, where the delimeter would be a slash. - /// - UINT32 delimiter; - - /// - /// How many occurences of the delimiter to step back. - /// - UINT32 delimiterCount; -}; - - -interface IDWriteTypography; -interface IDWriteInlineObject; - -/// -/// The format of text used for text layout purpose. -/// -/// -/// This object may not be thread-safe and it may carry the state of text format change. -/// -interface DWRITE_DECLARE_INTERFACE("9c906818-31d7-4fd3-a151-7c5e225db55a") IDWriteTextFormat : public IUnknown -{ - /// - /// Set alignment option of text relative to layout box's leading and trailing edge. - /// - /// Text alignment option - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetTextAlignment)( - DWRITE_TEXT_ALIGNMENT textAlignment - ) PURE; - - /// - /// Set alignment option of paragraph relative to layout box's top and bottom edge. - /// - /// Paragraph alignment option - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetParagraphAlignment)( - DWRITE_PARAGRAPH_ALIGNMENT paragraphAlignment - ) PURE; - - /// - /// Set word wrapping option. - /// - /// Word wrapping option - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetWordWrapping)( - DWRITE_WORD_WRAPPING wordWrapping - ) PURE; - - /// - /// Set paragraph reading direction. - /// - /// Text reading direction - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetReadingDirection)( - DWRITE_READING_DIRECTION readingDirection - ) PURE; - - /// - /// Set paragraph flow direction. - /// - /// Paragraph flow direction - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetFlowDirection)( - DWRITE_FLOW_DIRECTION flowDirection - ) PURE; - - /// - /// Set incremental tab stop position. - /// - /// The incremental tab stop value - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetIncrementalTabStop)( - FLOAT incrementalTabStop - ) PURE; - - /// - /// Set trimming options for any trailing text exceeding the layout width - /// or for any far text exceeding the layout height. - /// - /// Text trimming options. - /// Application-defined omission sign. This parameter may be NULL if no trimming sign is desired. - /// - /// Any inline object can be used for the trimming sign, but CreateEllipsisTrimmingSign - /// provides a typical ellipsis symbol. Trimming is also useful vertically for hiding - /// partial lines. - /// - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetTrimming)( - __in DWRITE_TRIMMING const* trimmingOptions, - IDWriteInlineObject* trimmingSign - ) PURE; - - /// - /// Set line spacing. - /// - /// How to determine line height. - /// The line height, or rather distance between one baseline to another. - /// Distance from top of line to baseline. A reasonable ratio to lineSpacing is 80%. - /// - /// For the default method, spacing depends solely on the content. - /// For uniform spacing, the given line height will override the content. - /// - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetLineSpacing)( - DWRITE_LINE_SPACING_METHOD lineSpacingMethod, - FLOAT lineSpacing, - FLOAT baseline - ) PURE; - - /// - /// Get alignment option of text relative to layout box's leading and trailing edge. - /// - STDMETHOD_(DWRITE_TEXT_ALIGNMENT, GetTextAlignment)() PURE; - - /// - /// Get alignment option of paragraph relative to layout box's top and bottom edge. - /// - STDMETHOD_(DWRITE_PARAGRAPH_ALIGNMENT, GetParagraphAlignment)() PURE; - - /// - /// Get word wrapping option. - /// - STDMETHOD_(DWRITE_WORD_WRAPPING, GetWordWrapping)() PURE; - - /// - /// Get paragraph reading direction. - /// - STDMETHOD_(DWRITE_READING_DIRECTION, GetReadingDirection)() PURE; - - /// - /// Get paragraph flow direction. - /// - STDMETHOD_(DWRITE_FLOW_DIRECTION, GetFlowDirection)() PURE; - - /// - /// Get incremental tab stop position. - /// - STDMETHOD_(FLOAT, GetIncrementalTabStop)() PURE; - - /// - /// Get trimming options for text overflowing the layout width. - /// - /// Text trimming options. - /// Trimming omission sign. This parameter may be NULL. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetTrimming)( - __out DWRITE_TRIMMING* trimmingOptions, - __out IDWriteInlineObject** trimmingSign - ) PURE; - - /// - /// Get line spacing. - /// - /// How line height is determined. - /// The line height, or rather distance between one baseline to another. - /// Distance from top of line to baseline. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetLineSpacing)( - __out DWRITE_LINE_SPACING_METHOD* lineSpacingMethod, - __out FLOAT* lineSpacing, - __out FLOAT* baseline - ) PURE; - - /// - /// Get the font collection. - /// - /// The current font collection. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontCollection)( - __out IDWriteFontCollection** fontCollection - ) PURE; - - /// - /// Get the length of the font family name, in characters, not including the terminating NULL character. - /// - STDMETHOD_(UINT32, GetFontFamilyNameLength)() PURE; - - /// - /// Get a copy of the font family name. - /// - /// Character array that receives the current font family name - /// Size of the character array in character count including the terminated NULL character. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontFamilyName)( - __out_ecount_z(nameSize) WCHAR* fontFamilyName, - UINT32 nameSize - ) PURE; - - /// - /// Get the font weight. - /// - STDMETHOD_(DWRITE_FONT_WEIGHT, GetFontWeight)() PURE; - - /// - /// Get the font style. - /// - STDMETHOD_(DWRITE_FONT_STYLE, GetFontStyle)() PURE; - - /// - /// Get the font stretch. - /// - STDMETHOD_(DWRITE_FONT_STRETCH, GetFontStretch)() PURE; - - /// - /// Get the font em height. - /// - STDMETHOD_(FLOAT, GetFontSize)() PURE; - - /// - /// Get the length of the locale name, in characters, not including the terminating NULL character. - /// - STDMETHOD_(UINT32, GetLocaleNameLength)() PURE; - - /// - /// Get a copy of the locale name. - /// - /// Character array that receives the current locale name - /// Size of the character array in character count including the terminated NULL character. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetLocaleName)( - __out_ecount_z(nameSize) WCHAR* localeName, - UINT32 nameSize - ) PURE; -}; - - -/// -/// Font typography setting. -/// -interface DWRITE_DECLARE_INTERFACE("55f1112b-1dc2-4b3c-9541-f46894ed85b6") IDWriteTypography : public IUnknown -{ - /// - /// Add font feature. - /// - /// The font feature to add. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(AddFontFeature)( - DWRITE_FONT_FEATURE fontFeature - ) PURE; - - /// - /// Get the number of font features. - /// - STDMETHOD_(UINT32, GetFontFeatureCount)() PURE; - - /// - /// Get the font feature at the specified index. - /// - /// The zero-based index of the font feature to get. - /// The font feature. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontFeature)( - UINT32 fontFeatureIndex, - __out DWRITE_FONT_FEATURE* fontFeature - ) PURE; -}; - -enum DWRITE_SCRIPT_SHAPES -{ - /// - /// No additional shaping requirement. Text is shaped with the writing system default behavior. - /// - DWRITE_SCRIPT_SHAPES_DEFAULT = 0, - - /// - /// Text should leave no visual on display i.e. control or format control characters. - /// - DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1 -}; - -#ifdef DEFINE_ENUM_FLAG_OPERATORS -DEFINE_ENUM_FLAG_OPERATORS(DWRITE_SCRIPT_SHAPES); -#endif - -/// -/// Association of text and its writing system script as well as some display attributes. -/// -struct DWRITE_SCRIPT_ANALYSIS -{ - /// - /// Zero-based index representation of writing system script. - /// - UINT16 script; - - /// - /// Additional shaping requirement of text. - /// - DWRITE_SCRIPT_SHAPES shapes; -}; - -/// -/// Condition at the edges of inline object or text used to determine -/// line-breaking behavior. -/// -enum DWRITE_BREAK_CONDITION -{ - /// - /// Whether a break is allowed is determined by the condition of the - /// neighboring text span or inline object. - /// - DWRITE_BREAK_CONDITION_NEUTRAL, - - /// - /// A break is allowed, unless overruled by the condition of the - /// neighboring text span or inline object, either prohibited by a - /// May Not or forced by a Must. - /// - DWRITE_BREAK_CONDITION_CAN_BREAK, - - /// - /// There should be no break, unless overruled by a Must condition from - /// the neighboring text span or inline object. - /// - DWRITE_BREAK_CONDITION_MAY_NOT_BREAK, - - /// - /// The break must happen, regardless of the condition of the adjacent - /// text span or inline object. - /// - DWRITE_BREAK_CONDITION_MUST_BREAK -}; - -/// -/// Line breakpoint characteristics of a character. -/// -struct DWRITE_LINE_BREAKPOINT -{ - /// - /// Breaking condition before the character. - /// - UINT8 breakConditionBefore : 2; - - /// - /// Breaking condition after the character. - /// - UINT8 breakConditionAfter : 2; - - /// - /// The character is some form of whitespace, which may be meaningful - /// for justification. - /// - UINT8 isWhitespace : 1; - - /// - /// The character is a soft hyphen, often used to indicate hyphenation - /// points inside words. - /// - UINT8 isSoftHyphen : 1; - - UINT8 padding : 2; -}; - -/// -/// How to apply number substitution on digits and related punctuation. -/// -enum DWRITE_NUMBER_SUBSTITUTION_METHOD -{ - /// - /// Specifies that the substitution method should be determined based - /// on LOCALE_IDIGITSUBSTITUTION value of the specified text culture. - /// - DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE, - - /// - /// If the culture is Arabic or Farsi, specifies that the number shape - /// depend on the context. Either traditional or nominal number shape - /// are used depending on the nearest preceding strong character or (if - /// there is none) the reading direction of the paragraph. - /// - DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, - - /// - /// Specifies that code points 0x30-0x39 are always rendered as nominal numeral - /// shapes (ones of the European number), i.e., no substitution is performed. - /// - DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, - - /// - /// Specifies that number are rendered using the national number shape - /// as specified by the LOCALE_SNATIVEDIGITS value of the specified text culture. - /// - DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, - - /// - /// Specifies that number are rendered using the traditional shape - /// for the specified culture. For most cultures, this is the same as - /// NativeNational. However, NativeNational results in Latin number - /// for some Arabic cultures, whereas this value results in Arabic - /// number for all Arabic cultures. - /// - DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL -}; - -/// -/// Holds the appropriate digits and numeric punctuation for a given locale. -/// -interface DECLSPEC_UUID("14885CC9-BAB0-4f90-B6ED-5C366A2CD03D") DECLSPEC_NOVTABLE IDWriteNumberSubstitution : public IUnknown -{ -}; - -/// -/// Shaping output properties per input character. -/// -struct DWRITE_SHAPING_TEXT_PROPERTIES -{ - /// - /// This character can be shaped independently from the others - /// (usually set for the space character). - /// - UINT16 isShapedAlone : 1; - - /// - /// Reserved for use by shaping engine. - /// - UINT16 reserved : 15; -}; - -/// -/// Shaping output properties per output glyph. -/// -struct DWRITE_SHAPING_GLYPH_PROPERTIES -{ - /// - /// Justification class, whether to use spacing, kashidas, or - /// another method. This exists for backwards compatibility - /// with Uniscribe's SCRIPT_JUSTIFY enum. - /// - UINT16 justification : 4; - - /// - /// Indicates glyph is the first of a cluster. - /// - UINT16 isClusterStart : 1; - - /// - /// Glyph is a diacritic. - /// - UINT16 isDiacritic : 1; - - /// - /// Glyph has no width, blank, ZWJ, ZWNJ etc. - /// - UINT16 isZeroWidthSpace : 1; - - /// - /// Reserved for use by shaping engine. - /// - UINT16 reserved : 9; -}; - -/// -/// The interface implemented by the text analyzer's client to provide text to -/// the analyzer. It allows the separation between the logical view of text as -/// a continuous stream of characters identifiable by unique text positions, -/// and the actual memory layout of potentially discrete blocks of text in the -/// client's backing store. -/// -/// If any of these callbacks returns an error, the analysis functions will -/// stop prematurely and return a callback error. Rather than return E_NOTIMPL, -/// an application should stub the method and return a constant/null and S_OK. -/// -interface DECLSPEC_UUID("688e1a58-5094-47c8-adc8-fbcea60ae92b") DECLSPEC_NOVTABLE IDWriteTextAnalysisSource : public IUnknown -{ - /// - /// Get a block of text starting at the specified text position. - /// Returning NULL indicates the end of text - the position is after - /// the last character. This function is called iteratively for - /// each consecutive block, tying together several fragmented blocks - /// in the backing store into a virtual contiguous string. - /// - /// First position of the piece to obtain. All - /// positions are in UTF16 code-units, not whole characters, which - /// matters when supplementary characters are used. - /// Address that receives a pointer to the text block - /// at the specified position. - /// Number of UTF16 units of the retrieved chunk. - /// The returned length is not the length of the block, but the length - /// remaining in the block, from the given position until its end. - /// So querying for a position that is 75 positions into a 100 - /// postition block would return 25. - /// Pointer to the first character at the given text position. - /// NULL indicates no chunk available at the specified position, either - /// because textPosition >= the entire text content length or because the - /// queried position is not mapped into the app's backing store. - /// - /// Although apps can implement sparse textual content that only maps part of - /// the backing store, the app must map any text that is in the range passed - /// to any analysis functions. - /// - STDMETHOD(GetTextAtPosition)( - UINT32 textPosition, - __out WCHAR const** textString, - __out UINT32* textLength - ) PURE; - - /// - /// Get a block of text immediately preceding the specified position. - /// - /// Position immediately after the last position of the chunk to obtain. - /// Address that receives a pointer to the text block - /// at the specified position. - /// Number of UTF16 units of the retrieved block. - /// The length returned is from the given position to the front of - /// the block. - /// Pointer to the first character at (textPosition - textLength). - /// NULL indicates no chunk available at the specified position, either - /// because textPosition == 0,the textPosition > the entire text content - /// length, or the queried position is not mapped into the app's backing - /// store. - /// - /// Although apps can implement sparse textual content that only maps part of - /// the backing store, the app must map any text that is in the range passed - /// to any analysis functions. - /// - STDMETHOD(GetTextBeforePosition)( - UINT32 textPosition, - __out WCHAR const** textString, - __out UINT32* textLength - ) PURE; - - /// - /// Get paragraph reading direction. - /// - STDMETHOD_(DWRITE_READING_DIRECTION, GetParagraphReadingDirection)() PURE; - - /// - /// Get locale name on the range affected by it. - /// - /// Position to get the locale name of. - /// Receives the length from the given position up to the - /// next differing locale. - /// Address that receives a pointer to the locale - /// at the specified position. - /// - /// The localeName pointer must remain valid until the next call or until - /// the analysis returns. - /// - STDMETHOD(GetLocaleName)( - UINT32 textPosition, - __out UINT32* textLength, - __out_z WCHAR const** localeName - ) PURE; - - /// - /// Get number substitution on the range affected by it. - /// - /// Position to get the number substitution of. - /// Receives the length from the given position up to the - /// next differing number substitution. - /// Address that receives a pointer to the number substitution - /// at the specified position. - /// - /// Any implementation should return the number substitution with an - /// incremented ref count, and the analysis will release when finished - /// with it (either before the next call or before it returns). However, - /// the sink callback may hold onto it after that. - /// - STDMETHOD(GetNumberSubstitution)( - UINT32 textPosition, - __out UINT32* textLength, - __out IDWriteNumberSubstitution** numberSubstitution - ) PURE; -}; - -/// -/// The interface implemented by the text analyzer's client to receive the -/// output of a given text analysis. The Text analyzer disregards any current -/// state of the analysis sink, therefore a Set method call on a range -/// overwrites the previously set analysis result of the same range. -/// -interface DECLSPEC_UUID("5810cd44-0ca0-4701-b3fa-bec5182ae4f6") DECLSPEC_NOVTABLE IDWriteTextAnalysisSink : public IUnknown -{ - /// - /// Report script analysis for the text range. - /// - /// Starting position to report from. - /// Number of UTF16 units of the reported range. - /// Script analysis of characters in range. - /// - /// A successful code or error code to abort analysis. - /// - STDMETHOD(SetScriptAnalysis)( - UINT32 textPosition, - UINT32 textLength, - __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis - ) PURE; - - /// - /// Repport line-break opportunities for each character, starting from - /// the specified position. - /// - /// Starting position to report from. - /// Number of UTF16 units of the reported range. - /// Breaking conditions for each character. - /// - /// A successful code or error code to abort analysis. - /// - STDMETHOD(SetLineBreakpoints)( - UINT32 textPosition, - UINT32 textLength, - __in_ecount(textLength) DWRITE_LINE_BREAKPOINT const* lineBreakpoints - ) PURE; - - /// - /// Set bidirectional level on the range, called once per each - /// level run change (either explicit or resolved implicit). - /// - /// Starting position to report from. - /// Number of UTF16 units of the reported range. - /// Explicit level from embedded control codes - /// RLE/RLO/LRE/LRO/PDF, determined before any additional rules. - /// Final implicit level considering the - /// explicit level and characters' natural directionality, after all - /// Bidi rules have been applied. - /// - /// A successful code or error code to abort analysis. - /// - STDMETHOD(SetBidiLevel)( - UINT32 textPosition, - UINT32 textLength, - UINT8 explicitLevel, - UINT8 resolvedLevel - ) PURE; - - /// - /// Set number substitution on the range. - /// - /// Starting position to report from. - /// Number of UTF16 units of the reported range. - /// The number substitution applicable to - /// the returned range of text. The sink callback may hold onto it by - /// incrementing its ref count. - /// - /// A successful code or error code to abort analysis. - /// - /// - /// Unlike script and bidi analysis, where every character passed to the - /// analyzer has a result, this will only be called for those ranges where - /// substitution is applicable. For any other range, you will simply not - /// be called. - /// - STDMETHOD(SetNumberSubstitution)( - UINT32 textPosition, - UINT32 textLength, - __notnull IDWriteNumberSubstitution* numberSubstitution - ) PURE; -}; - -/// -/// Analyzes various text properties for complex script processing. -/// -interface DWRITE_DECLARE_INTERFACE("b7e6163e-7f46-43b4-84b3-e4e6249c365d") IDWriteTextAnalyzer : public IUnknown -{ - /// - /// Analyzes a text range for script boundaries, reading text attributes - /// from the source and reporting the Unicode script ID to the sink - /// callback SetScript. - /// - /// Source object to analyze. - /// Starting position within the source object. - /// Length to analyze. - /// Callback object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(AnalyzeScript)( - IDWriteTextAnalysisSource* analysisSource, - UINT32 textPosition, - UINT32 textLength, - IDWriteTextAnalysisSink* analysisSink - ) PURE; - - /// - /// Analyzes a text range for script directionality, reading attributes - /// from the source and reporting levels to the sink callback SetBidiLevel. - /// - /// Source object to analyze. - /// Starting position within the source object. - /// Length to analyze. - /// Callback object. - /// - /// Standard HRESULT error code. - /// - /// - /// While the function can handle multiple paragraphs, the text range - /// should not arbitrarily split the middle of paragraphs. Otherwise the - /// returned levels may be wrong, since the Bidi algorithm is meant to - /// apply to the paragraph as a whole. - /// - /// - /// Embedded control codes (LRE/LRO/RLE/RLO/PDF) are taken into account. - /// - STDMETHOD(AnalyzeBidi)( - IDWriteTextAnalysisSource* analysisSource, - UINT32 textPosition, - UINT32 textLength, - IDWriteTextAnalysisSink* analysisSink - ) PURE; - - /// - /// Analyzes a text range for spans where number substitution is applicable, - /// reading attributes from the source and reporting substitutable ranges - /// to the sink callback SetNumberSubstitution. - /// - /// Source object to analyze. - /// Starting position within the source object. - /// Length to analyze. - /// Callback object. - /// - /// Standard HRESULT error code. - /// - /// - /// While the function can handle multiple ranges of differing number - /// substitutions, the text ranges should not arbitrarily split the - /// middle of numbers. Otherwise it will treat the numbers separately - /// and will not translate any intervening punctuation. - /// - /// - /// Embedded control codes (LRE/LRO/RLE/RLO/PDF) are taken into account. - /// - STDMETHOD(AnalyzeNumberSubstitution)( - IDWriteTextAnalysisSource* analysisSource, - UINT32 textPosition, - UINT32 textLength, - IDWriteTextAnalysisSink* analysisSink - ) PURE; - - /// - /// Analyzes a text range for potential breakpoint opportunities, reading - /// attributes from the source and reporting breakpoint opportunities to - /// the sink callback SetLineBreakpoints. - /// - /// Source object to analyze. - /// Starting position within the source object. - /// Length to analyze. - /// Callback object. - /// - /// Standard HRESULT error code. - /// - /// - /// While the function can handle multiple paragraphs, the text range - /// should not arbitrarily split the middle of paragraphs, unless the - /// given text span is considered a whole unit. Otherwise the - /// returned properties for the first and last characters will - /// inappropriately allow breaks. - /// - /// - /// Special cases include the first, last, and surrogate characters. Any - /// text span is treated as if adjacent to inline objects on either side. - /// So the rules with contingent-break opportunities are used, where the - /// edge between text and inline objects is always treated as a potential - /// break opportunity, dependent on any overriding rules of the adjacent - /// objects to prohibit or force the break (see Unicode TR #14). - /// Surrogate pairs never break between. - /// - STDMETHOD(AnalyzeLineBreakpoints)( - IDWriteTextAnalysisSource* analysisSource, - UINT32 textPosition, - UINT32 textLength, - IDWriteTextAnalysisSink* analysisSink - ) PURE; - - /// - /// Parses the input text string and maps it to the set of glyphs and associated glyph data - /// according to the font and the writing system's rendering rules. - /// - /// The string to convert to glyphs. - /// The length of textString. - /// The font face to get glyphs from. - /// Set to true if the text is intended to be - /// drawn vertically. - /// Set to TRUE for right-to-left text. - /// Script analysis result from AnalyzeScript. - /// The locale to use when selecting glyphs. - /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. - /// If this is NULL then the default mapping based on the script is used. - /// Optional number substitution which - /// selects the appropriate glyphs for digits and related numeric characters, - /// depending on the results obtained from AnalyzeNumberSubstitution. Passing - /// null indicates that no substitution is needed and that the digits should - /// receive nominal glyphs. - /// An array of pointers to the sets of typographic - /// features to use in each feature range. - /// The length of each feature range, in characters. - /// The sum of all lengths should be equal to textLength. - /// The number of feature ranges. - /// The maximum number of glyphs that can be - /// returned. - /// The mapping from character ranges to glyph - /// ranges. - /// Per-character output properties. - /// Output glyph indices. - /// Per-glyph output properties. - /// The actual number of glyphs returned if - /// the call succeeds. - /// - /// Standard HRESULT error code. - /// - /// - /// Note that the mapping from characters to glyphs is, in general, many- - /// to-many. The recommended estimate for the per-glyph output buffers is - /// (3 * textLength / 2 + 16). This is not guaranteed to be sufficient. - /// - /// The value of the actualGlyphCount parameter is only valid if the call - /// succeeds. In the event that maxGlyphCount is not big enough - /// E_NOT_SUFFICIENT_BUFFER, which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), - /// will be returned. The application should allocate a larger buffer and try again. - /// - STDMETHOD(GetGlyphs)( - __in_ecount(textLength) WCHAR const* textString, - UINT32 textLength, - IDWriteFontFace* fontFace, - BOOL isSideways, - BOOL isRightToLeft, - __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, - __in_z_opt WCHAR const* localeName, - __maybenull IDWriteNumberSubstitution* numberSubstitution, - __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, - __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, - UINT32 featureRanges, - UINT32 maxGlyphCount, - __out_ecount(textLength) UINT16* clusterMap, - __out_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, - __out_ecount(maxGlyphCount) UINT16* glyphIndices, - __out_ecount(maxGlyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES* glyphProps, - __out UINT32* actualGlyphCount - ) PURE; - - /// - /// Place glyphs output from the GetGlyphs method according to the font - /// and the writing system's rendering rules. - /// - /// The original string the glyphs came from. - /// The mapping from character ranges to glyph - /// ranges. Returned by GetGlyphs. - /// Per-character properties. Returned by - /// GetGlyphs. - /// The length of textString. - /// Glyph indices. See GetGlyphs - /// Per-glyph properties. See GetGlyphs - /// The number of glyphs. - /// The font face the glyphs came from. - /// Logical font size in DIP's. - /// Set to true if the text is intended to be - /// drawn vertically. - /// Set to TRUE for right-to-left text. - /// Script analysis result from AnalyzeScript. - /// The locale to use when selecting glyphs. - /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. - /// If this is NULL then the default mapping based on the script is used. - /// An array of pointers to the sets of typographic - /// features to use in each feature range. - /// The length of each feature range, in characters. - /// The sum of all lengths should be equal to textLength. - /// The number of feature ranges. - /// The advance width of each glyph. - /// The offset of the origin of each glyph. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetGlyphPlacements)( - __in_ecount(textLength) WCHAR const* textString, - __in_ecount(textLength) UINT16 const* clusterMap, - __in_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, - UINT32 textLength, - __in_ecount(glyphCount) UINT16 const* glyphIndices, - __in_ecount(glyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES const* glyphProps, - UINT32 glyphCount, - IDWriteFontFace * fontFace, - FLOAT fontEmSize, - BOOL isSideways, - BOOL isRightToLeft, - __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, - __in_z_opt WCHAR const* localeName, - __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, - __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, - UINT32 featureRanges, - __out_ecount(glyphCount) FLOAT* glyphAdvances, - __out_ecount(glyphCount) DWRITE_GLYPH_OFFSET* glyphOffsets - ) PURE; - - /// - /// Place glyphs output from the GetGlyphs method according to the font - /// and the writing system's rendering rules. - /// - /// The original string the glyphs came from. - /// The mapping from character ranges to glyph - /// ranges. Returned by GetGlyphs. - /// Per-character properties. Returned by - /// GetGlyphs. - /// The length of textString. - /// Glyph indices. See GetGlyphs - /// Per-glyph properties. See GetGlyphs - /// The number of glyphs. - /// The font face the glyphs came from. - /// Logical font size in DIP's. - /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this - /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. - /// Optional transform applied to the glyphs and their positions. This transform is applied after the - /// scaling specified by the font size and pixelsPerDip. - /// - /// When set to FALSE, the metrics are the same as the metrics of GDI aliased text. - /// When set to TRUE, the metrics are the same as the metrics of text measured by GDI using a font - /// created with CLEARTYPE_NATURAL_QUALITY. - /// - /// Set to true if the text is intended to be - /// drawn vertically. - /// Set to TRUE for right-to-left text. - /// Script analysis result from AnalyzeScript. - /// The locale to use when selecting glyphs. - /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. - /// If this is NULL then the default mapping based on the script is used. - /// An array of pointers to the sets of typographic - /// features to use in each feature range. - /// The length of each feature range, in characters. - /// The sum of all lengths should be equal to textLength. - /// The number of feature ranges. - /// The advance width of each glyph. - /// The offset of the origin of each glyph. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetGdiCompatibleGlyphPlacements)( - __in_ecount(textLength) WCHAR const* textString, - __in_ecount(textLength) UINT16 const* clusterMap, - __in_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, - UINT32 textLength, - __in_ecount(glyphCount) UINT16 const* glyphIndices, - __in_ecount(glyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES const* glyphProps, - UINT32 glyphCount, - IDWriteFontFace * fontFace, - FLOAT fontEmSize, - FLOAT pixelsPerDip, - __in_opt DWRITE_MATRIX const* transform, - BOOL useGdiNatural, - BOOL isSideways, - BOOL isRightToLeft, - __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, - __in_z_opt WCHAR const* localeName, - __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, - __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, - UINT32 featureRanges, - __out_ecount(glyphCount) FLOAT* glyphAdvances, - __out_ecount(glyphCount) DWRITE_GLYPH_OFFSET* glyphOffsets - ) PURE; -}; - -/// -/// The DWRITE_GLYPH_RUN structure contains the information needed by renderers -/// to draw glyph runs. All coordinates are in device independent pixels (DIPs). -/// -struct DWRITE_GLYPH_RUN -{ - /// - /// The physical font face to draw with. - /// - __notnull IDWriteFontFace* fontFace; - - /// - /// Logical size of the font in DIPs, not points (equals 1/96 inch). - /// - FLOAT fontEmSize; - - /// - /// The number of glyphs. - /// - UINT32 glyphCount; - - /// - /// The indices to render. - /// - __field_ecount(glyphCount) UINT16 const* glyphIndices; - - /// - /// Glyph advance widths. - /// - __field_ecount_opt(glyphCount) FLOAT const* glyphAdvances; - - /// - /// Glyph offsets. - /// - __field_ecount_opt(glyphCount) DWRITE_GLYPH_OFFSET const* glyphOffsets; - - /// - /// If true, specifies that glyphs are rotated 90 degrees to the left and - /// vertical metrics are used. Vertical writing is achieved by specifying - /// isSideways = true and rotating the entire run 90 degrees to the right - /// via a rotate transform. - /// - BOOL isSideways; - - /// - /// The implicit resolved bidi level of the run. Odd levels indicate - /// right-to-left languages like Hebrew and Arabic, while even levels - /// indicate left-to-right languages like English and Japanese (when - /// written horizontally). For right-to-left languages, the text origin - /// is on the right, and text should be drawn to the left. - /// - UINT32 bidiLevel; -}; - -/// -/// The DWRITE_GLYPH_RUN_DESCRIPTION structure contains additional properties -/// related to those in DWRITE_GLYPH_RUN. -/// -struct DWRITE_GLYPH_RUN_DESCRIPTION -{ - /// - /// The locale name associated with this run. - /// - __nullterminated WCHAR const* localeName; - - /// - /// The text associated with the glyphs. - /// - __field_ecount(stringLength) WCHAR const* string; - - /// - /// The number of characters (UTF16 code-units). - /// Note that this may be different than the number of glyphs. - /// - UINT32 stringLength; - - /// - /// An array of indices to the glyph indices array, of the first glyphs of - /// all the glyph clusters of the glyphs to render. - /// - __field_ecount(stringLength) UINT16 const* clusterMap; - - /// - /// Corresponding text position in the original string - /// this glyph run came from. - /// - UINT32 textPosition; -}; - -/// -/// The DWRITE_UNDERLINE structure contains about the size and placement of -/// underlines. All coordinates are in device independent pixels (DIPs). -/// -struct DWRITE_UNDERLINE -{ - /// - /// Width of the underline, measured parallel to the baseline. - /// - FLOAT width; - - /// - /// Thickness of the underline, measured perpendicular to the - /// baseline. - /// - FLOAT thickness; - - /// - /// Offset of the underline from the baseline. - /// A positive offset represents a position below the baseline and - /// a negative offset is above. - /// - FLOAT offset; - - /// - /// Height of the tallest run where the underline applies. - /// - FLOAT runHeight; - - /// - /// Reading direction of the text associated with the underline. This - /// value is used to interpret whether the width value runs horizontally - /// or vertically. - /// - DWRITE_READING_DIRECTION readingDirection; - - /// - /// Flow direction of the text associated with the underline. This value - /// is used to interpret whether the thickness value advances top to - /// bottom, left to right, or right to left. - /// - DWRITE_FLOW_DIRECTION flowDirection; - - /// - /// Locale of the text the underline is being drawn under. Can be - /// pertinent where the locale affects how the underline is drawn. - /// For example, in vertical text, the underline belongs on the - /// left for Chinese but on the right for Japanese. - /// This choice is completely left up to higher levels. - /// - __nullterminated WCHAR const* localeName; - - /// - /// The measuring mode can be useful to the renderer to determine how - /// underlines are rendered, e.g. rounding the thickness to a whole pixel - /// in GDI-compatible modes. - /// - DWRITE_MEASURING_MODE measuringMode; -}; - -/// -/// The DWRITE_STRIKETHROUGH structure contains about the size and placement of -/// strickthroughs. All coordinates are in device independent pixels (DIPs). -/// -struct DWRITE_STRIKETHROUGH -{ - /// - /// Width of the strikethrough, measured parallel to the baseline. - /// - FLOAT width; - - /// - /// Thickness of the strikethrough, measured perpendicular to the - /// baseline. - /// - FLOAT thickness; - - /// - /// Offset of the stikethrough from the baseline. - /// A positive offset represents a position below the baseline and - /// a negative offset is above. - /// - FLOAT offset; - - /// - /// Reading direction of the text associated with the strikethrough. This - /// value is used to interpret whether the width value runs horizontally - /// or vertically. - /// - DWRITE_READING_DIRECTION readingDirection; - - /// - /// Flow direction of the text associated with the strikethrough. This - /// value is used to interpret whether the thickness value advances top to - /// bottom, left to right, or right to left. - /// - DWRITE_FLOW_DIRECTION flowDirection; - - /// - /// Locale of the range. Can be pertinent where the locale affects the style. - /// - __nullterminated WCHAR const* localeName; - - /// - /// The measuring mode can be useful to the renderer to determine how - /// underlines are rendered, e.g. rounding the thickness to a whole pixel - /// in GDI-compatible modes. - /// - DWRITE_MEASURING_MODE measuringMode; -}; - -/// -/// The DWRITE_LINE_METRICS structure contains information about a formatted -/// line of text. -/// -struct DWRITE_LINE_METRICS -{ - /// - /// The number of total text positions in the line. - /// This includes any trailing whitespace and newline characters. - /// - UINT32 length; - - /// - /// The number of whitespace positions at the end of the line. Newline - /// sequences are considered whitespace. - /// - UINT32 trailingWhitespaceLength; - - /// - /// The number of characters in the newline sequence at the end of the line. - /// If the count is zero, then the line was either wrapped or it is the - /// end of the text. - /// - UINT32 newlineLength; - - /// - /// Height of the line as measured from top to bottom. - /// - FLOAT height; - - /// - /// Distance from the top of the line to its baseline. - /// - FLOAT baseline; - - /// - /// The line is trimmed. - /// - BOOL isTrimmed; -}; - - -/// -/// The DWRITE_CLUSTER_METRICS structure contains information about a glyph cluster. -/// -struct DWRITE_CLUSTER_METRICS -{ - /// - /// The total advance width of all glyphs in the cluster. - /// - FLOAT width; - - /// - /// The number of text positions in the cluster. - /// - UINT16 length; - - /// - /// Indicate whether line can be broken right after the cluster. - /// - UINT16 canWrapLineAfter : 1; - - /// - /// Indicate whether the cluster corresponds to whitespace character. - /// - UINT16 isWhitespace : 1; - - /// - /// Indicate whether the cluster corresponds to a newline character. - /// - UINT16 isNewline : 1; - - /// - /// Indicate whether the cluster corresponds to soft hyphen character. - /// - UINT16 isSoftHyphen : 1; - - /// - /// Indicate whether the cluster is read from right to left. - /// - UINT16 isRightToLeft : 1; - - UINT16 padding : 11; -}; - - -/// -/// Overall metrics associated with text after layout. -/// All coordinates are in device independent pixels (DIPs). -/// -struct DWRITE_TEXT_METRICS -{ - /// - /// Left-most point of formatted text relative to layout box - /// (excluding any glyph overhang). - /// - FLOAT left; - - /// - /// Top-most point of formatted text relative to layout box - /// (excluding any glyph overhang). - /// - FLOAT top; - - /// - /// The width of the formatted text ignoring trailing whitespace - /// at the end of each line. - /// - FLOAT width; - - /// - /// The width of the formatted text taking into account the - /// trailing whitespace at the end of each line. - /// - FLOAT widthIncludingTrailingWhitespace; - - /// - /// The height of the formatted text. The height of an empty string - /// is determined by the size of the default font's line height. - /// - FLOAT height; - - /// - /// Initial width given to the layout. Depending on whether the text - /// was wrapped or not, it can be either larger or smaller than the - /// text content width. - /// - FLOAT layoutWidth; - - /// - /// Initial height given to the layout. Depending on the length of the - /// text, it may be larger or smaller than the text content height. - /// - FLOAT layoutHeight; - - /// - /// The maximum reordering count of any line of text, used - /// to calculate the most number of hit-testing boxes needed. - /// If the layout has no bidirectional text or no text at all, - /// the minimum level is 1. - /// - UINT32 maxBidiReorderingDepth; - - /// - /// Total number of lines. - /// - UINT32 lineCount; -}; - - -/// -/// Properties describing the geometric measurement of an -/// application-defined inline object. -/// -struct DWRITE_INLINE_OBJECT_METRICS -{ - /// - /// Width of the inline object. - /// - FLOAT width; - - /// - /// Height of the inline object as measured from top to bottom. - /// - FLOAT height; - - /// - /// Distance from the top of the object to the baseline where it is lined up with the adjacent text. - /// If the baseline is at the bottom, baseline simply equals height. - /// - FLOAT baseline; - - /// - /// Flag indicating whether the object is to be placed upright or alongside the text baseline - /// for vertical text. - /// - BOOL supportsSideways; -}; - - -/// -/// The DWRITE_OVERHANG_METRICS structure holds how much any visible pixels -/// (in DIPs) overshoot each side of the layout or inline objects. -/// -/// -/// Positive overhangs indicate that the visible area extends outside the layout -/// box or inline object, while negative values mean there is whitespace inside. -/// The returned values are unaffected by rendering transforms or pixel snapping. -/// Additionally, they may not exactly match final target's pixel bounds after -/// applying grid fitting and hinting. -/// -struct DWRITE_OVERHANG_METRICS -{ - /// - /// The distance from the left-most visible DIP to its left alignment edge. - /// - FLOAT left; - - /// - /// The distance from the top-most visible DIP to its top alignment edge. - /// - FLOAT top; - - /// - /// The distance from the right-most visible DIP to its right alignment edge. - /// - FLOAT right; - - /// - /// The distance from the bottom-most visible DIP to its bottom alignment edge. - /// - FLOAT bottom; -}; - - -/// -/// Geometry enclosing of text positions. -/// -struct DWRITE_HIT_TEST_METRICS -{ - /// - /// First text position within the geometry. - /// - UINT32 textPosition; - - /// - /// Number of text positions within the geometry. - /// - UINT32 length; - - /// - /// Left position of the top-left coordinate of the geometry. - /// - FLOAT left; - - /// - /// Top position of the top-left coordinate of the geometry. - /// - FLOAT top; - - /// - /// Geometry's width. - /// - FLOAT width; - - /// - /// Geometry's height. - /// - FLOAT height; - - /// - /// Bidi level of text positions enclosed within the geometry. - /// - UINT32 bidiLevel; - - /// - /// Geometry encloses text? - /// - BOOL isText; - - /// - /// Range is trimmed. - /// - BOOL isTrimmed; -}; - - -interface IDWriteTextRenderer; - - -/// -/// The IDWriteInlineObject interface wraps an application defined inline graphic, -/// allowing DWrite to query metrics as if it was a glyph inline with the text. -/// -interface DWRITE_DECLARE_INTERFACE("8339FDE3-106F-47ab-8373-1C6295EB10B3") IDWriteInlineObject : public IUnknown -{ - /// - /// The application implemented rendering callback (IDWriteTextRenderer::DrawInlineObject) - /// can use this to draw the inline object without needing to cast or query the object - /// type. The text layout does not call this method directly. - /// - /// The context passed to IDWriteTextLayout::Draw. - /// The renderer passed to IDWriteTextLayout::Draw as the object's containing parent. - /// X-coordinate at the top-left corner of the inline object. - /// Y-coordinate at the top-left corner of the inline object. - /// The object should be drawn on its side. - /// The object is in an right-to-left context and should be drawn flipped. - /// The drawing effect set in IDWriteTextLayout::SetDrawingEffect. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(Draw)( - __maybenull void* clientDrawingContext, - IDWriteTextRenderer* renderer, - FLOAT originX, - FLOAT originY, - BOOL isSideways, - BOOL isRightToLeft, - __maybenull IUnknown* clientDrawingEffect - ) PURE; - - /// - /// TextLayout calls this callback function to get the measurement of the inline object. - /// - /// Returned metrics - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetMetrics)( - __out DWRITE_INLINE_OBJECT_METRICS* metrics - ) PURE; - - /// - /// TextLayout calls this callback function to get the visible extents (in DIPs) of the inline object. - /// In the case of a simple bitmap, with no padding and no overhang, all the overhangs will - /// simply be zeroes. - /// - /// Overshoot of visible extents (in DIPs) outside the object. - /// - /// Standard HRESULT error code. - /// - /// - /// The overhangs should be returned relative to the reported size of the object - /// (DWRITE_INLINE_OBJECT_METRICS::width/height), and should not be baseline - /// adjusted. If you have an image that is actually 100x100 DIPs, but you want it - /// slightly inset (perhaps it has a glow) by 20 DIPs on each side, you would - /// return a width/height of 60x60 and four overhangs of 20 DIPs. - /// - STDMETHOD(GetOverhangMetrics)( - __out DWRITE_OVERHANG_METRICS* overhangs - ) PURE; - - /// - /// Layout uses this to determine the line breaking behavior of the inline object - /// amidst the text. - /// - /// Line-breaking condition between the object and the content immediately preceding it. - /// Line-breaking condition between the object and the content immediately following it. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetBreakConditions)( - __out DWRITE_BREAK_CONDITION* breakConditionBefore, - __out DWRITE_BREAK_CONDITION* breakConditionAfter - ) PURE; -}; - -/// -/// The IDWritePixelSnapping interface defines the pixel snapping properties of a text renderer. -/// -interface DWRITE_DECLARE_INTERFACE("eaf3a2da-ecf4-4d24-b644-b34f6842024b") IDWritePixelSnapping : public IUnknown -{ - /// - /// Determines whether pixel snapping is disabled. The recommended default is FALSE, - /// unless doing animation that requires subpixel vertical placement. - /// - /// The context passed to IDWriteTextLayout::Draw. - /// Receives TRUE if pixel snapping is disabled or FALSE if it not. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(IsPixelSnappingDisabled)( - __maybenull void* clientDrawingContext, - __out BOOL* isDisabled - ) PURE; - - /// - /// Gets the current transform that maps abstract coordinates to DIPs, - /// which may disable pixel snapping upon any rotation or shear. - /// - /// The context passed to IDWriteTextLayout::Draw. - /// Receives the transform. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetCurrentTransform)( - __maybenull void* clientDrawingContext, - __out DWRITE_MATRIX* transform - ) PURE; - - /// - /// Gets the number of physical pixels per DIP. A DIP (device-independent pixel) is 1/96 inch, - /// so the pixelsPerDip value is the number of logical pixels per inch divided by 96 (yielding - /// a value of 1 for 96 DPI and 1.25 for 120). - /// - /// The context passed to IDWriteTextLayout::Draw. - /// Receives the number of physical pixels per DIP. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetPixelsPerDip)( - __maybenull void* clientDrawingContext, - __out FLOAT* pixelsPerDip - ) PURE; -}; - -/// -/// The IDWriteTextLayout interface represents a set of application-defined -/// callbacks that perform rendering of text, inline objects, and decorations -/// such as underlines. -/// -interface DWRITE_DECLARE_INTERFACE("ef8a8135-5cc6-45fe-8825-c5a0724eb819") IDWriteTextRenderer : public IDWritePixelSnapping -{ - /// - /// IDWriteTextLayout::Draw calls this function to instruct the client to - /// render a run of glyphs. - /// - /// The context passed to - /// IDWriteTextLayout::Draw. - /// X-coordinate of the baseline. - /// Y-coordinate of the baseline. - /// Specifies measuring method for glyphs in the run. - /// Renderer implementations may choose different rendering modes for given measuring methods, - /// but best results are seen when the rendering mode matches the corresponding measuring mode: - /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL - /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC - /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL - /// - /// The glyph run to draw. - /// Properties of the characters - /// associated with this run. - /// The drawing effect set in - /// IDWriteTextLayout::SetDrawingEffect. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(DrawGlyphRun)( - __maybenull void* clientDrawingContext, - FLOAT baselineOriginX, - FLOAT baselineOriginY, - DWRITE_MEASURING_MODE measuringMode, - __in DWRITE_GLYPH_RUN const* glyphRun, - __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, - __maybenull IUnknown* clientDrawingEffect - ) PURE; - - /// - /// IDWriteTextLayout::Draw calls this function to instruct the client to draw - /// an underline. - /// - /// The context passed to - /// IDWriteTextLayout::Draw. - /// X-coordinate of the baseline. - /// Y-coordinate of the baseline. - /// Underline logical information. - /// The drawing effect set in - /// IDWriteTextLayout::SetDrawingEffect. - /// - /// Standard HRESULT error code. - /// - /// - /// A single underline can be broken into multiple calls, depending on - /// how the formatting changes attributes. If font sizes/styles change - /// within an underline, the thickness and offset will be averaged - /// weighted according to characters. - /// To get the correct top coordinate of the underline rect, add underline::offset - /// to the baseline's Y. Otherwise the underline will be immediately under the text. - /// The x coordinate will always be passed as the left side, regardless - /// of text directionality. This simplifies drawing and reduces the - /// problem of round-off that could potentially cause gaps or a double - /// stamped alpha blend. To avoid alpha overlap, round the end points - /// to the nearest device pixel. - /// - STDMETHOD(DrawUnderline)( - __maybenull void* clientDrawingContext, - FLOAT baselineOriginX, - FLOAT baselineOriginY, - __in DWRITE_UNDERLINE const* underline, - __maybenull IUnknown* clientDrawingEffect - ) PURE; - - /// - /// IDWriteTextLayout::Draw calls this function to instruct the client to draw - /// a strikethrough. - /// - /// The context passed to - /// IDWriteTextLayout::Draw. - /// X-coordinate of the baseline. - /// Y-coordinate of the baseline. - /// Strikethrough logical information. - /// The drawing effect set in - /// IDWriteTextLayout::SetDrawingEffect. - /// - /// Standard HRESULT error code. - /// - /// - /// A single strikethrough can be broken into multiple calls, depending on - /// how the formatting changes attributes. Strikethrough is not averaged - /// across font sizes/styles changes. - /// To get the correct top coordinate of the strikethrough rect, - /// add strikethrough::offset to the baseline's Y. - /// Like underlines, the x coordinate will always be passed as the left side, - /// regardless of text directionality. - /// - STDMETHOD(DrawStrikethrough)( - __maybenull void* clientDrawingContext, - FLOAT baselineOriginX, - FLOAT baselineOriginY, - __in DWRITE_STRIKETHROUGH const* strikethrough, - __maybenull IUnknown* clientDrawingEffect - ) PURE; - - /// - /// IDWriteTextLayout::Draw calls this application callback when it needs to - /// draw an inline object. - /// - /// The context passed to IDWriteTextLayout::Draw. - /// X-coordinate at the top-left corner of the inline object. - /// Y-coordinate at the top-left corner of the inline object. - /// The object set using IDWriteTextLayout::SetInlineObject. - /// The object should be drawn on its side. - /// The object is in an right-to-left context and should be drawn flipped. - /// The drawing effect set in - /// IDWriteTextLayout::SetDrawingEffect. - /// - /// Standard HRESULT error code. - /// - /// - /// The right-to-left flag is a hint for those cases where it would look - /// strange for the image to be shown normally (like an arrow pointing to - /// right to indicate a submenu). - /// - STDMETHOD(DrawInlineObject)( - __maybenull void* clientDrawingContext, - FLOAT originX, - FLOAT originY, - IDWriteInlineObject* inlineObject, - BOOL isSideways, - BOOL isRightToLeft, - __maybenull IUnknown* clientDrawingEffect - ) PURE; -}; - -/// -/// The IDWriteTextLayout interface represents a block of text after it has -/// been fully analyzed and formatted. -/// -/// All coordinates are in device independent pixels (DIPs). -/// -interface DWRITE_DECLARE_INTERFACE("53737037-6d14-410b-9bfe-0b182bb70961") IDWriteTextLayout : public IDWriteTextFormat -{ - /// - /// Set layout maximum width - /// - /// Layout maximum width - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetMaxWidth)( - FLOAT maxWidth - ) PURE; - - /// - /// Set layout maximum height - /// - /// Layout maximum height - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetMaxHeight)( - FLOAT maxHeight - ) PURE; - - /// - /// Set the font collection. - /// - /// The font collection to set - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetFontCollection)( - IDWriteFontCollection* fontCollection, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set null-terminated font family name. - /// - /// Font family name - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetFontFamilyName)( - __in_z WCHAR const* fontFamilyName, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set font weight. - /// - /// Font weight - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetFontWeight)( - DWRITE_FONT_WEIGHT fontWeight, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set font style. - /// - /// Font style - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetFontStyle)( - DWRITE_FONT_STYLE fontStyle, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set font stretch. - /// - /// font stretch - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetFontStretch)( - DWRITE_FONT_STRETCH fontStretch, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set font em height. - /// - /// Font em height - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetFontSize)( - FLOAT fontSize, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set underline. - /// - /// The Boolean flag indicates whether underline takes place - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetUnderline)( - BOOL hasUnderline, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set strikethrough. - /// - /// The Boolean flag indicates whether strikethrough takes place - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetStrikethrough)( - BOOL hasStrikethrough, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set application-defined drawing effect. - /// - /// Pointer to an application-defined drawing effect. - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - /// - /// This drawing effect is associated with the specified range and will be passed back - /// to the application via the callback when the range is drawn at drawing time. - /// - STDMETHOD(SetDrawingEffect)( - IUnknown* drawingEffect, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set inline object. - /// - /// Pointer to an application-implemented inline object. - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - /// - /// This inline object applies to the specified range and will be passed back - /// to the application via the DrawInlineObject callback when the range is drawn. - /// Any text in that range will be suppressed. - /// - STDMETHOD(SetInlineObject)( - IDWriteInlineObject* inlineObject, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set font typography features. - /// - /// Pointer to font typography setting. - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetTypography)( - IDWriteTypography* typography, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Set locale name. - /// - /// Locale name - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetLocaleName)( - __in_z WCHAR const* localeName, - DWRITE_TEXT_RANGE textRange - ) PURE; - - /// - /// Get layout maximum width - /// - STDMETHOD_(FLOAT, GetMaxWidth)() PURE; - - /// - /// Get layout maximum height - /// - STDMETHOD_(FLOAT, GetMaxHeight)() PURE; - - /// - /// Get the font collection where the current position is at. - /// - /// The current text position. - /// The current font collection - /// Text range to which this change applies. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontCollection)( - UINT32 currentPosition, - __out IDWriteFontCollection** fontCollection, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the length of the font family name where the current position is at. - /// - /// The current text position. - /// Size of the character array in character count not including the terminated NULL character. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontFamilyNameLength)( - UINT32 currentPosition, - __out UINT32* nameLength, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Copy the font family name where the current position is at. - /// - /// The current text position. - /// Character array that receives the current font family name - /// Size of the character array in character count including the terminated NULL character. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontFamilyName)( - UINT32 currentPosition, - __out_ecount_z(nameSize) WCHAR* fontFamilyName, - UINT32 nameSize, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the font weight where the current position is at. - /// - /// The current text position. - /// The current font weight - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontWeight)( - UINT32 currentPosition, - __out DWRITE_FONT_WEIGHT* fontWeight, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the font style where the current position is at. - /// - /// The current text position. - /// The current font style - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontStyle)( - UINT32 currentPosition, - __out DWRITE_FONT_STYLE* fontStyle, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the font stretch where the current position is at. - /// - /// The current text position. - /// The current font stretch - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontStretch)( - UINT32 currentPosition, - __out DWRITE_FONT_STRETCH* fontStretch, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the font em height where the current position is at. - /// - /// The current text position. - /// The current font em height - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetFontSize)( - UINT32 currentPosition, - __out FLOAT* fontSize, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the underline presence where the current position is at. - /// - /// The current text position. - /// The Boolean flag indicates whether text is underlined. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetUnderline)( - UINT32 currentPosition, - __out BOOL* hasUnderline, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the strikethrough presence where the current position is at. - /// - /// The current text position. - /// The Boolean flag indicates whether text has strikethrough. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetStrikethrough)( - UINT32 currentPosition, - __out BOOL* hasStrikethrough, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the application-defined drawing effect where the current position is at. - /// - /// The current text position. - /// The current application-defined drawing effect. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetDrawingEffect)( - UINT32 currentPosition, - __out IUnknown** drawingEffect, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the inline object at the given position. - /// - /// The given text position. - /// The inline object. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetInlineObject)( - UINT32 currentPosition, - __out IDWriteInlineObject** inlineObject, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the typography setting where the current position is at. - /// - /// The current text position. - /// The current typography setting. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetTypography)( - UINT32 currentPosition, - __out IDWriteTypography** typography, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the length of the locale name where the current position is at. - /// - /// The current text position. - /// Size of the character array in character count not including the terminated NULL character. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetLocaleNameLength)( - UINT32 currentPosition, - __out UINT32* nameLength, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Get the locale name where the current position is at. - /// - /// The current text position. - /// Character array that receives the current locale name - /// Size of the character array in character count including the terminated NULL character. - /// The position range of the current format. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetLocaleName)( - UINT32 currentPosition, - __out_ecount_z(nameSize) WCHAR* localeName, - UINT32 nameSize, - __out_opt DWRITE_TEXT_RANGE* textRange = NULL - ) PURE; - - /// - /// Initiate drawing of the text. - /// - /// An application defined value - /// included in rendering callbacks. - /// The set of application-defined callbacks that do - /// the actual rendering. - /// X-coordinate of the layout's left side. - /// Y-coordinate of the layout's top side. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(Draw)( - __maybenull void* clientDrawingContext, - IDWriteTextRenderer* renderer, - FLOAT originX, - FLOAT originY - ) PURE; - - /// - /// GetLineMetrics returns properties of each line. - /// - /// The array to fill with line information. - /// The maximum size of the lineMetrics array. - /// The actual size of the lineMetrics - /// array that is needed. - /// - /// Standard HRESULT error code. - /// - /// - /// If maxLineCount is not large enough E_NOT_SUFFICIENT_BUFFER, - /// which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), - /// is returned and *actualLineCount is set to the number of lines - /// needed. - /// - STDMETHOD(GetLineMetrics)( - __out_ecount_opt(maxLineCount) DWRITE_LINE_METRICS* lineMetrics, - UINT32 maxLineCount, - __out UINT32* actualLineCount - ) PURE; - - /// - /// GetMetrics retrieves overall metrics for the formatted string. - /// - /// The returned metrics. - /// - /// Standard HRESULT error code. - /// - /// - /// Drawing effects like underline and strikethrough do not contribute - /// to the text size, which is essentially the sum of advance widths and - /// line heights. Additionally, visible swashes and other graphic - /// adornments may extend outside the returned width and height. - /// - STDMETHOD(GetMetrics)( - __out DWRITE_TEXT_METRICS* textMetrics - ) PURE; - - /// - /// GetOverhangMetrics returns the overhangs (in DIPs) of the layout and all - /// objects contained in it, including text glyphs and inline objects. - /// - /// Overshoots of visible extents (in DIPs) outside the layout. - /// - /// Standard HRESULT error code. - /// - /// - /// Any underline and strikethrough do not contribute to the black box - /// determination, since these are actually drawn by the renderer, which - /// is allowed to draw them in any variety of styles. - /// - STDMETHOD(GetOverhangMetrics)( - __out DWRITE_OVERHANG_METRICS* overhangs - ) PURE; - - /// - /// Retrieve logical properties and measurement of each cluster. - /// - /// The array to fill with cluster information. - /// The maximum size of the clusterMetrics array. - /// The actual size of the clusterMetrics array that is needed. - /// - /// Standard HRESULT error code. - /// - /// - /// If maxClusterCount is not large enough E_NOT_SUFFICIENT_BUFFER, - /// which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), - /// is returned and *actualClusterCount is set to the number of clusters - /// needed. - /// - STDMETHOD(GetClusterMetrics)( - __out_ecount_opt(maxClusterCount) DWRITE_CLUSTER_METRICS* clusterMetrics, - UINT32 maxClusterCount, - __out UINT32* actualClusterCount - ) PURE; - - /// - /// Determines the minimum possible width the layout can be set to without - /// emergency breaking between the characters of whole words. - /// - /// Minimum width. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(DetermineMinWidth)( - __out FLOAT* minWidth - ) PURE; - - /// - /// Given a coordinate (in DIPs) relative to the top-left of the layout box, - /// this returns the corresponding hit-test metrics of the text string where - /// the hit-test has occurred. This is useful for mapping mouse clicks to caret - /// positions. When the given coordinate is outside the text string, the function - /// sets the output value *isInside to false but returns the nearest character - /// position. - /// - /// X coordinate to hit-test, relative to the top-left location of the layout box. - /// Y coordinate to hit-test, relative to the top-left location of the layout box. - /// Output flag indicating whether the hit-test location is at the leading or the trailing - /// side of the character. When the output *isInside value is set to false, this value is set according to the output - /// *position value to represent the edge closest to the hit-test location. - /// Output flag indicating whether the hit-test location is inside the text string. - /// When false, the position nearest the text's edge is returned. - /// Output geometry fully enclosing the hit-test location. When the output *isInside value - /// is set to false, this structure represents the geometry enclosing the edge closest to the hit-test location. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(HitTestPoint)( - FLOAT pointX, - FLOAT pointY, - __out BOOL* isTrailingHit, - __out BOOL* isInside, - __out DWRITE_HIT_TEST_METRICS* hitTestMetrics - ) PURE; - - /// - /// Given a text position and whether the caret is on the leading or trailing - /// edge of that position, this returns the corresponding coordinate (in DIPs) - /// relative to the top-left of the layout box. This is most useful for drawing - /// the caret's current position, but it could also be used to anchor an IME to the - /// typed text or attach a floating menu near the point of interest. It may also be - /// used to programmatically obtain the geometry of a particular text position - /// for UI automation. - /// - /// Text position to get the coordinate of. - /// Flag indicating whether the location is of the leading or the trailing side of the specified text position. - /// Output caret X, relative to the top-left of the layout box. - /// Output caret Y, relative to the top-left of the layout box. - /// Output geometry fully enclosing the specified text position. - /// - /// Standard HRESULT error code. - /// - /// - /// When drawing a caret at the returned X,Y, it should should be centered on X - /// and drawn from the Y coordinate down. The height will be the size of the - /// hit-tested text (which can vary in size within a line). - /// Reading direction also affects which side of the character the caret is drawn. - /// However, the returned X coordinate will be correct for either case. - /// You can get a text length back that is larger than a single character. - /// This happens for complex scripts when multiple characters form a single cluster, - /// when diacritics join their base character, or when you test a surrogate pair. - /// - STDMETHOD(HitTestTextPosition)( - UINT32 textPosition, - BOOL isTrailingHit, - __out FLOAT* pointX, - __out FLOAT* pointY, - __out DWRITE_HIT_TEST_METRICS* hitTestMetrics - ) PURE; - - /// - /// The application calls this function to get a set of hit-test metrics - /// corresponding to a range of text positions. The main usage for this - /// is to draw highlighted selection of the text string. - /// - /// The function returns E_NOT_SUFFICIENT_BUFFER, which is equivalent to - /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), when the buffer size of - /// hitTestMetrics is too small to hold all the regions calculated by the - /// function. In such situation, the function sets the output value - /// *actualHitTestMetricsCount to the number of geometries calculated. - /// The application is responsible to allocate a new buffer of greater - /// size and call the function again. - /// - /// A good value to use as an initial value for maxHitTestMetricsCount may - /// be calculated from the following equation: - /// maxHitTestMetricsCount = lineCount * maxBidiReorderingDepth - /// - /// where lineCount is obtained from the value of the output argument - /// *actualLineCount from the function IDWriteTextLayout::GetLineMetrics, - /// and the maxBidiReorderingDepth value from the DWRITE_TEXT_METRICS - /// structure of the output argument *textMetrics from the function - /// IDWriteFactory::CreateTextLayout. - /// - /// First text position of the specified range. - /// Number of positions of the specified range. - /// Offset of the X origin (left of the layout box) which is added to each of the hit-test metrics returned. - /// Offset of the Y origin (top of the layout box) which is added to each of the hit-test metrics returned. - /// Pointer to a buffer of the output geometry fully enclosing the specified position range. - /// Maximum number of distinct metrics it could hold in its buffer memory. - /// Actual number of metrics returned or needed. - /// - /// Standard HRESULT error code. - /// - /// - /// There are no gaps in the returned metrics. While there could be visual gaps, - /// depending on bidi ordering, each range is contiguous and reports all the text, - /// including any hidden characters and trimmed text. - /// The height of each returned range will be the same within each line, regardless - /// of how the font sizes vary. - /// - STDMETHOD(HitTestTextRange)( - UINT32 textPosition, - UINT32 textLength, - FLOAT originX, - FLOAT originY, - __out_ecount_opt(maxHitTestMetricsCount) DWRITE_HIT_TEST_METRICS* hitTestMetrics, - UINT32 maxHitTestMetricsCount, - __out UINT32* actualHitTestMetricsCount - ) PURE; -}; - -/// -/// Encapsulates a 32-bit device independent bitmap and device context, which can be used for rendering glyphs. -/// -interface DWRITE_DECLARE_INTERFACE("5e5a32a3-8dff-4773-9ff6-0696eab77267") IDWriteBitmapRenderTarget : public IUnknown -{ - /// - /// Draws a run of glyphs to the bitmap. - /// - /// Horizontal position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB. - /// Vertical position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB. - /// Specifies measuring method for glyphs in the run. - /// Renderer implementations may choose different rendering modes for different measuring methods, for example - /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL, - /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC, and - /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL. - /// - /// Structure containing the properties of the glyph run. - /// Object that controls rendering behavior. - /// Specifies the foreground color of the text. - /// Optional rectangle that receives the bounding box (in pixels not DIPs) of all the pixels affected by - /// drawing the glyph run. The black box rectangle may extend beyond the dimensions of the bitmap. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(DrawGlyphRun)( - FLOAT baselineOriginX, - FLOAT baselineOriginY, - DWRITE_MEASURING_MODE measuringMode, - __in DWRITE_GLYPH_RUN const* glyphRun, - IDWriteRenderingParams* renderingParams, - COLORREF textColor, - __out_opt RECT* blackBoxRect = NULL - ) PURE; - - /// - /// Gets a handle to the memory device context. - /// - /// - /// Returns the device context handle. - /// - /// - /// An application can use the device context to draw using GDI functions. An application can obtain the bitmap handle - /// (HBITMAP) by calling GetCurrentObject. An application that wants information about the underlying bitmap, including - /// a pointer to the pixel data, can call GetObject to fill in a DIBSECTION structure. The bitmap is always a 32-bit - /// top-down DIB. - /// - STDMETHOD_(HDC, GetMemoryDC)() PURE; - - /// - /// Gets the number of bitmap pixels per DIP. A DIP (device-independent pixel) is 1/96 inch so this value is the number - /// if pixels per inch divided by 96. - /// - /// - /// Returns the number of bitmap pixels per DIP. - /// - STDMETHOD_(FLOAT, GetPixelsPerDip)() PURE; - - /// - /// Sets the number of bitmap pixels per DIP. A DIP (device-independent pixel) is 1/96 inch so this value is the number - /// if pixels per inch divided by 96. - /// - /// Specifies the number of pixels per DIP. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetPixelsPerDip)( - FLOAT pixelsPerDip - ) PURE; - - /// - /// Gets the transform that maps abstract coordinate to DIPs. By default this is the identity - /// transform. Note that this is unrelated to the world transform of the underlying device - /// context. - /// - /// Receives the transform. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetCurrentTransform)( - __out DWRITE_MATRIX* transform - ) PURE; - - /// - /// Sets the transform that maps abstract coordinate to DIPs. This does not affect the world - /// transform of the underlying device context. - /// - /// Specifies the new transform. This parameter can be NULL, in which - /// case the identity transform is implied. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(SetCurrentTransform)( - __in_opt DWRITE_MATRIX const* transform - ) PURE; - - /// - /// Gets the dimensions of the bitmap. - /// - /// Receives the size of the bitmap in pixels. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetSize)( - __out SIZE* size - ) PURE; - - /// - /// Resizes the bitmap. - /// - /// New bitmap width, in pixels. - /// New bitmap height, in pixels. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(Resize)( - UINT32 width, - UINT32 height - ) PURE; -}; - -/// -/// The GDI interop interface provides interoperability with GDI. -/// -interface DWRITE_DECLARE_INTERFACE("1edd9491-9853-4299-898f-6432983b6f3a") IDWriteGdiInterop : public IUnknown -{ - /// - /// Creates a font object that matches the properties specified by the LOGFONT structure. - /// - /// Structure containing a GDI-compatible font description. - /// Receives a newly created font object if successful, or NULL in case of error. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateFontFromLOGFONT)( - __in LOGFONTW const* logFont, - __out IDWriteFont** font - ) PURE; - - /// - /// Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font. - /// - /// Specifies a font in the system font collection. - /// Structure that receives a GDI-compatible font description. - /// Contains TRUE if the specified font object is part of the system font collection - /// or FALSE otherwise. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(ConvertFontToLOGFONT)( - IDWriteFont* font, - __out LOGFONTW* logFont, - __out BOOL* isSystemFont - ) PURE; - - /// - /// Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font. - /// - /// Specifies a font face. - /// Structure that receives a GDI-compatible font description. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(ConvertFontFaceToLOGFONT)( - IDWriteFontFace* font, - __out LOGFONTW* logFont - ) PURE; - - /// - /// Creates a font face object that corresponds to the currently selected HFONT. - /// - /// Handle to a device context into which a font has been selected. It is assumed that the client - /// has already performed font mapping and that the font selected into the DC is the actual font that would be used - /// for rendering glyphs. - /// Contains the newly created font face object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateFontFaceFromHdc)( - HDC hdc, - __out IDWriteFontFace** fontFace - ) PURE; - - /// - /// Creates an object that encapsulates a bitmap and memory DC which can be used for rendering glyphs. - /// - /// Optional device context used to create a compatible memory DC. - /// Width of the bitmap. - /// Height of the bitmap. - /// Receives a pointer to the newly created render target. - STDMETHOD(CreateBitmapRenderTarget)( - __in_opt HDC hdc, - UINT32 width, - UINT32 height, - __out IDWriteBitmapRenderTarget** renderTarget - ) PURE; -}; - -/// -/// The DWRITE_TEXTURE_TYPE enumeration identifies a type of alpha texture. An alpha texture is a bitmap of alpha values, each -/// representing the darkness (i.e., opacity) of a pixel or subpixel. -/// -enum DWRITE_TEXTURE_TYPE -{ - /// - /// Specifies an alpha texture for aliased text rendering (i.e., bi-level, where each pixel is either fully opaque or fully transparent), - /// with one byte per pixel. - /// - DWRITE_TEXTURE_ALIASED_1x1, - - /// - /// Specifies an alpha texture for ClearType text rendering, with three bytes per pixel in the horizontal dimension and - /// one byte per pixel in the vertical dimension. - /// - DWRITE_TEXTURE_CLEARTYPE_3x1 -}; - -/// -/// Maximum alpha value in a texture returned by IDWriteGlyphRunAnalysis::CreateAlphaTexture. -/// -#define DWRITE_ALPHA_MAX 255 - -/// -/// Interface that encapsulates information used to render a glyph run. -/// -interface DWRITE_DECLARE_INTERFACE("7d97dbf7-e085-42d4-81e3-6a883bded118") IDWriteGlyphRunAnalysis : public IUnknown -{ - /// - /// Gets the bounding rectangle of the physical pixels affected by the glyph run. - /// - /// Specifies the type of texture requested. If a bi-level texture is requested, the - /// bounding rectangle includes only bi-level glyphs. Otherwise, the bounding rectangle includes only anti-aliased - /// glyphs. - /// Receives the bounding rectangle, or an empty rectangle if there are no glyphs - /// if the specified type. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetAlphaTextureBounds)( - DWRITE_TEXTURE_TYPE textureType, - __out RECT* textureBounds - ) PURE; - - /// - /// Creates an alpha texture of the specified type. - /// - /// Specifies the type of texture requested. If a bi-level texture is requested, the - /// texture contains only bi-level glyphs. Otherwise, the texture contains only anti-aliased glyphs. - /// Specifies the bounding rectangle of the texture, which can be different than - /// the bounding rectangle returned by GetAlphaTextureBounds. - /// Receives the array of alpha values. - /// Size of the alphaValues array. The minimum size depends on the dimensions of the - /// rectangle and the type of texture requested. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateAlphaTexture)( - DWRITE_TEXTURE_TYPE textureType, - __in RECT const* textureBounds, - __out_bcount(bufferSize) BYTE* alphaValues, - UINT32 bufferSize - ) PURE; - - /// - /// Gets properties required for ClearType blending. - /// - /// Rendering parameters object. In most cases, the values returned in the output - /// parameters are based on the properties of this object. The exception is if a GDI-compatible rendering mode - /// is specified. - /// Receives the gamma value to use for gamma correction. - /// Receives the enhanced contrast value. - /// Receives the ClearType level. - STDMETHOD(GetAlphaBlendParams)( - IDWriteRenderingParams* renderingParams, - __out FLOAT* blendGamma, - __out FLOAT* blendEnhancedContrast, - __out FLOAT* blendClearTypeLevel - ) PURE; -}; - -/// -/// The root factory interface for all DWrite objects. -/// -interface DWRITE_DECLARE_INTERFACE("b859ee5a-d838-4b5b-a2e8-1adc7d93db48") IDWriteFactory : public IUnknown -{ - /// - /// Gets a font collection representing the set of installed fonts. - /// - /// Receives a pointer to the system font collection object, or NULL in case of failure. - /// If this parameter is nonzero, the function performs an immediate check for changes to the set of - /// installed fonts. If this parameter is FALSE, the function will still detect changes if the font cache service is running, but - /// there may be some latency. For example, an application might specify TRUE if it has itself just installed a font and wants to - /// be sure the font collection contains that font. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetSystemFontCollection)( - __out IDWriteFontCollection** fontCollection, - BOOL checkForUpdates = FALSE - ) PURE; - - /// - /// Creates a font collection using a custom font collection loader. - /// - /// Application-defined font collection loader, which must have been previously - /// registered using RegisterFontCollectionLoader. - /// Key used by the loader to identify a collection of font files. - /// Size in bytes of the collection key. - /// Receives a pointer to the system font collection object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateCustomFontCollection)( - IDWriteFontCollectionLoader* collectionLoader, - __in_bcount(collectionKeySize) void const* collectionKey, - UINT32 collectionKeySize, - __out IDWriteFontCollection** fontCollection - ) PURE; - - /// - /// Registers a custom font collection loader with the factory object. - /// - /// Application-defined font collection loader. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(RegisterFontCollectionLoader)( - IDWriteFontCollectionLoader* fontCollectionLoader - ) PURE; - - /// - /// Unregisters a custom font collection loader that was previously registered using RegisterFontCollectionLoader. - /// - /// Application-defined font collection loader. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(UnregisterFontCollectionLoader)( - IDWriteFontCollectionLoader* fontCollectionLoader - ) PURE; - - /// - /// CreateFontFileReference creates a font file reference object from a local font file. - /// - /// Absolute file path. Subsequent operations on the constructed object may fail - /// if the user provided filePath doesn't correspond to a valid file on the disk. - /// Last modified time of the input file path. If the parameter is omitted, - /// the function will access the font file to obtain its last write time, so the clients are encouraged to specify this value - /// to avoid extra disk access. Subsequent operations on the constructed object may fail - /// if the user provided lastWriteTime doesn't match the file on the disk. - /// Contains newly created font file reference object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateFontFileReference)( - __in_z WCHAR const* filePath, - __in_opt FILETIME const* lastWriteTime, - __out IDWriteFontFile** fontFile - ) PURE; - - /// - /// CreateCustomFontFileReference creates a reference to an application specific font file resource. - /// This function enables an application or a document to use a font without having to install it on the system. - /// The fontFileReferenceKey has to be unique only in the scope of the fontFileLoader used in this call. - /// - /// Font file reference key that uniquely identifies the font file resource - /// during the lifetime of fontFileLoader. - /// Size of font file reference key in bytes. - /// Font file loader that will be used by the font system to load data from the file identified by - /// fontFileReferenceKey. - /// Contains the newly created font file object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - /// - /// This function is provided for cases when an application or a document needs to use a font - /// without having to install it on the system. fontFileReferenceKey has to be unique only in the scope - /// of the fontFileLoader used in this call. - /// - STDMETHOD(CreateCustomFontFileReference)( - __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, - UINT32 fontFileReferenceKeySize, - IDWriteFontFileLoader* fontFileLoader, - __out IDWriteFontFile** fontFile - ) PURE; - - /// - /// Creates a font face object. - /// - /// The file format of the font face. - /// The number of font files require to represent the font face. - /// Font files representing the font face. Since IDWriteFontFace maintains its own references - /// to the input font file objects, it's OK to release them after this call. - /// The zero based index of a font face in cases when the font files contain a collection of font faces. - /// If the font files contain a single face, this value should be zero. - /// Font face simulation flags for algorithmic emboldening and italicization. - /// Contains the newly created font face object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateFontFace)( - DWRITE_FONT_FACE_TYPE fontFaceType, - UINT32 numberOfFiles, - __in_ecount(numberOfFiles) IDWriteFontFile* const* fontFiles, - UINT32 faceIndex, - DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags, - __out IDWriteFontFace** fontFace - ) PURE; - - /// - /// Creates a rendering parameters object with default settings for the primary monitor. - /// - /// Holds the newly created rendering parameters object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateRenderingParams)( - __out IDWriteRenderingParams** renderingParams - ) PURE; - - /// - /// Creates a rendering parameters object with default settings for the specified monitor. - /// - /// The monitor to read the default values from. - /// Holds the newly created rendering parameters object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateMonitorRenderingParams)( - HMONITOR monitor, - __out IDWriteRenderingParams** renderingParams - ) PURE; - - /// - /// Creates a rendering parameters object with the specified properties. - /// - /// The gamma value used for gamma correction, which must be greater than zero and cannot exceed 256. - /// The amount of contrast enhancement, zero or greater. - /// The degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType). - /// The geometry of a device pixel. - /// Method of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode. - /// Holds the newly created rendering parameters object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateCustomRenderingParams)( - FLOAT gamma, - FLOAT enhancedContrast, - FLOAT clearTypeLevel, - DWRITE_PIXEL_GEOMETRY pixelGeometry, - DWRITE_RENDERING_MODE renderingMode, - __out IDWriteRenderingParams** renderingParams - ) PURE; - - /// - /// Registers a font file loader with DirectWrite. - /// - /// Pointer to the implementation of the IDWriteFontFileLoader for a particular file resource type. - /// - /// Standard HRESULT error code. - /// - /// - /// This function registers a font file loader with DirectWrite. - /// Font file loader interface handles loading font file resources of a particular type from a key. - /// The font file loader interface is recommended to be implemented by a singleton object. - /// A given instance can only be registered once. - /// Succeeding attempts will return an error that it has already been registered. - /// IMPORTANT: font file loader implementations must not register themselves with DirectWrite - /// inside their constructors and must not unregister themselves in their destructors, because - /// registration and unregistraton operations increment and decrement the object reference count respectively. - /// Instead, registration and unregistration of font file loaders with DirectWrite should be performed - /// outside of the font file loader implementation as a separate step. - /// - STDMETHOD(RegisterFontFileLoader)( - IDWriteFontFileLoader* fontFileLoader - ) PURE; - - /// - /// Unregisters a font file loader that was previously registered with the DirectWrite font system using RegisterFontFileLoader. - /// - /// Pointer to the file loader that was previously registered with the DirectWrite font system using RegisterFontFileLoader. - /// - /// This function will succeed if the user loader is requested to be removed. - /// It will fail if the pointer to the file loader identifies a standard DirectWrite loader, - /// or a loader that is never registered or has already been unregistered. - /// - /// - /// This function unregisters font file loader callbacks with the DirectWrite font system. - /// The font file loader interface is recommended to be implemented by a singleton object. - /// IMPORTANT: font file loader implementations must not register themselves with DirectWrite - /// inside their constructors and must not unregister themselves in their destructors, because - /// registration and unregistraton operations increment and decrement the object reference count respectively. - /// Instead, registration and unregistration of font file loaders with DirectWrite should be performed - /// outside of the font file loader implementation as a separate step. - /// - STDMETHOD(UnregisterFontFileLoader)( - IDWriteFontFileLoader* fontFileLoader - ) PURE; - - /// - /// Create a text format object used for text layout. - /// - /// Name of the font family - /// Font collection. NULL indicates the system font collection. - /// Font weight - /// Font style - /// Font stretch - /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. - /// Locale name - /// Contains newly created text format object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateTextFormat)( - __in_z WCHAR const* fontFamilyName, - __maybenull IDWriteFontCollection* fontCollection, - DWRITE_FONT_WEIGHT fontWeight, - DWRITE_FONT_STYLE fontStyle, - DWRITE_FONT_STRETCH fontStretch, - FLOAT fontSize, - __in_z WCHAR const* localeName, - __out IDWriteTextFormat** textFormat - ) PURE; - - /// - /// Create a typography object used in conjunction with text format for text layout. - /// - /// Contains newly created typography object, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateTypography)( - __out IDWriteTypography** typography - ) PURE; - - /// - /// Create an object used for interoperability with GDI. - /// - /// Receives the GDI interop object if successful, or NULL in case of failure. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(GetGdiInterop)( - __out IDWriteGdiInterop** gdiInterop - ) PURE; - - /// - /// CreateTextLayout takes a string, format, and associated constraints - /// and produces and object representing the fully analyzed - /// and formatted result. - /// - /// The string to layout. - /// The length of the string. - /// The format to apply to the string. - /// Width of the layout box. - /// Height of the layout box. - /// The resultant object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateTextLayout)( - __in_ecount(stringLength) WCHAR const* string, - UINT32 stringLength, - IDWriteTextFormat* textFormat, - FLOAT maxWidth, - FLOAT maxHeight, - __out IDWriteTextLayout** textLayout - ) PURE; - - /// - /// CreateGdiCompatibleTextLayout takes a string, format, and associated constraints - /// and produces and object representing the result formatted for a particular display resolution - /// and measuring method. The resulting text layout should only be used for the intended resolution, - /// and for cases where text scalability is desired, CreateTextLayout should be used instead. - /// - /// The string to layout. - /// The length of the string. - /// The format to apply to the string. - /// Width of the layout box. - /// Height of the layout box. - /// Number of physical pixels per DIP. For example, if rendering onto a 96 DPI device then pixelsPerDip - /// is 1. If rendering onto a 120 DPI device then pixelsPerDip is 120/96. - /// Optional transform applied to the glyphs and their positions. This transform is applied after the - /// scaling specified the font size and pixelsPerDip. - /// - /// When set to FALSE, instructs the text layout to use the same metrics as GDI aliased text. - /// When set to TRUE, instructs the text layout to use the same metrics as text measured by GDI using a font - /// created with CLEARTYPE_NATURAL_QUALITY. - /// - /// The resultant object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateGdiCompatibleTextLayout)( - __in_ecount(stringLength) WCHAR const* string, - UINT32 stringLength, - IDWriteTextFormat* textFormat, - FLOAT layoutWidth, - FLOAT layoutHeight, - FLOAT pixelsPerDip, - __in_opt DWRITE_MATRIX const* transform, - BOOL useGdiNatural, - __out IDWriteTextLayout** textLayout - ) PURE; - - /// - /// The application may call this function to create an inline object for trimming, using an ellipsis as the omission sign. - /// The ellipsis will be created using the current settings of the format, including base font, style, and any effects. - /// Alternate omission signs can be created by the application by implementing IDWriteInlineObject. - /// - /// Text format used as a template for the omission sign. - /// Created omission sign. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateEllipsisTrimmingSign)( - IDWriteTextFormat* textFormat, - __out IDWriteInlineObject** trimmingSign - ) PURE; - - /// - /// Return an interface to perform text analysis with. - /// - /// The resultant object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateTextAnalyzer)( - __out IDWriteTextAnalyzer** textAnalyzer - ) PURE; - - /// - /// Creates a number substitution object using a locale name, - /// substitution method, and whether to ignore user overrides (uses NLS - /// defaults for the given culture instead). - /// - /// Method of number substitution to use. - /// Which locale to obtain the digits from. - /// Ignore the user's settings and use the locale defaults - /// Receives a pointer to the newly created object. - STDMETHOD(CreateNumberSubstitution)( - __in DWRITE_NUMBER_SUBSTITUTION_METHOD substitutionMethod, - __in_z WCHAR const* localeName, - __in BOOL ignoreUserOverride, - __out IDWriteNumberSubstitution** numberSubstitution - ) PURE; - - /// - /// Creates a glyph run analysis object, which encapsulates information - /// used to render a glyph run. - /// - /// Structure specifying the properties of the glyph run. - /// Number of physical pixels per DIP. For example, if rendering onto a 96 DPI bitmap then pixelsPerDip - /// is 1. If rendering onto a 120 DPI bitmap then pixelsPerDip is 120/96. - /// Optional transform applied to the glyphs and their positions. This transform is applied after the - /// scaling specified the emSize and pixelsPerDip. - /// Specifies the rendering mode, which must be one of the raster rendering modes (i.e., not default - /// and not outline). - /// Specifies the method to measure glyphs. - /// Horizontal position of the baseline origin, in DIPs. - /// Vertical position of the baseline origin, in DIPs. - /// Receives a pointer to the newly created object. - /// - /// Standard HRESULT error code. - /// - STDMETHOD(CreateGlyphRunAnalysis)( - __in DWRITE_GLYPH_RUN const* glyphRun, - FLOAT pixelsPerDip, - __in_opt DWRITE_MATRIX const* transform, - DWRITE_RENDERING_MODE renderingMode, - DWRITE_MEASURING_MODE measuringMode, - FLOAT baselineOriginX, - FLOAT baselineOriginY, - __out IDWriteGlyphRunAnalysis** glyphRunAnalysis - ) PURE; - -}; // interface IDWriteFactory - -/// -/// Creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects. -/// -/// Identifies whether the factory object will be shared or isolated. -/// Identifies the DirectWrite factory interface, such as __uuidof(IDWriteFactory). -/// Receives the DirectWrite factory object. -/// -/// Standard HRESULT error code. -/// -/// -/// Obtains DirectWrite factory object that is used for subsequent creation of individual DirectWrite classes. -/// DirectWrite factory contains internal state such as font loader registration and cached font data. -/// In most cases it is recommended to use the shared factory object, because it allows multiple components -/// that use DirectWrite to share internal DirectWrite state and reduce memory usage. -/// However, there are cases when it is desirable to reduce the impact of a component, -/// such as a plug-in from an untrusted source, on the rest of the process by sandboxing and isolating it -/// from the rest of the process components. In such cases, it is recommended to use an isolated factory for the sandboxed -/// component. -/// -EXTERN_C HRESULT DWRITE_EXPORT DWriteCreateFactory( - __in DWRITE_FACTORY_TYPE factoryType, - __in REFIID iid, - __out IUnknown **factory - ); - -// Macros used to define DirectWrite error codes. -#define FACILITY_DWRITE 0x898 -#define DWRITE_ERR_BASE 0x5000 -#define MAKE_DWRITE_HR(severity, code) MAKE_HRESULT(severity, FACILITY_DWRITE, (DWRITE_ERR_BASE + code)) -#define MAKE_DWRITE_HR_ERR(code) MAKE_DWRITE_HR(SEVERITY_ERROR, code) - -/// -/// Indicates an error in an input file such as a font file. -/// -#define DWRITE_E_FILEFORMAT MAKE_DWRITE_HR_ERR(0x000) - -/// -/// Indicates an error originating in DirectWrite code, which is not expected to occur but is safe to recover from. -/// -#define DWRITE_E_UNEXPECTED MAKE_DWRITE_HR_ERR(0x001) - -/// -/// Indicates the specified font does not exist. -/// -#define DWRITE_E_NOFONT MAKE_DWRITE_HR_ERR(0x002) - -/// -/// A font file could not be opened because the file, directory, network location, drive, or other storage -/// location does not exist or is unavailable. -/// -#define DWRITE_E_FILENOTFOUND MAKE_DWRITE_HR_ERR(0x003) - -/// -/// A font file exists but could not be opened due to access denied, sharing violation, or similar error. -/// -#define DWRITE_E_FILEACCESS MAKE_DWRITE_HR_ERR(0x004) - -/// -/// A font collection is obsolete due to changes in the system. -/// -#define DWRITE_E_FONTCOLLECTIONOBSOLETE MAKE_DWRITE_HR_ERR(0x005) - -/// -/// The given interface is already registered. -/// -#define DWRITE_E_ALREADYREGISTERED MAKE_DWRITE_HR_ERR(0x006) - -#endif /* DWRITE_H_INCLUDED */ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Abstract: +// DirectX Typography Services public API definitions. +// +//---------------------------------------------------------------------------- + +#ifndef DWRITE_H_INCLUDED +#define DWRITE_H_INCLUDED + +#if _MSC_VER > 1000 +#pragma once +#endif + +#ifndef DWRITE_NO_WINDOWS_H + +#include "specstrings.h" +#include "unknwn.h" + +#endif // DWRITE_NO_WINDOWS_H + +#include "dcommon.h" + +#if _FX_COMPILER_ == _FX_VC6_ +typedef signed char INT8, *PINT8; +typedef signed short INT16, *PINT16; +typedef signed int INT32, *PINT32; +typedef signed __int64 INT64, *PINT64; +typedef unsigned char UINT8, *PUINT8; +typedef unsigned short UINT16, *PUINT16; +typedef unsigned int UINT32, *PUINT32; +typedef unsigned __int64 UINT64, *PUINT64; +#endif + +#ifndef DWRITE_DECLARE_INTERFACE +#define DWRITE_DECLARE_INTERFACE(iid) DECLSPEC_UUID(iid) DECLSPEC_NOVTABLE +#endif + +#ifndef DWRITE_EXPORT +#define DWRITE_EXPORT __declspec(dllimport) WINAPI +#endif + +/// +/// The type of a font represented by a single font file. +/// Font formats that consist of multiple files, e.g. Type 1 .PFM and .PFB, have +/// separate enum values for each of the file type. +/// +enum DWRITE_FONT_FILE_TYPE +{ + /// + /// Font type is not recognized by the DirectWrite font system. + /// + DWRITE_FONT_FILE_TYPE_UNKNOWN, + + /// + /// OpenType font with CFF outlines. + /// + DWRITE_FONT_FILE_TYPE_CFF, + + /// + /// OpenType font with TrueType outlines. + /// + DWRITE_FONT_FILE_TYPE_TRUETYPE, + + /// + /// OpenType font that contains a TrueType collection. + /// + DWRITE_FONT_FILE_TYPE_TRUETYPE_COLLECTION, + + /// + /// Type 1 PFM font. + /// + DWRITE_FONT_FILE_TYPE_TYPE1_PFM, + + /// + /// Type 1 PFB font. + /// + DWRITE_FONT_FILE_TYPE_TYPE1_PFB, + + /// + /// Vector .FON font. + /// + DWRITE_FONT_FILE_TYPE_VECTOR, + + /// + /// Bitmap .FON font. + /// + DWRITE_FONT_FILE_TYPE_BITMAP +}; + +/// +/// The file format of a complete font face. +/// Font formats that consist of multiple files, e.g. Type 1 .PFM and .PFB, have +/// a single enum entry. +/// +enum DWRITE_FONT_FACE_TYPE +{ + /// + /// OpenType font face with CFF outlines. + /// + DWRITE_FONT_FACE_TYPE_CFF, + + /// + /// OpenType font face with TrueType outlines. + /// + DWRITE_FONT_FACE_TYPE_TRUETYPE, + + /// + /// OpenType font face that is a part of a TrueType collection. + /// + DWRITE_FONT_FACE_TYPE_TRUETYPE_COLLECTION, + + /// + /// A Type 1 font face. + /// + DWRITE_FONT_FACE_TYPE_TYPE1, + + /// + /// A vector .FON format font face. + /// + DWRITE_FONT_FACE_TYPE_VECTOR, + + /// + /// A bitmap .FON format font face. + /// + DWRITE_FONT_FACE_TYPE_BITMAP, + + /// + /// Font face type is not recognized by the DirectWrite font system. + /// + DWRITE_FONT_FACE_TYPE_UNKNOWN +}; + +/// +/// Specifies algorithmic style simulations to be applied to the font face. +/// Bold and oblique simulations can be combined via bitwise OR operation. +/// +enum DWRITE_FONT_SIMULATIONS +{ + /// + /// No simulations are performed. + /// + DWRITE_FONT_SIMULATIONS_NONE = 0x0000, + + /// + /// Algorithmic emboldening is performed. + /// + DWRITE_FONT_SIMULATIONS_BOLD = 0x0001, + + /// + /// Algorithmic italicization is performed. + /// + DWRITE_FONT_SIMULATIONS_OBLIQUE = 0x0002 +}; + +#ifdef DEFINE_ENUM_FLAG_OPERATORS +DEFINE_ENUM_FLAG_OPERATORS(DWRITE_FONT_SIMULATIONS); +#endif + +/// +/// The font weight enumeration describes common values for degree of blackness or thickness of strokes of characters in a font. +/// Font weight values less than 1 or greater than 999 are considered to be invalid, and they are rejected by font API functions. +/// +enum DWRITE_FONT_WEIGHT +{ + /// + /// Predefined font weight : Thin (100). + /// + DWRITE_FONT_WEIGHT_THIN = 100, + + /// + /// Predefined font weight : Extra-light (200). + /// + DWRITE_FONT_WEIGHT_EXTRA_LIGHT = 200, + + /// + /// Predefined font weight : Ultra-light (200). + /// + DWRITE_FONT_WEIGHT_ULTRA_LIGHT = 200, + + /// + /// Predefined font weight : Light (300). + /// + DWRITE_FONT_WEIGHT_LIGHT = 300, + + /// + /// Predefined font weight : Normal (400). + /// + DWRITE_FONT_WEIGHT_NORMAL = 400, + + /// + /// Predefined font weight : Regular (400). + /// + DWRITE_FONT_WEIGHT_REGULAR = 400, + + /// + /// Predefined font weight : Medium (500). + /// + DWRITE_FONT_WEIGHT_MEDIUM = 500, + + /// + /// Predefined font weight : Demi-bold (600). + /// + DWRITE_FONT_WEIGHT_DEMI_BOLD = 600, + + /// + /// Predefined font weight : Semi-bold (600). + /// + DWRITE_FONT_WEIGHT_SEMI_BOLD = 600, + + /// + /// Predefined font weight : Bold (700). + /// + DWRITE_FONT_WEIGHT_BOLD = 700, + + /// + /// Predefined font weight : Extra-bold (800). + /// + DWRITE_FONT_WEIGHT_EXTRA_BOLD = 800, + + /// + /// Predefined font weight : Ultra-bold (800). + /// + DWRITE_FONT_WEIGHT_ULTRA_BOLD = 800, + + /// + /// Predefined font weight : Black (900). + /// + DWRITE_FONT_WEIGHT_BLACK = 900, + + /// + /// Predefined font weight : Heavy (900). + /// + DWRITE_FONT_WEIGHT_HEAVY = 900, + + /// + /// Predefined font weight : Extra-black (950). + /// + DWRITE_FONT_WEIGHT_EXTRA_BLACK = 950, + + /// + /// Predefined font weight : Ultra-black (950). + /// + DWRITE_FONT_WEIGHT_ULTRA_BLACK = 950 +}; + +/// +/// The font stretch enumeration describes relative change from the normal aspect ratio +/// as specified by a font designer for the glyphs in a font. +/// Values less than 1 or greater than 9 are considered to be invalid, and they are rejected by font API functions. +/// +enum DWRITE_FONT_STRETCH +{ + /// + /// Predefined font stretch : Not known (0). + /// + DWRITE_FONT_STRETCH_UNDEFINED = 0, + + /// + /// Predefined font stretch : Ultra-condensed (1). + /// + DWRITE_FONT_STRETCH_ULTRA_CONDENSED = 1, + + /// + /// Predefined font stretch : Extra-condensed (2). + /// + DWRITE_FONT_STRETCH_EXTRA_CONDENSED = 2, + + /// + /// Predefined font stretch : Condensed (3). + /// + DWRITE_FONT_STRETCH_CONDENSED = 3, + + /// + /// Predefined font stretch : Semi-condensed (4). + /// + DWRITE_FONT_STRETCH_SEMI_CONDENSED = 4, + + /// + /// Predefined font stretch : Normal (5). + /// + DWRITE_FONT_STRETCH_NORMAL = 5, + + /// + /// Predefined font stretch : Medium (5). + /// + DWRITE_FONT_STRETCH_MEDIUM = 5, + + /// + /// Predefined font stretch : Semi-expanded (6). + /// + DWRITE_FONT_STRETCH_SEMI_EXPANDED = 6, + + /// + /// Predefined font stretch : Expanded (7). + /// + DWRITE_FONT_STRETCH_EXPANDED = 7, + + /// + /// Predefined font stretch : Extra-expanded (8). + /// + DWRITE_FONT_STRETCH_EXTRA_EXPANDED = 8, + + /// + /// Predefined font stretch : Ultra-expanded (9). + /// + DWRITE_FONT_STRETCH_ULTRA_EXPANDED = 9 +}; + +/// +/// The font style enumeration describes the slope style of a font face, such as Normal, Italic or Oblique. +/// Values other than the ones defined in the enumeration are considered to be invalid, and they are rejected by font API functions. +/// +enum DWRITE_FONT_STYLE +{ + /// + /// Font slope style : Normal. + /// + DWRITE_FONT_STYLE_NORMAL, + + /// + /// Font slope style : Oblique. + /// + DWRITE_FONT_STYLE_OBLIQUE, + + /// + /// Font slope style : Italic. + /// + DWRITE_FONT_STYLE_ITALIC + +}; + +/// +/// The informational string enumeration identifies a string in a font. +/// +enum DWRITE_INFORMATIONAL_STRING_ID +{ + /// + /// Unspecified name ID. + /// + DWRITE_INFORMATIONAL_STRING_NONE, + + /// + /// Copyright notice provided by the font. + /// + DWRITE_INFORMATIONAL_STRING_COPYRIGHT_NOTICE, + + /// + /// String containing a version number. + /// + DWRITE_INFORMATIONAL_STRING_VERSION_STRINGS, + + /// + /// Trademark information provided by the font. + /// + DWRITE_INFORMATIONAL_STRING_TRADEMARK, + + /// + /// Name of the font manufacturer. + /// + DWRITE_INFORMATIONAL_STRING_MANUFACTURER, + + /// + /// Name of the font designer. + /// + DWRITE_INFORMATIONAL_STRING_DESIGNER, + + /// + /// URL of font designer (with protocol, e.g., http://, ftp://). + /// + DWRITE_INFORMATIONAL_STRING_DESIGNER_URL, + + /// + /// Description of the font. Can contain revision information, usage recommendations, history, features, etc. + /// + DWRITE_INFORMATIONAL_STRING_DESCRIPTION, + + /// + /// URL of font vendor (with protocol, e.g., http://, ftp://). If a unique serial number is embedded in the URL, it can be used to register the font. + /// + DWRITE_INFORMATIONAL_STRING_FONT_VENDOR_URL, + + /// + /// Description of how the font may be legally used, or different example scenarios for licensed use. This field should be written in plain language, not legalese. + /// + DWRITE_INFORMATIONAL_STRING_LICENSE_DESCRIPTION, + + /// + /// URL where additional licensing information can be found. + /// + DWRITE_INFORMATIONAL_STRING_LICENSE_INFO_URL, + + /// + /// GDI-compatible family name. Because GDI allows a maximum of four fonts per family, fonts in the same family may have different GDI-compatible family names + /// (e.g., "Arial", "Arial Narrow", "Arial Black"). + /// + DWRITE_INFORMATIONAL_STRING_WIN32_FAMILY_NAMES, + + /// + /// GDI-compatible subfamily name. + /// + DWRITE_INFORMATIONAL_STRING_WIN32_SUBFAMILY_NAMES, + + /// + /// Family name preferred by the designer. This enables font designers to group more than four fonts in a single family without losing compatibility with + /// GDI. This name is typically only present if it differs from the GDI-compatible family name. + /// + DWRITE_INFORMATIONAL_STRING_PREFERRED_FAMILY_NAMES, + + /// + /// Subfamily name preferred by the designer. This name is typically only present if it differs from the GDI-compatible subfamily name. + /// + DWRITE_INFORMATIONAL_STRING_PREFERRED_SUBFAMILY_NAMES, + + /// + /// Sample text. This can be the font name or any other text that the designer thinks is the best example to display the font in. + /// + DWRITE_INFORMATIONAL_STRING_SAMPLE_TEXT +}; + + +/// +/// The DWRITE_FONT_METRICS structure specifies the metrics of a font face that +/// are applicable to all glyphs within the font face. +/// +struct DWRITE_FONT_METRICS +{ + /// + /// The number of font design units per em unit. + /// Font files use their own coordinate system of font design units. + /// A font design unit is the smallest measurable unit in the em square, + /// an imaginary square that is used to size and align glyphs. + /// The concept of em square is used as a reference scale factor when defining font size and device transformation semantics. + /// The size of one em square is also commonly used to compute the paragraph identation value. + /// + UINT16 designUnitsPerEm; + + /// + /// Ascent value of the font face in font design units. + /// Ascent is the distance from the top of font character alignment box to English baseline. + /// + UINT16 ascent; + + /// + /// Descent value of the font face in font design units. + /// Descent is the distance from the bottom of font character alignment box to English baseline. + /// + UINT16 descent; + + /// + /// Line gap in font design units. + /// Recommended additional white space to add between lines to improve legibility. The recommended line spacing + /// (baseline-to-baseline distance) is thus the sum of ascent, descent, and lineGap. The line gap is usually + /// positive or zero but can be negative, in which case the recommended line spacing is less than the height + /// of the character alignment box. + /// + INT16 lineGap; + + /// + /// Cap height value of the font face in font design units. + /// Cap height is the distance from English baseline to the top of a typical English capital. + /// Capital "H" is often used as a reference character for the purpose of calculating the cap height value. + /// + UINT16 capHeight; + + /// + /// x-height value of the font face in font design units. + /// x-height is the distance from English baseline to the top of lowercase letter "x", or a similar lowercase character. + /// + UINT16 xHeight; + + /// + /// The underline position value of the font face in font design units. + /// Underline position is the position of underline relative to the English baseline. + /// The value is usually made negative in order to place the underline below the baseline. + /// + INT16 underlinePosition; + + /// + /// The suggested underline thickness value of the font face in font design units. + /// + UINT16 underlineThickness; + + /// + /// The strikethrough position value of the font face in font design units. + /// Strikethrough position is the position of strikethrough relative to the English baseline. + /// The value is usually made positive in order to place the strikethrough above the baseline. + /// + INT16 strikethroughPosition; + + /// + /// The suggested strikethrough thickness value of the font face in font design units. + /// + UINT16 strikethroughThickness; +}; + +/// +/// The DWRITE_GLYPH_METRICS structure specifies the metrics of an individual glyph. +/// The units depend on how the metrics are obtained. +/// +struct DWRITE_GLYPH_METRICS +{ + /// + /// Specifies the X offset from the glyph origin to the left edge of the black box. + /// The glyph origin is the current horizontal writing position. + /// A negative value means the black box extends to the left of the origin (often true for lowercase italic 'f'). + /// + INT32 leftSideBearing; + + /// + /// Specifies the X offset from the origin of the current glyph to the origin of the next glyph when writing horizontally. + /// + UINT32 advanceWidth; + + /// + /// Specifies the X offset from the right edge of the black box to the origin of the next glyph when writing horizontally. + /// The value is negative when the right edge of the black box overhangs the layout box. + /// + INT32 rightSideBearing; + + /// + /// Specifies the vertical offset from the vertical origin to the top of the black box. + /// Thus, a positive value adds whitespace whereas a negative value means the glyph overhangs the top of the layout box. + /// + INT32 topSideBearing; + + /// + /// Specifies the Y offset from the vertical origin of the current glyph to the vertical origin of the next glyph when writing vertically. + /// (Note that the term "origin" by itself denotes the horizontal origin. The vertical origin is different. + /// Its Y coordinate is specified by verticalOriginY value, + /// and its X coordinate is half the advanceWidth to the right of the horizontal origin). + /// + UINT32 advanceHeight; + + /// + /// Specifies the vertical distance from the black box's bottom edge to the advance height. + /// Positive when the bottom edge of the black box is within the layout box. + /// Negative when the bottom edge of black box overhangs the layout box. + /// + INT32 bottomSideBearing; + + /// + /// Specifies the Y coordinate of a glyph's vertical origin, in the font's design coordinate system. + /// The y coordinate of a glyph's vertical origin is the sum of the glyph's top side bearing + /// and the top (i.e. yMax) of the glyph's bounding box. + /// + INT32 verticalOriginY; +}; + +/// +/// Optional adjustment to a glyph's position. An glyph offset changes the position of a glyph without affecting +/// the pen position. Offsets are in logical, pre-transform units. +/// +struct DWRITE_GLYPH_OFFSET +{ + /// + /// Offset in the advance direction of the run. A positive advance offset moves the glyph to the right + /// (in pre-transform coordinates) if the run is left-to-right or to the left if the run is right-to-left. + /// + FLOAT advanceOffset; + + /// + /// Offset in the ascent direction, i.e., the direction ascenders point. A positive ascender offset moves + /// the glyph up (in pre-transform coordinates). + /// + FLOAT ascenderOffset; +}; + +/// +/// Specifies the type of DirectWrite factory object. +/// DirectWrite factory contains internal state such as font loader registration and cached font data. +/// In most cases it is recommended to use the shared factory object, because it allows multiple components +/// that use DirectWrite to share internal DirectWrite state and reduce memory usage. +/// However, there are cases when it is desirable to reduce the impact of a component, +/// such as a plug-in from an untrusted source, on the rest of the process by sandboxing and isolating it +/// from the rest of the process components. In such cases, it is recommended to use an isolated factory for the sandboxed +/// component. +/// +enum DWRITE_FACTORY_TYPE +{ + /// + /// Shared factory allow for re-use of cached font data across multiple in process components. + /// Such factories also take advantage of cross process font caching components for better performance. + /// + DWRITE_FACTORY_TYPE_SHARED, + + /// + /// Objects created from the isolated factory do not interact with internal DirectWrite state from other components. + /// + DWRITE_FACTORY_TYPE_ISOLATED +}; + +// Creates an OpenType tag as a 32bit integer such that +// the first character in the tag is the lowest byte, +// (least significant on little endian architectures) +// which can be used to compare with tags in the font file. +// This macro is compatible with DWRITE_FONT_FEATURE_TAG. +// +// Example: DWRITE_MAKE_OPENTYPE_TAG('c','c','m','p') +// Dword: 0x706D6363 +// +#define DWRITE_MAKE_OPENTYPE_TAG(a,b,c,d) ( \ + (static_cast(static_cast(d)) << 24) | \ + (static_cast(static_cast(c)) << 16) | \ + (static_cast(static_cast(b)) << 8) | \ + static_cast(static_cast(a))) + +interface IDWriteFontFileStream; + +/// +/// Font file loader interface handles loading font file resources of a particular type from a key. +/// The font file loader interface is recommended to be implemented by a singleton object. +/// IMPORTANT: font file loader implementations must not register themselves with DirectWrite factory +/// inside their constructors and must not unregister themselves in their destructors, because +/// registration and unregistraton operations increment and decrement the object reference count respectively. +/// Instead, registration and unregistration of font file loaders with DirectWrite factory should be performed +/// outside of the font file loader implementation as a separate step. +/// +interface DWRITE_DECLARE_INTERFACE("727cad4e-d6af-4c9e-8a08-d695b11caa49") IDWriteFontFileLoader : public IUnknown +{ + /// + /// Creates a font file stream object that encapsulates an open file resource. + /// The resource is closed when the last reference to fontFileStream is released. + /// + /// Font file reference key that uniquely identifies the font file resource + /// within the scope of the font loader being used. + /// Size of font file reference key in bytes. + /// Pointer to the newly created font file stream. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateStreamFromKey)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + __out IDWriteFontFileStream** fontFileStream + ) PURE; +}; + +/// +/// A built-in implementation of IDWriteFontFileLoader interface that operates on local font files +/// and exposes local font file information from the font file reference key. +/// Font file references created using CreateFontFileReference use this font file loader. +/// +interface DWRITE_DECLARE_INTERFACE("b2d9f3ec-c9fe-4a11-a2ec-d86208f7c0a2") IDWriteLocalFontFileLoader : public IDWriteFontFileLoader +{ + /// + /// Obtains the length of the absolute file path from the font file reference key. + /// + /// Font file reference key that uniquely identifies the local font file + /// within the scope of the font loader being used. + /// Size of font file reference key in bytes. + /// Length of the file path string not including the terminated NULL character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFilePathLengthFromKey)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + __out UINT32* filePathLength + ) PURE; + + /// + /// Obtains the absolute font file path from the font file reference key. + /// + /// Font file reference key that uniquely identifies the local font file + /// within the scope of the font loader being used. + /// Size of font file reference key in bytes. + /// Character array that receives the local file path. + /// Size of the filePath array in character count including the terminated NULL character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFilePathFromKey)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + __out_ecount_z(filePathSize) WCHAR* filePath, + UINT32 filePathSize + ) PURE; + + /// + /// Obtains the last write time of the file from the font file reference key. + /// + /// Font file reference key that uniquely identifies the local font file + /// within the scope of the font loader being used. + /// Size of font file reference key in bytes. + /// Last modified time of the font file. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLastWriteTimeFromKey)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + __out FILETIME* lastWriteTime + ) PURE; +}; + +/// +/// The interface for loading font file data. +/// +interface DWRITE_DECLARE_INTERFACE("6d4865fe-0ab8-4d91-8f62-5dd6be34a3e0") IDWriteFontFileStream : public IUnknown +{ + /// + /// Reads a fragment from a file. + /// + /// Receives the pointer to the start of the font file fragment. + /// Offset of the fragment from the beginning of the font file. + /// Size of the fragment in bytes. + /// The client defined context to be passed to the ReleaseFileFragment. + /// + /// Standard HRESULT error code. + /// + /// + /// IMPORTANT: ReadFileFragment() implementations must check whether the requested file fragment + /// is within the file bounds. Otherwise, an error should be returned from ReadFileFragment. + /// + STDMETHOD(ReadFileFragment)( + __deref_out_bcount(fragmentSize) void const** fragmentStart, + UINT64 fileOffset, + UINT64 fragmentSize, + __out void** fragmentContext + ) PURE; + + /// + /// Releases a fragment from a file. + /// + /// The client defined context of a font fragment returned from ReadFileFragment. + STDMETHOD_(void, ReleaseFileFragment)( + void* fragmentContext + ) PURE; + + /// + /// Obtains the total size of a file. + /// + /// Receives the total size of the file. + /// + /// Standard HRESULT error code. + /// + /// + /// Implementing GetFileSize() for asynchronously loaded font files may require + /// downloading the complete file contents, therefore this method should only be used for operations that + /// either require complete font file to be loaded (e.g., copying a font file) or need to make + /// decisions based on the value of the file size (e.g., validation against a persisted file size). + /// + STDMETHOD(GetFileSize)( + __out UINT64* fileSize + ) PURE; + + /// + /// Obtains the last modified time of the file. The last modified time is used by DirectWrite font selection algorithms + /// to determine whether one font resource is more up to date than another one. + /// + /// Receives the last modifed time of the file in the format that represents + /// the number of 100-nanosecond intervals since January 1, 1601 (UTC). + /// + /// Standard HRESULT error code. For resources that don't have a concept of the last modified time, the implementation of + /// GetLastWriteTime should return E_NOTIMPL. + /// + STDMETHOD(GetLastWriteTime)( + __out UINT64* lastWriteTime + ) PURE; +}; + +/// +/// The interface that represents a reference to a font file. +/// +interface DWRITE_DECLARE_INTERFACE("739d886a-cef5-47dc-8769-1a8b41bebbb0") IDWriteFontFile : public IUnknown +{ + /// + /// This method obtains the pointer to the reference key of a font file. The pointer is only valid until the object that refers to it is released. + /// + /// Pointer to the font file reference key. + /// IMPORTANT: The pointer value is valid until the font file reference object it is obtained from is released. + /// Size of font file reference key in bytes. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetReferenceKey)( + __deref_out_bcount(*fontFileReferenceKeySize) void const** fontFileReferenceKey, + __out UINT32* fontFileReferenceKeySize + ) PURE; + + /// + /// Obtains the file loader associated with a font file object. + /// + /// The font file loader associated with the font file object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLoader)( + __out IDWriteFontFileLoader** fontFileLoader + ) PURE; + + /// + /// Analyzes a file and returns whether it represents a font, and whether the font type is supported by the font system. + /// + /// TRUE if the font type is supported by the font system, FALSE otherwise. + /// The type of the font file. Note that even if isSupportedFontType is FALSE, + /// the fontFileType value may be different from DWRITE_FONT_FILE_TYPE_UNKNOWN. + /// The type of the font face that can be constructed from the font file. + /// Note that even if isSupportedFontType is FALSE, the fontFaceType value may be different from + /// DWRITE_FONT_FACE_TYPE_UNKNOWN. + /// Number of font faces contained in the font file. + /// + /// Standard HRESULT error code if there was a processing error during analysis. + /// + /// + /// IMPORTANT: certain font file types are recognized, but not supported by the font system. + /// For example, the font system will recognize a file as a Type 1 font file, + /// but will not be able to construct a font face object from it. In such situations, Analyze will set + /// isSupportedFontType output parameter to FALSE. + /// + STDMETHOD(Analyze)( + __out BOOL* isSupportedFontType, + __out DWRITE_FONT_FILE_TYPE* fontFileType, + __out_opt DWRITE_FONT_FACE_TYPE* fontFaceType, + __out UINT32* numberOfFaces + ) PURE; +}; + +/// +/// Represents the internal structure of a device pixel (i.e., the physical arrangement of red, +/// green, and blue color components) that is assumed for purposes of rendering text. +/// +#ifndef DWRITE_PIXEL_GEOMETRY_DEFINED +enum DWRITE_PIXEL_GEOMETRY +{ + /// + /// The red, green, and blue color components of each pixel are assumed to occupy the same point. + /// + DWRITE_PIXEL_GEOMETRY_FLAT, + + /// + /// Each pixel comprises three vertical stripes, with red on the left, green in the center, and + /// blue on the right. This is the most common pixel geometry for LCD monitors. + /// + DWRITE_PIXEL_GEOMETRY_RGB, + + /// + /// Each pixel comprises three vertical stripes, with blue on the left, green in the center, and + /// red on the right. + /// + DWRITE_PIXEL_GEOMETRY_BGR +}; +#define DWRITE_PIXEL_GEOMETRY_DEFINED +#endif + +/// +/// Represents a method of rendering glyphs. +/// +enum DWRITE_RENDERING_MODE +{ + /// + /// Specifies that the rendering mode is determined automatically based on the font and size. + /// + DWRITE_RENDERING_MODE_DEFAULT, + + /// + /// Specifies that no anti-aliasing is performed. Each pixel is either set to the foreground + /// color of the text or retains the color of the background. + /// + DWRITE_RENDERING_MODE_ALIASED, + + /// + /// Specifies ClearType rendering with the same metrics as aliased text. Glyphs can only + /// be positioned on whole-pixel boundaries. + /// + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC, + + /// + /// Specifies ClearType rendering with the same metrics as text rendering using GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. Glyph metrics are closer to their ideal values than + /// with aliased text, but glyphs are still positioned on whole-pixel boundaries. + /// + DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL, + + /// + /// Specifies ClearType rendering with anti-aliasing in the horizontal dimension only. This is + /// typically used with small to medium font sizes (up to 16 ppem). + /// + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL, + + /// + /// Specifies ClearType rendering with anti-aliasing in both horizontal and vertical dimensions. + /// This is typically used at larger sizes to makes curves and diagonal lines look smoother, at + /// the expense of some softness. + /// + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC, + + /// + /// Specifies that rendering should bypass the rasterizer and use the outlines directly. This is + /// typically used at very large sizes. + /// + DWRITE_RENDERING_MODE_OUTLINE +}; + +/// +/// The DWRITE_MATRIX structure specifies the graphics transform to be applied +/// to rendered glyphs. +/// +struct DWRITE_MATRIX +{ + /// + /// Horizontal scaling / cosine of rotation + /// + FLOAT m11; + + /// + /// Vertical shear / sine of rotation + /// + FLOAT m12; + + /// + /// Horizontal shear / negative sine of rotation + /// + FLOAT m21; + + /// + /// Vertical scaling / cosine of rotation + /// + FLOAT m22; + + /// + /// Horizontal shift (always orthogonal regardless of rotation) + /// + FLOAT dx; + + /// + /// Vertical shift (always orthogonal regardless of rotation) + /// + FLOAT dy; +}; + +/// +/// The interface that represents text rendering settings for glyph rasterization and filtering. +/// +interface DWRITE_DECLARE_INTERFACE("2f0da53a-2add-47cd-82ee-d9ec34688e75") IDWriteRenderingParams : public IUnknown +{ + /// + /// Gets the gamma value used for gamma correction. Valid values must be + /// greater than zero and cannot exceed 256. + /// + STDMETHOD_(FLOAT, GetGamma)() PURE; + + /// + /// Gets the amount of contrast enhancement. Valid values are greater than + /// or equal to zero. + /// + STDMETHOD_(FLOAT, GetEnhancedContrast)() PURE; + + /// + /// Gets the ClearType level. Valid values range from 0.0f (no ClearType) + /// to 1.0f (full ClearType). + /// + STDMETHOD_(FLOAT, GetClearTypeLevel)() PURE; + + /// + /// Gets the pixel geometry. + /// + STDMETHOD_(DWRITE_PIXEL_GEOMETRY, GetPixelGeometry)() PURE; + + /// + /// Gets the rendering mode. + /// + STDMETHOD_(DWRITE_RENDERING_MODE, GetRenderingMode)() PURE; +}; + +// Forward declarations of D2D types +interface ID2D1SimplifiedGeometrySink; + +typedef ID2D1SimplifiedGeometrySink IDWriteGeometrySink; + +/// +/// The interface that represents an absolute reference to a font face. +/// It contains font face type, appropriate file references and face identification data. +/// Various font data such as metrics, names and glyph outlines is obtained from IDWriteFontFace. +/// +interface DWRITE_DECLARE_INTERFACE("5f49804d-7024-4d43-bfa9-d25984f53849") IDWriteFontFace : public IUnknown +{ + /// + /// Obtains the file format type of a font face. + /// + STDMETHOD_(DWRITE_FONT_FACE_TYPE, GetType)() PURE; + + /// + /// Obtains the font files representing a font face. + /// + /// The number of files representing the font face. + /// User provided array that stores pointers to font files representing the font face. + /// This parameter can be NULL if the user is only interested in the number of files representing the font face. + /// This API increments reference count of the font file pointers returned according to COM conventions, and the client + /// should release them when finished. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFiles)( + __inout UINT32* numberOfFiles, + __out_ecount_opt(*numberOfFiles) IDWriteFontFile** fontFiles + ) PURE; + + /// + /// Obtains the zero-based index of the font face in its font file or files. If the font files contain a single face, + /// the return value is zero. + /// + STDMETHOD_(UINT32, GetIndex)() PURE; + + /// + /// Obtains the algorithmic style simulation flags of a font face. + /// + STDMETHOD_(DWRITE_FONT_SIMULATIONS, GetSimulations)() PURE; + + /// + /// Determines whether the font is a symbol font. + /// + STDMETHOD_(BOOL, IsSymbolFont)() PURE; + + /// + /// Obtains design units and common metrics for the font face. + /// These metrics are applicable to all the glyphs within a fontface and are used by applications for layout calculations. + /// + /// Points to a DWRITE_FONT_METRICS structure to fill in. + /// The metrics returned by this function are in font design units. + STDMETHOD_(void, GetMetrics)( + __out DWRITE_FONT_METRICS* fontFaceMetrics + ) PURE; + + /// + /// Obtains the number of glyphs in the font face. + /// + STDMETHOD_(UINT16, GetGlyphCount)() PURE; + + /// + /// Obtains ideal glyph metrics in font design units. Design glyphs metrics are used for glyph positioning. + /// + /// An array of glyph indices to compute the metrics for. + /// The number of elements in the glyphIndices array. + /// Array of DWRITE_GLYPH_METRICS structures filled by this function. + /// The metrics returned by this function are in font design units. + /// Indicates whether the font is being used in a sideways run. + /// This can affect the glyph metrics if the font has oblique simulation + /// because sideways oblique simulation differs from non-sideways oblique simulation. + /// + /// Standard HRESULT error code. If any of the input glyph indices are outside of the valid glyph index range + /// for the current font face, E_INVALIDARG will be returned. + /// + STDMETHOD(GetDesignGlyphMetrics)( + __in_ecount(glyphCount) UINT16 const* glyphIndices, + UINT32 glyphCount, + __out_ecount(glyphCount) DWRITE_GLYPH_METRICS* glyphMetrics, + BOOL isSideways = FALSE + ) PURE; + + /// + /// Returns the nominal mapping of UCS4 Unicode code points to glyph indices as defined by the font 'CMAP' table. + /// Note that this mapping is primarily provided for line layout engines built on top of the physical font API. + /// Because of OpenType glyph substitution and line layout character substitution, the nominal conversion does not always correspond + /// to how a Unicode string will map to glyph indices when rendering using a particular font face. + /// Also, note that Unicode Variant Selectors provide for alternate mappings for character to glyph. + /// This call will always return the default variant. + /// + /// An array of USC4 code points to obtain nominal glyph indices from. + /// The number of elements in the codePoints array. + /// Array of nominal glyph indices filled by this function. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGlyphIndices)( + __in_ecount(codePointCount) UINT32 const* codePoints, + UINT32 codePointCount, + __out_ecount(codePointCount) UINT16* glyphIndices + ) PURE; + + /// + /// Finds the specified OpenType font table if it exists and returns a pointer to it. + /// The function accesses the underling font data via the IDWriteFontStream interface + /// implemented by the font file loader. + /// + /// Four character tag of table to find. + /// Use the DWRITE_MAKE_OPENTYPE_TAG() macro to create it. + /// Unlike GDI, it does not support the special TTCF and null tags to access the whole font. + /// + /// Pointer to base of table in memory. + /// The pointer is only valid so long as the FontFace used to get the font table still exists + /// (not any other FontFace, even if it actually refers to the same physical font). + /// + /// Byte size of table. + /// + /// Opaque context which must be freed by calling ReleaseFontTable. + /// The context actually comes from the lower level IDWriteFontFileStream, + /// which may be implemented by the application or DWrite itself. + /// It is possible for a NULL tableContext to be returned, especially if + /// the implementation directly memory maps the whole file. + /// Nevertheless, always release it later, and do not use it as a test for function success. + /// The same table can be queried multiple times, + /// but each returned context can be different, so release each separately. + /// + /// True if table exists. + /// + /// Standard HRESULT error code. + /// If a table can not be found, the function will not return an error, but the size will be 0, table NULL, and exists = FALSE. + /// The context does not need to be freed if the table was not found. + /// + /// + /// The context for the same tag may be different for each call, + /// so each one must be held and released separately. + /// + STDMETHOD(TryGetFontTable)( + __in UINT32 openTypeTableTag, + __deref_out_bcount(*tableSize) const void** tableData, + __out UINT32* tableSize, + __out void** tableContext, + __out BOOL* exists + ) PURE; + + /// + /// Releases the table obtained earlier from TryGetFontTable. + /// + /// Opaque context from TryGetFontTable. + /// + /// Standard HRESULT error code. + /// + STDMETHOD_(void, ReleaseFontTable)( + __in void* tableContext + ) PURE; + + /// + /// Computes the outline of a run of glyphs by calling back to the outline sink interface. + /// + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Array of glyph indices. + /// Optional array of glyph advances in DIPs. + /// Optional array of glyph offsets. + /// Number of glyphs. + /// If true, specifies that glyphs are rotated 90 degrees to the left and vertical metrics are used. + /// A client can render a vertical run by specifying isSideways = true and rotating the resulting geometry 90 degrees to the + /// right using a transform. The isSideways and isRightToLeft parameters cannot both be true. + /// If true, specifies that the advance direction is right to left. By default, the advance direction + /// is left to right. + /// Interface the function calls back to draw each element of the geometry. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGlyphRunOutline)( + FLOAT emSize, + __in_ecount(glyphCount) UINT16 const* glyphIndices, + __in_ecount_opt(glyphCount) FLOAT const* glyphAdvances, + __in_ecount_opt(glyphCount) DWRITE_GLYPH_OFFSET const* glyphOffsets, + UINT32 glyphCount, + BOOL isSideways, + BOOL isRightToLeft, + IDWriteGeometrySink* geometrySink + ) PURE; + + /// + /// Determines the recommended rendering mode for the font given the specified size and rendering parameters. + /// + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this + /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. + /// Specifies measuring method that will be used for glyphs in the font. + /// Renderer implementations may choose different rendering modes for given measuring methods, but + /// best results are seen when the corresponding modes match: + /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL + /// + /// Rendering parameters object. This parameter is necessary in case the rendering parameters + /// object overrides the rendering mode. + /// Receives the recommended rendering mode to use. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetRecommendedRenderingMode)( + FLOAT emSize, + FLOAT pixelsPerDip, + DWRITE_MEASURING_MODE measuringMode, + IDWriteRenderingParams* renderingParams, + __out DWRITE_RENDERING_MODE* renderingMode + ) PURE; + + /// + /// Obtains design units and common metrics for the font face. + /// These metrics are applicable to all the glyphs within a fontface and are used by applications for layout calculations. + /// + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this + /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified by the font size and pixelsPerDip. + /// Points to a DWRITE_FONT_METRICS structure to fill in. + /// The metrics returned by this function are in font design units. + STDMETHOD(GetGdiCompatibleMetrics)( + FLOAT emSize, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + __out DWRITE_FONT_METRICS* fontFaceMetrics + ) PURE; + + + /// + /// Obtains glyph metrics in font design units with the return values compatible with what GDI would produce. + /// Glyphs metrics are used for positioning of individual glyphs. + /// + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this + /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified by the font size and pixelsPerDip. + /// + /// When set to FALSE, the metrics are the same as the metrics of GDI aliased text. + /// When set to TRUE, the metrics are the same as the metrics of text measured by GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. + /// + /// An array of glyph indices to compute the metrics for. + /// The number of elements in the glyphIndices array. + /// Array of DWRITE_GLYPH_METRICS structures filled by this function. + /// The metrics returned by this function are in font design units. + /// Indicates whether the font is being used in a sideways run. + /// This can affect the glyph metrics if the font has oblique simulation + /// because sideways oblique simulation differs from non-sideways oblique simulation. + /// + /// Standard HRESULT error code. If any of the input glyph indices are outside of the valid glyph index range + /// for the current font face, E_INVALIDARG will be returned. + /// + STDMETHOD(GetGdiCompatibleGlyphMetrics)( + FLOAT emSize, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + BOOL useGdiNatural, + __in_ecount(glyphCount) UINT16 const* glyphIndices, + UINT32 glyphCount, + __out_ecount(glyphCount) DWRITE_GLYPH_METRICS* glyphMetrics, + BOOL isSideways = FALSE + ) PURE; +}; + +interface IDWriteFactory; +interface IDWriteFontFileEnumerator; + +/// +/// The font collection loader interface is used to construct a collection of fonts given a particular type of key. +/// The font collection loader interface is recommended to be implemented by a singleton object. +/// IMPORTANT: font collection loader implementations must not register themselves with a DirectWrite factory +/// inside their constructors and must not unregister themselves in their destructors, because +/// registration and unregistraton operations increment and decrement the object reference count respectively. +/// Instead, registration and unregistration of font file loaders with DirectWrite factory should be performed +/// outside of the font file loader implementation as a separate step. +/// +interface DWRITE_DECLARE_INTERFACE("cca920e4-52f0-492b-bfa8-29c72ee0a468") IDWriteFontCollectionLoader : public IUnknown +{ + /// + /// Creates a font file enumerator object that encapsulates a collection of font files. + /// The font system calls back to this interface to create a font collection. + /// + /// Factory associated with the loader. + /// Font collection key that uniquely identifies the collection of font files within + /// the scope of the font collection loader being used. + /// Size of the font collection key in bytes. + /// Pointer to the newly created font file enumerator. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateEnumeratorFromKey)( + IDWriteFactory* factory, + __in_bcount(collectionKeySize) void const* collectionKey, + UINT32 collectionKeySize, + __out IDWriteFontFileEnumerator** fontFileEnumerator + ) PURE; +}; + +/// +/// The font file enumerator interface encapsulates a collection of font files. The font system uses this interface +/// to enumerate font files when building a font collection. +/// +interface DWRITE_DECLARE_INTERFACE("72755049-5ff7-435d-8348-4be97cfa6c7c") IDWriteFontFileEnumerator : public IUnknown +{ + /// + /// Advances to the next font file in the collection. When it is first created, the enumerator is positioned + /// before the first element of the collection and the first call to MoveNext advances to the first file. + /// + /// Receives the value TRUE if the enumerator advances to a file, or FALSE if + /// the enumerator advanced past the last file in the collection. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(MoveNext)( + __out BOOL* hasCurrentFile + ) PURE; + + /// + /// Gets a reference to the current font file. + /// + /// Pointer to the newly created font file object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetCurrentFontFile)( + __out IDWriteFontFile** fontFile + ) PURE; +}; + +/// +/// Represents a collection of strings indexed by locale name. +/// +interface DWRITE_DECLARE_INTERFACE("08256209-099a-4b34-b86d-c22b110e7771") IDWriteLocalizedStrings : public IUnknown +{ + /// + /// Gets the number of language/string pairs. + /// + STDMETHOD_(UINT32, GetCount)() PURE; + + /// + /// Gets the index of the item with the specified locale name. + /// + /// Locale name to look for. + /// Receives the zero-based index of the locale name/string pair. + /// Receives TRUE if the locale name exists or FALSE if not. + /// + /// Standard HRESULT error code. If the specified locale name does not exist, the return value is S_OK, + /// but *index is UINT_MAX and *exists is FALSE. + /// + STDMETHOD(FindLocaleName)( + __in_z WCHAR const* localeName, + __out UINT32* index, + __out BOOL* exists + ) PURE; + + /// + /// Gets the length in characters (not including the null terminator) of the locale name with the specified index. + /// + /// Zero-based index of the locale name. + /// Receives the length in characters, not including the null terminator. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleNameLength)( + UINT32 index, + __out UINT32* length + ) PURE; + + /// + /// Copies the locale name with the specified index to the specified array. + /// + /// Zero-based index of the locale name. + /// Character array that receives the locale name. + /// Size of the array in characters. The size must include space for the terminating + /// null character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleName)( + UINT32 index, + __out_ecount_z(size) WCHAR* localeName, + UINT32 size + ) PURE; + + /// + /// Gets the length in characters (not including the null terminator) of the string with the specified index. + /// + /// Zero-based index of the string. + /// Receives the length in characters, not including the null terminator. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetStringLength)( + UINT32 index, + __out UINT32* length + ) PURE; + + /// + /// Copies the string with the specified index to the specified array. + /// + /// Zero-based index of the string. + /// Character array that receives the string. + /// Size of the array in characters. The size must include space for the terminating + /// null character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetString)( + UINT32 index, + __out_ecount_z(size) WCHAR* stringBuffer, + UINT32 size + ) PURE; +}; + +interface IDWriteFontFamily; +interface IDWriteFont; + +/// +/// The IDWriteFontCollection encapsulates a collection of fonts. +/// +interface DWRITE_DECLARE_INTERFACE("a84cee02-3eea-4eee-a827-87c1a02a0fcc") IDWriteFontCollection : public IUnknown +{ + /// + /// Gets the number of font families in the collection. + /// + STDMETHOD_(UINT32, GetFontFamilyCount)() PURE; + + /// + /// Creates a font family object given a zero-based font family index. + /// + /// Zero-based index of the font family. + /// Receives a pointer the newly created font family object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamily)( + UINT32 index, + __out IDWriteFontFamily** fontFamily + ) PURE; + + /// + /// Finds the font family with the specified family name. + /// + /// Name of the font family. The name is not case-sensitive but must otherwise exactly match a family name in the collection. + /// Receives the zero-based index of the matching font family if the family name was found or UINT_MAX otherwise. + /// Receives TRUE if the family name exists or FALSE otherwise. + /// + /// Standard HRESULT error code. If the specified family name does not exist, the return value is S_OK, but *index is UINT_MAX and *exists is FALSE. + /// + STDMETHOD(FindFamilyName)( + __in_z WCHAR const* familyName, + __out UINT32* index, + __out BOOL* exists + ) PURE; + + /// + /// Gets the font object that corresponds to the same physical font as the specified font face object. The specified physical font must belong + /// to the font collection. + /// + /// Font face object that specifies the physical font. + /// Receives a pointer to the newly created font object if successful or NULL otherwise. + /// + /// Standard HRESULT error code. If the specified physical font is not part of the font collection the return value is DWRITE_E_NOFONT. + /// + STDMETHOD(GetFontFromFontFace)( + IDWriteFontFace* fontFace, + __out IDWriteFont** font + ) PURE; +}; + +/// +/// The IDWriteFontList interface represents a list of fonts. +/// +interface DWRITE_DECLARE_INTERFACE("1a0d8438-1d97-4ec1-aef9-a2fb86ed6acb") IDWriteFontList : public IUnknown +{ + /// + /// Gets the font collection that contains the fonts. + /// + /// Receives a pointer to the font collection object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontCollection)( + __out IDWriteFontCollection** fontCollection + ) PURE; + + /// + /// Gets the number of fonts in the font list. + /// + STDMETHOD_(UINT32, GetFontCount)() PURE; + + /// + /// Gets a font given its zero-based index. + /// + /// Zero-based index of the font in the font list. + /// Receives a pointer to the newly created font object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFont)( + UINT32 index, + __out IDWriteFont** font + ) PURE; +}; + +/// +/// The IDWriteFontFamily interface represents a set of fonts that share the same design but are differentiated +/// by weight, stretch, and style. +/// +interface DWRITE_DECLARE_INTERFACE("da20d8ef-812a-4c43-9802-62ec4abd7add") IDWriteFontFamily : public IDWriteFontList +{ + /// + /// Creates an localized strings object that contains the family names for the font family, indexed by locale name. + /// + /// Receives a pointer to the newly created localized strings object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFamilyNames)( + __out IDWriteLocalizedStrings** names + ) PURE; + + /// + /// Gets the font that best matches the specified properties. + /// + /// Requested font weight. + /// Requested font stretch. + /// Requested font style. + /// Receives a pointer to the newly created font object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFirstMatchingFont)( + DWRITE_FONT_WEIGHT weight, + DWRITE_FONT_STRETCH stretch, + DWRITE_FONT_STYLE style, + __out IDWriteFont** matchingFont + ) PURE; + + /// + /// Gets a list of fonts in the font family ranked in order of how well they match the specified properties. + /// + /// Requested font weight. + /// Requested font stretch. + /// Requested font style. + /// Receives a pointer to the newly created font list object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetMatchingFonts)( + DWRITE_FONT_WEIGHT weight, + DWRITE_FONT_STRETCH stretch, + DWRITE_FONT_STYLE style, + __out IDWriteFontList** matchingFonts + ) PURE; +}; + +/// +/// The IDWriteFont interface represents a physical font in a font collection. +/// +interface DWRITE_DECLARE_INTERFACE("acd16696-8c14-4f5d-877e-fe3fc1d32737") IDWriteFont : public IUnknown +{ + /// + /// Gets the font family to which the specified font belongs. + /// + /// Receives a pointer to the font family object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamily)( + __out IDWriteFontFamily** fontFamily + ) PURE; + + /// + /// Gets the weight of the specified font. + /// + STDMETHOD_(DWRITE_FONT_WEIGHT, GetWeight)() PURE; + + /// + /// Gets the stretch (aka. width) of the specified font. + /// + STDMETHOD_(DWRITE_FONT_STRETCH, GetStretch)() PURE; + + /// + /// Gets the style (aka. slope) of the specified font. + /// + STDMETHOD_(DWRITE_FONT_STYLE, GetStyle)() PURE; + + /// + /// Returns TRUE if the font is a symbol font or FALSE if not. + /// + STDMETHOD_(BOOL, IsSymbolFont)() PURE; + + /// + /// Gets a localized strings collection containing the face names for the font (e.g., Regular or Bold), indexed by locale name. + /// + /// Receives a pointer to the newly created localized strings object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFaceNames)( + __out IDWriteLocalizedStrings** names + ) PURE; + + /// + /// Gets a localized strings collection containing the specified informational strings, indexed by locale name. + /// + /// Identifies the string to get. + /// Receives a pointer to the newly created localized strings object. + /// Receives the value TRUE if the font contains the specified string ID or FALSE if not. + /// + /// Standard HRESULT error code. If the font does not contain the specified string, the return value is S_OK but + /// informationalStrings receives a NULL pointer and exists receives the value FALSE. + /// + STDMETHOD(GetInformationalStrings)( + DWRITE_INFORMATIONAL_STRING_ID informationalStringID, + __out IDWriteLocalizedStrings** informationalStrings, + __out BOOL* exists + ) PURE; + + /// + /// Gets a value that indicates what simulation are applied to the specified font. + /// + STDMETHOD_(DWRITE_FONT_SIMULATIONS, GetSimulations)() PURE; + + /// + /// Gets the metrics for the font. + /// + /// Receives the font metrics. + STDMETHOD_(void, GetMetrics)( + __out DWRITE_FONT_METRICS* fontMetrics + ) PURE; + + /// + /// Determines whether the font supports the specified character. + /// + /// Unicode (UCS-4) character value. + /// Receives the value TRUE if the font supports the specified character or FALSE if not. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(HasCharacter)( + UINT32 unicodeValue, + __out BOOL* exists + ) PURE; + + /// + /// Creates a font face object for the font. + /// + /// Receives a pointer to the newly created font face object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFace)( + __out IDWriteFontFace** fontFace + ) PURE; +}; + +/// +/// Direction for how reading progresses. +/// +enum DWRITE_READING_DIRECTION +{ + /// + /// Reading progresses from left to right. + /// + DWRITE_READING_DIRECTION_LEFT_TO_RIGHT, + + /// + /// Reading progresses from right to left. + /// + DWRITE_READING_DIRECTION_RIGHT_TO_LEFT +}; + +/// +/// Direction for how lines of text are placed relative to one another. +/// +enum DWRITE_FLOW_DIRECTION +{ + /// + /// Text lines are placed from top to bottom. + /// + DWRITE_FLOW_DIRECTION_TOP_TO_BOTTOM +}; + +/// +/// Alignment of paragraph text along the reading direction axis relative to +/// the leading and trailing edge of the layout box. +/// +enum DWRITE_TEXT_ALIGNMENT +{ + /// + /// The leading edge of the paragraph text is aligned to the layout box's leading edge. + /// + DWRITE_TEXT_ALIGNMENT_LEADING, + + /// + /// The trailing edge of the paragraph text is aligned to the layout box's trailing edge. + /// + DWRITE_TEXT_ALIGNMENT_TRAILING, + + /// + /// The center of the paragraph text is aligned to the center of the layout box. + /// + DWRITE_TEXT_ALIGNMENT_CENTER +}; + +/// +/// Alignment of paragraph text along the flow direction axis relative to the +/// flow's beginning and ending edge of the layout box. +/// +enum DWRITE_PARAGRAPH_ALIGNMENT +{ + /// + /// The first line of paragraph is aligned to the flow's beginning edge of the layout box. + /// + DWRITE_PARAGRAPH_ALIGNMENT_NEAR, + + /// + /// The last line of paragraph is aligned to the flow's ending edge of the layout box. + /// + DWRITE_PARAGRAPH_ALIGNMENT_FAR, + + /// + /// The center of the paragraph is aligned to the center of the flow of the layout box. + /// + DWRITE_PARAGRAPH_ALIGNMENT_CENTER +}; + +/// +/// Word wrapping in multiline paragraph. +/// +enum DWRITE_WORD_WRAPPING +{ + /// + /// Words are broken across lines to avoid text overflowing the layout box. + /// + DWRITE_WORD_WRAPPING_WRAP, + + /// + /// Words are kept within the same line even when it overflows the layout box. + /// This option is often used with scrolling to reveal overflow text. + /// + DWRITE_WORD_WRAPPING_NO_WRAP +}; + +/// +/// The method used for line spacing in layout. +/// +enum DWRITE_LINE_SPACING_METHOD +{ + /// + /// Line spacing depends solely on the content, growing to accomodate the size of fonts and inline objects. + /// + DWRITE_LINE_SPACING_METHOD_DEFAULT, + + /// + /// Lines are explicitly set to uniform spacing, regardless of contained font sizes. + /// This can be useful to avoid the uneven appearance that can occur from font fallback. + /// + DWRITE_LINE_SPACING_METHOD_UNIFORM +}; + +/// +/// Text granularity used to trim text overflowing the layout box. +/// +enum DWRITE_TRIMMING_GRANULARITY +{ + /// + /// No trimming occurs. Text flows beyond the layout width. + /// + DWRITE_TRIMMING_GRANULARITY_NONE, + + /// + /// Trimming occurs at character cluster boundary. + /// + DWRITE_TRIMMING_GRANULARITY_CHARACTER, + + /// + /// Trimming occurs at word boundary. + /// + DWRITE_TRIMMING_GRANULARITY_WORD +}; + +/// +/// Typographic feature of text supplied by the font. +/// +enum DWRITE_FONT_FEATURE_TAG +{ + DWRITE_FONT_FEATURE_TAG_ALTERNATIVE_FRACTIONS = 0x63726661, // 'afrc' + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS_FROM_CAPITALS = 0x63703263, // 'c2pc' + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS_FROM_CAPITALS = 0x63733263, // 'c2sc' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES = 0x746c6163, // 'calt' + DWRITE_FONT_FEATURE_TAG_CASE_SENSITIVE_FORMS = 0x65736163, // 'case' + DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION = 0x706d6363, // 'ccmp' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES = 0x67696c63, // 'clig' + DWRITE_FONT_FEATURE_TAG_CAPITAL_SPACING = 0x70737063, // 'cpsp' + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_SWASH = 0x68777363, // 'cswh' + DWRITE_FONT_FEATURE_TAG_CURSIVE_POSITIONING = 0x73727563, // 'curs' + DWRITE_FONT_FEATURE_TAG_DEFAULT = 0x746c6664, // 'dflt' + DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES = 0x67696c64, // 'dlig' + DWRITE_FONT_FEATURE_TAG_EXPERT_FORMS = 0x74707865, // 'expt' + DWRITE_FONT_FEATURE_TAG_FRACTIONS = 0x63617266, // 'frac' + DWRITE_FONT_FEATURE_TAG_FULL_WIDTH = 0x64697766, // 'fwid' + DWRITE_FONT_FEATURE_TAG_HALF_FORMS = 0x666c6168, // 'half' + DWRITE_FONT_FEATURE_TAG_HALANT_FORMS = 0x6e6c6168, // 'haln' + DWRITE_FONT_FEATURE_TAG_ALTERNATE_HALF_WIDTH = 0x746c6168, // 'halt' + DWRITE_FONT_FEATURE_TAG_HISTORICAL_FORMS = 0x74736968, // 'hist' + DWRITE_FONT_FEATURE_TAG_HORIZONTAL_KANA_ALTERNATES = 0x616e6b68, // 'hkna' + DWRITE_FONT_FEATURE_TAG_HISTORICAL_LIGATURES = 0x67696c68, // 'hlig' + DWRITE_FONT_FEATURE_TAG_HALF_WIDTH = 0x64697768, // 'hwid' + DWRITE_FONT_FEATURE_TAG_HOJO_KANJI_FORMS = 0x6f6a6f68, // 'hojo' + DWRITE_FONT_FEATURE_TAG_JIS04_FORMS = 0x3430706a, // 'jp04' + DWRITE_FONT_FEATURE_TAG_JIS78_FORMS = 0x3837706a, // 'jp78' + DWRITE_FONT_FEATURE_TAG_JIS83_FORMS = 0x3338706a, // 'jp83' + DWRITE_FONT_FEATURE_TAG_JIS90_FORMS = 0x3039706a, // 'jp90' + DWRITE_FONT_FEATURE_TAG_KERNING = 0x6e72656b, // 'kern' + DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES = 0x6167696c, // 'liga' + DWRITE_FONT_FEATURE_TAG_LINING_FIGURES = 0x6d756e6c, // 'lnum' + DWRITE_FONT_FEATURE_TAG_LOCALIZED_FORMS = 0x6c636f6c, // 'locl' + DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING = 0x6b72616d, // 'mark' + DWRITE_FONT_FEATURE_TAG_MATHEMATICAL_GREEK = 0x6b72676d, // 'mgrk' + DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING = 0x6b6d6b6d, // 'mkmk' + DWRITE_FONT_FEATURE_TAG_ALTERNATE_ANNOTATION_FORMS = 0x746c616e, // 'nalt' + DWRITE_FONT_FEATURE_TAG_NLC_KANJI_FORMS = 0x6b636c6e, // 'nlck' + DWRITE_FONT_FEATURE_TAG_OLD_STYLE_FIGURES = 0x6d756e6f, // 'onum' + DWRITE_FONT_FEATURE_TAG_ORDINALS = 0x6e64726f, // 'ordn' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_ALTERNATE_WIDTH = 0x746c6170, // 'palt' + DWRITE_FONT_FEATURE_TAG_PETITE_CAPITALS = 0x70616370, // 'pcap' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_FIGURES = 0x6d756e70, // 'pnum' + DWRITE_FONT_FEATURE_TAG_PROPORTIONAL_WIDTHS = 0x64697770, // 'pwid' + DWRITE_FONT_FEATURE_TAG_QUARTER_WIDTHS = 0x64697771, // 'qwid' + DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES = 0x67696c72, // 'rlig' + DWRITE_FONT_FEATURE_TAG_RUBY_NOTATION_FORMS = 0x79627572, // 'ruby' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_ALTERNATES = 0x746c6173, // 'salt' + DWRITE_FONT_FEATURE_TAG_SCIENTIFIC_INFERIORS = 0x666e6973, // 'sinf' + DWRITE_FONT_FEATURE_TAG_SMALL_CAPITALS = 0x70636d73, // 'smcp' + DWRITE_FONT_FEATURE_TAG_SIMPLIFIED_FORMS = 0x6c706d73, // 'smpl' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_1 = 0x31307373, // 'ss01' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_2 = 0x32307373, // 'ss02' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_3 = 0x33307373, // 'ss03' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_4 = 0x34307373, // 'ss04' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_5 = 0x35307373, // 'ss05' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_6 = 0x36307373, // 'ss06' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_7 = 0x37307373, // 'ss07' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_8 = 0x38307373, // 'ss08' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_9 = 0x39307373, // 'ss09' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_10 = 0x30317373, // 'ss10' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_11 = 0x31317373, // 'ss11' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_12 = 0x32317373, // 'ss12' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_13 = 0x33317373, // 'ss13' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_14 = 0x34317373, // 'ss14' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_15 = 0x35317373, // 'ss15' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_16 = 0x36317373, // 'ss16' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_17 = 0x37317373, // 'ss17' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_18 = 0x38317373, // 'ss18' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_19 = 0x39317373, // 'ss19' + DWRITE_FONT_FEATURE_TAG_STYLISTIC_SET_20 = 0x30327373, // 'ss20' + DWRITE_FONT_FEATURE_TAG_SUBSCRIPT = 0x73627573, // 'subs' + DWRITE_FONT_FEATURE_TAG_SUPERSCRIPT = 0x73707573, // 'sups' + DWRITE_FONT_FEATURE_TAG_SWASH = 0x68737773, // 'swsh' + DWRITE_FONT_FEATURE_TAG_TITLING = 0x6c746974, // 'titl' + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_NAME_FORMS = 0x6d616e74, // 'tnam' + DWRITE_FONT_FEATURE_TAG_TABULAR_FIGURES = 0x6d756e74, // 'tnum' + DWRITE_FONT_FEATURE_TAG_TRADITIONAL_FORMS = 0x64617274, // 'trad' + DWRITE_FONT_FEATURE_TAG_THIRD_WIDTHS = 0x64697774, // 'twid' + DWRITE_FONT_FEATURE_TAG_UNICASE = 0x63696e75, // 'unic' + DWRITE_FONT_FEATURE_TAG_SLASHED_ZERO = 0x6f72657a, // 'zero' +}; + +/// +/// The DWRITE_TEXT_RANGE structure specifies a range of text positions where format is applied. +/// +struct DWRITE_TEXT_RANGE +{ + /// + /// The start text position of the range. + /// + UINT32 startPosition; + + /// + /// The number of text positions in the range. + /// + UINT32 length; +}; + +/// +/// The DWRITE_FONT_FEATURE structure specifies properties used to identify and execute typographic feature in the font. +/// +struct DWRITE_FONT_FEATURE +{ + /// + /// The feature OpenType name identifier. + /// + DWRITE_FONT_FEATURE_TAG nameTag; + + /// + /// Execution parameter of the feature. + /// + /// + /// The parameter should be non-zero to enable the feature. Once enabled, a feature can't be disabled again within + /// the same range. Features requiring a selector use this value to indicate the selector index. + /// + UINT32 parameter; +}; + +/// +/// Defines a set of typographic features to be applied during shaping. +/// Notice the character range which this feature list spans is specified +/// as a separate parameter to GetGlyphs. +/// +struct DWRITE_TYPOGRAPHIC_FEATURES +{ + /// + /// Array of font features. + /// + __field_ecount(featureCount) DWRITE_FONT_FEATURE* features; + + /// + /// The number of features. + /// + UINT32 featureCount; +}; + +/// +/// The DWRITE_TRIMMING structure specifies the trimming option for text overflowing the layout box. +/// +struct DWRITE_TRIMMING +{ + /// + /// Text granularity of which trimming applies. + /// + DWRITE_TRIMMING_GRANULARITY granularity; + + /// + /// Character code used as the delimiter signaling the beginning of the portion of text to be preserved, + /// most useful for path ellipsis, where the delimeter would be a slash. + /// + UINT32 delimiter; + + /// + /// How many occurences of the delimiter to step back. + /// + UINT32 delimiterCount; +}; + + +interface IDWriteTypography; +interface IDWriteInlineObject; + +/// +/// The format of text used for text layout purpose. +/// +/// +/// This object may not be thread-safe and it may carry the state of text format change. +/// +interface DWRITE_DECLARE_INTERFACE("9c906818-31d7-4fd3-a151-7c5e225db55a") IDWriteTextFormat : public IUnknown +{ + /// + /// Set alignment option of text relative to layout box's leading and trailing edge. + /// + /// Text alignment option + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetTextAlignment)( + DWRITE_TEXT_ALIGNMENT textAlignment + ) PURE; + + /// + /// Set alignment option of paragraph relative to layout box's top and bottom edge. + /// + /// Paragraph alignment option + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetParagraphAlignment)( + DWRITE_PARAGRAPH_ALIGNMENT paragraphAlignment + ) PURE; + + /// + /// Set word wrapping option. + /// + /// Word wrapping option + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetWordWrapping)( + DWRITE_WORD_WRAPPING wordWrapping + ) PURE; + + /// + /// Set paragraph reading direction. + /// + /// Text reading direction + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetReadingDirection)( + DWRITE_READING_DIRECTION readingDirection + ) PURE; + + /// + /// Set paragraph flow direction. + /// + /// Paragraph flow direction + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFlowDirection)( + DWRITE_FLOW_DIRECTION flowDirection + ) PURE; + + /// + /// Set incremental tab stop position. + /// + /// The incremental tab stop value + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetIncrementalTabStop)( + FLOAT incrementalTabStop + ) PURE; + + /// + /// Set trimming options for any trailing text exceeding the layout width + /// or for any far text exceeding the layout height. + /// + /// Text trimming options. + /// Application-defined omission sign. This parameter may be NULL if no trimming sign is desired. + /// + /// Any inline object can be used for the trimming sign, but CreateEllipsisTrimmingSign + /// provides a typical ellipsis symbol. Trimming is also useful vertically for hiding + /// partial lines. + /// + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetTrimming)( + __in DWRITE_TRIMMING const* trimmingOptions, + IDWriteInlineObject* trimmingSign + ) PURE; + + /// + /// Set line spacing. + /// + /// How to determine line height. + /// The line height, or rather distance between one baseline to another. + /// Distance from top of line to baseline. A reasonable ratio to lineSpacing is 80%. + /// + /// For the default method, spacing depends solely on the content. + /// For uniform spacing, the given line height will override the content. + /// + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetLineSpacing)( + DWRITE_LINE_SPACING_METHOD lineSpacingMethod, + FLOAT lineSpacing, + FLOAT baseline + ) PURE; + + /// + /// Get alignment option of text relative to layout box's leading and trailing edge. + /// + STDMETHOD_(DWRITE_TEXT_ALIGNMENT, GetTextAlignment)() PURE; + + /// + /// Get alignment option of paragraph relative to layout box's top and bottom edge. + /// + STDMETHOD_(DWRITE_PARAGRAPH_ALIGNMENT, GetParagraphAlignment)() PURE; + + /// + /// Get word wrapping option. + /// + STDMETHOD_(DWRITE_WORD_WRAPPING, GetWordWrapping)() PURE; + + /// + /// Get paragraph reading direction. + /// + STDMETHOD_(DWRITE_READING_DIRECTION, GetReadingDirection)() PURE; + + /// + /// Get paragraph flow direction. + /// + STDMETHOD_(DWRITE_FLOW_DIRECTION, GetFlowDirection)() PURE; + + /// + /// Get incremental tab stop position. + /// + STDMETHOD_(FLOAT, GetIncrementalTabStop)() PURE; + + /// + /// Get trimming options for text overflowing the layout width. + /// + /// Text trimming options. + /// Trimming omission sign. This parameter may be NULL. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetTrimming)( + __out DWRITE_TRIMMING* trimmingOptions, + __out IDWriteInlineObject** trimmingSign + ) PURE; + + /// + /// Get line spacing. + /// + /// How line height is determined. + /// The line height, or rather distance between one baseline to another. + /// Distance from top of line to baseline. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLineSpacing)( + __out DWRITE_LINE_SPACING_METHOD* lineSpacingMethod, + __out FLOAT* lineSpacing, + __out FLOAT* baseline + ) PURE; + + /// + /// Get the font collection. + /// + /// The current font collection. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontCollection)( + __out IDWriteFontCollection** fontCollection + ) PURE; + + /// + /// Get the length of the font family name, in characters, not including the terminating NULL character. + /// + STDMETHOD_(UINT32, GetFontFamilyNameLength)() PURE; + + /// + /// Get a copy of the font family name. + /// + /// Character array that receives the current font family name + /// Size of the character array in character count including the terminated NULL character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamilyName)( + __out_ecount_z(nameSize) WCHAR* fontFamilyName, + UINT32 nameSize + ) PURE; + + /// + /// Get the font weight. + /// + STDMETHOD_(DWRITE_FONT_WEIGHT, GetFontWeight)() PURE; + + /// + /// Get the font style. + /// + STDMETHOD_(DWRITE_FONT_STYLE, GetFontStyle)() PURE; + + /// + /// Get the font stretch. + /// + STDMETHOD_(DWRITE_FONT_STRETCH, GetFontStretch)() PURE; + + /// + /// Get the font em height. + /// + STDMETHOD_(FLOAT, GetFontSize)() PURE; + + /// + /// Get the length of the locale name, in characters, not including the terminating NULL character. + /// + STDMETHOD_(UINT32, GetLocaleNameLength)() PURE; + + /// + /// Get a copy of the locale name. + /// + /// Character array that receives the current locale name + /// Size of the character array in character count including the terminated NULL character. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleName)( + __out_ecount_z(nameSize) WCHAR* localeName, + UINT32 nameSize + ) PURE; +}; + + +/// +/// Font typography setting. +/// +interface DWRITE_DECLARE_INTERFACE("55f1112b-1dc2-4b3c-9541-f46894ed85b6") IDWriteTypography : public IUnknown +{ + /// + /// Add font feature. + /// + /// The font feature to add. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(AddFontFeature)( + DWRITE_FONT_FEATURE fontFeature + ) PURE; + + /// + /// Get the number of font features. + /// + STDMETHOD_(UINT32, GetFontFeatureCount)() PURE; + + /// + /// Get the font feature at the specified index. + /// + /// The zero-based index of the font feature to get. + /// The font feature. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFeature)( + UINT32 fontFeatureIndex, + __out DWRITE_FONT_FEATURE* fontFeature + ) PURE; +}; + +enum DWRITE_SCRIPT_SHAPES +{ + /// + /// No additional shaping requirement. Text is shaped with the writing system default behavior. + /// + DWRITE_SCRIPT_SHAPES_DEFAULT = 0, + + /// + /// Text should leave no visual on display i.e. control or format control characters. + /// + DWRITE_SCRIPT_SHAPES_NO_VISUAL = 1 +}; + +#ifdef DEFINE_ENUM_FLAG_OPERATORS +DEFINE_ENUM_FLAG_OPERATORS(DWRITE_SCRIPT_SHAPES); +#endif + +/// +/// Association of text and its writing system script as well as some display attributes. +/// +struct DWRITE_SCRIPT_ANALYSIS +{ + /// + /// Zero-based index representation of writing system script. + /// + UINT16 script; + + /// + /// Additional shaping requirement of text. + /// + DWRITE_SCRIPT_SHAPES shapes; +}; + +/// +/// Condition at the edges of inline object or text used to determine +/// line-breaking behavior. +/// +enum DWRITE_BREAK_CONDITION +{ + /// + /// Whether a break is allowed is determined by the condition of the + /// neighboring text span or inline object. + /// + DWRITE_BREAK_CONDITION_NEUTRAL, + + /// + /// A break is allowed, unless overruled by the condition of the + /// neighboring text span or inline object, either prohibited by a + /// May Not or forced by a Must. + /// + DWRITE_BREAK_CONDITION_CAN_BREAK, + + /// + /// There should be no break, unless overruled by a Must condition from + /// the neighboring text span or inline object. + /// + DWRITE_BREAK_CONDITION_MAY_NOT_BREAK, + + /// + /// The break must happen, regardless of the condition of the adjacent + /// text span or inline object. + /// + DWRITE_BREAK_CONDITION_MUST_BREAK +}; + +/// +/// Line breakpoint characteristics of a character. +/// +struct DWRITE_LINE_BREAKPOINT +{ + /// + /// Breaking condition before the character. + /// + UINT8 breakConditionBefore : 2; + + /// + /// Breaking condition after the character. + /// + UINT8 breakConditionAfter : 2; + + /// + /// The character is some form of whitespace, which may be meaningful + /// for justification. + /// + UINT8 isWhitespace : 1; + + /// + /// The character is a soft hyphen, often used to indicate hyphenation + /// points inside words. + /// + UINT8 isSoftHyphen : 1; + + UINT8 padding : 2; +}; + +/// +/// How to apply number substitution on digits and related punctuation. +/// +enum DWRITE_NUMBER_SUBSTITUTION_METHOD +{ + /// + /// Specifies that the substitution method should be determined based + /// on LOCALE_IDIGITSUBSTITUTION value of the specified text culture. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_FROM_CULTURE, + + /// + /// If the culture is Arabic or Farsi, specifies that the number shape + /// depend on the context. Either traditional or nominal number shape + /// are used depending on the nearest preceding strong character or (if + /// there is none) the reading direction of the paragraph. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_CONTEXTUAL, + + /// + /// Specifies that code points 0x30-0x39 are always rendered as nominal numeral + /// shapes (ones of the European number), i.e., no substitution is performed. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_NONE, + + /// + /// Specifies that number are rendered using the national number shape + /// as specified by the LOCALE_SNATIVEDIGITS value of the specified text culture. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_NATIONAL, + + /// + /// Specifies that number are rendered using the traditional shape + /// for the specified culture. For most cultures, this is the same as + /// NativeNational. However, NativeNational results in Latin number + /// for some Arabic cultures, whereas this value results in Arabic + /// number for all Arabic cultures. + /// + DWRITE_NUMBER_SUBSTITUTION_METHOD_TRADITIONAL +}; + +/// +/// Holds the appropriate digits and numeric punctuation for a given locale. +/// +interface DECLSPEC_UUID("14885CC9-BAB0-4f90-B6ED-5C366A2CD03D") DECLSPEC_NOVTABLE IDWriteNumberSubstitution : public IUnknown +{ +}; + +/// +/// Shaping output properties per input character. +/// +struct DWRITE_SHAPING_TEXT_PROPERTIES +{ + /// + /// This character can be shaped independently from the others + /// (usually set for the space character). + /// + UINT16 isShapedAlone : 1; + + /// + /// Reserved for use by shaping engine. + /// + UINT16 reserved : 15; +}; + +/// +/// Shaping output properties per output glyph. +/// +struct DWRITE_SHAPING_GLYPH_PROPERTIES +{ + /// + /// Justification class, whether to use spacing, kashidas, or + /// another method. This exists for backwards compatibility + /// with Uniscribe's SCRIPT_JUSTIFY enum. + /// + UINT16 justification : 4; + + /// + /// Indicates glyph is the first of a cluster. + /// + UINT16 isClusterStart : 1; + + /// + /// Glyph is a diacritic. + /// + UINT16 isDiacritic : 1; + + /// + /// Glyph has no width, blank, ZWJ, ZWNJ etc. + /// + UINT16 isZeroWidthSpace : 1; + + /// + /// Reserved for use by shaping engine. + /// + UINT16 reserved : 9; +}; + +/// +/// The interface implemented by the text analyzer's client to provide text to +/// the analyzer. It allows the separation between the logical view of text as +/// a continuous stream of characters identifiable by unique text positions, +/// and the actual memory layout of potentially discrete blocks of text in the +/// client's backing store. +/// +/// If any of these callbacks returns an error, the analysis functions will +/// stop prematurely and return a callback error. Rather than return E_NOTIMPL, +/// an application should stub the method and return a constant/null and S_OK. +/// +interface DECLSPEC_UUID("688e1a58-5094-47c8-adc8-fbcea60ae92b") DECLSPEC_NOVTABLE IDWriteTextAnalysisSource : public IUnknown +{ + /// + /// Get a block of text starting at the specified text position. + /// Returning NULL indicates the end of text - the position is after + /// the last character. This function is called iteratively for + /// each consecutive block, tying together several fragmented blocks + /// in the backing store into a virtual contiguous string. + /// + /// First position of the piece to obtain. All + /// positions are in UTF16 code-units, not whole characters, which + /// matters when supplementary characters are used. + /// Address that receives a pointer to the text block + /// at the specified position. + /// Number of UTF16 units of the retrieved chunk. + /// The returned length is not the length of the block, but the length + /// remaining in the block, from the given position until its end. + /// So querying for a position that is 75 positions into a 100 + /// postition block would return 25. + /// Pointer to the first character at the given text position. + /// NULL indicates no chunk available at the specified position, either + /// because textPosition >= the entire text content length or because the + /// queried position is not mapped into the app's backing store. + /// + /// Although apps can implement sparse textual content that only maps part of + /// the backing store, the app must map any text that is in the range passed + /// to any analysis functions. + /// + STDMETHOD(GetTextAtPosition)( + UINT32 textPosition, + __out WCHAR const** textString, + __out UINT32* textLength + ) PURE; + + /// + /// Get a block of text immediately preceding the specified position. + /// + /// Position immediately after the last position of the chunk to obtain. + /// Address that receives a pointer to the text block + /// at the specified position. + /// Number of UTF16 units of the retrieved block. + /// The length returned is from the given position to the front of + /// the block. + /// Pointer to the first character at (textPosition - textLength). + /// NULL indicates no chunk available at the specified position, either + /// because textPosition == 0,the textPosition > the entire text content + /// length, or the queried position is not mapped into the app's backing + /// store. + /// + /// Although apps can implement sparse textual content that only maps part of + /// the backing store, the app must map any text that is in the range passed + /// to any analysis functions. + /// + STDMETHOD(GetTextBeforePosition)( + UINT32 textPosition, + __out WCHAR const** textString, + __out UINT32* textLength + ) PURE; + + /// + /// Get paragraph reading direction. + /// + STDMETHOD_(DWRITE_READING_DIRECTION, GetParagraphReadingDirection)() PURE; + + /// + /// Get locale name on the range affected by it. + /// + /// Position to get the locale name of. + /// Receives the length from the given position up to the + /// next differing locale. + /// Address that receives a pointer to the locale + /// at the specified position. + /// + /// The localeName pointer must remain valid until the next call or until + /// the analysis returns. + /// + STDMETHOD(GetLocaleName)( + UINT32 textPosition, + __out UINT32* textLength, + __out_z WCHAR const** localeName + ) PURE; + + /// + /// Get number substitution on the range affected by it. + /// + /// Position to get the number substitution of. + /// Receives the length from the given position up to the + /// next differing number substitution. + /// Address that receives a pointer to the number substitution + /// at the specified position. + /// + /// Any implementation should return the number substitution with an + /// incremented ref count, and the analysis will release when finished + /// with it (either before the next call or before it returns). However, + /// the sink callback may hold onto it after that. + /// + STDMETHOD(GetNumberSubstitution)( + UINT32 textPosition, + __out UINT32* textLength, + __out IDWriteNumberSubstitution** numberSubstitution + ) PURE; +}; + +/// +/// The interface implemented by the text analyzer's client to receive the +/// output of a given text analysis. The Text analyzer disregards any current +/// state of the analysis sink, therefore a Set method call on a range +/// overwrites the previously set analysis result of the same range. +/// +interface DECLSPEC_UUID("5810cd44-0ca0-4701-b3fa-bec5182ae4f6") DECLSPEC_NOVTABLE IDWriteTextAnalysisSink : public IUnknown +{ + /// + /// Report script analysis for the text range. + /// + /// Starting position to report from. + /// Number of UTF16 units of the reported range. + /// Script analysis of characters in range. + /// + /// A successful code or error code to abort analysis. + /// + STDMETHOD(SetScriptAnalysis)( + UINT32 textPosition, + UINT32 textLength, + __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis + ) PURE; + + /// + /// Repport line-break opportunities for each character, starting from + /// the specified position. + /// + /// Starting position to report from. + /// Number of UTF16 units of the reported range. + /// Breaking conditions for each character. + /// + /// A successful code or error code to abort analysis. + /// + STDMETHOD(SetLineBreakpoints)( + UINT32 textPosition, + UINT32 textLength, + __in_ecount(textLength) DWRITE_LINE_BREAKPOINT const* lineBreakpoints + ) PURE; + + /// + /// Set bidirectional level on the range, called once per each + /// level run change (either explicit or resolved implicit). + /// + /// Starting position to report from. + /// Number of UTF16 units of the reported range. + /// Explicit level from embedded control codes + /// RLE/RLO/LRE/LRO/PDF, determined before any additional rules. + /// Final implicit level considering the + /// explicit level and characters' natural directionality, after all + /// Bidi rules have been applied. + /// + /// A successful code or error code to abort analysis. + /// + STDMETHOD(SetBidiLevel)( + UINT32 textPosition, + UINT32 textLength, + UINT8 explicitLevel, + UINT8 resolvedLevel + ) PURE; + + /// + /// Set number substitution on the range. + /// + /// Starting position to report from. + /// Number of UTF16 units of the reported range. + /// The number substitution applicable to + /// the returned range of text. The sink callback may hold onto it by + /// incrementing its ref count. + /// + /// A successful code or error code to abort analysis. + /// + /// + /// Unlike script and bidi analysis, where every character passed to the + /// analyzer has a result, this will only be called for those ranges where + /// substitution is applicable. For any other range, you will simply not + /// be called. + /// + STDMETHOD(SetNumberSubstitution)( + UINT32 textPosition, + UINT32 textLength, + __notnull IDWriteNumberSubstitution* numberSubstitution + ) PURE; +}; + +/// +/// Analyzes various text properties for complex script processing. +/// +interface DWRITE_DECLARE_INTERFACE("b7e6163e-7f46-43b4-84b3-e4e6249c365d") IDWriteTextAnalyzer : public IUnknown +{ + /// + /// Analyzes a text range for script boundaries, reading text attributes + /// from the source and reporting the Unicode script ID to the sink + /// callback SetScript. + /// + /// Source object to analyze. + /// Starting position within the source object. + /// Length to analyze. + /// Callback object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(AnalyzeScript)( + IDWriteTextAnalysisSource* analysisSource, + UINT32 textPosition, + UINT32 textLength, + IDWriteTextAnalysisSink* analysisSink + ) PURE; + + /// + /// Analyzes a text range for script directionality, reading attributes + /// from the source and reporting levels to the sink callback SetBidiLevel. + /// + /// Source object to analyze. + /// Starting position within the source object. + /// Length to analyze. + /// Callback object. + /// + /// Standard HRESULT error code. + /// + /// + /// While the function can handle multiple paragraphs, the text range + /// should not arbitrarily split the middle of paragraphs. Otherwise the + /// returned levels may be wrong, since the Bidi algorithm is meant to + /// apply to the paragraph as a whole. + /// + /// + /// Embedded control codes (LRE/LRO/RLE/RLO/PDF) are taken into account. + /// + STDMETHOD(AnalyzeBidi)( + IDWriteTextAnalysisSource* analysisSource, + UINT32 textPosition, + UINT32 textLength, + IDWriteTextAnalysisSink* analysisSink + ) PURE; + + /// + /// Analyzes a text range for spans where number substitution is applicable, + /// reading attributes from the source and reporting substitutable ranges + /// to the sink callback SetNumberSubstitution. + /// + /// Source object to analyze. + /// Starting position within the source object. + /// Length to analyze. + /// Callback object. + /// + /// Standard HRESULT error code. + /// + /// + /// While the function can handle multiple ranges of differing number + /// substitutions, the text ranges should not arbitrarily split the + /// middle of numbers. Otherwise it will treat the numbers separately + /// and will not translate any intervening punctuation. + /// + /// + /// Embedded control codes (LRE/LRO/RLE/RLO/PDF) are taken into account. + /// + STDMETHOD(AnalyzeNumberSubstitution)( + IDWriteTextAnalysisSource* analysisSource, + UINT32 textPosition, + UINT32 textLength, + IDWriteTextAnalysisSink* analysisSink + ) PURE; + + /// + /// Analyzes a text range for potential breakpoint opportunities, reading + /// attributes from the source and reporting breakpoint opportunities to + /// the sink callback SetLineBreakpoints. + /// + /// Source object to analyze. + /// Starting position within the source object. + /// Length to analyze. + /// Callback object. + /// + /// Standard HRESULT error code. + /// + /// + /// While the function can handle multiple paragraphs, the text range + /// should not arbitrarily split the middle of paragraphs, unless the + /// given text span is considered a whole unit. Otherwise the + /// returned properties for the first and last characters will + /// inappropriately allow breaks. + /// + /// + /// Special cases include the first, last, and surrogate characters. Any + /// text span is treated as if adjacent to inline objects on either side. + /// So the rules with contingent-break opportunities are used, where the + /// edge between text and inline objects is always treated as a potential + /// break opportunity, dependent on any overriding rules of the adjacent + /// objects to prohibit or force the break (see Unicode TR #14). + /// Surrogate pairs never break between. + /// + STDMETHOD(AnalyzeLineBreakpoints)( + IDWriteTextAnalysisSource* analysisSource, + UINT32 textPosition, + UINT32 textLength, + IDWriteTextAnalysisSink* analysisSink + ) PURE; + + /// + /// Parses the input text string and maps it to the set of glyphs and associated glyph data + /// according to the font and the writing system's rendering rules. + /// + /// The string to convert to glyphs. + /// The length of textString. + /// The font face to get glyphs from. + /// Set to true if the text is intended to be + /// drawn vertically. + /// Set to TRUE for right-to-left text. + /// Script analysis result from AnalyzeScript. + /// The locale to use when selecting glyphs. + /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. + /// If this is NULL then the default mapping based on the script is used. + /// Optional number substitution which + /// selects the appropriate glyphs for digits and related numeric characters, + /// depending on the results obtained from AnalyzeNumberSubstitution. Passing + /// null indicates that no substitution is needed and that the digits should + /// receive nominal glyphs. + /// An array of pointers to the sets of typographic + /// features to use in each feature range. + /// The length of each feature range, in characters. + /// The sum of all lengths should be equal to textLength. + /// The number of feature ranges. + /// The maximum number of glyphs that can be + /// returned. + /// The mapping from character ranges to glyph + /// ranges. + /// Per-character output properties. + /// Output glyph indices. + /// Per-glyph output properties. + /// The actual number of glyphs returned if + /// the call succeeds. + /// + /// Standard HRESULT error code. + /// + /// + /// Note that the mapping from characters to glyphs is, in general, many- + /// to-many. The recommended estimate for the per-glyph output buffers is + /// (3 * textLength / 2 + 16). This is not guaranteed to be sufficient. + /// + /// The value of the actualGlyphCount parameter is only valid if the call + /// succeeds. In the event that maxGlyphCount is not big enough + /// E_NOT_SUFFICIENT_BUFFER, which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), + /// will be returned. The application should allocate a larger buffer and try again. + /// + STDMETHOD(GetGlyphs)( + __in_ecount(textLength) WCHAR const* textString, + UINT32 textLength, + IDWriteFontFace* fontFace, + BOOL isSideways, + BOOL isRightToLeft, + __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, + __in_z_opt WCHAR const* localeName, + __maybenull IDWriteNumberSubstitution* numberSubstitution, + __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, + __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, + UINT32 featureRanges, + UINT32 maxGlyphCount, + __out_ecount(textLength) UINT16* clusterMap, + __out_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, + __out_ecount(maxGlyphCount) UINT16* glyphIndices, + __out_ecount(maxGlyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES* glyphProps, + __out UINT32* actualGlyphCount + ) PURE; + + /// + /// Place glyphs output from the GetGlyphs method according to the font + /// and the writing system's rendering rules. + /// + /// The original string the glyphs came from. + /// The mapping from character ranges to glyph + /// ranges. Returned by GetGlyphs. + /// Per-character properties. Returned by + /// GetGlyphs. + /// The length of textString. + /// Glyph indices. See GetGlyphs + /// Per-glyph properties. See GetGlyphs + /// The number of glyphs. + /// The font face the glyphs came from. + /// Logical font size in DIP's. + /// Set to true if the text is intended to be + /// drawn vertically. + /// Set to TRUE for right-to-left text. + /// Script analysis result from AnalyzeScript. + /// The locale to use when selecting glyphs. + /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. + /// If this is NULL then the default mapping based on the script is used. + /// An array of pointers to the sets of typographic + /// features to use in each feature range. + /// The length of each feature range, in characters. + /// The sum of all lengths should be equal to textLength. + /// The number of feature ranges. + /// The advance width of each glyph. + /// The offset of the origin of each glyph. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGlyphPlacements)( + __in_ecount(textLength) WCHAR const* textString, + __in_ecount(textLength) UINT16 const* clusterMap, + __in_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, + UINT32 textLength, + __in_ecount(glyphCount) UINT16 const* glyphIndices, + __in_ecount(glyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES const* glyphProps, + UINT32 glyphCount, + IDWriteFontFace * fontFace, + FLOAT fontEmSize, + BOOL isSideways, + BOOL isRightToLeft, + __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, + __in_z_opt WCHAR const* localeName, + __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, + __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, + UINT32 featureRanges, + __out_ecount(glyphCount) FLOAT* glyphAdvances, + __out_ecount(glyphCount) DWRITE_GLYPH_OFFSET* glyphOffsets + ) PURE; + + /// + /// Place glyphs output from the GetGlyphs method according to the font + /// and the writing system's rendering rules. + /// + /// The original string the glyphs came from. + /// The mapping from character ranges to glyph + /// ranges. Returned by GetGlyphs. + /// Per-character properties. Returned by + /// GetGlyphs. + /// The length of textString. + /// Glyph indices. See GetGlyphs + /// Per-glyph properties. See GetGlyphs + /// The number of glyphs. + /// The font face the glyphs came from. + /// Logical font size in DIP's. + /// Number of physical pixels per DIP. For example, if the DPI of the rendering surface is 96 this + /// value is 1.0f. If the DPI is 120, this value is 120.0f/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified by the font size and pixelsPerDip. + /// + /// When set to FALSE, the metrics are the same as the metrics of GDI aliased text. + /// When set to TRUE, the metrics are the same as the metrics of text measured by GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. + /// + /// Set to true if the text is intended to be + /// drawn vertically. + /// Set to TRUE for right-to-left text. + /// Script analysis result from AnalyzeScript. + /// The locale to use when selecting glyphs. + /// e.g. the same character may map to different glyphs for ja-jp vs zh-chs. + /// If this is NULL then the default mapping based on the script is used. + /// An array of pointers to the sets of typographic + /// features to use in each feature range. + /// The length of each feature range, in characters. + /// The sum of all lengths should be equal to textLength. + /// The number of feature ranges. + /// The advance width of each glyph. + /// The offset of the origin of each glyph. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGdiCompatibleGlyphPlacements)( + __in_ecount(textLength) WCHAR const* textString, + __in_ecount(textLength) UINT16 const* clusterMap, + __in_ecount(textLength) DWRITE_SHAPING_TEXT_PROPERTIES* textProps, + UINT32 textLength, + __in_ecount(glyphCount) UINT16 const* glyphIndices, + __in_ecount(glyphCount) DWRITE_SHAPING_GLYPH_PROPERTIES const* glyphProps, + UINT32 glyphCount, + IDWriteFontFace * fontFace, + FLOAT fontEmSize, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + BOOL useGdiNatural, + BOOL isSideways, + BOOL isRightToLeft, + __in DWRITE_SCRIPT_ANALYSIS const* scriptAnalysis, + __in_z_opt WCHAR const* localeName, + __in_ecount_opt(featureRanges) DWRITE_TYPOGRAPHIC_FEATURES const** features, + __in_ecount_opt(featureRanges) UINT32 const* featureRangeLengths, + UINT32 featureRanges, + __out_ecount(glyphCount) FLOAT* glyphAdvances, + __out_ecount(glyphCount) DWRITE_GLYPH_OFFSET* glyphOffsets + ) PURE; +}; + +/// +/// The DWRITE_GLYPH_RUN structure contains the information needed by renderers +/// to draw glyph runs. All coordinates are in device independent pixels (DIPs). +/// +struct DWRITE_GLYPH_RUN +{ + /// + /// The physical font face to draw with. + /// + __notnull IDWriteFontFace* fontFace; + + /// + /// Logical size of the font in DIPs, not points (equals 1/96 inch). + /// + FLOAT fontEmSize; + + /// + /// The number of glyphs. + /// + UINT32 glyphCount; + + /// + /// The indices to render. + /// + __field_ecount(glyphCount) UINT16 const* glyphIndices; + + /// + /// Glyph advance widths. + /// + __field_ecount_opt(glyphCount) FLOAT const* glyphAdvances; + + /// + /// Glyph offsets. + /// + __field_ecount_opt(glyphCount) DWRITE_GLYPH_OFFSET const* glyphOffsets; + + /// + /// If true, specifies that glyphs are rotated 90 degrees to the left and + /// vertical metrics are used. Vertical writing is achieved by specifying + /// isSideways = true and rotating the entire run 90 degrees to the right + /// via a rotate transform. + /// + BOOL isSideways; + + /// + /// The implicit resolved bidi level of the run. Odd levels indicate + /// right-to-left languages like Hebrew and Arabic, while even levels + /// indicate left-to-right languages like English and Japanese (when + /// written horizontally). For right-to-left languages, the text origin + /// is on the right, and text should be drawn to the left. + /// + UINT32 bidiLevel; +}; + +/// +/// The DWRITE_GLYPH_RUN_DESCRIPTION structure contains additional properties +/// related to those in DWRITE_GLYPH_RUN. +/// +struct DWRITE_GLYPH_RUN_DESCRIPTION +{ + /// + /// The locale name associated with this run. + /// + __nullterminated WCHAR const* localeName; + + /// + /// The text associated with the glyphs. + /// + __field_ecount(stringLength) WCHAR const* string; + + /// + /// The number of characters (UTF16 code-units). + /// Note that this may be different than the number of glyphs. + /// + UINT32 stringLength; + + /// + /// An array of indices to the glyph indices array, of the first glyphs of + /// all the glyph clusters of the glyphs to render. + /// + __field_ecount(stringLength) UINT16 const* clusterMap; + + /// + /// Corresponding text position in the original string + /// this glyph run came from. + /// + UINT32 textPosition; +}; + +/// +/// The DWRITE_UNDERLINE structure contains about the size and placement of +/// underlines. All coordinates are in device independent pixels (DIPs). +/// +struct DWRITE_UNDERLINE +{ + /// + /// Width of the underline, measured parallel to the baseline. + /// + FLOAT width; + + /// + /// Thickness of the underline, measured perpendicular to the + /// baseline. + /// + FLOAT thickness; + + /// + /// Offset of the underline from the baseline. + /// A positive offset represents a position below the baseline and + /// a negative offset is above. + /// + FLOAT offset; + + /// + /// Height of the tallest run where the underline applies. + /// + FLOAT runHeight; + + /// + /// Reading direction of the text associated with the underline. This + /// value is used to interpret whether the width value runs horizontally + /// or vertically. + /// + DWRITE_READING_DIRECTION readingDirection; + + /// + /// Flow direction of the text associated with the underline. This value + /// is used to interpret whether the thickness value advances top to + /// bottom, left to right, or right to left. + /// + DWRITE_FLOW_DIRECTION flowDirection; + + /// + /// Locale of the text the underline is being drawn under. Can be + /// pertinent where the locale affects how the underline is drawn. + /// For example, in vertical text, the underline belongs on the + /// left for Chinese but on the right for Japanese. + /// This choice is completely left up to higher levels. + /// + __nullterminated WCHAR const* localeName; + + /// + /// The measuring mode can be useful to the renderer to determine how + /// underlines are rendered, e.g. rounding the thickness to a whole pixel + /// in GDI-compatible modes. + /// + DWRITE_MEASURING_MODE measuringMode; +}; + +/// +/// The DWRITE_STRIKETHROUGH structure contains about the size and placement of +/// strickthroughs. All coordinates are in device independent pixels (DIPs). +/// +struct DWRITE_STRIKETHROUGH +{ + /// + /// Width of the strikethrough, measured parallel to the baseline. + /// + FLOAT width; + + /// + /// Thickness of the strikethrough, measured perpendicular to the + /// baseline. + /// + FLOAT thickness; + + /// + /// Offset of the stikethrough from the baseline. + /// A positive offset represents a position below the baseline and + /// a negative offset is above. + /// + FLOAT offset; + + /// + /// Reading direction of the text associated with the strikethrough. This + /// value is used to interpret whether the width value runs horizontally + /// or vertically. + /// + DWRITE_READING_DIRECTION readingDirection; + + /// + /// Flow direction of the text associated with the strikethrough. This + /// value is used to interpret whether the thickness value advances top to + /// bottom, left to right, or right to left. + /// + DWRITE_FLOW_DIRECTION flowDirection; + + /// + /// Locale of the range. Can be pertinent where the locale affects the style. + /// + __nullterminated WCHAR const* localeName; + + /// + /// The measuring mode can be useful to the renderer to determine how + /// underlines are rendered, e.g. rounding the thickness to a whole pixel + /// in GDI-compatible modes. + /// + DWRITE_MEASURING_MODE measuringMode; +}; + +/// +/// The DWRITE_LINE_METRICS structure contains information about a formatted +/// line of text. +/// +struct DWRITE_LINE_METRICS +{ + /// + /// The number of total text positions in the line. + /// This includes any trailing whitespace and newline characters. + /// + UINT32 length; + + /// + /// The number of whitespace positions at the end of the line. Newline + /// sequences are considered whitespace. + /// + UINT32 trailingWhitespaceLength; + + /// + /// The number of characters in the newline sequence at the end of the line. + /// If the count is zero, then the line was either wrapped or it is the + /// end of the text. + /// + UINT32 newlineLength; + + /// + /// Height of the line as measured from top to bottom. + /// + FLOAT height; + + /// + /// Distance from the top of the line to its baseline. + /// + FLOAT baseline; + + /// + /// The line is trimmed. + /// + BOOL isTrimmed; +}; + + +/// +/// The DWRITE_CLUSTER_METRICS structure contains information about a glyph cluster. +/// +struct DWRITE_CLUSTER_METRICS +{ + /// + /// The total advance width of all glyphs in the cluster. + /// + FLOAT width; + + /// + /// The number of text positions in the cluster. + /// + UINT16 length; + + /// + /// Indicate whether line can be broken right after the cluster. + /// + UINT16 canWrapLineAfter : 1; + + /// + /// Indicate whether the cluster corresponds to whitespace character. + /// + UINT16 isWhitespace : 1; + + /// + /// Indicate whether the cluster corresponds to a newline character. + /// + UINT16 isNewline : 1; + + /// + /// Indicate whether the cluster corresponds to soft hyphen character. + /// + UINT16 isSoftHyphen : 1; + + /// + /// Indicate whether the cluster is read from right to left. + /// + UINT16 isRightToLeft : 1; + + UINT16 padding : 11; +}; + + +/// +/// Overall metrics associated with text after layout. +/// All coordinates are in device independent pixels (DIPs). +/// +struct DWRITE_TEXT_METRICS +{ + /// + /// Left-most point of formatted text relative to layout box + /// (excluding any glyph overhang). + /// + FLOAT left; + + /// + /// Top-most point of formatted text relative to layout box + /// (excluding any glyph overhang). + /// + FLOAT top; + + /// + /// The width of the formatted text ignoring trailing whitespace + /// at the end of each line. + /// + FLOAT width; + + /// + /// The width of the formatted text taking into account the + /// trailing whitespace at the end of each line. + /// + FLOAT widthIncludingTrailingWhitespace; + + /// + /// The height of the formatted text. The height of an empty string + /// is determined by the size of the default font's line height. + /// + FLOAT height; + + /// + /// Initial width given to the layout. Depending on whether the text + /// was wrapped or not, it can be either larger or smaller than the + /// text content width. + /// + FLOAT layoutWidth; + + /// + /// Initial height given to the layout. Depending on the length of the + /// text, it may be larger or smaller than the text content height. + /// + FLOAT layoutHeight; + + /// + /// The maximum reordering count of any line of text, used + /// to calculate the most number of hit-testing boxes needed. + /// If the layout has no bidirectional text or no text at all, + /// the minimum level is 1. + /// + UINT32 maxBidiReorderingDepth; + + /// + /// Total number of lines. + /// + UINT32 lineCount; +}; + + +/// +/// Properties describing the geometric measurement of an +/// application-defined inline object. +/// +struct DWRITE_INLINE_OBJECT_METRICS +{ + /// + /// Width of the inline object. + /// + FLOAT width; + + /// + /// Height of the inline object as measured from top to bottom. + /// + FLOAT height; + + /// + /// Distance from the top of the object to the baseline where it is lined up with the adjacent text. + /// If the baseline is at the bottom, baseline simply equals height. + /// + FLOAT baseline; + + /// + /// Flag indicating whether the object is to be placed upright or alongside the text baseline + /// for vertical text. + /// + BOOL supportsSideways; +}; + + +/// +/// The DWRITE_OVERHANG_METRICS structure holds how much any visible pixels +/// (in DIPs) overshoot each side of the layout or inline objects. +/// +/// +/// Positive overhangs indicate that the visible area extends outside the layout +/// box or inline object, while negative values mean there is whitespace inside. +/// The returned values are unaffected by rendering transforms or pixel snapping. +/// Additionally, they may not exactly match final target's pixel bounds after +/// applying grid fitting and hinting. +/// +struct DWRITE_OVERHANG_METRICS +{ + /// + /// The distance from the left-most visible DIP to its left alignment edge. + /// + FLOAT left; + + /// + /// The distance from the top-most visible DIP to its top alignment edge. + /// + FLOAT top; + + /// + /// The distance from the right-most visible DIP to its right alignment edge. + /// + FLOAT right; + + /// + /// The distance from the bottom-most visible DIP to its bottom alignment edge. + /// + FLOAT bottom; +}; + + +/// +/// Geometry enclosing of text positions. +/// +struct DWRITE_HIT_TEST_METRICS +{ + /// + /// First text position within the geometry. + /// + UINT32 textPosition; + + /// + /// Number of text positions within the geometry. + /// + UINT32 length; + + /// + /// Left position of the top-left coordinate of the geometry. + /// + FLOAT left; + + /// + /// Top position of the top-left coordinate of the geometry. + /// + FLOAT top; + + /// + /// Geometry's width. + /// + FLOAT width; + + /// + /// Geometry's height. + /// + FLOAT height; + + /// + /// Bidi level of text positions enclosed within the geometry. + /// + UINT32 bidiLevel; + + /// + /// Geometry encloses text? + /// + BOOL isText; + + /// + /// Range is trimmed. + /// + BOOL isTrimmed; +}; + + +interface IDWriteTextRenderer; + + +/// +/// The IDWriteInlineObject interface wraps an application defined inline graphic, +/// allowing DWrite to query metrics as if it was a glyph inline with the text. +/// +interface DWRITE_DECLARE_INTERFACE("8339FDE3-106F-47ab-8373-1C6295EB10B3") IDWriteInlineObject : public IUnknown +{ + /// + /// The application implemented rendering callback (IDWriteTextRenderer::DrawInlineObject) + /// can use this to draw the inline object without needing to cast or query the object + /// type. The text layout does not call this method directly. + /// + /// The context passed to IDWriteTextLayout::Draw. + /// The renderer passed to IDWriteTextLayout::Draw as the object's containing parent. + /// X-coordinate at the top-left corner of the inline object. + /// Y-coordinate at the top-left corner of the inline object. + /// The object should be drawn on its side. + /// The object is in an right-to-left context and should be drawn flipped. + /// The drawing effect set in IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(Draw)( + __maybenull void* clientDrawingContext, + IDWriteTextRenderer* renderer, + FLOAT originX, + FLOAT originY, + BOOL isSideways, + BOOL isRightToLeft, + __maybenull IUnknown* clientDrawingEffect + ) PURE; + + /// + /// TextLayout calls this callback function to get the measurement of the inline object. + /// + /// Returned metrics + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetMetrics)( + __out DWRITE_INLINE_OBJECT_METRICS* metrics + ) PURE; + + /// + /// TextLayout calls this callback function to get the visible extents (in DIPs) of the inline object. + /// In the case of a simple bitmap, with no padding and no overhang, all the overhangs will + /// simply be zeroes. + /// + /// Overshoot of visible extents (in DIPs) outside the object. + /// + /// Standard HRESULT error code. + /// + /// + /// The overhangs should be returned relative to the reported size of the object + /// (DWRITE_INLINE_OBJECT_METRICS::width/height), and should not be baseline + /// adjusted. If you have an image that is actually 100x100 DIPs, but you want it + /// slightly inset (perhaps it has a glow) by 20 DIPs on each side, you would + /// return a width/height of 60x60 and four overhangs of 20 DIPs. + /// + STDMETHOD(GetOverhangMetrics)( + __out DWRITE_OVERHANG_METRICS* overhangs + ) PURE; + + /// + /// Layout uses this to determine the line breaking behavior of the inline object + /// amidst the text. + /// + /// Line-breaking condition between the object and the content immediately preceding it. + /// Line-breaking condition between the object and the content immediately following it. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetBreakConditions)( + __out DWRITE_BREAK_CONDITION* breakConditionBefore, + __out DWRITE_BREAK_CONDITION* breakConditionAfter + ) PURE; +}; + +/// +/// The IDWritePixelSnapping interface defines the pixel snapping properties of a text renderer. +/// +interface DWRITE_DECLARE_INTERFACE("eaf3a2da-ecf4-4d24-b644-b34f6842024b") IDWritePixelSnapping : public IUnknown +{ + /// + /// Determines whether pixel snapping is disabled. The recommended default is FALSE, + /// unless doing animation that requires subpixel vertical placement. + /// + /// The context passed to IDWriteTextLayout::Draw. + /// Receives TRUE if pixel snapping is disabled or FALSE if it not. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(IsPixelSnappingDisabled)( + __maybenull void* clientDrawingContext, + __out BOOL* isDisabled + ) PURE; + + /// + /// Gets the current transform that maps abstract coordinates to DIPs, + /// which may disable pixel snapping upon any rotation or shear. + /// + /// The context passed to IDWriteTextLayout::Draw. + /// Receives the transform. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetCurrentTransform)( + __maybenull void* clientDrawingContext, + __out DWRITE_MATRIX* transform + ) PURE; + + /// + /// Gets the number of physical pixels per DIP. A DIP (device-independent pixel) is 1/96 inch, + /// so the pixelsPerDip value is the number of logical pixels per inch divided by 96 (yielding + /// a value of 1 for 96 DPI and 1.25 for 120). + /// + /// The context passed to IDWriteTextLayout::Draw. + /// Receives the number of physical pixels per DIP. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetPixelsPerDip)( + __maybenull void* clientDrawingContext, + __out FLOAT* pixelsPerDip + ) PURE; +}; + +/// +/// The IDWriteTextLayout interface represents a set of application-defined +/// callbacks that perform rendering of text, inline objects, and decorations +/// such as underlines. +/// +interface DWRITE_DECLARE_INTERFACE("ef8a8135-5cc6-45fe-8825-c5a0724eb819") IDWriteTextRenderer : public IDWritePixelSnapping +{ + /// + /// IDWriteTextLayout::Draw calls this function to instruct the client to + /// render a run of glyphs. + /// + /// The context passed to + /// IDWriteTextLayout::Draw. + /// X-coordinate of the baseline. + /// Y-coordinate of the baseline. + /// Specifies measuring method for glyphs in the run. + /// Renderer implementations may choose different rendering modes for given measuring methods, + /// but best results are seen when the rendering mode matches the corresponding measuring mode: + /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL + /// + /// The glyph run to draw. + /// Properties of the characters + /// associated with this run. + /// The drawing effect set in + /// IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(DrawGlyphRun)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + DWRITE_MEASURING_MODE measuringMode, + __in DWRITE_GLYPH_RUN const* glyphRun, + __in DWRITE_GLYPH_RUN_DESCRIPTION const* glyphRunDescription, + __maybenull IUnknown* clientDrawingEffect + ) PURE; + + /// + /// IDWriteTextLayout::Draw calls this function to instruct the client to draw + /// an underline. + /// + /// The context passed to + /// IDWriteTextLayout::Draw. + /// X-coordinate of the baseline. + /// Y-coordinate of the baseline. + /// Underline logical information. + /// The drawing effect set in + /// IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + /// + /// A single underline can be broken into multiple calls, depending on + /// how the formatting changes attributes. If font sizes/styles change + /// within an underline, the thickness and offset will be averaged + /// weighted according to characters. + /// To get the correct top coordinate of the underline rect, add underline::offset + /// to the baseline's Y. Otherwise the underline will be immediately under the text. + /// The x coordinate will always be passed as the left side, regardless + /// of text directionality. This simplifies drawing and reduces the + /// problem of round-off that could potentially cause gaps or a double + /// stamped alpha blend. To avoid alpha overlap, round the end points + /// to the nearest device pixel. + /// + STDMETHOD(DrawUnderline)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __in DWRITE_UNDERLINE const* underline, + __maybenull IUnknown* clientDrawingEffect + ) PURE; + + /// + /// IDWriteTextLayout::Draw calls this function to instruct the client to draw + /// a strikethrough. + /// + /// The context passed to + /// IDWriteTextLayout::Draw. + /// X-coordinate of the baseline. + /// Y-coordinate of the baseline. + /// Strikethrough logical information. + /// The drawing effect set in + /// IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + /// + /// A single strikethrough can be broken into multiple calls, depending on + /// how the formatting changes attributes. Strikethrough is not averaged + /// across font sizes/styles changes. + /// To get the correct top coordinate of the strikethrough rect, + /// add strikethrough::offset to the baseline's Y. + /// Like underlines, the x coordinate will always be passed as the left side, + /// regardless of text directionality. + /// + STDMETHOD(DrawStrikethrough)( + __maybenull void* clientDrawingContext, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __in DWRITE_STRIKETHROUGH const* strikethrough, + __maybenull IUnknown* clientDrawingEffect + ) PURE; + + /// + /// IDWriteTextLayout::Draw calls this application callback when it needs to + /// draw an inline object. + /// + /// The context passed to IDWriteTextLayout::Draw. + /// X-coordinate at the top-left corner of the inline object. + /// Y-coordinate at the top-left corner of the inline object. + /// The object set using IDWriteTextLayout::SetInlineObject. + /// The object should be drawn on its side. + /// The object is in an right-to-left context and should be drawn flipped. + /// The drawing effect set in + /// IDWriteTextLayout::SetDrawingEffect. + /// + /// Standard HRESULT error code. + /// + /// + /// The right-to-left flag is a hint for those cases where it would look + /// strange for the image to be shown normally (like an arrow pointing to + /// right to indicate a submenu). + /// + STDMETHOD(DrawInlineObject)( + __maybenull void* clientDrawingContext, + FLOAT originX, + FLOAT originY, + IDWriteInlineObject* inlineObject, + BOOL isSideways, + BOOL isRightToLeft, + __maybenull IUnknown* clientDrawingEffect + ) PURE; +}; + +/// +/// The IDWriteTextLayout interface represents a block of text after it has +/// been fully analyzed and formatted. +/// +/// All coordinates are in device independent pixels (DIPs). +/// +interface DWRITE_DECLARE_INTERFACE("53737037-6d14-410b-9bfe-0b182bb70961") IDWriteTextLayout : public IDWriteTextFormat +{ + /// + /// Set layout maximum width + /// + /// Layout maximum width + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetMaxWidth)( + FLOAT maxWidth + ) PURE; + + /// + /// Set layout maximum height + /// + /// Layout maximum height + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetMaxHeight)( + FLOAT maxHeight + ) PURE; + + /// + /// Set the font collection. + /// + /// The font collection to set + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontCollection)( + IDWriteFontCollection* fontCollection, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set null-terminated font family name. + /// + /// Font family name + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontFamilyName)( + __in_z WCHAR const* fontFamilyName, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font weight. + /// + /// Font weight + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontWeight)( + DWRITE_FONT_WEIGHT fontWeight, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font style. + /// + /// Font style + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontStyle)( + DWRITE_FONT_STYLE fontStyle, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font stretch. + /// + /// font stretch + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontStretch)( + DWRITE_FONT_STRETCH fontStretch, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font em height. + /// + /// Font em height + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetFontSize)( + FLOAT fontSize, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set underline. + /// + /// The Boolean flag indicates whether underline takes place + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetUnderline)( + BOOL hasUnderline, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set strikethrough. + /// + /// The Boolean flag indicates whether strikethrough takes place + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetStrikethrough)( + BOOL hasStrikethrough, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set application-defined drawing effect. + /// + /// Pointer to an application-defined drawing effect. + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + /// + /// This drawing effect is associated with the specified range and will be passed back + /// to the application via the callback when the range is drawn at drawing time. + /// + STDMETHOD(SetDrawingEffect)( + IUnknown* drawingEffect, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set inline object. + /// + /// Pointer to an application-implemented inline object. + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + /// + /// This inline object applies to the specified range and will be passed back + /// to the application via the DrawInlineObject callback when the range is drawn. + /// Any text in that range will be suppressed. + /// + STDMETHOD(SetInlineObject)( + IDWriteInlineObject* inlineObject, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set font typography features. + /// + /// Pointer to font typography setting. + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetTypography)( + IDWriteTypography* typography, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Set locale name. + /// + /// Locale name + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetLocaleName)( + __in_z WCHAR const* localeName, + DWRITE_TEXT_RANGE textRange + ) PURE; + + /// + /// Get layout maximum width + /// + STDMETHOD_(FLOAT, GetMaxWidth)() PURE; + + /// + /// Get layout maximum height + /// + STDMETHOD_(FLOAT, GetMaxHeight)() PURE; + + /// + /// Get the font collection where the current position is at. + /// + /// The current text position. + /// The current font collection + /// Text range to which this change applies. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontCollection)( + UINT32 currentPosition, + __out IDWriteFontCollection** fontCollection, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the length of the font family name where the current position is at. + /// + /// The current text position. + /// Size of the character array in character count not including the terminated NULL character. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamilyNameLength)( + UINT32 currentPosition, + __out UINT32* nameLength, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Copy the font family name where the current position is at. + /// + /// The current text position. + /// Character array that receives the current font family name + /// Size of the character array in character count including the terminated NULL character. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontFamilyName)( + UINT32 currentPosition, + __out_ecount_z(nameSize) WCHAR* fontFamilyName, + UINT32 nameSize, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the font weight where the current position is at. + /// + /// The current text position. + /// The current font weight + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontWeight)( + UINT32 currentPosition, + __out DWRITE_FONT_WEIGHT* fontWeight, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the font style where the current position is at. + /// + /// The current text position. + /// The current font style + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontStyle)( + UINT32 currentPosition, + __out DWRITE_FONT_STYLE* fontStyle, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the font stretch where the current position is at. + /// + /// The current text position. + /// The current font stretch + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontStretch)( + UINT32 currentPosition, + __out DWRITE_FONT_STRETCH* fontStretch, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the font em height where the current position is at. + /// + /// The current text position. + /// The current font em height + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetFontSize)( + UINT32 currentPosition, + __out FLOAT* fontSize, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the underline presence where the current position is at. + /// + /// The current text position. + /// The Boolean flag indicates whether text is underlined. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetUnderline)( + UINT32 currentPosition, + __out BOOL* hasUnderline, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the strikethrough presence where the current position is at. + /// + /// The current text position. + /// The Boolean flag indicates whether text has strikethrough. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetStrikethrough)( + UINT32 currentPosition, + __out BOOL* hasStrikethrough, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the application-defined drawing effect where the current position is at. + /// + /// The current text position. + /// The current application-defined drawing effect. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetDrawingEffect)( + UINT32 currentPosition, + __out IUnknown** drawingEffect, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the inline object at the given position. + /// + /// The given text position. + /// The inline object. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetInlineObject)( + UINT32 currentPosition, + __out IDWriteInlineObject** inlineObject, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the typography setting where the current position is at. + /// + /// The current text position. + /// The current typography setting. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetTypography)( + UINT32 currentPosition, + __out IDWriteTypography** typography, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the length of the locale name where the current position is at. + /// + /// The current text position. + /// Size of the character array in character count not including the terminated NULL character. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleNameLength)( + UINT32 currentPosition, + __out UINT32* nameLength, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Get the locale name where the current position is at. + /// + /// The current text position. + /// Character array that receives the current locale name + /// Size of the character array in character count including the terminated NULL character. + /// The position range of the current format. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetLocaleName)( + UINT32 currentPosition, + __out_ecount_z(nameSize) WCHAR* localeName, + UINT32 nameSize, + __out_opt DWRITE_TEXT_RANGE* textRange = NULL + ) PURE; + + /// + /// Initiate drawing of the text. + /// + /// An application defined value + /// included in rendering callbacks. + /// The set of application-defined callbacks that do + /// the actual rendering. + /// X-coordinate of the layout's left side. + /// Y-coordinate of the layout's top side. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(Draw)( + __maybenull void* clientDrawingContext, + IDWriteTextRenderer* renderer, + FLOAT originX, + FLOAT originY + ) PURE; + + /// + /// GetLineMetrics returns properties of each line. + /// + /// The array to fill with line information. + /// The maximum size of the lineMetrics array. + /// The actual size of the lineMetrics + /// array that is needed. + /// + /// Standard HRESULT error code. + /// + /// + /// If maxLineCount is not large enough E_NOT_SUFFICIENT_BUFFER, + /// which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), + /// is returned and *actualLineCount is set to the number of lines + /// needed. + /// + STDMETHOD(GetLineMetrics)( + __out_ecount_opt(maxLineCount) DWRITE_LINE_METRICS* lineMetrics, + UINT32 maxLineCount, + __out UINT32* actualLineCount + ) PURE; + + /// + /// GetMetrics retrieves overall metrics for the formatted string. + /// + /// The returned metrics. + /// + /// Standard HRESULT error code. + /// + /// + /// Drawing effects like underline and strikethrough do not contribute + /// to the text size, which is essentially the sum of advance widths and + /// line heights. Additionally, visible swashes and other graphic + /// adornments may extend outside the returned width and height. + /// + STDMETHOD(GetMetrics)( + __out DWRITE_TEXT_METRICS* textMetrics + ) PURE; + + /// + /// GetOverhangMetrics returns the overhangs (in DIPs) of the layout and all + /// objects contained in it, including text glyphs and inline objects. + /// + /// Overshoots of visible extents (in DIPs) outside the layout. + /// + /// Standard HRESULT error code. + /// + /// + /// Any underline and strikethrough do not contribute to the black box + /// determination, since these are actually drawn by the renderer, which + /// is allowed to draw them in any variety of styles. + /// + STDMETHOD(GetOverhangMetrics)( + __out DWRITE_OVERHANG_METRICS* overhangs + ) PURE; + + /// + /// Retrieve logical properties and measurement of each cluster. + /// + /// The array to fill with cluster information. + /// The maximum size of the clusterMetrics array. + /// The actual size of the clusterMetrics array that is needed. + /// + /// Standard HRESULT error code. + /// + /// + /// If maxClusterCount is not large enough E_NOT_SUFFICIENT_BUFFER, + /// which is equivalent to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), + /// is returned and *actualClusterCount is set to the number of clusters + /// needed. + /// + STDMETHOD(GetClusterMetrics)( + __out_ecount_opt(maxClusterCount) DWRITE_CLUSTER_METRICS* clusterMetrics, + UINT32 maxClusterCount, + __out UINT32* actualClusterCount + ) PURE; + + /// + /// Determines the minimum possible width the layout can be set to without + /// emergency breaking between the characters of whole words. + /// + /// Minimum width. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(DetermineMinWidth)( + __out FLOAT* minWidth + ) PURE; + + /// + /// Given a coordinate (in DIPs) relative to the top-left of the layout box, + /// this returns the corresponding hit-test metrics of the text string where + /// the hit-test has occurred. This is useful for mapping mouse clicks to caret + /// positions. When the given coordinate is outside the text string, the function + /// sets the output value *isInside to false but returns the nearest character + /// position. + /// + /// X coordinate to hit-test, relative to the top-left location of the layout box. + /// Y coordinate to hit-test, relative to the top-left location of the layout box. + /// Output flag indicating whether the hit-test location is at the leading or the trailing + /// side of the character. When the output *isInside value is set to false, this value is set according to the output + /// *position value to represent the edge closest to the hit-test location. + /// Output flag indicating whether the hit-test location is inside the text string. + /// When false, the position nearest the text's edge is returned. + /// Output geometry fully enclosing the hit-test location. When the output *isInside value + /// is set to false, this structure represents the geometry enclosing the edge closest to the hit-test location. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(HitTestPoint)( + FLOAT pointX, + FLOAT pointY, + __out BOOL* isTrailingHit, + __out BOOL* isInside, + __out DWRITE_HIT_TEST_METRICS* hitTestMetrics + ) PURE; + + /// + /// Given a text position and whether the caret is on the leading or trailing + /// edge of that position, this returns the corresponding coordinate (in DIPs) + /// relative to the top-left of the layout box. This is most useful for drawing + /// the caret's current position, but it could also be used to anchor an IME to the + /// typed text or attach a floating menu near the point of interest. It may also be + /// used to programmatically obtain the geometry of a particular text position + /// for UI automation. + /// + /// Text position to get the coordinate of. + /// Flag indicating whether the location is of the leading or the trailing side of the specified text position. + /// Output caret X, relative to the top-left of the layout box. + /// Output caret Y, relative to the top-left of the layout box. + /// Output geometry fully enclosing the specified text position. + /// + /// Standard HRESULT error code. + /// + /// + /// When drawing a caret at the returned X,Y, it should should be centered on X + /// and drawn from the Y coordinate down. The height will be the size of the + /// hit-tested text (which can vary in size within a line). + /// Reading direction also affects which side of the character the caret is drawn. + /// However, the returned X coordinate will be correct for either case. + /// You can get a text length back that is larger than a single character. + /// This happens for complex scripts when multiple characters form a single cluster, + /// when diacritics join their base character, or when you test a surrogate pair. + /// + STDMETHOD(HitTestTextPosition)( + UINT32 textPosition, + BOOL isTrailingHit, + __out FLOAT* pointX, + __out FLOAT* pointY, + __out DWRITE_HIT_TEST_METRICS* hitTestMetrics + ) PURE; + + /// + /// The application calls this function to get a set of hit-test metrics + /// corresponding to a range of text positions. The main usage for this + /// is to draw highlighted selection of the text string. + /// + /// The function returns E_NOT_SUFFICIENT_BUFFER, which is equivalent to + /// HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), when the buffer size of + /// hitTestMetrics is too small to hold all the regions calculated by the + /// function. In such situation, the function sets the output value + /// *actualHitTestMetricsCount to the number of geometries calculated. + /// The application is responsible to allocate a new buffer of greater + /// size and call the function again. + /// + /// A good value to use as an initial value for maxHitTestMetricsCount may + /// be calculated from the following equation: + /// maxHitTestMetricsCount = lineCount * maxBidiReorderingDepth + /// + /// where lineCount is obtained from the value of the output argument + /// *actualLineCount from the function IDWriteTextLayout::GetLineMetrics, + /// and the maxBidiReorderingDepth value from the DWRITE_TEXT_METRICS + /// structure of the output argument *textMetrics from the function + /// IDWriteFactory::CreateTextLayout. + /// + /// First text position of the specified range. + /// Number of positions of the specified range. + /// Offset of the X origin (left of the layout box) which is added to each of the hit-test metrics returned. + /// Offset of the Y origin (top of the layout box) which is added to each of the hit-test metrics returned. + /// Pointer to a buffer of the output geometry fully enclosing the specified position range. + /// Maximum number of distinct metrics it could hold in its buffer memory. + /// Actual number of metrics returned or needed. + /// + /// Standard HRESULT error code. + /// + /// + /// There are no gaps in the returned metrics. While there could be visual gaps, + /// depending on bidi ordering, each range is contiguous and reports all the text, + /// including any hidden characters and trimmed text. + /// The height of each returned range will be the same within each line, regardless + /// of how the font sizes vary. + /// + STDMETHOD(HitTestTextRange)( + UINT32 textPosition, + UINT32 textLength, + FLOAT originX, + FLOAT originY, + __out_ecount_opt(maxHitTestMetricsCount) DWRITE_HIT_TEST_METRICS* hitTestMetrics, + UINT32 maxHitTestMetricsCount, + __out UINT32* actualHitTestMetricsCount + ) PURE; +}; + +/// +/// Encapsulates a 32-bit device independent bitmap and device context, which can be used for rendering glyphs. +/// +interface DWRITE_DECLARE_INTERFACE("5e5a32a3-8dff-4773-9ff6-0696eab77267") IDWriteBitmapRenderTarget : public IUnknown +{ + /// + /// Draws a run of glyphs to the bitmap. + /// + /// Horizontal position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB. + /// Vertical position of the baseline origin, in DIPs, relative to the upper-left corner of the DIB. + /// Specifies measuring method for glyphs in the run. + /// Renderer implementations may choose different rendering modes for different measuring methods, for example + /// DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL for DWRITE_MEASURING_MODE_NATURAL, + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC for DWRITE_MEASURING_MODE_GDI_CLASSIC, and + /// DWRITE_RENDERING_MODE_CLEARTYPE_GDI_NATURAL for DWRITE_MEASURING_MODE_GDI_NATURAL. + /// + /// Structure containing the properties of the glyph run. + /// Object that controls rendering behavior. + /// Specifies the foreground color of the text. + /// Optional rectangle that receives the bounding box (in pixels not DIPs) of all the pixels affected by + /// drawing the glyph run. The black box rectangle may extend beyond the dimensions of the bitmap. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(DrawGlyphRun)( + FLOAT baselineOriginX, + FLOAT baselineOriginY, + DWRITE_MEASURING_MODE measuringMode, + __in DWRITE_GLYPH_RUN const* glyphRun, + IDWriteRenderingParams* renderingParams, + COLORREF textColor, + __out_opt RECT* blackBoxRect = NULL + ) PURE; + + /// + /// Gets a handle to the memory device context. + /// + /// + /// Returns the device context handle. + /// + /// + /// An application can use the device context to draw using GDI functions. An application can obtain the bitmap handle + /// (HBITMAP) by calling GetCurrentObject. An application that wants information about the underlying bitmap, including + /// a pointer to the pixel data, can call GetObject to fill in a DIBSECTION structure. The bitmap is always a 32-bit + /// top-down DIB. + /// + STDMETHOD_(HDC, GetMemoryDC)() PURE; + + /// + /// Gets the number of bitmap pixels per DIP. A DIP (device-independent pixel) is 1/96 inch so this value is the number + /// if pixels per inch divided by 96. + /// + /// + /// Returns the number of bitmap pixels per DIP. + /// + STDMETHOD_(FLOAT, GetPixelsPerDip)() PURE; + + /// + /// Sets the number of bitmap pixels per DIP. A DIP (device-independent pixel) is 1/96 inch so this value is the number + /// if pixels per inch divided by 96. + /// + /// Specifies the number of pixels per DIP. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetPixelsPerDip)( + FLOAT pixelsPerDip + ) PURE; + + /// + /// Gets the transform that maps abstract coordinate to DIPs. By default this is the identity + /// transform. Note that this is unrelated to the world transform of the underlying device + /// context. + /// + /// Receives the transform. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetCurrentTransform)( + __out DWRITE_MATRIX* transform + ) PURE; + + /// + /// Sets the transform that maps abstract coordinate to DIPs. This does not affect the world + /// transform of the underlying device context. + /// + /// Specifies the new transform. This parameter can be NULL, in which + /// case the identity transform is implied. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(SetCurrentTransform)( + __in_opt DWRITE_MATRIX const* transform + ) PURE; + + /// + /// Gets the dimensions of the bitmap. + /// + /// Receives the size of the bitmap in pixels. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetSize)( + __out SIZE* size + ) PURE; + + /// + /// Resizes the bitmap. + /// + /// New bitmap width, in pixels. + /// New bitmap height, in pixels. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(Resize)( + UINT32 width, + UINT32 height + ) PURE; +}; + +/// +/// The GDI interop interface provides interoperability with GDI. +/// +interface DWRITE_DECLARE_INTERFACE("1edd9491-9853-4299-898f-6432983b6f3a") IDWriteGdiInterop : public IUnknown +{ + /// + /// Creates a font object that matches the properties specified by the LOGFONT structure. + /// + /// Structure containing a GDI-compatible font description. + /// Receives a newly created font object if successful, or NULL in case of error. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFromLOGFONT)( + __in LOGFONTW const* logFont, + __out IDWriteFont** font + ) PURE; + + /// + /// Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font. + /// + /// Specifies a font in the system font collection. + /// Structure that receives a GDI-compatible font description. + /// Contains TRUE if the specified font object is part of the system font collection + /// or FALSE otherwise. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(ConvertFontToLOGFONT)( + IDWriteFont* font, + __out LOGFONTW* logFont, + __out BOOL* isSystemFont + ) PURE; + + /// + /// Initializes a LOGFONT structure based on the GDI-compatible properties of the specified font. + /// + /// Specifies a font face. + /// Structure that receives a GDI-compatible font description. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(ConvertFontFaceToLOGFONT)( + IDWriteFontFace* font, + __out LOGFONTW* logFont + ) PURE; + + /// + /// Creates a font face object that corresponds to the currently selected HFONT. + /// + /// Handle to a device context into which a font has been selected. It is assumed that the client + /// has already performed font mapping and that the font selected into the DC is the actual font that would be used + /// for rendering glyphs. + /// Contains the newly created font face object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFaceFromHdc)( + HDC hdc, + __out IDWriteFontFace** fontFace + ) PURE; + + /// + /// Creates an object that encapsulates a bitmap and memory DC which can be used for rendering glyphs. + /// + /// Optional device context used to create a compatible memory DC. + /// Width of the bitmap. + /// Height of the bitmap. + /// Receives a pointer to the newly created render target. + STDMETHOD(CreateBitmapRenderTarget)( + __in_opt HDC hdc, + UINT32 width, + UINT32 height, + __out IDWriteBitmapRenderTarget** renderTarget + ) PURE; +}; + +/// +/// The DWRITE_TEXTURE_TYPE enumeration identifies a type of alpha texture. An alpha texture is a bitmap of alpha values, each +/// representing the darkness (i.e., opacity) of a pixel or subpixel. +/// +enum DWRITE_TEXTURE_TYPE +{ + /// + /// Specifies an alpha texture for aliased text rendering (i.e., bi-level, where each pixel is either fully opaque or fully transparent), + /// with one byte per pixel. + /// + DWRITE_TEXTURE_ALIASED_1x1, + + /// + /// Specifies an alpha texture for ClearType text rendering, with three bytes per pixel in the horizontal dimension and + /// one byte per pixel in the vertical dimension. + /// + DWRITE_TEXTURE_CLEARTYPE_3x1 +}; + +/// +/// Maximum alpha value in a texture returned by IDWriteGlyphRunAnalysis::CreateAlphaTexture. +/// +#define DWRITE_ALPHA_MAX 255 + +/// +/// Interface that encapsulates information used to render a glyph run. +/// +interface DWRITE_DECLARE_INTERFACE("7d97dbf7-e085-42d4-81e3-6a883bded118") IDWriteGlyphRunAnalysis : public IUnknown +{ + /// + /// Gets the bounding rectangle of the physical pixels affected by the glyph run. + /// + /// Specifies the type of texture requested. If a bi-level texture is requested, the + /// bounding rectangle includes only bi-level glyphs. Otherwise, the bounding rectangle includes only anti-aliased + /// glyphs. + /// Receives the bounding rectangle, or an empty rectangle if there are no glyphs + /// if the specified type. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetAlphaTextureBounds)( + DWRITE_TEXTURE_TYPE textureType, + __out RECT* textureBounds + ) PURE; + + /// + /// Creates an alpha texture of the specified type. + /// + /// Specifies the type of texture requested. If a bi-level texture is requested, the + /// texture contains only bi-level glyphs. Otherwise, the texture contains only anti-aliased glyphs. + /// Specifies the bounding rectangle of the texture, which can be different than + /// the bounding rectangle returned by GetAlphaTextureBounds. + /// Receives the array of alpha values. + /// Size of the alphaValues array. The minimum size depends on the dimensions of the + /// rectangle and the type of texture requested. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateAlphaTexture)( + DWRITE_TEXTURE_TYPE textureType, + __in RECT const* textureBounds, + __out_bcount(bufferSize) BYTE* alphaValues, + UINT32 bufferSize + ) PURE; + + /// + /// Gets properties required for ClearType blending. + /// + /// Rendering parameters object. In most cases, the values returned in the output + /// parameters are based on the properties of this object. The exception is if a GDI-compatible rendering mode + /// is specified. + /// Receives the gamma value to use for gamma correction. + /// Receives the enhanced contrast value. + /// Receives the ClearType level. + STDMETHOD(GetAlphaBlendParams)( + IDWriteRenderingParams* renderingParams, + __out FLOAT* blendGamma, + __out FLOAT* blendEnhancedContrast, + __out FLOAT* blendClearTypeLevel + ) PURE; +}; + +/// +/// The root factory interface for all DWrite objects. +/// +interface DWRITE_DECLARE_INTERFACE("b859ee5a-d838-4b5b-a2e8-1adc7d93db48") IDWriteFactory : public IUnknown +{ + /// + /// Gets a font collection representing the set of installed fonts. + /// + /// Receives a pointer to the system font collection object, or NULL in case of failure. + /// If this parameter is nonzero, the function performs an immediate check for changes to the set of + /// installed fonts. If this parameter is FALSE, the function will still detect changes if the font cache service is running, but + /// there may be some latency. For example, an application might specify TRUE if it has itself just installed a font and wants to + /// be sure the font collection contains that font. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetSystemFontCollection)( + __out IDWriteFontCollection** fontCollection, + BOOL checkForUpdates = FALSE + ) PURE; + + /// + /// Creates a font collection using a custom font collection loader. + /// + /// Application-defined font collection loader, which must have been previously + /// registered using RegisterFontCollectionLoader. + /// Key used by the loader to identify a collection of font files. + /// Size in bytes of the collection key. + /// Receives a pointer to the system font collection object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateCustomFontCollection)( + IDWriteFontCollectionLoader* collectionLoader, + __in_bcount(collectionKeySize) void const* collectionKey, + UINT32 collectionKeySize, + __out IDWriteFontCollection** fontCollection + ) PURE; + + /// + /// Registers a custom font collection loader with the factory object. + /// + /// Application-defined font collection loader. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(RegisterFontCollectionLoader)( + IDWriteFontCollectionLoader* fontCollectionLoader + ) PURE; + + /// + /// Unregisters a custom font collection loader that was previously registered using RegisterFontCollectionLoader. + /// + /// Application-defined font collection loader. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(UnregisterFontCollectionLoader)( + IDWriteFontCollectionLoader* fontCollectionLoader + ) PURE; + + /// + /// CreateFontFileReference creates a font file reference object from a local font file. + /// + /// Absolute file path. Subsequent operations on the constructed object may fail + /// if the user provided filePath doesn't correspond to a valid file on the disk. + /// Last modified time of the input file path. If the parameter is omitted, + /// the function will access the font file to obtain its last write time, so the clients are encouraged to specify this value + /// to avoid extra disk access. Subsequent operations on the constructed object may fail + /// if the user provided lastWriteTime doesn't match the file on the disk. + /// Contains newly created font file reference object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFileReference)( + __in_z WCHAR const* filePath, + __in_opt FILETIME const* lastWriteTime, + __out IDWriteFontFile** fontFile + ) PURE; + + /// + /// CreateCustomFontFileReference creates a reference to an application specific font file resource. + /// This function enables an application or a document to use a font without having to install it on the system. + /// The fontFileReferenceKey has to be unique only in the scope of the fontFileLoader used in this call. + /// + /// Font file reference key that uniquely identifies the font file resource + /// during the lifetime of fontFileLoader. + /// Size of font file reference key in bytes. + /// Font file loader that will be used by the font system to load data from the file identified by + /// fontFileReferenceKey. + /// Contains the newly created font file object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + /// + /// This function is provided for cases when an application or a document needs to use a font + /// without having to install it on the system. fontFileReferenceKey has to be unique only in the scope + /// of the fontFileLoader used in this call. + /// + STDMETHOD(CreateCustomFontFileReference)( + __in_bcount(fontFileReferenceKeySize) void const* fontFileReferenceKey, + UINT32 fontFileReferenceKeySize, + IDWriteFontFileLoader* fontFileLoader, + __out IDWriteFontFile** fontFile + ) PURE; + + /// + /// Creates a font face object. + /// + /// The file format of the font face. + /// The number of font files require to represent the font face. + /// Font files representing the font face. Since IDWriteFontFace maintains its own references + /// to the input font file objects, it's OK to release them after this call. + /// The zero based index of a font face in cases when the font files contain a collection of font faces. + /// If the font files contain a single face, this value should be zero. + /// Font face simulation flags for algorithmic emboldening and italicization. + /// Contains the newly created font face object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateFontFace)( + DWRITE_FONT_FACE_TYPE fontFaceType, + UINT32 numberOfFiles, + __in_ecount(numberOfFiles) IDWriteFontFile* const* fontFiles, + UINT32 faceIndex, + DWRITE_FONT_SIMULATIONS fontFaceSimulationFlags, + __out IDWriteFontFace** fontFace + ) PURE; + + /// + /// Creates a rendering parameters object with default settings for the primary monitor. + /// + /// Holds the newly created rendering parameters object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateRenderingParams)( + __out IDWriteRenderingParams** renderingParams + ) PURE; + + /// + /// Creates a rendering parameters object with default settings for the specified monitor. + /// + /// The monitor to read the default values from. + /// Holds the newly created rendering parameters object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateMonitorRenderingParams)( + HMONITOR monitor, + __out IDWriteRenderingParams** renderingParams + ) PURE; + + /// + /// Creates a rendering parameters object with the specified properties. + /// + /// The gamma value used for gamma correction, which must be greater than zero and cannot exceed 256. + /// The amount of contrast enhancement, zero or greater. + /// The degree of ClearType level, from 0.0f (no ClearType) to 1.0f (full ClearType). + /// The geometry of a device pixel. + /// Method of rendering glyphs. In most cases, this should be DWRITE_RENDERING_MODE_DEFAULT to automatically use an appropriate mode. + /// Holds the newly created rendering parameters object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateCustomRenderingParams)( + FLOAT gamma, + FLOAT enhancedContrast, + FLOAT clearTypeLevel, + DWRITE_PIXEL_GEOMETRY pixelGeometry, + DWRITE_RENDERING_MODE renderingMode, + __out IDWriteRenderingParams** renderingParams + ) PURE; + + /// + /// Registers a font file loader with DirectWrite. + /// + /// Pointer to the implementation of the IDWriteFontFileLoader for a particular file resource type. + /// + /// Standard HRESULT error code. + /// + /// + /// This function registers a font file loader with DirectWrite. + /// Font file loader interface handles loading font file resources of a particular type from a key. + /// The font file loader interface is recommended to be implemented by a singleton object. + /// A given instance can only be registered once. + /// Succeeding attempts will return an error that it has already been registered. + /// IMPORTANT: font file loader implementations must not register themselves with DirectWrite + /// inside their constructors and must not unregister themselves in their destructors, because + /// registration and unregistraton operations increment and decrement the object reference count respectively. + /// Instead, registration and unregistration of font file loaders with DirectWrite should be performed + /// outside of the font file loader implementation as a separate step. + /// + STDMETHOD(RegisterFontFileLoader)( + IDWriteFontFileLoader* fontFileLoader + ) PURE; + + /// + /// Unregisters a font file loader that was previously registered with the DirectWrite font system using RegisterFontFileLoader. + /// + /// Pointer to the file loader that was previously registered with the DirectWrite font system using RegisterFontFileLoader. + /// + /// This function will succeed if the user loader is requested to be removed. + /// It will fail if the pointer to the file loader identifies a standard DirectWrite loader, + /// or a loader that is never registered or has already been unregistered. + /// + /// + /// This function unregisters font file loader callbacks with the DirectWrite font system. + /// The font file loader interface is recommended to be implemented by a singleton object. + /// IMPORTANT: font file loader implementations must not register themselves with DirectWrite + /// inside their constructors and must not unregister themselves in their destructors, because + /// registration and unregistraton operations increment and decrement the object reference count respectively. + /// Instead, registration and unregistration of font file loaders with DirectWrite should be performed + /// outside of the font file loader implementation as a separate step. + /// + STDMETHOD(UnregisterFontFileLoader)( + IDWriteFontFileLoader* fontFileLoader + ) PURE; + + /// + /// Create a text format object used for text layout. + /// + /// Name of the font family + /// Font collection. NULL indicates the system font collection. + /// Font weight + /// Font style + /// Font stretch + /// Logical size of the font in DIP units. A DIP ("device-independent pixel") equals 1/96 inch. + /// Locale name + /// Contains newly created text format object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateTextFormat)( + __in_z WCHAR const* fontFamilyName, + __maybenull IDWriteFontCollection* fontCollection, + DWRITE_FONT_WEIGHT fontWeight, + DWRITE_FONT_STYLE fontStyle, + DWRITE_FONT_STRETCH fontStretch, + FLOAT fontSize, + __in_z WCHAR const* localeName, + __out IDWriteTextFormat** textFormat + ) PURE; + + /// + /// Create a typography object used in conjunction with text format for text layout. + /// + /// Contains newly created typography object, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateTypography)( + __out IDWriteTypography** typography + ) PURE; + + /// + /// Create an object used for interoperability with GDI. + /// + /// Receives the GDI interop object if successful, or NULL in case of failure. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(GetGdiInterop)( + __out IDWriteGdiInterop** gdiInterop + ) PURE; + + /// + /// CreateTextLayout takes a string, format, and associated constraints + /// and produces and object representing the fully analyzed + /// and formatted result. + /// + /// The string to layout. + /// The length of the string. + /// The format to apply to the string. + /// Width of the layout box. + /// Height of the layout box. + /// The resultant object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateTextLayout)( + __in_ecount(stringLength) WCHAR const* string, + UINT32 stringLength, + IDWriteTextFormat* textFormat, + FLOAT maxWidth, + FLOAT maxHeight, + __out IDWriteTextLayout** textLayout + ) PURE; + + /// + /// CreateGdiCompatibleTextLayout takes a string, format, and associated constraints + /// and produces and object representing the result formatted for a particular display resolution + /// and measuring method. The resulting text layout should only be used for the intended resolution, + /// and for cases where text scalability is desired, CreateTextLayout should be used instead. + /// + /// The string to layout. + /// The length of the string. + /// The format to apply to the string. + /// Width of the layout box. + /// Height of the layout box. + /// Number of physical pixels per DIP. For example, if rendering onto a 96 DPI device then pixelsPerDip + /// is 1. If rendering onto a 120 DPI device then pixelsPerDip is 120/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified the font size and pixelsPerDip. + /// + /// When set to FALSE, instructs the text layout to use the same metrics as GDI aliased text. + /// When set to TRUE, instructs the text layout to use the same metrics as text measured by GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. + /// + /// The resultant object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateGdiCompatibleTextLayout)( + __in_ecount(stringLength) WCHAR const* string, + UINT32 stringLength, + IDWriteTextFormat* textFormat, + FLOAT layoutWidth, + FLOAT layoutHeight, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + BOOL useGdiNatural, + __out IDWriteTextLayout** textLayout + ) PURE; + + /// + /// The application may call this function to create an inline object for trimming, using an ellipsis as the omission sign. + /// The ellipsis will be created using the current settings of the format, including base font, style, and any effects. + /// Alternate omission signs can be created by the application by implementing IDWriteInlineObject. + /// + /// Text format used as a template for the omission sign. + /// Created omission sign. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateEllipsisTrimmingSign)( + IDWriteTextFormat* textFormat, + __out IDWriteInlineObject** trimmingSign + ) PURE; + + /// + /// Return an interface to perform text analysis with. + /// + /// The resultant object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateTextAnalyzer)( + __out IDWriteTextAnalyzer** textAnalyzer + ) PURE; + + /// + /// Creates a number substitution object using a locale name, + /// substitution method, and whether to ignore user overrides (uses NLS + /// defaults for the given culture instead). + /// + /// Method of number substitution to use. + /// Which locale to obtain the digits from. + /// Ignore the user's settings and use the locale defaults + /// Receives a pointer to the newly created object. + STDMETHOD(CreateNumberSubstitution)( + __in DWRITE_NUMBER_SUBSTITUTION_METHOD substitutionMethod, + __in_z WCHAR const* localeName, + __in BOOL ignoreUserOverride, + __out IDWriteNumberSubstitution** numberSubstitution + ) PURE; + + /// + /// Creates a glyph run analysis object, which encapsulates information + /// used to render a glyph run. + /// + /// Structure specifying the properties of the glyph run. + /// Number of physical pixels per DIP. For example, if rendering onto a 96 DPI bitmap then pixelsPerDip + /// is 1. If rendering onto a 120 DPI bitmap then pixelsPerDip is 120/96. + /// Optional transform applied to the glyphs and their positions. This transform is applied after the + /// scaling specified the emSize and pixelsPerDip. + /// Specifies the rendering mode, which must be one of the raster rendering modes (i.e., not default + /// and not outline). + /// Specifies the method to measure glyphs. + /// Horizontal position of the baseline origin, in DIPs. + /// Vertical position of the baseline origin, in DIPs. + /// Receives a pointer to the newly created object. + /// + /// Standard HRESULT error code. + /// + STDMETHOD(CreateGlyphRunAnalysis)( + __in DWRITE_GLYPH_RUN const* glyphRun, + FLOAT pixelsPerDip, + __in_opt DWRITE_MATRIX const* transform, + DWRITE_RENDERING_MODE renderingMode, + DWRITE_MEASURING_MODE measuringMode, + FLOAT baselineOriginX, + FLOAT baselineOriginY, + __out IDWriteGlyphRunAnalysis** glyphRunAnalysis + ) PURE; + +}; // interface IDWriteFactory + +/// +/// Creates a DirectWrite factory object that is used for subsequent creation of individual DirectWrite objects. +/// +/// Identifies whether the factory object will be shared or isolated. +/// Identifies the DirectWrite factory interface, such as __uuidof(IDWriteFactory). +/// Receives the DirectWrite factory object. +/// +/// Standard HRESULT error code. +/// +/// +/// Obtains DirectWrite factory object that is used for subsequent creation of individual DirectWrite classes. +/// DirectWrite factory contains internal state such as font loader registration and cached font data. +/// In most cases it is recommended to use the shared factory object, because it allows multiple components +/// that use DirectWrite to share internal DirectWrite state and reduce memory usage. +/// However, there are cases when it is desirable to reduce the impact of a component, +/// such as a plug-in from an untrusted source, on the rest of the process by sandboxing and isolating it +/// from the rest of the process components. In such cases, it is recommended to use an isolated factory for the sandboxed +/// component. +/// +EXTERN_C HRESULT DWRITE_EXPORT DWriteCreateFactory( + __in DWRITE_FACTORY_TYPE factoryType, + __in REFIID iid, + __out IUnknown **factory + ); + +// Macros used to define DirectWrite error codes. +#define FACILITY_DWRITE 0x898 +#define DWRITE_ERR_BASE 0x5000 +#define MAKE_DWRITE_HR(severity, code) MAKE_HRESULT(severity, FACILITY_DWRITE, (DWRITE_ERR_BASE + code)) +#define MAKE_DWRITE_HR_ERR(code) MAKE_DWRITE_HR(SEVERITY_ERROR, code) + +/// +/// Indicates an error in an input file such as a font file. +/// +#define DWRITE_E_FILEFORMAT MAKE_DWRITE_HR_ERR(0x000) + +/// +/// Indicates an error originating in DirectWrite code, which is not expected to occur but is safe to recover from. +/// +#define DWRITE_E_UNEXPECTED MAKE_DWRITE_HR_ERR(0x001) + +/// +/// Indicates the specified font does not exist. +/// +#define DWRITE_E_NOFONT MAKE_DWRITE_HR_ERR(0x002) + +/// +/// A font file could not be opened because the file, directory, network location, drive, or other storage +/// location does not exist or is unavailable. +/// +#define DWRITE_E_FILENOTFOUND MAKE_DWRITE_HR_ERR(0x003) + +/// +/// A font file exists but could not be opened due to access denied, sharing violation, or similar error. +/// +#define DWRITE_E_FILEACCESS MAKE_DWRITE_HR_ERR(0x004) + +/// +/// A font collection is obsolete due to changes in the system. +/// +#define DWRITE_E_FONTCOLLECTIONOBSOLETE MAKE_DWRITE_HR_ERR(0x005) + +/// +/// The given interface is already registered. +/// +#define DWRITE_E_ALREADYREGISTERED MAKE_DWRITE_HR_ERR(0x006) + +#endif /* DWRITE_H_INCLUDED */ diff --git a/core/src/fxge/Microsoft SDK/include/Dcommon.h b/core/src/fxge/Microsoft SDK/include/Dcommon.h index a6c901aeac..4ecc5c174b 100644 --- a/core/src/fxge/Microsoft SDK/include/Dcommon.h +++ b/core/src/fxge/Microsoft SDK/include/Dcommon.h @@ -1,65 +1,65 @@ -//+-------------------------------------------------------------------------- -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// -// Abstract: -// Public API definitions for DWrite and D2D -// -//---------------------------------------------------------------------------- - -#ifndef DCOMMON_H_INCLUDED -#define DCOMMON_H_INCLUDED - -// -//These macros are defined in the Windows 7 SDK, however to enable development using the technical preview, -//they are included here temporarily. -// -#ifndef DEFINE_ENUM_FLAG_OPERATORS -#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \ -extern "C++" { \ -inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) | ((int)b)); } \ -inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \ -inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) & ((int)b)); } \ -inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \ -inline ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((int)a)); } \ -inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) ^ ((int)b)); } \ -inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \ -} -#endif - -#ifndef __field_ecount_opt -#define __field_ecount_opt(x) -#endif - -#ifndef __range -#define __range(x,y) -#endif - -#ifndef __field_ecount -#define __field_ecount(x) -#endif - -/// -/// The measuring method used for text layout. -/// -typedef enum DWRITE_MEASURING_MODE -{ - /// - /// Text is measured using glyph ideal metrics whose values are independent to the current display resolution. - /// - DWRITE_MEASURING_MODE_NATURAL, - - /// - /// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution. - /// - DWRITE_MEASURING_MODE_GDI_CLASSIC, - - /// - /// Text is measured using the same glyph display metrics as text measured by GDI using a font - /// created with CLEARTYPE_NATURAL_QUALITY. - /// - DWRITE_MEASURING_MODE_GDI_NATURAL - -} DWRITE_MEASURING_MODE; - -#endif /* DCOMMON_H_INCLUDED */ +//+-------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// +// Abstract: +// Public API definitions for DWrite and D2D +// +//---------------------------------------------------------------------------- + +#ifndef DCOMMON_H_INCLUDED +#define DCOMMON_H_INCLUDED + +// +//These macros are defined in the Windows 7 SDK, however to enable development using the technical preview, +//they are included here temporarily. +// +#ifndef DEFINE_ENUM_FLAG_OPERATORS +#define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \ +extern "C++" { \ +inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) | ((int)b)); } \ +inline ENUMTYPE &operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \ +inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) & ((int)b)); } \ +inline ENUMTYPE &operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \ +inline ENUMTYPE operator ~ (ENUMTYPE a) { return ENUMTYPE(~((int)a)); } \ +inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a) ^ ((int)b)); } \ +inline ENUMTYPE &operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \ +} +#endif + +#ifndef __field_ecount_opt +#define __field_ecount_opt(x) +#endif + +#ifndef __range +#define __range(x,y) +#endif + +#ifndef __field_ecount +#define __field_ecount(x) +#endif + +/// +/// The measuring method used for text layout. +/// +typedef enum DWRITE_MEASURING_MODE +{ + /// + /// Text is measured using glyph ideal metrics whose values are independent to the current display resolution. + /// + DWRITE_MEASURING_MODE_NATURAL, + + /// + /// Text is measured using glyph display compatible metrics whose values tuned for the current display resolution. + /// + DWRITE_MEASURING_MODE_GDI_CLASSIC, + + /// + /// Text is measured using the same glyph display metrics as text measured by GDI using a font + /// created with CLEARTYPE_NATURAL_QUALITY. + /// + DWRITE_MEASURING_MODE_GDI_NATURAL + +} DWRITE_MEASURING_MODE; + +#endif /* DCOMMON_H_INCLUDED */ diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlus.h b/core/src/fxge/Microsoft SDK/include/GdiPlus.h index 82393e7050..75eb509469 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlus.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlus.h @@ -1,156 +1,156 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* Gdiplus.h -* -* Abstract: -* -* GDI+ Native C++ public header file -* -\**************************************************************************/ - -#ifndef _GDIPLUS_H -#define _GDIPLUS_H - -struct IDirectDrawSurface7; - -typedef signed short INT16; -typedef unsigned short UINT16; - -#ifndef DCR_REMOVE_INTERNAL - -#ifndef DCR_USE_NEW_105760 - #define DCR_USE_NEW_105760 -#endif -#ifndef DCR_USE_NEW_127084 - #define DCR_USE_NEW_127084 -#endif -#ifndef DCR_USE_NEW_135429 - #define DCR_USE_NEW_135429 -#endif -#ifndef DCR_USE_NEW_140782 - #define DCR_USE_NEW_140782 -#endif -#ifndef DCR_USE_NEW_140855 - #define DCR_USE_NEW_140855 -#endif -#ifndef DCR_USE_NEW_140857 - #define DCR_USE_NEW_140857 -#endif -#ifndef DCR_USE_NEW_140861 - #define DCR_USE_NEW_140861 -#endif -#ifndef DCR_USE_NEW_145135 - #define DCR_USE_NEW_145135 -#endif -#ifndef DCR_USE_NEW_145138 - #define DCR_USE_NEW_145138 -#endif -#ifndef DCR_USE_NEW_145139 - #define DCR_USE_NEW_145139 -#endif -#ifndef DCR_USE_NEW_145804 - #define DCR_USE_NEW_145804 -#endif -#ifndef DCR_USE_NEW_146933 - #define DCR_USE_NEW_146933 -#endif -#ifndef DCR_USE_NEW_152154 - #define DCR_USE_NEW_152154 -#endif -#ifndef DCR_USE_NEW_175866 - #define DCR_USE_NEW_175866 -#endif - -#ifndef DCR_USE_NEW_188922 - #define DCR_USE_NEW_188922 -#endif -#ifndef DCR_USE_NEW_137252 - #define DCR_USE_NEW_137252 -#endif -#ifndef DCR_USE_NEW_202903 - #define DCR_USE_NEW_202903 -#endif -#ifndef DCR_USE_NEW_197819 - #define DCR_USE_NEW_197819 -#endif -#ifndef DCR_USE_NEW_186091 - #define DCR_USE_NEW_186091 -#endif -#ifndef DCR_USE_NEW_125467 - #define DCR_USE_NEW_125467 -#endif -#ifndef DCR_USE_NEW_168772 - #define DCR_USE_NEW_168772 -#endif -#ifndef DCR_USE_NEW_186764 - #define DCR_USE_NEW_186764 -#endif -#ifndef DCR_USE_NEW_174340 - #define DCR_USE_NEW_174340 -#endif -#ifndef DCR_USE_NEW_186151 - #define DCR_USE_NEW_186151 -#endif - -#ifndef DCR_USE_NEW_235072 - #define DCR_USE_NEW_235072 -#endif - -#endif // DCR_REMOVE_INTERNAL - -namespace Gdiplus -{ - namespace DllExports - { - #include "GdiplusMem.h" - }; - - #include "GdiplusBase.h" - - // The following headers are used internally as well - #include "GdiplusEnums.h" - #include "GdiplusTypes.h" - #include "GdiplusInit.h" - #include "GdiplusPixelFormats.h" - #include "GdiplusColor.h" - #include "GdiplusMetaHeader.h" - #include "GdiplusImaging.h" - #include "GdiplusColorMatrix.h" - - // The rest of these are used only by the application - - #include "GdiplusGpStubs.h" - #include "GdiplusHeaders.h" - - namespace DllExports - { - #include "GdiplusFlat.h" - }; - - - #include "GdiplusImageAttributes.h" - #include "GdiplusMatrix.h" - #include "GdiplusBrush.h" - #include "GdiplusPen.h" - #include "GdiplusStringFormat.h" - #include "GdiplusPath.h" - #include "GdiplusLineCaps.h" - #include "GdiplusMetafile.h" - #include "GdiplusGraphics.h" - #include "GdiplusCachedBitmap.h" - #include "GdiplusRegion.h" - #include "GdiplusFontCollection.h" - #include "GdiplusFontFamily.h" - #include "GdiplusFont.h" - #include "GdiplusBitmap.h" - #include "GdiplusImageCodec.h" - -}; // namespace Gdiplus - - - -#endif // !_GDIPLUS_HPP +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* Gdiplus.h +* +* Abstract: +* +* GDI+ Native C++ public header file +* +\**************************************************************************/ + +#ifndef _GDIPLUS_H +#define _GDIPLUS_H + +struct IDirectDrawSurface7; + +typedef signed short INT16; +typedef unsigned short UINT16; + +#ifndef DCR_REMOVE_INTERNAL + +#ifndef DCR_USE_NEW_105760 + #define DCR_USE_NEW_105760 +#endif +#ifndef DCR_USE_NEW_127084 + #define DCR_USE_NEW_127084 +#endif +#ifndef DCR_USE_NEW_135429 + #define DCR_USE_NEW_135429 +#endif +#ifndef DCR_USE_NEW_140782 + #define DCR_USE_NEW_140782 +#endif +#ifndef DCR_USE_NEW_140855 + #define DCR_USE_NEW_140855 +#endif +#ifndef DCR_USE_NEW_140857 + #define DCR_USE_NEW_140857 +#endif +#ifndef DCR_USE_NEW_140861 + #define DCR_USE_NEW_140861 +#endif +#ifndef DCR_USE_NEW_145135 + #define DCR_USE_NEW_145135 +#endif +#ifndef DCR_USE_NEW_145138 + #define DCR_USE_NEW_145138 +#endif +#ifndef DCR_USE_NEW_145139 + #define DCR_USE_NEW_145139 +#endif +#ifndef DCR_USE_NEW_145804 + #define DCR_USE_NEW_145804 +#endif +#ifndef DCR_USE_NEW_146933 + #define DCR_USE_NEW_146933 +#endif +#ifndef DCR_USE_NEW_152154 + #define DCR_USE_NEW_152154 +#endif +#ifndef DCR_USE_NEW_175866 + #define DCR_USE_NEW_175866 +#endif + +#ifndef DCR_USE_NEW_188922 + #define DCR_USE_NEW_188922 +#endif +#ifndef DCR_USE_NEW_137252 + #define DCR_USE_NEW_137252 +#endif +#ifndef DCR_USE_NEW_202903 + #define DCR_USE_NEW_202903 +#endif +#ifndef DCR_USE_NEW_197819 + #define DCR_USE_NEW_197819 +#endif +#ifndef DCR_USE_NEW_186091 + #define DCR_USE_NEW_186091 +#endif +#ifndef DCR_USE_NEW_125467 + #define DCR_USE_NEW_125467 +#endif +#ifndef DCR_USE_NEW_168772 + #define DCR_USE_NEW_168772 +#endif +#ifndef DCR_USE_NEW_186764 + #define DCR_USE_NEW_186764 +#endif +#ifndef DCR_USE_NEW_174340 + #define DCR_USE_NEW_174340 +#endif +#ifndef DCR_USE_NEW_186151 + #define DCR_USE_NEW_186151 +#endif + +#ifndef DCR_USE_NEW_235072 + #define DCR_USE_NEW_235072 +#endif + +#endif // DCR_REMOVE_INTERNAL + +namespace Gdiplus +{ + namespace DllExports + { + #include "GdiplusMem.h" + }; + + #include "GdiplusBase.h" + + // The following headers are used internally as well + #include "GdiplusEnums.h" + #include "GdiplusTypes.h" + #include "GdiplusInit.h" + #include "GdiplusPixelFormats.h" + #include "GdiplusColor.h" + #include "GdiplusMetaHeader.h" + #include "GdiplusImaging.h" + #include "GdiplusColorMatrix.h" + + // The rest of these are used only by the application + + #include "GdiplusGpStubs.h" + #include "GdiplusHeaders.h" + + namespace DllExports + { + #include "GdiplusFlat.h" + }; + + + #include "GdiplusImageAttributes.h" + #include "GdiplusMatrix.h" + #include "GdiplusBrush.h" + #include "GdiplusPen.h" + #include "GdiplusStringFormat.h" + #include "GdiplusPath.h" + #include "GdiplusLineCaps.h" + #include "GdiplusMetafile.h" + #include "GdiplusGraphics.h" + #include "GdiplusCachedBitmap.h" + #include "GdiplusRegion.h" + #include "GdiplusFontCollection.h" + #include "GdiplusFontFamily.h" + #include "GdiplusFont.h" + #include "GdiplusBitmap.h" + #include "GdiplusImageCodec.h" + +}; // namespace Gdiplus + + + +#endif // !_GDIPLUS_HPP diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusBase.h b/core/src/fxge/Microsoft SDK/include/GdiPlusBase.h index 40a977d1b1..59f7cc2fee 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusBase.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusBase.h @@ -1,40 +1,40 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusBase.h -* -* Abstract: -* -* Represents the base class for GDIPlus memory allocation. -* -\**************************************************************************/ - -#ifndef _GDIPLUSBASE_H -#define _GDIPLUSBASE_H - -class GdiplusBase -{ -public: - void (operator delete)(void* in_pVoid) - { - DllExports::GdipFree(in_pVoid); - } - void* (operator new)(size_t in_size) - { - return DllExports::GdipAlloc(in_size); - } - void (operator delete[])(void* in_pVoid) - { - DllExports::GdipFree(in_pVoid); - } - void* (operator new[])(size_t in_size) - { - return DllExports::GdipAlloc(in_size); - } -}; - -#endif - +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusBase.h +* +* Abstract: +* +* Represents the base class for GDIPlus memory allocation. +* +\**************************************************************************/ + +#ifndef _GDIPLUSBASE_H +#define _GDIPLUSBASE_H + +class GdiplusBase +{ +public: + void (operator delete)(void* in_pVoid) + { + DllExports::GdipFree(in_pVoid); + } + void* (operator new)(size_t in_size) + { + return DllExports::GdipAlloc(in_size); + } + void (operator delete[])(void* in_pVoid) + { + DllExports::GdipFree(in_pVoid); + } + void* (operator new[])(size_t in_size) + { + return DllExports::GdipAlloc(in_size); + } +}; + +#endif + diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusBitmap.h b/core/src/fxge/Microsoft SDK/include/GdiPlusBitmap.h index fbe0061d41..16d66bdaeb 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusBitmap.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusBitmap.h @@ -1,1004 +1,1004 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusBitmap.h -* -* Abstract: -* -* Bitmap related declarations -* -\**************************************************************************/ - -#ifndef _GDIPLUSBITMAP_H -#define _GDIPLUSBITMAP_H - -// NOTE: -// Our current choice for the public API is to use constructors -// instead of static load functions to create image objects. -// -// I've kept the static load functions here for now so that -// existing test programs are not broken. But they should -// eventually be taken out. - -#ifndef DCR_USE_NEW_140782 - -inline -Image::Image( - IN const WCHAR* filename - ) -{ - nativeImage = NULL; - lastResult = DllExports::GdipLoadImageFromFile(filename, &nativeImage); -} - -inline -Image::Image( - IN IStream* stream - ) -{ - nativeImage = NULL; - lastResult = DllExports::GdipLoadImageFromStream(stream, &nativeImage); -} - -inline Image* -Image::FromFile( - IN const WCHAR* filename - ) -{ - return new Image(filename); -} - -inline Image* -Image::FromStream( - IN IStream* stream - ) -{ - return new Image(stream); -} - -#else - -inline -Image::Image( - IN const WCHAR* filename, - IN BOOL useEmbeddedColorManagement - ) -{ - nativeImage = NULL; - if(useEmbeddedColorManagement) - { - lastResult = DllExports::GdipLoadImageFromFileICM( - filename, - &nativeImage - ); - } - else - { - lastResult = DllExports::GdipLoadImageFromFile( - filename, - &nativeImage - ); - } -} - -inline -Image::Image( - IN IStream* stream, - IN BOOL useEmbeddedColorManagement - ) -{ - nativeImage = NULL; - if(useEmbeddedColorManagement) - { - lastResult = DllExports::GdipLoadImageFromStreamICM( - stream, - &nativeImage - ); - } - else - { - lastResult = DllExports::GdipLoadImageFromStream( - stream, - &nativeImage - ); - } -} - -inline Image* -Image::FromFile( - IN const WCHAR* filename, - IN BOOL useEmbeddedColorManagement - ) -{ - return new Image( - filename, - useEmbeddedColorManagement - ); -} - -inline Image* -Image::FromStream( - IN IStream* stream, - IN BOOL useEmbeddedColorManagement - ) -{ - return new Image( - stream, - useEmbeddedColorManagement - ); -} - -#endif - -inline -Image::~Image() -{ - DllExports::GdipDisposeImage(nativeImage); -} - -inline Image* -Image::Clone() -{ - GpImage *cloneimage = NULL; - - SetStatus(DllExports::GdipCloneImage(nativeImage, &cloneimage)); - - return new Image(cloneimage, lastResult); -} - -// Encorder Parameter - -inline UINT -Image::GetEncoderParameterListSize( - IN const CLSID* clsidEncoder - ) -{ - UINT size = 0; - - SetStatus(DllExports::GdipGetEncoderParameterListSize(nativeImage, - clsidEncoder, - &size)); - return size; -} - -inline Status -Image::GetEncoderParameterList( - IN const CLSID* clsidEncoder, - IN UINT size, - OUT EncoderParameters* buffer - ) -{ - return SetStatus(DllExports::GdipGetEncoderParameterList(nativeImage, - clsidEncoder, - size, - buffer)); -} - -// Save images - -inline Status -Image::Save( - IN const WCHAR* filename, - IN const CLSID* clsidEncoder, - IN const EncoderParameters *encoderParams - ) -{ - return SetStatus(DllExports::GdipSaveImageToFile(nativeImage, - filename, - clsidEncoder, - encoderParams)); -} - -inline Status -Image::Save( - IN IStream* stream, - IN const CLSID* clsidEncoder, - IN const EncoderParameters *encoderParams - ) -{ - return SetStatus(DllExports::GdipSaveImageToStream(nativeImage, - stream, - clsidEncoder, - encoderParams)); -} - -inline Status -Image::SaveAdd( - IN const EncoderParameters *encoderParams - ) -{ - return SetStatus(DllExports::GdipSaveAdd(nativeImage, - encoderParams)); -} - -inline Status -Image::SaveAdd( - IN Image* newImage, - IN const EncoderParameters *encoderParams - ) -{ - if ( newImage == NULL ) - { - return SetStatus(InvalidParameter); - } - - return SetStatus(DllExports::GdipSaveAddImage(nativeImage, - newImage->nativeImage, - encoderParams)); -} - -// Get size and type information -inline ImageType -Image::GetType() const -{ - ImageType type = ImageTypeUnknown; - - SetStatus(DllExports::GdipGetImageType(nativeImage, &type)); - - return type; -} - -inline Status -Image::GetPhysicalDimension( - OUT SizeF* size - ) -{ - if (size == NULL) - { - return SetStatus(InvalidParameter); - } - - REAL width, height; - Status status; - - status = SetStatus(DllExports::GdipGetImageDimension(nativeImage, - &width, &height)); - - size->Width = width; - size->Height = height; - - return status; -} - -inline Status -Image::GetBounds( - OUT RectF *srcRect, - OUT Unit *srcUnit - ) -{ - return SetStatus(DllExports::GdipGetImageBounds(nativeImage, - srcRect, srcUnit)); -} - -inline UINT -Image::GetWidth() -{ - UINT width = 0; - - SetStatus(DllExports::GdipGetImageWidth(nativeImage, &width)); - - return width; -} - -inline UINT -Image::GetHeight() -{ - UINT height = 0; - - SetStatus(DllExports::GdipGetImageHeight(nativeImage, &height)); - - return height; -} - -inline REAL -Image::GetHorizontalResolution() -{ - REAL resolution = 0.0f; - - SetStatus(DllExports::GdipGetImageHorizontalResolution(nativeImage, &resolution)); - - return resolution; -} - -inline REAL -Image::GetVerticalResolution() -{ - REAL resolution = 0.0f; - - SetStatus(DllExports::GdipGetImageVerticalResolution(nativeImage, &resolution)); - - return resolution; -} - -inline UINT -Image::GetFlags() -{ - UINT flags = 0; - - SetStatus(DllExports::GdipGetImageFlags(nativeImage, &flags)); - - return flags; -} - -inline Status -Image::GetRawFormat(OUT GUID *format) -{ - return SetStatus(DllExports::GdipGetImageRawFormat(nativeImage, format)); -} - -inline PixelFormat -Image::GetPixelFormat() -{ - PixelFormat format; - - SetStatus(DllExports::GdipGetImagePixelFormat(nativeImage, &format)); - - return format; -} - -inline INT -Image::GetPaletteSize() -{ - INT size = 0; - - SetStatus(DllExports::GdipGetImagePaletteSize(nativeImage, &size)); - - return size; -} - -inline Status -Image::GetPalette( - OUT ColorPalette *palette, - IN INT size -) -{ - return SetStatus(DllExports::GdipGetImagePalette(nativeImage, palette, size)); -} - -inline Status -Image::SetPalette( - IN const ColorPalette *palette - ) -{ - return SetStatus(DllExports::GdipSetImagePalette(nativeImage, palette)); -} - -// Thumbnail support - -inline Image* -Image::GetThumbnailImage( - IN UINT thumbWidth, - IN UINT thumbHeight, - IN GetThumbnailImageAbort callback, - IN VOID* callbackData - ) -{ - GpImage *thumbimage = NULL; - - SetStatus(DllExports::GdipGetImageThumbnail(nativeImage, - thumbWidth, thumbHeight, - &thumbimage, - callback, callbackData)); - - Image *newImage = new Image(thumbimage, lastResult); - - if (newImage == NULL) - { - DllExports::GdipDisposeImage(thumbimage); - } - - return newImage; -} - -// Multi-frame support -inline UINT -Image::GetFrameDimensionsCount() -{ - UINT count = 0; - - SetStatus(DllExports::GdipImageGetFrameDimensionsCount(nativeImage, - &count)); - - return count; -} - -inline Status -Image::GetFrameDimensionsList( - OUT GUID* dimensionIDs, - IN UINT count - ) -{ - return SetStatus(DllExports::GdipImageGetFrameDimensionsList(nativeImage, - dimensionIDs, - count)); -} - -inline UINT -Image::GetFrameCount( - IN const GUID* dimensionID - ) -{ - UINT count = 0; - - SetStatus(DllExports::GdipImageGetFrameCount(nativeImage, - dimensionID, - &count)); - return count; -} - -inline Status -Image::SelectActiveFrame( - IN const GUID *dimensionID, - IN UINT frameIndex - ) -{ - return SetStatus(DllExports::GdipImageSelectActiveFrame(nativeImage, - dimensionID, - frameIndex)); -} - -inline Status -Image::RotateFlip( - IN RotateFlipType rotateFlipType - ) -{ - return SetStatus(DllExports::GdipImageRotateFlip(nativeImage, - rotateFlipType)); -} - -// Image property related functions - -inline UINT -Image::GetPropertyCount() -{ - UINT numProperty = 0; - - SetStatus(DllExports::GdipGetPropertyCount(nativeImage, - &numProperty)); - - return numProperty; -} - -inline Status -Image::GetPropertyIdList( - IN UINT numOfProperty, - OUT PROPID* list - ) -{ - return SetStatus(DllExports::GdipGetPropertyIdList(nativeImage, - numOfProperty, list)); -} - -inline UINT -Image::GetPropertyItemSize( - IN PROPID propId - ) -{ - UINT size = 0; - - SetStatus(DllExports::GdipGetPropertyItemSize(nativeImage, - propId, - &size)); - - return size; -} - -inline Status -Image::GetPropertyItem( - IN PROPID propId, - IN UINT propSize, - OUT PropertyItem* buffer - ) -{ - return SetStatus(DllExports::GdipGetPropertyItem(nativeImage, - propId, propSize, buffer)); -} - -inline Status -Image::GetPropertySize( - OUT UINT* totalBufferSize, - OUT UINT* numProperties - ) -{ - return SetStatus(DllExports::GdipGetPropertySize(nativeImage, - totalBufferSize, - numProperties)); -} - -inline Status -Image::GetAllPropertyItems( - IN UINT totalBufferSize, - IN UINT numProperties, - OUT PropertyItem* allItems - ) -{ - if (allItems == NULL) - { - return SetStatus(InvalidParameter); - } - return SetStatus(DllExports::GdipGetAllPropertyItems(nativeImage, - totalBufferSize, - numProperties, - allItems)); -} - -inline Status -Image::RemovePropertyItem( - IN PROPID propId - ) -{ - return SetStatus(DllExports::GdipRemovePropertyItem(nativeImage, propId)); -} - -inline Status -Image::SetPropertyItem( - IN const PropertyItem* item - ) -{ - return SetStatus(DllExports::GdipSetPropertyItem(nativeImage, item)); -} - -// Get/SetLayout -// Support for Middle East localization (right-to-left mirroring) - -inline ImageLayout -Image::GetLayout() const -{ - ImageLayout layout; - - SetStatus(DllExports::GdipGetImageLayout(nativeImage, &layout)); - - return layout; -} - -inline Status -Image::SetLayout(IN const ImageLayout layout) -{ - return SetStatus( - DllExports::GdipSetImageLayout(nativeImage, layout) - ); -} - -inline Status -Image::GetLastStatus() const -{ - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; -} - -inline -Image::Image(GpImage *nativeImage, Status status) -{ - SetNativeImage(nativeImage); - lastResult = status; -} - -inline VOID -Image::SetNativeImage(GpImage *nativeImage) -{ - this->nativeImage = nativeImage; -} - -inline -Bitmap::Bitmap( - IN const WCHAR *filename, - IN BOOL useEmbeddedColorManagement - ) -{ - GpBitmap *bitmap = NULL; - - if(useEmbeddedColorManagement) - { - lastResult = DllExports::GdipCreateBitmapFromFileICM(filename, &bitmap); - } - else - { - lastResult = DllExports::GdipCreateBitmapFromFile(filename, &bitmap); - } - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN IStream *stream, - IN BOOL useEmbeddedColorManagement - ) -{ - GpBitmap *bitmap = NULL; - - if(useEmbeddedColorManagement) - { - lastResult = DllExports::GdipCreateBitmapFromStreamICM(stream, &bitmap); - } - else - { - lastResult = DllExports::GdipCreateBitmapFromStream(stream, &bitmap); - } - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN INT width, - IN INT height, - IN INT stride, - IN PixelFormat format, - IN BYTE *scan0 - ) -{ - GpBitmap *bitmap = NULL; - - lastResult = DllExports::GdipCreateBitmapFromScan0(width, - height, - stride, - format, - scan0, - &bitmap); - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN INT width, - IN INT height, - IN PixelFormat format - ) -{ - GpBitmap *bitmap = NULL; - - lastResult = DllExports::GdipCreateBitmapFromScan0(width, - height, - 0, - format, - NULL, - &bitmap); - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN INT width, - IN INT height, - IN Graphics* target) -{ - GpBitmap *bitmap = NULL; - - lastResult = DllExports::GdipCreateBitmapFromGraphics(width, - height, - target->nativeGraphics, - &bitmap); - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN IDirectDrawSurface7 * surface - ) -{ - GpBitmap *bitmap = NULL; - - lastResult = DllExports::GdipCreateBitmapFromDirectDrawSurface(surface, - &bitmap); - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN const BITMAPINFO* gdiBitmapInfo, - IN VOID* gdiBitmapData - ) -{ - GpBitmap *bitmap = NULL; - - lastResult = DllExports::GdipCreateBitmapFromGdiDib(gdiBitmapInfo, - gdiBitmapData, - &bitmap); - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN HBITMAP hbm, - IN HPALETTE hpal - ) -{ - GpBitmap *bitmap = NULL; - - lastResult = DllExports::GdipCreateBitmapFromHBITMAP(hbm, hpal, &bitmap); - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN HICON hicon - ) -{ - GpBitmap *bitmap = NULL; - - lastResult = DllExports::GdipCreateBitmapFromHICON(hicon, &bitmap); - - SetNativeImage(bitmap); -} - -inline -Bitmap::Bitmap( - IN HINSTANCE hInstance, - IN const WCHAR *bitmapName - ) -{ - GpBitmap *bitmap = NULL; - - lastResult = DllExports::GdipCreateBitmapFromResource(hInstance, - bitmapName, - &bitmap); - - SetNativeImage(bitmap); -} - - -inline Bitmap* -Bitmap::FromFile( - IN const WCHAR *filename, - IN BOOL useEmbeddedColorManagement - ) -{ - return new Bitmap( - filename, - useEmbeddedColorManagement - ); -} - -inline Bitmap* -Bitmap::FromStream( - IN IStream *stream, - IN BOOL useEmbeddedColorManagement - ) -{ - return new Bitmap( - stream, - useEmbeddedColorManagement - ); -} - -inline Bitmap* -Bitmap::FromDirectDrawSurface7( - IN IDirectDrawSurface7* surface - ) -{ - return new Bitmap(surface); -} - -inline Bitmap* -Bitmap::FromBITMAPINFO( - IN const BITMAPINFO* gdiBitmapInfo, - IN VOID* gdiBitmapData) -{ - return new Bitmap(gdiBitmapInfo, gdiBitmapData); -} - -inline Bitmap* -Bitmap::FromHBITMAP( - IN HBITMAP hbm, - IN HPALETTE hpal - ) -{ - return new Bitmap(hbm, hpal); -} - -inline Bitmap* -Bitmap::FromHICON( - IN HICON hicon - ) -{ - return new Bitmap(hicon); -} - -inline Bitmap* -Bitmap::FromResource( - IN HINSTANCE hInstance, - IN const WCHAR *bitmapName) -{ - return new Bitmap(hInstance, bitmapName); -} - -inline Status -Bitmap::GetHBITMAP( - IN const Color& colorBackground, - OUT HBITMAP* hbmReturn - ) -{ - return SetStatus(DllExports::GdipCreateHBITMAPFromBitmap( - static_cast(nativeImage), - hbmReturn, - colorBackground.GetValue())); -} - -inline Status -Bitmap::GetHICON( - OUT HICON* hiconReturn - ) -{ - return SetStatus(DllExports::GdipCreateHICONFromBitmap( - static_cast(nativeImage), - hiconReturn)); -} - -inline Bitmap* -Bitmap::Clone( - IN const Rect& rect, - IN PixelFormat format - ) -{ - return Clone(rect.X, rect.Y, rect.Width, rect.Height, format); -} - -inline Bitmap* -Bitmap::Clone( - IN INT x, - IN INT y, - IN INT width, - IN INT height, - IN PixelFormat format - ) -{ - GpBitmap* gpdstBitmap = NULL; - Bitmap* bitmap; - - lastResult = DllExports::GdipCloneBitmapAreaI( - x, - y, - width, - height, - format, - (GpBitmap *)nativeImage, - &gpdstBitmap); - - if (lastResult == Ok) - { - bitmap = new Bitmap(gpdstBitmap); - - if (bitmap == NULL) - { - DllExports::GdipDisposeImage(gpdstBitmap); - } - - return bitmap; - } - else - return NULL; -} - -inline Bitmap* -Bitmap::Clone( - IN const RectF& rect, - IN PixelFormat format - ) -{ - return Clone(rect.X, rect.Y, rect.Width, rect.Height, format); -} - -inline Bitmap* -Bitmap::Clone( - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height, - IN PixelFormat format - ) -{ - GpBitmap* gpdstBitmap = NULL; - Bitmap* bitmap; - - SetStatus(DllExports::GdipCloneBitmapArea( - x, - y, - width, - height, - format, - (GpBitmap *)nativeImage, - &gpdstBitmap)); - - if (lastResult == Ok) - { - bitmap = new Bitmap(gpdstBitmap); - - if (bitmap == NULL) - { - DllExports::GdipDisposeImage(gpdstBitmap); - } - - return bitmap; - } - else - return NULL; -} - -inline Bitmap::Bitmap(GpBitmap *nativeBitmap) -{ - lastResult = Ok; - - SetNativeImage(nativeBitmap); -} - -inline Status -Bitmap::LockBits( - IN const Rect& rect, - IN UINT flags, - IN PixelFormat format, - OUT BitmapData* lockedBitmapData -) -{ - return SetStatus(DllExports::GdipBitmapLockBits( - static_cast(nativeImage), - &rect, - flags, - format, - lockedBitmapData)); -} - -inline Status -Bitmap::UnlockBits( - IN BitmapData* lockedBitmapData - ) -{ - return SetStatus(DllExports::GdipBitmapUnlockBits( - static_cast(nativeImage), - lockedBitmapData)); -} - -inline Status -Bitmap::GetPixel( - IN INT x, - IN INT y, - OUT Color *color) -{ - ARGB argb; - - Status status = SetStatus(DllExports::GdipBitmapGetPixel( - static_cast(nativeImage), - x, y, - &argb)); - - if (status == Ok) - { - color->SetValue(argb); - } - - return status; -} - -inline Status -Bitmap::SetPixel( - IN INT x, - IN INT y, - IN const Color& color) -{ - return SetStatus(DllExports::GdipBitmapSetPixel( - static_cast(nativeImage), - x, y, - color.GetValue())); -} - -inline Status -Bitmap::SetResolution( - IN REAL xdpi, - IN REAL ydpi) -{ - return SetStatus(DllExports::GdipBitmapSetResolution( - static_cast(nativeImage), - xdpi, ydpi)); -} -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusBitmap.h +* +* Abstract: +* +* Bitmap related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSBITMAP_H +#define _GDIPLUSBITMAP_H + +// NOTE: +// Our current choice for the public API is to use constructors +// instead of static load functions to create image objects. +// +// I've kept the static load functions here for now so that +// existing test programs are not broken. But they should +// eventually be taken out. + +#ifndef DCR_USE_NEW_140782 + +inline +Image::Image( + IN const WCHAR* filename + ) +{ + nativeImage = NULL; + lastResult = DllExports::GdipLoadImageFromFile(filename, &nativeImage); +} + +inline +Image::Image( + IN IStream* stream + ) +{ + nativeImage = NULL; + lastResult = DllExports::GdipLoadImageFromStream(stream, &nativeImage); +} + +inline Image* +Image::FromFile( + IN const WCHAR* filename + ) +{ + return new Image(filename); +} + +inline Image* +Image::FromStream( + IN IStream* stream + ) +{ + return new Image(stream); +} + +#else + +inline +Image::Image( + IN const WCHAR* filename, + IN BOOL useEmbeddedColorManagement + ) +{ + nativeImage = NULL; + if(useEmbeddedColorManagement) + { + lastResult = DllExports::GdipLoadImageFromFileICM( + filename, + &nativeImage + ); + } + else + { + lastResult = DllExports::GdipLoadImageFromFile( + filename, + &nativeImage + ); + } +} + +inline +Image::Image( + IN IStream* stream, + IN BOOL useEmbeddedColorManagement + ) +{ + nativeImage = NULL; + if(useEmbeddedColorManagement) + { + lastResult = DllExports::GdipLoadImageFromStreamICM( + stream, + &nativeImage + ); + } + else + { + lastResult = DllExports::GdipLoadImageFromStream( + stream, + &nativeImage + ); + } +} + +inline Image* +Image::FromFile( + IN const WCHAR* filename, + IN BOOL useEmbeddedColorManagement + ) +{ + return new Image( + filename, + useEmbeddedColorManagement + ); +} + +inline Image* +Image::FromStream( + IN IStream* stream, + IN BOOL useEmbeddedColorManagement + ) +{ + return new Image( + stream, + useEmbeddedColorManagement + ); +} + +#endif + +inline +Image::~Image() +{ + DllExports::GdipDisposeImage(nativeImage); +} + +inline Image* +Image::Clone() +{ + GpImage *cloneimage = NULL; + + SetStatus(DllExports::GdipCloneImage(nativeImage, &cloneimage)); + + return new Image(cloneimage, lastResult); +} + +// Encorder Parameter + +inline UINT +Image::GetEncoderParameterListSize( + IN const CLSID* clsidEncoder + ) +{ + UINT size = 0; + + SetStatus(DllExports::GdipGetEncoderParameterListSize(nativeImage, + clsidEncoder, + &size)); + return size; +} + +inline Status +Image::GetEncoderParameterList( + IN const CLSID* clsidEncoder, + IN UINT size, + OUT EncoderParameters* buffer + ) +{ + return SetStatus(DllExports::GdipGetEncoderParameterList(nativeImage, + clsidEncoder, + size, + buffer)); +} + +// Save images + +inline Status +Image::Save( + IN const WCHAR* filename, + IN const CLSID* clsidEncoder, + IN const EncoderParameters *encoderParams + ) +{ + return SetStatus(DllExports::GdipSaveImageToFile(nativeImage, + filename, + clsidEncoder, + encoderParams)); +} + +inline Status +Image::Save( + IN IStream* stream, + IN const CLSID* clsidEncoder, + IN const EncoderParameters *encoderParams + ) +{ + return SetStatus(DllExports::GdipSaveImageToStream(nativeImage, + stream, + clsidEncoder, + encoderParams)); +} + +inline Status +Image::SaveAdd( + IN const EncoderParameters *encoderParams + ) +{ + return SetStatus(DllExports::GdipSaveAdd(nativeImage, + encoderParams)); +} + +inline Status +Image::SaveAdd( + IN Image* newImage, + IN const EncoderParameters *encoderParams + ) +{ + if ( newImage == NULL ) + { + return SetStatus(InvalidParameter); + } + + return SetStatus(DllExports::GdipSaveAddImage(nativeImage, + newImage->nativeImage, + encoderParams)); +} + +// Get size and type information +inline ImageType +Image::GetType() const +{ + ImageType type = ImageTypeUnknown; + + SetStatus(DllExports::GdipGetImageType(nativeImage, &type)); + + return type; +} + +inline Status +Image::GetPhysicalDimension( + OUT SizeF* size + ) +{ + if (size == NULL) + { + return SetStatus(InvalidParameter); + } + + REAL width, height; + Status status; + + status = SetStatus(DllExports::GdipGetImageDimension(nativeImage, + &width, &height)); + + size->Width = width; + size->Height = height; + + return status; +} + +inline Status +Image::GetBounds( + OUT RectF *srcRect, + OUT Unit *srcUnit + ) +{ + return SetStatus(DllExports::GdipGetImageBounds(nativeImage, + srcRect, srcUnit)); +} + +inline UINT +Image::GetWidth() +{ + UINT width = 0; + + SetStatus(DllExports::GdipGetImageWidth(nativeImage, &width)); + + return width; +} + +inline UINT +Image::GetHeight() +{ + UINT height = 0; + + SetStatus(DllExports::GdipGetImageHeight(nativeImage, &height)); + + return height; +} + +inline REAL +Image::GetHorizontalResolution() +{ + REAL resolution = 0.0f; + + SetStatus(DllExports::GdipGetImageHorizontalResolution(nativeImage, &resolution)); + + return resolution; +} + +inline REAL +Image::GetVerticalResolution() +{ + REAL resolution = 0.0f; + + SetStatus(DllExports::GdipGetImageVerticalResolution(nativeImage, &resolution)); + + return resolution; +} + +inline UINT +Image::GetFlags() +{ + UINT flags = 0; + + SetStatus(DllExports::GdipGetImageFlags(nativeImage, &flags)); + + return flags; +} + +inline Status +Image::GetRawFormat(OUT GUID *format) +{ + return SetStatus(DllExports::GdipGetImageRawFormat(nativeImage, format)); +} + +inline PixelFormat +Image::GetPixelFormat() +{ + PixelFormat format; + + SetStatus(DllExports::GdipGetImagePixelFormat(nativeImage, &format)); + + return format; +} + +inline INT +Image::GetPaletteSize() +{ + INT size = 0; + + SetStatus(DllExports::GdipGetImagePaletteSize(nativeImage, &size)); + + return size; +} + +inline Status +Image::GetPalette( + OUT ColorPalette *palette, + IN INT size +) +{ + return SetStatus(DllExports::GdipGetImagePalette(nativeImage, palette, size)); +} + +inline Status +Image::SetPalette( + IN const ColorPalette *palette + ) +{ + return SetStatus(DllExports::GdipSetImagePalette(nativeImage, palette)); +} + +// Thumbnail support + +inline Image* +Image::GetThumbnailImage( + IN UINT thumbWidth, + IN UINT thumbHeight, + IN GetThumbnailImageAbort callback, + IN VOID* callbackData + ) +{ + GpImage *thumbimage = NULL; + + SetStatus(DllExports::GdipGetImageThumbnail(nativeImage, + thumbWidth, thumbHeight, + &thumbimage, + callback, callbackData)); + + Image *newImage = new Image(thumbimage, lastResult); + + if (newImage == NULL) + { + DllExports::GdipDisposeImage(thumbimage); + } + + return newImage; +} + +// Multi-frame support +inline UINT +Image::GetFrameDimensionsCount() +{ + UINT count = 0; + + SetStatus(DllExports::GdipImageGetFrameDimensionsCount(nativeImage, + &count)); + + return count; +} + +inline Status +Image::GetFrameDimensionsList( + OUT GUID* dimensionIDs, + IN UINT count + ) +{ + return SetStatus(DllExports::GdipImageGetFrameDimensionsList(nativeImage, + dimensionIDs, + count)); +} + +inline UINT +Image::GetFrameCount( + IN const GUID* dimensionID + ) +{ + UINT count = 0; + + SetStatus(DllExports::GdipImageGetFrameCount(nativeImage, + dimensionID, + &count)); + return count; +} + +inline Status +Image::SelectActiveFrame( + IN const GUID *dimensionID, + IN UINT frameIndex + ) +{ + return SetStatus(DllExports::GdipImageSelectActiveFrame(nativeImage, + dimensionID, + frameIndex)); +} + +inline Status +Image::RotateFlip( + IN RotateFlipType rotateFlipType + ) +{ + return SetStatus(DllExports::GdipImageRotateFlip(nativeImage, + rotateFlipType)); +} + +// Image property related functions + +inline UINT +Image::GetPropertyCount() +{ + UINT numProperty = 0; + + SetStatus(DllExports::GdipGetPropertyCount(nativeImage, + &numProperty)); + + return numProperty; +} + +inline Status +Image::GetPropertyIdList( + IN UINT numOfProperty, + OUT PROPID* list + ) +{ + return SetStatus(DllExports::GdipGetPropertyIdList(nativeImage, + numOfProperty, list)); +} + +inline UINT +Image::GetPropertyItemSize( + IN PROPID propId + ) +{ + UINT size = 0; + + SetStatus(DllExports::GdipGetPropertyItemSize(nativeImage, + propId, + &size)); + + return size; +} + +inline Status +Image::GetPropertyItem( + IN PROPID propId, + IN UINT propSize, + OUT PropertyItem* buffer + ) +{ + return SetStatus(DllExports::GdipGetPropertyItem(nativeImage, + propId, propSize, buffer)); +} + +inline Status +Image::GetPropertySize( + OUT UINT* totalBufferSize, + OUT UINT* numProperties + ) +{ + return SetStatus(DllExports::GdipGetPropertySize(nativeImage, + totalBufferSize, + numProperties)); +} + +inline Status +Image::GetAllPropertyItems( + IN UINT totalBufferSize, + IN UINT numProperties, + OUT PropertyItem* allItems + ) +{ + if (allItems == NULL) + { + return SetStatus(InvalidParameter); + } + return SetStatus(DllExports::GdipGetAllPropertyItems(nativeImage, + totalBufferSize, + numProperties, + allItems)); +} + +inline Status +Image::RemovePropertyItem( + IN PROPID propId + ) +{ + return SetStatus(DllExports::GdipRemovePropertyItem(nativeImage, propId)); +} + +inline Status +Image::SetPropertyItem( + IN const PropertyItem* item + ) +{ + return SetStatus(DllExports::GdipSetPropertyItem(nativeImage, item)); +} + +// Get/SetLayout +// Support for Middle East localization (right-to-left mirroring) + +inline ImageLayout +Image::GetLayout() const +{ + ImageLayout layout; + + SetStatus(DllExports::GdipGetImageLayout(nativeImage, &layout)); + + return layout; +} + +inline Status +Image::SetLayout(IN const ImageLayout layout) +{ + return SetStatus( + DllExports::GdipSetImageLayout(nativeImage, layout) + ); +} + +inline Status +Image::GetLastStatus() const +{ + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; +} + +inline +Image::Image(GpImage *nativeImage, Status status) +{ + SetNativeImage(nativeImage); + lastResult = status; +} + +inline VOID +Image::SetNativeImage(GpImage *nativeImage) +{ + this->nativeImage = nativeImage; +} + +inline +Bitmap::Bitmap( + IN const WCHAR *filename, + IN BOOL useEmbeddedColorManagement + ) +{ + GpBitmap *bitmap = NULL; + + if(useEmbeddedColorManagement) + { + lastResult = DllExports::GdipCreateBitmapFromFileICM(filename, &bitmap); + } + else + { + lastResult = DllExports::GdipCreateBitmapFromFile(filename, &bitmap); + } + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN IStream *stream, + IN BOOL useEmbeddedColorManagement + ) +{ + GpBitmap *bitmap = NULL; + + if(useEmbeddedColorManagement) + { + lastResult = DllExports::GdipCreateBitmapFromStreamICM(stream, &bitmap); + } + else + { + lastResult = DllExports::GdipCreateBitmapFromStream(stream, &bitmap); + } + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN INT width, + IN INT height, + IN INT stride, + IN PixelFormat format, + IN BYTE *scan0 + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromScan0(width, + height, + stride, + format, + scan0, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN INT width, + IN INT height, + IN PixelFormat format + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromScan0(width, + height, + 0, + format, + NULL, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN INT width, + IN INT height, + IN Graphics* target) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromGraphics(width, + height, + target->nativeGraphics, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN IDirectDrawSurface7 * surface + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromDirectDrawSurface(surface, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN const BITMAPINFO* gdiBitmapInfo, + IN VOID* gdiBitmapData + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromGdiDib(gdiBitmapInfo, + gdiBitmapData, + &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN HBITMAP hbm, + IN HPALETTE hpal + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromHBITMAP(hbm, hpal, &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN HICON hicon + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromHICON(hicon, &bitmap); + + SetNativeImage(bitmap); +} + +inline +Bitmap::Bitmap( + IN HINSTANCE hInstance, + IN const WCHAR *bitmapName + ) +{ + GpBitmap *bitmap = NULL; + + lastResult = DllExports::GdipCreateBitmapFromResource(hInstance, + bitmapName, + &bitmap); + + SetNativeImage(bitmap); +} + + +inline Bitmap* +Bitmap::FromFile( + IN const WCHAR *filename, + IN BOOL useEmbeddedColorManagement + ) +{ + return new Bitmap( + filename, + useEmbeddedColorManagement + ); +} + +inline Bitmap* +Bitmap::FromStream( + IN IStream *stream, + IN BOOL useEmbeddedColorManagement + ) +{ + return new Bitmap( + stream, + useEmbeddedColorManagement + ); +} + +inline Bitmap* +Bitmap::FromDirectDrawSurface7( + IN IDirectDrawSurface7* surface + ) +{ + return new Bitmap(surface); +} + +inline Bitmap* +Bitmap::FromBITMAPINFO( + IN const BITMAPINFO* gdiBitmapInfo, + IN VOID* gdiBitmapData) +{ + return new Bitmap(gdiBitmapInfo, gdiBitmapData); +} + +inline Bitmap* +Bitmap::FromHBITMAP( + IN HBITMAP hbm, + IN HPALETTE hpal + ) +{ + return new Bitmap(hbm, hpal); +} + +inline Bitmap* +Bitmap::FromHICON( + IN HICON hicon + ) +{ + return new Bitmap(hicon); +} + +inline Bitmap* +Bitmap::FromResource( + IN HINSTANCE hInstance, + IN const WCHAR *bitmapName) +{ + return new Bitmap(hInstance, bitmapName); +} + +inline Status +Bitmap::GetHBITMAP( + IN const Color& colorBackground, + OUT HBITMAP* hbmReturn + ) +{ + return SetStatus(DllExports::GdipCreateHBITMAPFromBitmap( + static_cast(nativeImage), + hbmReturn, + colorBackground.GetValue())); +} + +inline Status +Bitmap::GetHICON( + OUT HICON* hiconReturn + ) +{ + return SetStatus(DllExports::GdipCreateHICONFromBitmap( + static_cast(nativeImage), + hiconReturn)); +} + +inline Bitmap* +Bitmap::Clone( + IN const Rect& rect, + IN PixelFormat format + ) +{ + return Clone(rect.X, rect.Y, rect.Width, rect.Height, format); +} + +inline Bitmap* +Bitmap::Clone( + IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN PixelFormat format + ) +{ + GpBitmap* gpdstBitmap = NULL; + Bitmap* bitmap; + + lastResult = DllExports::GdipCloneBitmapAreaI( + x, + y, + width, + height, + format, + (GpBitmap *)nativeImage, + &gpdstBitmap); + + if (lastResult == Ok) + { + bitmap = new Bitmap(gpdstBitmap); + + if (bitmap == NULL) + { + DllExports::GdipDisposeImage(gpdstBitmap); + } + + return bitmap; + } + else + return NULL; +} + +inline Bitmap* +Bitmap::Clone( + IN const RectF& rect, + IN PixelFormat format + ) +{ + return Clone(rect.X, rect.Y, rect.Width, rect.Height, format); +} + +inline Bitmap* +Bitmap::Clone( + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN PixelFormat format + ) +{ + GpBitmap* gpdstBitmap = NULL; + Bitmap* bitmap; + + SetStatus(DllExports::GdipCloneBitmapArea( + x, + y, + width, + height, + format, + (GpBitmap *)nativeImage, + &gpdstBitmap)); + + if (lastResult == Ok) + { + bitmap = new Bitmap(gpdstBitmap); + + if (bitmap == NULL) + { + DllExports::GdipDisposeImage(gpdstBitmap); + } + + return bitmap; + } + else + return NULL; +} + +inline Bitmap::Bitmap(GpBitmap *nativeBitmap) +{ + lastResult = Ok; + + SetNativeImage(nativeBitmap); +} + +inline Status +Bitmap::LockBits( + IN const Rect& rect, + IN UINT flags, + IN PixelFormat format, + OUT BitmapData* lockedBitmapData +) +{ + return SetStatus(DllExports::GdipBitmapLockBits( + static_cast(nativeImage), + &rect, + flags, + format, + lockedBitmapData)); +} + +inline Status +Bitmap::UnlockBits( + IN BitmapData* lockedBitmapData + ) +{ + return SetStatus(DllExports::GdipBitmapUnlockBits( + static_cast(nativeImage), + lockedBitmapData)); +} + +inline Status +Bitmap::GetPixel( + IN INT x, + IN INT y, + OUT Color *color) +{ + ARGB argb; + + Status status = SetStatus(DllExports::GdipBitmapGetPixel( + static_cast(nativeImage), + x, y, + &argb)); + + if (status == Ok) + { + color->SetValue(argb); + } + + return status; +} + +inline Status +Bitmap::SetPixel( + IN INT x, + IN INT y, + IN const Color& color) +{ + return SetStatus(DllExports::GdipBitmapSetPixel( + static_cast(nativeImage), + x, y, + color.GetValue())); +} + +inline Status +Bitmap::SetResolution( + IN REAL xdpi, + IN REAL ydpi) +{ + return SetStatus(DllExports::GdipBitmapSetResolution( + static_cast(nativeImage), + xdpi, ydpi)); +} +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusBrush.h b/core/src/fxge/Microsoft SDK/include/GdiPlusBrush.h index a506f87982..c25e34ae01 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusBrush.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusBrush.h @@ -1,951 +1,951 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusBrush.h -* -* Abstract: -* -* Brush API related declarations -* -\**************************************************************************/ - -#ifndef _GDIPLUSBRUSH_H -#define _GDIPLUSBRUSH_H - -//-------------------------------------------------------------------------- -// Abstract base class for various brush types -//-------------------------------------------------------------------------- - -class GraphicsPath; - -class Brush : public GdiplusBase -{ -public: - friend class Pen; - friend class Graphics; - - virtual ~Brush() - { - DllExports::GdipDeleteBrush(nativeBrush); - } - - virtual Brush* Clone() const - { - GpBrush *brush = NULL; - - SetStatus(DllExports::GdipCloneBrush(nativeBrush, &brush)); - - Brush *newBrush = new Brush(brush, lastResult); - - if (newBrush == NULL) - { - DllExports::GdipDeleteBrush(brush); - } - - return newBrush; - } - - BrushType GetType() const - { - BrushType type = static_cast(-1); - - SetStatus(DllExports::GdipGetBrushType(nativeBrush, &type)); - - return type; - } - - Status GetLastStatus() const - { - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; - } - -protected: - - Brush() - { - SetStatus(NotImplemented); - } - -#ifdef DCR_USE_NEW_250932 - -private: - Brush(const Brush& brush); - Brush& operator=(const Brush& brush); -protected: - -#else - - Brush(const Brush& brush) - { - brush; - SetStatus(NotImplemented); - } - - Brush& operator=(const Brush& brush) - { - brush; - SetStatus(NotImplemented); - return *this; - } - -#endif - - Brush(GpBrush* nativeBrush, Status status) - { - lastResult = status; - SetNativeBrush(nativeBrush); - } - - VOID SetNativeBrush(GpBrush* nativeBrush) - { - this->nativeBrush = nativeBrush; - } - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - - GpBrush* nativeBrush; - mutable Status lastResult; -}; - -//-------------------------------------------------------------------------- -// Represent solid fill brush object -//-------------------------------------------------------------------------- - -class SolidBrush : public Brush -{ -public: - friend class Pen; - - SolidBrush(IN const Color& color) - { - GpSolidFill *brush = NULL; - - lastResult = DllExports::GdipCreateSolidFill(color.GetValue(), &brush); - - SetNativeBrush(brush); - } - - Status GetColor(OUT Color* color) const - { - ARGB argb; - - if (color == NULL) - { - return SetStatus(InvalidParameter); - } - - SetStatus(DllExports::GdipGetSolidFillColor((GpSolidFill*)nativeBrush, - &argb)); - - *color = Color(argb); - - return lastResult; - } - - Status SetColor(IN const Color& color) - { - return SetStatus(DllExports::GdipSetSolidFillColor((GpSolidFill*)nativeBrush, - color.GetValue())); - } - -#ifdef DCR_USE_NEW_250932 - -private: - SolidBrush(const SolidBrush &); - SolidBrush& operator=(const SolidBrush &); - -#endif - -protected: - - SolidBrush() - { - } -}; - -class TextureBrush : public Brush -{ -public: - friend class Pen; - - TextureBrush(IN Image* image, - IN WrapMode wrapMode = WrapModeTile) - { - GpTexture *texture = NULL; - - lastResult = DllExports::GdipCreateTexture( - image->nativeImage, - wrapMode, &texture); - - SetNativeBrush(texture); - } - - // When creating a texture brush from a metafile image, the dstRect - // is used to specify the size that the metafile image should be - // rendered at in the device units of the destination graphics. - // It is NOT used to crop the metafile image, so only the width - // and height values matter for metafiles. - TextureBrush(IN Image* image, - IN WrapMode wrapMode, - IN const RectF &dstRect) - { - GpTexture *texture = NULL; - - lastResult = DllExports::GdipCreateTexture2( - image->nativeImage, - wrapMode, - dstRect.X, - dstRect.Y, - dstRect.Width, - dstRect.Height, - &texture); - - SetNativeBrush(texture); - } - - // When creating a texture brush from a metafile image, the dstRect - // is used to specify the size that the metafile image should be - // rendered at in the device units of the destination graphics. - // It is NOT used to crop the metafile image, so only the width - // and height values matter for metafiles. - - TextureBrush(IN Image *image, - IN const RectF &dstRect, - IN const ImageAttributes *imageAttributes = NULL) - { - GpTexture *texture = NULL; - - lastResult = DllExports::GdipCreateTextureIA( - image->nativeImage, - (imageAttributes)?imageAttributes->nativeImageAttr:NULL, - dstRect.X, - dstRect.Y, - dstRect.Width, - dstRect.Height, - &texture - ); - - SetNativeBrush(texture); - } - - #ifdef DCR_USE_NEW_145138 - TextureBrush(IN Image *image, - IN const Rect &dstRect, - IN const ImageAttributes *imageAttributes = NULL) - { - GpTexture *texture = NULL; - - lastResult = DllExports::GdipCreateTextureIAI( - image->nativeImage, - (imageAttributes)?imageAttributes->nativeImageAttr:NULL, - dstRect.X, - dstRect.Y, - dstRect.Width, - dstRect.Height, - &texture - ); - - SetNativeBrush(texture); - } - #endif - - // When creating a texture brush from a metafile image, the dstRect - // is used to specify the size that the metafile image should be - // rendered at in the device units of the destination graphics. - // It is NOT used to crop the metafile image, so only the width - // and height values matter for metafiles. - - TextureBrush( - IN Image* image, - IN WrapMode wrapMode, - - #ifdef DCR_USE_NEW_145138 - const IN Rect &dstRect - #else - IN Rect &dstRect - #endif - ) - { - GpTexture *texture = NULL; - - lastResult = DllExports::GdipCreateTexture2I( - image->nativeImage, - wrapMode, - dstRect.X, - dstRect.Y, - dstRect.Width, - dstRect.Height, - &texture); - - SetNativeBrush(texture); - } - - // When creating a texture brush from a metafile image, the dstRect - // is used to specify the size that the metafile image should be - // rendered at in the device units of the destination graphics. - // It is NOT used to crop the metafile image, so only the width - // and height values matter for metafiles. - TextureBrush(IN Image* image, - IN WrapMode wrapMode, - IN REAL dstX, - IN REAL dstY, - IN REAL dstWidth, - IN REAL dstHeight) - { - GpTexture *texture = NULL; - - lastResult = DllExports::GdipCreateTexture2( - image->nativeImage, - wrapMode, - dstX, - dstY, - dstWidth, - dstHeight, - &texture); - - SetNativeBrush(texture); - } - - // When creating a texture brush from a metafile image, the dstRect - // is used to specify the size that the metafile image should be - // rendered at in the device units of the destination graphics. - // It is NOT used to crop the metafile image, so only the width - // and height values matter for metafiles. - TextureBrush(IN Image* image, - IN WrapMode wrapMode, - IN INT dstX, - IN INT dstY, - IN INT dstWidth, - IN INT dstHeight) - { - GpTexture *texture = NULL; - - lastResult = DllExports::GdipCreateTexture2I( - image->nativeImage, - wrapMode, - dstX, - dstY, - dstWidth, - dstHeight, - &texture); - - SetNativeBrush(texture); - } - - /** - * Set/get brush transform - */ - Status SetTransform(IN const Matrix* matrix) - { - return SetStatus(DllExports::GdipSetTextureTransform((GpTexture*)nativeBrush, - matrix->nativeMatrix)); - } - - Status GetTransform(OUT Matrix* matrix) const - { - return SetStatus(DllExports::GdipGetTextureTransform((GpTexture*)nativeBrush, - matrix->nativeMatrix)); - } - - Status ResetTransform() - { - return SetStatus(DllExports::GdipResetTextureTransform((GpTexture*)nativeBrush)); - } - - Status MultiplyTransform(IN const Matrix* matrix, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipMultiplyTextureTransform((GpTexture*)nativeBrush, - matrix->nativeMatrix, - order)); - } - - Status TranslateTransform(IN REAL dx, - IN REAL dy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipTranslateTextureTransform((GpTexture*)nativeBrush, - dx, dy, order)); - } - - Status ScaleTransform(IN REAL sx, - IN REAL sy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipScaleTextureTransform((GpTexture*)nativeBrush, - sx, sy, order)); - } - - Status RotateTransform(IN REAL angle, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipRotateTextureTransform((GpTexture*)nativeBrush, - angle, order)); - } - - /** - * Set/get brush wrapping mode - */ - Status SetWrapMode(IN WrapMode wrapMode) - { - return SetStatus(DllExports::GdipSetTextureWrapMode((GpTexture*)nativeBrush, - wrapMode)); - } - - WrapMode GetWrapMode() const - { - WrapMode wrapMode; - - SetStatus(DllExports::GdipGetTextureWrapMode((GpTexture*)nativeBrush, - &wrapMode)); - return wrapMode; - } - - // Get texture brush attributes - - Image *GetImage() const - { - GpImage *image; - - SetStatus(DllExports::GdipGetTextureImage((GpTexture *)nativeBrush, - &image)); - - Image *retimage = new Image(image, lastResult); - - if (retimage == NULL) - { - DllExports::GdipDisposeImage(image); - } - - return retimage; - } - -#ifdef DCR_USE_NEW_250932 - -private: - TextureBrush(const TextureBrush &); - TextureBrush& operator=(const TextureBrush &); - -#endif - -protected: - - TextureBrush() - { - } -}; - -//-------------------------------------------------------------------------- -// Represent line gradient brush object -//-------------------------------------------------------------------------- - -class LinearGradientBrush : public Brush -{ -public: - friend class Pen; - - LinearGradientBrush(IN const PointF& point1, - IN const PointF& point2, - IN const Color& color1, - IN const Color& color2) - { - GpLineGradient *brush = NULL; - - lastResult = DllExports::GdipCreateLineBrush(&point1, - &point2, - color1.GetValue(), - color2.GetValue(), - WrapModeTile, - &brush); - - SetNativeBrush(brush); - } - - LinearGradientBrush(IN const Point& point1, - IN const Point& point2, - IN const Color& color1, - IN const Color& color2) - { - GpLineGradient *brush = NULL; - - lastResult = DllExports::GdipCreateLineBrushI(&point1, - &point2, - color1.GetValue(), - color2.GetValue(), - WrapModeTile, - &brush); - - SetNativeBrush(brush); - } - - LinearGradientBrush(IN const RectF& rect, - IN const Color& color1, - IN const Color& color2, - IN LinearGradientMode mode) - { - GpLineGradient *brush = NULL; - - lastResult = DllExports::GdipCreateLineBrushFromRect(&rect, - color1.GetValue(), - color2.GetValue(), - mode, - WrapModeTile, - &brush); - - SetNativeBrush(brush); - } - - LinearGradientBrush(IN const Rect& rect, - IN const Color& color1, - IN const Color& color2, - IN LinearGradientMode mode) - { - GpLineGradient *brush = NULL; - - lastResult = DllExports::GdipCreateLineBrushFromRectI(&rect, - color1.GetValue(), - color2.GetValue(), - mode, - WrapModeTile, - &brush); - - SetNativeBrush(brush); - } - - LinearGradientBrush(IN const RectF& rect, - IN const Color& color1, - IN const Color& color2, - IN REAL angle, - IN BOOL isAngleScalable = FALSE) - { - GpLineGradient *brush = NULL; - - lastResult = DllExports::GdipCreateLineBrushFromRectWithAngle(&rect, - color1.GetValue(), - color2.GetValue(), - angle, - isAngleScalable, - WrapModeTile, - &brush); - - SetNativeBrush(brush); - } - - LinearGradientBrush(IN const Rect& rect, - IN const Color& color1, - IN const Color& color2, - IN REAL angle, - IN BOOL isAngleScalable = FALSE) - { - GpLineGradient *brush = NULL; - - lastResult = DllExports::GdipCreateLineBrushFromRectWithAngleI(&rect, - color1.GetValue(), - color2.GetValue(), - angle, - isAngleScalable, - WrapModeTile, - &brush); - - SetNativeBrush(brush); - } - - // Get/set point attributes - - Status SetLinearPoints(IN const PointF& point1, - IN const PointF& point2) - { - return SetStatus(DllExports::GdipSetLinePoints((GpLineGradient*)nativeBrush, - &point1, &point2)); - } - - Status GetLinearPoints(OUT PointF* points) const - { - return SetStatus(DllExports::GdipGetLinePoints((GpLineGradient*) nativeBrush, - points)); - } - - Status SetLinearPoints(IN const Point& point1, - IN const Point& point2) - { - return SetStatus(DllExports::GdipSetLinePointsI((GpLineGradient*)nativeBrush, - &point1, &point2)); - } - - Status GetLinearPoints(OUT Point* points) const - { - return SetStatus(DllExports::GdipGetLinePointsI((GpLineGradient*) nativeBrush, - points)); - } - // Get/set color attributes - - Status SetLinearColors(IN const Color& color1, - IN const Color& color2) - { - return SetStatus(DllExports::GdipSetLineColors((GpLineGradient*)nativeBrush, - color1.GetValue(), - color2.GetValue())); - } - - Status GetLinearColors(OUT Color* colors) const - { - ARGB argb[2]; - - if (colors == NULL) - { - return SetStatus(InvalidParameter); - } - - SetStatus(DllExports::GdipGetLineColors((GpLineGradient*) nativeBrush, argb)); - - if (lastResult == Ok) - { - // use bitwise copy operator for Color copy - colors[0] = Color(argb[0]); - colors[1] = Color(argb[1]); - } - - return lastResult; - } - - Status GetRectangle(OUT RectF* rect) const - { - return SetStatus(DllExports::GdipGetLineRect((GpLineGradient*)nativeBrush, rect)); - } - - // integer version - Status GetRectangle(OUT Rect* rect) const - { - return SetStatus(DllExports::GdipGetLineRectI((GpLineGradient*)nativeBrush, rect)); - } - - // Gamma correction in interporlation. - - Status SetGammaCorrection(IN BOOL useGammaCorrection) - { - return SetStatus(DllExports::GdipSetLineGammaCorrection((GpLineGradient*)nativeBrush, - useGammaCorrection)); - } - - BOOL GetGammaCorrection() const - { - BOOL useGammaCorrection; - - SetStatus(DllExports::GdipGetLineGammaCorrection((GpLineGradient*)nativeBrush, - &useGammaCorrection)); - - return useGammaCorrection; - } - - INT GetBlendCount() const - { - INT count = 0; - - SetStatus(DllExports::GdipGetLineBlendCount((GpLineGradient*) - nativeBrush, - &count)); - - return count; - } - - Status SetBlend(IN const REAL* blendFactors, - IN const REAL* blendPositions, - IN INT count) - { - return SetStatus(DllExports::GdipSetLineBlend((GpLineGradient*) - nativeBrush, - blendFactors, - blendPositions, - count)); - } - - Status GetBlend(OUT REAL* blendFactors, - OUT REAL* blendPositions, - IN INT count) const - { - return SetStatus(DllExports::GdipGetLineBlend((GpLineGradient*)nativeBrush, - blendFactors, - blendPositions, - count)); - } - - INT GetInterpolationColorCount() const - { - INT count = 0; - - SetStatus(DllExports::GdipGetLinePresetBlendCount((GpLineGradient*) - nativeBrush, - &count)); - - return count; - } - - Status SetInterpolationColors(IN const Color* presetColors, - IN const REAL* blendPositions, - IN INT count) - { - if ((count <= 0) || !presetColors) - return SetStatus(InvalidParameter); - - ARGB *argbs = (ARGB*) new BYTE[count*sizeof(ARGB)]; - - if (argbs) - { - for (INT i = 0; i < count; i++) - { - argbs[i] = presetColors[i].GetValue(); - } - - Status status = SetStatus(DllExports::GdipSetLinePresetBlend( - (GpLineGradient*) nativeBrush, - argbs, - blendPositions, - count)); - delete [] argbs; - return status; - } - else - { - return SetStatus(OutOfMemory); - } - } - - Status GetInterpolationColors(OUT Color* presetColors, - OUT REAL* blendPositions, - IN INT count) const - { - if ((count <= 0) || !presetColors) - return SetStatus(InvalidParameter); - - ARGB* argbs = (ARGB*) new BYTE[count*sizeof(ARGB)]; - - if (!argbs) - { - return SetStatus(OutOfMemory); - } - - Status status = SetStatus(DllExports::GdipGetLinePresetBlend((GpLineGradient*)nativeBrush, - argbs, - blendPositions, - count)); - if (status == Ok) - { - for (INT i = 0; i < count; i++) - { - presetColors[i] = Color(argbs[i]); - } - } - - delete [] argbs; - - return status; - } - - Status SetBlendBellShape(IN REAL focus, - IN REAL scale = 1.0) - { - return SetStatus(DllExports::GdipSetLineSigmaBlend((GpLineGradient*)nativeBrush, focus, scale)); - } - - #ifdef DCR_USE_NEW_145135 - Status SetBlendTriangularShape( - IN REAL focus, - IN REAL scale = 1.0 - ) - #else - Status SetBlendTrianglarShape(IN REAL focus, - IN REAL scale = 1.0) - #endif - { - return SetStatus(DllExports::GdipSetLineLinearBlend((GpLineGradient*)nativeBrush, focus, scale)); - } - - /** - * Set/get brush transform - */ - Status SetTransform(IN const Matrix* matrix) - { - return SetStatus(DllExports::GdipSetLineTransform((GpLineGradient*)nativeBrush, - matrix->nativeMatrix)); - } - - Status GetTransform(OUT Matrix *matrix) const - { - return SetStatus(DllExports::GdipGetLineTransform((GpLineGradient*)nativeBrush, - matrix->nativeMatrix)); - } - - Status ResetTransform() - { - return SetStatus(DllExports::GdipResetLineTransform((GpLineGradient*)nativeBrush)); - } - - Status MultiplyTransform(IN const Matrix* matrix, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipMultiplyLineTransform((GpLineGradient*)nativeBrush, - matrix->nativeMatrix, - order)); - } - - Status TranslateTransform(IN REAL dx, - IN REAL dy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipTranslateLineTransform((GpLineGradient*)nativeBrush, - dx, dy, order)); - } - - Status ScaleTransform(IN REAL sx, - IN REAL sy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipScaleLineTransform((GpLineGradient*)nativeBrush, - sx, sy, order)); - } - - Status RotateTransform(IN REAL angle, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipRotateLineTransform((GpLineGradient*)nativeBrush, - angle, order)); - } - - /** - * Set/get brush wrapping mode - */ - Status SetWrapMode(IN WrapMode wrapMode) - { - return SetStatus(DllExports::GdipSetLineWrapMode((GpLineGradient*)nativeBrush, - wrapMode)); - } - - WrapMode GetWrapMode() const - { - WrapMode wrapMode; - - SetStatus(DllExports::GdipGetLineWrapMode((GpLineGradient*) - nativeBrush, - &wrapMode)); - - return wrapMode; - } - -#ifdef DCR_USE_NEW_250932 - -private: - LinearGradientBrush(const LinearGradientBrush &); - LinearGradientBrush& operator=(const LinearGradientBrush &); - -#endif - -protected: - - LinearGradientBrush() - { - } -}; - -//-------------------------------------------------------------------------- -// PathGradientBrush object is defined -// in gdipluspath.h. -//-------------------------------------------------------------------------- - -//-------------------------------------------------------------------------- -// Represent hatch brush object -//-------------------------------------------------------------------------- - -class HatchBrush : public Brush -{ -public: - friend class Pen; - - // Constructors - - HatchBrush(IN HatchStyle hatchStyle, - IN const Color& foreColor, - IN const Color& backColor = Color()) - { - GpHatch *brush = NULL; - - lastResult = DllExports::GdipCreateHatchBrush(hatchStyle, - foreColor.GetValue(), - backColor.GetValue(), - &brush); - SetNativeBrush(brush); - } - - HatchStyle GetHatchStyle() const - { - HatchStyle hatchStyle; - - SetStatus(DllExports::GdipGetHatchStyle((GpHatch*)nativeBrush, - &hatchStyle)); - - return hatchStyle; - } - - Status GetForegroundColor(OUT Color* color) const - { - ARGB argb; - - if (color == NULL) - { - return SetStatus(InvalidParameter); - } - - Status status = SetStatus(DllExports::GdipGetHatchForegroundColor( - (GpHatch*)nativeBrush, - &argb)); - - color->SetValue(argb); - - return status; - } - - Status GetBackgroundColor(OUT Color *color) const - { - ARGB argb; - - if (color == NULL) - { - return SetStatus(InvalidParameter); - } - - Status status = SetStatus(DllExports::GdipGetHatchBackgroundColor( - (GpHatch*)nativeBrush, - &argb)); - - color->SetValue(argb); - - return status; - } - -#ifdef DCR_USE_NEW_250932 - -private: - HatchBrush(const HatchBrush &); - HatchBrush& operator=(const HatchBrush &); - -#endif - -protected: - - HatchBrush() - { - } -}; - -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusBrush.h +* +* Abstract: +* +* Brush API related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSBRUSH_H +#define _GDIPLUSBRUSH_H + +//-------------------------------------------------------------------------- +// Abstract base class for various brush types +//-------------------------------------------------------------------------- + +class GraphicsPath; + +class Brush : public GdiplusBase +{ +public: + friend class Pen; + friend class Graphics; + + virtual ~Brush() + { + DllExports::GdipDeleteBrush(nativeBrush); + } + + virtual Brush* Clone() const + { + GpBrush *brush = NULL; + + SetStatus(DllExports::GdipCloneBrush(nativeBrush, &brush)); + + Brush *newBrush = new Brush(brush, lastResult); + + if (newBrush == NULL) + { + DllExports::GdipDeleteBrush(brush); + } + + return newBrush; + } + + BrushType GetType() const + { + BrushType type = static_cast(-1); + + SetStatus(DllExports::GdipGetBrushType(nativeBrush, &type)); + + return type; + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +protected: + + Brush() + { + SetStatus(NotImplemented); + } + +#ifdef DCR_USE_NEW_250932 + +private: + Brush(const Brush& brush); + Brush& operator=(const Brush& brush); +protected: + +#else + + Brush(const Brush& brush) + { + brush; + SetStatus(NotImplemented); + } + + Brush& operator=(const Brush& brush) + { + brush; + SetStatus(NotImplemented); + return *this; + } + +#endif + + Brush(GpBrush* nativeBrush, Status status) + { + lastResult = status; + SetNativeBrush(nativeBrush); + } + + VOID SetNativeBrush(GpBrush* nativeBrush) + { + this->nativeBrush = nativeBrush; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + + GpBrush* nativeBrush; + mutable Status lastResult; +}; + +//-------------------------------------------------------------------------- +// Represent solid fill brush object +//-------------------------------------------------------------------------- + +class SolidBrush : public Brush +{ +public: + friend class Pen; + + SolidBrush(IN const Color& color) + { + GpSolidFill *brush = NULL; + + lastResult = DllExports::GdipCreateSolidFill(color.GetValue(), &brush); + + SetNativeBrush(brush); + } + + Status GetColor(OUT Color* color) const + { + ARGB argb; + + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + SetStatus(DllExports::GdipGetSolidFillColor((GpSolidFill*)nativeBrush, + &argb)); + + *color = Color(argb); + + return lastResult; + } + + Status SetColor(IN const Color& color) + { + return SetStatus(DllExports::GdipSetSolidFillColor((GpSolidFill*)nativeBrush, + color.GetValue())); + } + +#ifdef DCR_USE_NEW_250932 + +private: + SolidBrush(const SolidBrush &); + SolidBrush& operator=(const SolidBrush &); + +#endif + +protected: + + SolidBrush() + { + } +}; + +class TextureBrush : public Brush +{ +public: + friend class Pen; + + TextureBrush(IN Image* image, + IN WrapMode wrapMode = WrapModeTile) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture( + image->nativeImage, + wrapMode, &texture); + + SetNativeBrush(texture); + } + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + TextureBrush(IN Image* image, + IN WrapMode wrapMode, + IN const RectF &dstRect) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture2( + image->nativeImage, + wrapMode, + dstRect.X, + dstRect.Y, + dstRect.Width, + dstRect.Height, + &texture); + + SetNativeBrush(texture); + } + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + + TextureBrush(IN Image *image, + IN const RectF &dstRect, + IN const ImageAttributes *imageAttributes = NULL) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTextureIA( + image->nativeImage, + (imageAttributes)?imageAttributes->nativeImageAttr:NULL, + dstRect.X, + dstRect.Y, + dstRect.Width, + dstRect.Height, + &texture + ); + + SetNativeBrush(texture); + } + + #ifdef DCR_USE_NEW_145138 + TextureBrush(IN Image *image, + IN const Rect &dstRect, + IN const ImageAttributes *imageAttributes = NULL) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTextureIAI( + image->nativeImage, + (imageAttributes)?imageAttributes->nativeImageAttr:NULL, + dstRect.X, + dstRect.Y, + dstRect.Width, + dstRect.Height, + &texture + ); + + SetNativeBrush(texture); + } + #endif + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + + TextureBrush( + IN Image* image, + IN WrapMode wrapMode, + + #ifdef DCR_USE_NEW_145138 + const IN Rect &dstRect + #else + IN Rect &dstRect + #endif + ) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture2I( + image->nativeImage, + wrapMode, + dstRect.X, + dstRect.Y, + dstRect.Width, + dstRect.Height, + &texture); + + SetNativeBrush(texture); + } + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + TextureBrush(IN Image* image, + IN WrapMode wrapMode, + IN REAL dstX, + IN REAL dstY, + IN REAL dstWidth, + IN REAL dstHeight) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture2( + image->nativeImage, + wrapMode, + dstX, + dstY, + dstWidth, + dstHeight, + &texture); + + SetNativeBrush(texture); + } + + // When creating a texture brush from a metafile image, the dstRect + // is used to specify the size that the metafile image should be + // rendered at in the device units of the destination graphics. + // It is NOT used to crop the metafile image, so only the width + // and height values matter for metafiles. + TextureBrush(IN Image* image, + IN WrapMode wrapMode, + IN INT dstX, + IN INT dstY, + IN INT dstWidth, + IN INT dstHeight) + { + GpTexture *texture = NULL; + + lastResult = DllExports::GdipCreateTexture2I( + image->nativeImage, + wrapMode, + dstX, + dstY, + dstWidth, + dstHeight, + &texture); + + SetNativeBrush(texture); + } + + /** + * Set/get brush transform + */ + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetTextureTransform((GpTexture*)nativeBrush, + matrix->nativeMatrix)); + } + + Status GetTransform(OUT Matrix* matrix) const + { + return SetStatus(DllExports::GdipGetTextureTransform((GpTexture*)nativeBrush, + matrix->nativeMatrix)); + } + + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetTextureTransform((GpTexture*)nativeBrush)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyTextureTransform((GpTexture*)nativeBrush, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslateTextureTransform((GpTexture*)nativeBrush, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScaleTextureTransform((GpTexture*)nativeBrush, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotateTextureTransform((GpTexture*)nativeBrush, + angle, order)); + } + + /** + * Set/get brush wrapping mode + */ + Status SetWrapMode(IN WrapMode wrapMode) + { + return SetStatus(DllExports::GdipSetTextureWrapMode((GpTexture*)nativeBrush, + wrapMode)); + } + + WrapMode GetWrapMode() const + { + WrapMode wrapMode; + + SetStatus(DllExports::GdipGetTextureWrapMode((GpTexture*)nativeBrush, + &wrapMode)); + return wrapMode; + } + + // Get texture brush attributes + + Image *GetImage() const + { + GpImage *image; + + SetStatus(DllExports::GdipGetTextureImage((GpTexture *)nativeBrush, + &image)); + + Image *retimage = new Image(image, lastResult); + + if (retimage == NULL) + { + DllExports::GdipDisposeImage(image); + } + + return retimage; + } + +#ifdef DCR_USE_NEW_250932 + +private: + TextureBrush(const TextureBrush &); + TextureBrush& operator=(const TextureBrush &); + +#endif + +protected: + + TextureBrush() + { + } +}; + +//-------------------------------------------------------------------------- +// Represent line gradient brush object +//-------------------------------------------------------------------------- + +class LinearGradientBrush : public Brush +{ +public: + friend class Pen; + + LinearGradientBrush(IN const PointF& point1, + IN const PointF& point2, + IN const Color& color1, + IN const Color& color2) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrush(&point1, + &point2, + color1.GetValue(), + color2.GetValue(), + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const Point& point1, + IN const Point& point2, + IN const Color& color1, + IN const Color& color2) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushI(&point1, + &point2, + color1.GetValue(), + color2.GetValue(), + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const RectF& rect, + IN const Color& color1, + IN const Color& color2, + IN LinearGradientMode mode) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushFromRect(&rect, + color1.GetValue(), + color2.GetValue(), + mode, + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const Rect& rect, + IN const Color& color1, + IN const Color& color2, + IN LinearGradientMode mode) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushFromRectI(&rect, + color1.GetValue(), + color2.GetValue(), + mode, + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const RectF& rect, + IN const Color& color1, + IN const Color& color2, + IN REAL angle, + IN BOOL isAngleScalable = FALSE) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushFromRectWithAngle(&rect, + color1.GetValue(), + color2.GetValue(), + angle, + isAngleScalable, + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + LinearGradientBrush(IN const Rect& rect, + IN const Color& color1, + IN const Color& color2, + IN REAL angle, + IN BOOL isAngleScalable = FALSE) + { + GpLineGradient *brush = NULL; + + lastResult = DllExports::GdipCreateLineBrushFromRectWithAngleI(&rect, + color1.GetValue(), + color2.GetValue(), + angle, + isAngleScalable, + WrapModeTile, + &brush); + + SetNativeBrush(brush); + } + + // Get/set point attributes + + Status SetLinearPoints(IN const PointF& point1, + IN const PointF& point2) + { + return SetStatus(DllExports::GdipSetLinePoints((GpLineGradient*)nativeBrush, + &point1, &point2)); + } + + Status GetLinearPoints(OUT PointF* points) const + { + return SetStatus(DllExports::GdipGetLinePoints((GpLineGradient*) nativeBrush, + points)); + } + + Status SetLinearPoints(IN const Point& point1, + IN const Point& point2) + { + return SetStatus(DllExports::GdipSetLinePointsI((GpLineGradient*)nativeBrush, + &point1, &point2)); + } + + Status GetLinearPoints(OUT Point* points) const + { + return SetStatus(DllExports::GdipGetLinePointsI((GpLineGradient*) nativeBrush, + points)); + } + // Get/set color attributes + + Status SetLinearColors(IN const Color& color1, + IN const Color& color2) + { + return SetStatus(DllExports::GdipSetLineColors((GpLineGradient*)nativeBrush, + color1.GetValue(), + color2.GetValue())); + } + + Status GetLinearColors(OUT Color* colors) const + { + ARGB argb[2]; + + if (colors == NULL) + { + return SetStatus(InvalidParameter); + } + + SetStatus(DllExports::GdipGetLineColors((GpLineGradient*) nativeBrush, argb)); + + if (lastResult == Ok) + { + // use bitwise copy operator for Color copy + colors[0] = Color(argb[0]); + colors[1] = Color(argb[1]); + } + + return lastResult; + } + + Status GetRectangle(OUT RectF* rect) const + { + return SetStatus(DllExports::GdipGetLineRect((GpLineGradient*)nativeBrush, rect)); + } + + // integer version + Status GetRectangle(OUT Rect* rect) const + { + return SetStatus(DllExports::GdipGetLineRectI((GpLineGradient*)nativeBrush, rect)); + } + + // Gamma correction in interporlation. + + Status SetGammaCorrection(IN BOOL useGammaCorrection) + { + return SetStatus(DllExports::GdipSetLineGammaCorrection((GpLineGradient*)nativeBrush, + useGammaCorrection)); + } + + BOOL GetGammaCorrection() const + { + BOOL useGammaCorrection; + + SetStatus(DllExports::GdipGetLineGammaCorrection((GpLineGradient*)nativeBrush, + &useGammaCorrection)); + + return useGammaCorrection; + } + + INT GetBlendCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetLineBlendCount((GpLineGradient*) + nativeBrush, + &count)); + + return count; + } + + Status SetBlend(IN const REAL* blendFactors, + IN const REAL* blendPositions, + IN INT count) + { + return SetStatus(DllExports::GdipSetLineBlend((GpLineGradient*) + nativeBrush, + blendFactors, + blendPositions, + count)); + } + + Status GetBlend(OUT REAL* blendFactors, + OUT REAL* blendPositions, + IN INT count) const + { + return SetStatus(DllExports::GdipGetLineBlend((GpLineGradient*)nativeBrush, + blendFactors, + blendPositions, + count)); + } + + INT GetInterpolationColorCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetLinePresetBlendCount((GpLineGradient*) + nativeBrush, + &count)); + + return count; + } + + Status SetInterpolationColors(IN const Color* presetColors, + IN const REAL* blendPositions, + IN INT count) + { + if ((count <= 0) || !presetColors) + return SetStatus(InvalidParameter); + + ARGB *argbs = (ARGB*) new BYTE[count*sizeof(ARGB)]; + + if (argbs) + { + for (INT i = 0; i < count; i++) + { + argbs[i] = presetColors[i].GetValue(); + } + + Status status = SetStatus(DllExports::GdipSetLinePresetBlend( + (GpLineGradient*) nativeBrush, + argbs, + blendPositions, + count)); + delete [] argbs; + return status; + } + else + { + return SetStatus(OutOfMemory); + } + } + + Status GetInterpolationColors(OUT Color* presetColors, + OUT REAL* blendPositions, + IN INT count) const + { + if ((count <= 0) || !presetColors) + return SetStatus(InvalidParameter); + + ARGB* argbs = (ARGB*) new BYTE[count*sizeof(ARGB)]; + + if (!argbs) + { + return SetStatus(OutOfMemory); + } + + Status status = SetStatus(DllExports::GdipGetLinePresetBlend((GpLineGradient*)nativeBrush, + argbs, + blendPositions, + count)); + if (status == Ok) + { + for (INT i = 0; i < count; i++) + { + presetColors[i] = Color(argbs[i]); + } + } + + delete [] argbs; + + return status; + } + + Status SetBlendBellShape(IN REAL focus, + IN REAL scale = 1.0) + { + return SetStatus(DllExports::GdipSetLineSigmaBlend((GpLineGradient*)nativeBrush, focus, scale)); + } + + #ifdef DCR_USE_NEW_145135 + Status SetBlendTriangularShape( + IN REAL focus, + IN REAL scale = 1.0 + ) + #else + Status SetBlendTrianglarShape(IN REAL focus, + IN REAL scale = 1.0) + #endif + { + return SetStatus(DllExports::GdipSetLineLinearBlend((GpLineGradient*)nativeBrush, focus, scale)); + } + + /** + * Set/get brush transform + */ + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetLineTransform((GpLineGradient*)nativeBrush, + matrix->nativeMatrix)); + } + + Status GetTransform(OUT Matrix *matrix) const + { + return SetStatus(DllExports::GdipGetLineTransform((GpLineGradient*)nativeBrush, + matrix->nativeMatrix)); + } + + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetLineTransform((GpLineGradient*)nativeBrush)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyLineTransform((GpLineGradient*)nativeBrush, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslateLineTransform((GpLineGradient*)nativeBrush, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScaleLineTransform((GpLineGradient*)nativeBrush, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotateLineTransform((GpLineGradient*)nativeBrush, + angle, order)); + } + + /** + * Set/get brush wrapping mode + */ + Status SetWrapMode(IN WrapMode wrapMode) + { + return SetStatus(DllExports::GdipSetLineWrapMode((GpLineGradient*)nativeBrush, + wrapMode)); + } + + WrapMode GetWrapMode() const + { + WrapMode wrapMode; + + SetStatus(DllExports::GdipGetLineWrapMode((GpLineGradient*) + nativeBrush, + &wrapMode)); + + return wrapMode; + } + +#ifdef DCR_USE_NEW_250932 + +private: + LinearGradientBrush(const LinearGradientBrush &); + LinearGradientBrush& operator=(const LinearGradientBrush &); + +#endif + +protected: + + LinearGradientBrush() + { + } +}; + +//-------------------------------------------------------------------------- +// PathGradientBrush object is defined +// in gdipluspath.h. +//-------------------------------------------------------------------------- + +//-------------------------------------------------------------------------- +// Represent hatch brush object +//-------------------------------------------------------------------------- + +class HatchBrush : public Brush +{ +public: + friend class Pen; + + // Constructors + + HatchBrush(IN HatchStyle hatchStyle, + IN const Color& foreColor, + IN const Color& backColor = Color()) + { + GpHatch *brush = NULL; + + lastResult = DllExports::GdipCreateHatchBrush(hatchStyle, + foreColor.GetValue(), + backColor.GetValue(), + &brush); + SetNativeBrush(brush); + } + + HatchStyle GetHatchStyle() const + { + HatchStyle hatchStyle; + + SetStatus(DllExports::GdipGetHatchStyle((GpHatch*)nativeBrush, + &hatchStyle)); + + return hatchStyle; + } + + Status GetForegroundColor(OUT Color* color) const + { + ARGB argb; + + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + Status status = SetStatus(DllExports::GdipGetHatchForegroundColor( + (GpHatch*)nativeBrush, + &argb)); + + color->SetValue(argb); + + return status; + } + + Status GetBackgroundColor(OUT Color *color) const + { + ARGB argb; + + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + Status status = SetStatus(DllExports::GdipGetHatchBackgroundColor( + (GpHatch*)nativeBrush, + &argb)); + + color->SetValue(argb); + + return status; + } + +#ifdef DCR_USE_NEW_250932 + +private: + HatchBrush(const HatchBrush &); + HatchBrush& operator=(const HatchBrush &); + +#endif + +protected: + + HatchBrush() + { + } +}; + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusCachedBitmap.h b/core/src/fxge/Microsoft SDK/include/GdiPlusCachedBitmap.h index 28fd8caea6..3bafebeb40 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusCachedBitmap.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusCachedBitmap.h @@ -1,71 +1,71 @@ -/************************************************************************** -* -* Copyright (c) 2000 Microsoft Corporation -* -* Module Name: -* -* CachedBitmap class definition -* -* Abstract: -* -* CachedBitmap is a representation of an accelerated drawing -* that has restrictions on what operations are allowed in order -* to accelerate the drawing to the destination. -* -**************************************************************************/ - -#ifndef _GDIPLUSCACHEDBITMAP_H -#define _GDIPLUSCACHEDBITMAP_H - -/************************************************************************** -* -* Class Name: -* -* CachedBitmap -* -* Abstract: -* -* An object to store a bitmap prepared for rendering on a particular -* Graphics object. The memory storage for the CachedBitmap is opaque -* to the other Engine code, so the only operations supported are -* initializing the data (with a bitmap) and using the graphics to -* draw it on the screen with an integer offset. -* -* Look for the class definition in GdiplusHeaders.h -* -* Created: -* -* 04/23/2000 asecchia -* Created it. -* -**************************************************************************/ -inline -CachedBitmap::CachedBitmap( - IN Bitmap *bitmap, - IN Graphics *graphics) -{ - nativeCachedBitmap = NULL; - - lastResult = DllExports::GdipCreateCachedBitmap( - (GpBitmap *)bitmap->nativeImage, - graphics->nativeGraphics, - &nativeCachedBitmap - ); -} - -inline -CachedBitmap::~CachedBitmap() -{ - DllExports::GdipDeleteCachedBitmap(nativeCachedBitmap); -} - -inline Status -CachedBitmap::GetLastStatus() const -{ - Status lastStatus = lastResult; - lastResult = Ok; - return (lastStatus); -} - -#endif - +/************************************************************************** +* +* Copyright (c) 2000 Microsoft Corporation +* +* Module Name: +* +* CachedBitmap class definition +* +* Abstract: +* +* CachedBitmap is a representation of an accelerated drawing +* that has restrictions on what operations are allowed in order +* to accelerate the drawing to the destination. +* +**************************************************************************/ + +#ifndef _GDIPLUSCACHEDBITMAP_H +#define _GDIPLUSCACHEDBITMAP_H + +/************************************************************************** +* +* Class Name: +* +* CachedBitmap +* +* Abstract: +* +* An object to store a bitmap prepared for rendering on a particular +* Graphics object. The memory storage for the CachedBitmap is opaque +* to the other Engine code, so the only operations supported are +* initializing the data (with a bitmap) and using the graphics to +* draw it on the screen with an integer offset. +* +* Look for the class definition in GdiplusHeaders.h +* +* Created: +* +* 04/23/2000 asecchia +* Created it. +* +**************************************************************************/ +inline +CachedBitmap::CachedBitmap( + IN Bitmap *bitmap, + IN Graphics *graphics) +{ + nativeCachedBitmap = NULL; + + lastResult = DllExports::GdipCreateCachedBitmap( + (GpBitmap *)bitmap->nativeImage, + graphics->nativeGraphics, + &nativeCachedBitmap + ); +} + +inline +CachedBitmap::~CachedBitmap() +{ + DllExports::GdipDeleteCachedBitmap(nativeCachedBitmap); +} + +inline Status +CachedBitmap::GetLastStatus() const +{ + Status lastStatus = lastResult; + lastResult = Ok; + return (lastStatus); +} + +#endif + diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusColor.h b/core/src/fxge/Microsoft SDK/include/GdiPlusColor.h index 72c21c295f..7ec10f8434 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusColor.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusColor.h @@ -1,209 +1,209 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusColor.h -* -* Abstract: -* -* Represents a GDI+ color. -* -\**************************************************************************/ - -#ifndef _GDIPLUSCOLOR_H -#define _GDIPLUSCOLOR_H - -//---------------------------------------------------------------------------- -// Color mode -//---------------------------------------------------------------------------- - -enum ColorMode -{ - ColorModeARGB32 = 0, - ColorModeARGB64 = 1 -}; - -//---------------------------------------------------------------------------- -// Color Channel flags -//---------------------------------------------------------------------------- - -enum ColorChannelFlags -{ - ColorChannelFlagsC = 0, - ColorChannelFlagsM, - ColorChannelFlagsY, - ColorChannelFlagsK, - ColorChannelFlagsLast -}; - -//---------------------------------------------------------------------------- -// Color -//---------------------------------------------------------------------------- - -class Color -{ -public: - - Color() - { - Argb = (ARGB)Color::Black; - } - - // Construct an opaque Color object with - // the specified R, G, B values. - - Color(IN BYTE r, - IN BYTE g, - IN BYTE b) - { - Argb = MakeARGB(255, r, g, b); - } - - // Construct a Color object with - // the specified A, R, G, B values. - // - // NOTE: R, G, B color values are not premultiplied. - - Color(IN BYTE a, - IN BYTE r, - IN BYTE g, - IN BYTE b) - { - Argb = MakeARGB(a, r, g, b); - } - - // Construct a Color object with - // the specified ARGB values. - // - // NOTE: R, G, B color components are not premultiplied. - - Color(IN ARGB argb) - { - Argb = argb; - } - - // Extract A, R, G, B components - - BYTE GetAlpha() const - { - return (BYTE) (Argb >> AlphaShift); - } - - BYTE GetA() const - { - return GetAlpha(); - } - - BYTE GetRed() const - { - return (BYTE) (Argb >> RedShift); - } - - BYTE GetR() const - { - return GetRed(); - } - - BYTE GetGreen() const - { - return (BYTE) (Argb >> GreenShift); - } - - BYTE GetG() const - { - return GetGreen(); - } - - BYTE GetBlue() const - { - return (BYTE) (Argb >> BlueShift); - } - - BYTE GetB() const - { - return GetBlue(); - } - - // Retrieve ARGB values - - ARGB GetValue() const - { - return Argb; - } - - VOID SetValue(IN ARGB argb) - { - Argb = argb; - } - - VOID SetFromCOLORREF(IN COLORREF rgb) - { - Argb = MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); - } - - COLORREF ToCOLORREF() const - { - return RGB(GetRed(), GetGreen(), GetBlue()); - } - -public: - - // Standard color constants - enum - { - Black = 0xff000000, - Silver = 0xffc0c0c0, - Gray = 0xff808080, - White = 0xffffffff, - Maroon = 0xff800000, - Red = 0xffff0000, - Purple = 0xff800080, - Fuchsia = 0xffff00ff, - Green = 0xff008000, - Lime = 0xff00ff00, - Olive = 0xff808000, - Yellow = 0xffffff00, - Navy = 0xff000080, - Blue = 0xff0000ff, - Teal = 0xff008080, - Aqua = 0xff00ffff - }; - - // Shift count and bit mask for A, R, G, B components - enum - { - AlphaShift = 24, - RedShift = 16, - GreenShift = 8, - BlueShift = 0 - }; - - enum - { - AlphaMask = 0xff000000, - RedMask = 0x00ff0000, - GreenMask = 0x0000ff00, - BlueMask = 0x000000ff - }; - - // Assemble A, R, G, B values into a 32-bit integer - static ARGB MakeARGB(IN BYTE a, - IN BYTE r, - IN BYTE g, - IN BYTE b) - { - return (((ARGB) (b) << BlueShift) | - ((ARGB) (g) << GreenShift) | - ((ARGB) (r) << RedShift) | - ((ARGB) (a) << AlphaShift)); - } - -protected: - - ARGB Argb; -}; - -#endif - +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusColor.h +* +* Abstract: +* +* Represents a GDI+ color. +* +\**************************************************************************/ + +#ifndef _GDIPLUSCOLOR_H +#define _GDIPLUSCOLOR_H + +//---------------------------------------------------------------------------- +// Color mode +//---------------------------------------------------------------------------- + +enum ColorMode +{ + ColorModeARGB32 = 0, + ColorModeARGB64 = 1 +}; + +//---------------------------------------------------------------------------- +// Color Channel flags +//---------------------------------------------------------------------------- + +enum ColorChannelFlags +{ + ColorChannelFlagsC = 0, + ColorChannelFlagsM, + ColorChannelFlagsY, + ColorChannelFlagsK, + ColorChannelFlagsLast +}; + +//---------------------------------------------------------------------------- +// Color +//---------------------------------------------------------------------------- + +class Color +{ +public: + + Color() + { + Argb = (ARGB)Color::Black; + } + + // Construct an opaque Color object with + // the specified R, G, B values. + + Color(IN BYTE r, + IN BYTE g, + IN BYTE b) + { + Argb = MakeARGB(255, r, g, b); + } + + // Construct a Color object with + // the specified A, R, G, B values. + // + // NOTE: R, G, B color values are not premultiplied. + + Color(IN BYTE a, + IN BYTE r, + IN BYTE g, + IN BYTE b) + { + Argb = MakeARGB(a, r, g, b); + } + + // Construct a Color object with + // the specified ARGB values. + // + // NOTE: R, G, B color components are not premultiplied. + + Color(IN ARGB argb) + { + Argb = argb; + } + + // Extract A, R, G, B components + + BYTE GetAlpha() const + { + return (BYTE) (Argb >> AlphaShift); + } + + BYTE GetA() const + { + return GetAlpha(); + } + + BYTE GetRed() const + { + return (BYTE) (Argb >> RedShift); + } + + BYTE GetR() const + { + return GetRed(); + } + + BYTE GetGreen() const + { + return (BYTE) (Argb >> GreenShift); + } + + BYTE GetG() const + { + return GetGreen(); + } + + BYTE GetBlue() const + { + return (BYTE) (Argb >> BlueShift); + } + + BYTE GetB() const + { + return GetBlue(); + } + + // Retrieve ARGB values + + ARGB GetValue() const + { + return Argb; + } + + VOID SetValue(IN ARGB argb) + { + Argb = argb; + } + + VOID SetFromCOLORREF(IN COLORREF rgb) + { + Argb = MakeARGB(255, GetRValue(rgb), GetGValue(rgb), GetBValue(rgb)); + } + + COLORREF ToCOLORREF() const + { + return RGB(GetRed(), GetGreen(), GetBlue()); + } + +public: + + // Standard color constants + enum + { + Black = 0xff000000, + Silver = 0xffc0c0c0, + Gray = 0xff808080, + White = 0xffffffff, + Maroon = 0xff800000, + Red = 0xffff0000, + Purple = 0xff800080, + Fuchsia = 0xffff00ff, + Green = 0xff008000, + Lime = 0xff00ff00, + Olive = 0xff808000, + Yellow = 0xffffff00, + Navy = 0xff000080, + Blue = 0xff0000ff, + Teal = 0xff008080, + Aqua = 0xff00ffff + }; + + // Shift count and bit mask for A, R, G, B components + enum + { + AlphaShift = 24, + RedShift = 16, + GreenShift = 8, + BlueShift = 0 + }; + + enum + { + AlphaMask = 0xff000000, + RedMask = 0x00ff0000, + GreenMask = 0x0000ff00, + BlueMask = 0x000000ff + }; + + // Assemble A, R, G, B values into a 32-bit integer + static ARGB MakeARGB(IN BYTE a, + IN BYTE r, + IN BYTE g, + IN BYTE b) + { + return (((ARGB) (b) << BlueShift) | + ((ARGB) (g) << GreenShift) | + ((ARGB) (r) << RedShift) | + ((ARGB) (a) << AlphaShift)); + } + +protected: + + ARGB Argb; +}; + +#endif + diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusColorMatrix.h b/core/src/fxge/Microsoft SDK/include/GdiPlusColorMatrix.h index d1d9ebc534..ec4d14b191 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusColorMatrix.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusColorMatrix.h @@ -1,63 +1,63 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusColorMatrix.h -* -* Abstract: -* -* Class for color adjustment object passed to Graphics.DrawImage -* -\**************************************************************************/ - -#ifndef _GDIPLUSCOLORMATRIX_H -#define _GDIPLUSCOLORMATRIX_H - -//---------------------------------------------------------------------------- -// Color matrix -//---------------------------------------------------------------------------- - -struct ColorMatrix -{ - REAL m[5][5]; -}; - -//---------------------------------------------------------------------------- -// Color Matrix flags -//---------------------------------------------------------------------------- - -enum ColorMatrixFlags -{ - ColorMatrixFlagsDefault = 0, - ColorMatrixFlagsSkipGrays = 1, - ColorMatrixFlagsAltGray = 2 -}; - -//---------------------------------------------------------------------------- -// Color Adjust Type -//---------------------------------------------------------------------------- - -enum ColorAdjustType -{ - ColorAdjustTypeDefault, - ColorAdjustTypeBitmap, - ColorAdjustTypeBrush, - ColorAdjustTypePen, - ColorAdjustTypeText, - ColorAdjustTypeCount, // must be immediately after all the individual ones - ColorAdjustTypeAny // internal use: for querying if any type has recoloring -}; - -//---------------------------------------------------------------------------- -// Color Map -//---------------------------------------------------------------------------- - -struct ColorMap -{ - Color oldColor; - Color newColor; -}; - -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusColorMatrix.h +* +* Abstract: +* +* Class for color adjustment object passed to Graphics.DrawImage +* +\**************************************************************************/ + +#ifndef _GDIPLUSCOLORMATRIX_H +#define _GDIPLUSCOLORMATRIX_H + +//---------------------------------------------------------------------------- +// Color matrix +//---------------------------------------------------------------------------- + +struct ColorMatrix +{ + REAL m[5][5]; +}; + +//---------------------------------------------------------------------------- +// Color Matrix flags +//---------------------------------------------------------------------------- + +enum ColorMatrixFlags +{ + ColorMatrixFlagsDefault = 0, + ColorMatrixFlagsSkipGrays = 1, + ColorMatrixFlagsAltGray = 2 +}; + +//---------------------------------------------------------------------------- +// Color Adjust Type +//---------------------------------------------------------------------------- + +enum ColorAdjustType +{ + ColorAdjustTypeDefault, + ColorAdjustTypeBitmap, + ColorAdjustTypeBrush, + ColorAdjustTypePen, + ColorAdjustTypeText, + ColorAdjustTypeCount, // must be immediately after all the individual ones + ColorAdjustTypeAny // internal use: for querying if any type has recoloring +}; + +//---------------------------------------------------------------------------- +// Color Map +//---------------------------------------------------------------------------- + +struct ColorMap +{ + Color oldColor; + Color newColor; +}; + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusEnums.h b/core/src/fxge/Microsoft SDK/include/GdiPlusEnums.h index 92a29c7463..9962ff586a 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusEnums.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusEnums.h @@ -1,1252 +1,1252 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusEnums.h -* -* Abstract: -* -* Various enumeration types -* -\**************************************************************************/ - -#ifndef _GDIPLUSENUMS_H -#define _GDIPLUSENUMS_H - - -//-------------------------------------------------------------------------- -// Default bezier flattening tolerance in device pixels. -//-------------------------------------------------------------------------- - -const float FlatnessDefault = 1.0f/4.0f; - -//-------------------------------------------------------------------------- -// Graphics and Container State cookies -//-------------------------------------------------------------------------- - -typedef UINT GraphicsState; -typedef UINT GraphicsContainer; - -//-------------------------------------------------------------------------- -// Fill mode constants -//-------------------------------------------------------------------------- - -enum FillMode -{ - FillModeAlternate, // 0 - FillModeWinding // 1 -}; - -//-------------------------------------------------------------------------- -// Quality mode constants -//-------------------------------------------------------------------------- - -enum QualityMode -{ - QualityModeInvalid = -1, - QualityModeDefault = 0, - QualityModeLow = 1, // for apps that need the best performance - QualityModeHigh = 2 // for apps that need the best rendering quality -}; - -//-------------------------------------------------------------------------- -// Alpha compositing mode constants -//-------------------------------------------------------------------------- - -enum CompositingMode -{ - CompositingModeSourceOver, // 0 - CompositingModeSourceCopy // 1 -}; - -//-------------------------------------------------------------------------- -// Alpha compositing quality constants -//-------------------------------------------------------------------------- - -enum CompositingQuality -{ - CompositingQualityInvalid = QualityModeInvalid, - CompositingQualityDefault = QualityModeDefault, - CompositingQualityHighSpeed = QualityModeLow, - CompositingQualityHighQuality = QualityModeHigh, - CompositingQualityGammaCorrected, - CompositingQualityAssumeLinear -}; - -//-------------------------------------------------------------------------- -// Unit constants -//-------------------------------------------------------------------------- - -enum Unit -{ - UnitWorld, // 0 -- World coordinate (non-physical unit) - UnitDisplay, // 1 -- Variable -- for PageTransform only - UnitPixel, // 2 -- Each unit is one device pixel. - UnitPoint, // 3 -- Each unit is a printer's point, or 1/72 inch. - UnitInch, // 4 -- Each unit is 1 inch. - UnitDocument, // 5 -- Each unit is 1/300 inch. - UnitMillimeter // 6 -- Each unit is 1 millimeter. -}; - -//-------------------------------------------------------------------------- -// MetafileFrameUnit -// -// The frameRect for creating a metafile can be specified in any of these -// units. There is an extra frame unit value (MetafileFrameUnitGdi) so -// that units can be supplied in the same units that GDI expects for -// frame rects -- these units are in .01 (1/100ths) millimeter units -// as defined by GDI. -//-------------------------------------------------------------------------- -enum MetafileFrameUnit -{ - MetafileFrameUnitPixel = UnitPixel, - MetafileFrameUnitPoint = UnitPoint, - MetafileFrameUnitInch = UnitInch, - MetafileFrameUnitDocument = UnitDocument, - MetafileFrameUnitMillimeter = UnitMillimeter, - MetafileFrameUnitGdi // GDI compatible .01 MM units -}; - -//-------------------------------------------------------------------------- -// Coordinate space identifiers -//-------------------------------------------------------------------------- - -enum CoordinateSpace -{ - CoordinateSpaceWorld, // 0 - CoordinateSpacePage, // 1 - CoordinateSpaceDevice // 2 -}; - -//-------------------------------------------------------------------------- -// Various wrap modes for brushes -//-------------------------------------------------------------------------- - -enum WrapMode -{ - WrapModeTile, // 0 - WrapModeTileFlipX, // 1 - WrapModeTileFlipY, // 2 - WrapModeTileFlipXY, // 3 - WrapModeClamp // 4 -}; - -//-------------------------------------------------------------------------- -// Various hatch styles -//-------------------------------------------------------------------------- - -enum HatchStyle -{ - HatchStyleHorizontal, // 0 - HatchStyleVertical, // 1 - HatchStyleForwardDiagonal, // 2 - HatchStyleBackwardDiagonal, // 3 - HatchStyleCross, // 4 - HatchStyleDiagonalCross, // 5 - HatchStyle05Percent, // 6 - HatchStyle10Percent, // 7 - HatchStyle20Percent, // 8 - HatchStyle25Percent, // 9 - HatchStyle30Percent, // 10 - HatchStyle40Percent, // 11 - HatchStyle50Percent, // 12 - HatchStyle60Percent, // 13 - HatchStyle70Percent, // 14 - HatchStyle75Percent, // 15 - HatchStyle80Percent, // 16 - HatchStyle90Percent, // 17 - HatchStyleLightDownwardDiagonal, // 18 - HatchStyleLightUpwardDiagonal, // 19 - HatchStyleDarkDownwardDiagonal, // 20 - HatchStyleDarkUpwardDiagonal, // 21 - HatchStyleWideDownwardDiagonal, // 22 - HatchStyleWideUpwardDiagonal, // 23 - HatchStyleLightVertical, // 24 - HatchStyleLightHorizontal, // 25 - HatchStyleNarrowVertical, // 26 - HatchStyleNarrowHorizontal, // 27 - HatchStyleDarkVertical, // 28 - HatchStyleDarkHorizontal, // 29 - HatchStyleDashedDownwardDiagonal, // 30 - HatchStyleDashedUpwardDiagonal, // 31 - HatchStyleDashedHorizontal, // 32 - HatchStyleDashedVertical, // 33 - HatchStyleSmallConfetti, // 34 - HatchStyleLargeConfetti, // 35 - HatchStyleZigZag, // 36 - HatchStyleWave, // 37 - HatchStyleDiagonalBrick, // 38 - HatchStyleHorizontalBrick, // 39 - HatchStyleWeave, // 40 - HatchStylePlaid, // 41 - HatchStyleDivot, // 42 - HatchStyleDottedGrid, // 43 - HatchStyleDottedDiamond, // 44 - HatchStyleShingle, // 45 - HatchStyleTrellis, // 46 - HatchStyleSphere, // 47 - HatchStyleSmallGrid, // 48 - HatchStyleSmallCheckerBoard, // 49 - HatchStyleLargeCheckerBoard, // 50 - HatchStyleOutlinedDiamond, // 51 - HatchStyleSolidDiamond, // 52 - - HatchStyleTotal, // must be after all unique hatch styles - - HatchStyleLargeGrid = HatchStyleCross, // 4 an alias for the cross style - - HatchStyleMin = HatchStyleHorizontal, - HatchStyleMax = HatchStyleTotal - 1, -}; - -//-------------------------------------------------------------------------- -// Dash style constants -//-------------------------------------------------------------------------- - -enum DashStyle -{ - DashStyleSolid, // 0 - DashStyleDash, // 1 - DashStyleDot, // 2 - DashStyleDashDot, // 3 - DashStyleDashDotDot, // 4 - DashStyleCustom // 5 -}; - -//-------------------------------------------------------------------------- -// Dash cap constants -//-------------------------------------------------------------------------- - -enum DashCap -{ - DashCapFlat = 0, - DashCapRound = 2, - DashCapTriangle = 3 -}; - -//-------------------------------------------------------------------------- -// Line cap constants (only the lowest 8 bits are used). -//-------------------------------------------------------------------------- - -enum LineCap -{ - LineCapFlat = 0, - LineCapSquare = 1, - LineCapRound = 2, - LineCapTriangle = 3, - - LineCapNoAnchor = 0x10, // corresponds to flat cap - LineCapSquareAnchor = 0x11, // corresponds to square cap - LineCapRoundAnchor = 0x12, // corresponds to round cap - LineCapDiamondAnchor = 0x13, // corresponds to triangle cap - LineCapArrowAnchor = 0x14, // no correspondence - - LineCapCustom = 0xff, // custom cap - - LineCapAnchorMask = 0xf0 // mask to check for anchor or not. -}; - -//-------------------------------------------------------------------------- -// Custom Line cap type constants -//-------------------------------------------------------------------------- - -enum CustomLineCapType -{ - CustomLineCapTypeDefault = 0, - CustomLineCapTypeAdjustableArrow = 1 -}; - -//-------------------------------------------------------------------------- -// Line join constants -//-------------------------------------------------------------------------- - -enum LineJoin -{ - LineJoinMiter = 0, - LineJoinBevel = 1, - LineJoinRound = 2, - LineJoinMiterClipped = 3 -}; - -//-------------------------------------------------------------------------- -// Path point types (only the lowest 8 bits are used.) -// The lowest 3 bits are interpreted as point type -// The higher 5 bits are reserved for flags. -//-------------------------------------------------------------------------- - -enum PathPointType -{ - PathPointTypeStart = 0, // move - PathPointTypeLine = 1, // line - PathPointTypeBezier = 3, // default Beizer (= cubic Bezier) - PathPointTypePathTypeMask = 0x07, // type mask (lowest 3 bits). - PathPointTypeDashMode = 0x10, // currently in dash mode. - PathPointTypePathMarker = 0x20, // a marker for the path. - PathPointTypeCloseSubpath = 0x80, // closed flag - - // Path types used for advanced path. - - PathPointTypeBezier2 = 2, // quadratic Beizer - PathPointTypeBezier3 = 3, // cubic Bezier - PathPointTypeBezier4 = 4, // quartic (4th order) Beizer - PathPointTypeBezier5 = 5, // quintic (5th order) Bezier - PathPointTypeBezier6 = 6 // hexaic (6th order) Bezier -}; - - -//-------------------------------------------------------------------------- -// WarpMode constants -//-------------------------------------------------------------------------- - -enum WarpMode -{ - WarpModePerspective, // 0 - WarpModeBilinear // 1 -}; - -//-------------------------------------------------------------------------- -// LineGradient Mode -//-------------------------------------------------------------------------- - -enum LinearGradientMode -{ - LinearGradientModeHorizontal, // 0 - LinearGradientModeVertical, // 1 - LinearGradientModeForwardDiagonal, // 2 - LinearGradientModeBackwardDiagonal // 3 -}; - -//-------------------------------------------------------------------------- -// Region Comine Modes -//-------------------------------------------------------------------------- - -enum CombineMode -{ - CombineModeReplace, // 0 - CombineModeIntersect, // 1 - CombineModeUnion, // 2 - CombineModeXor, // 3 - CombineModeExclude, // 4 - CombineModeComplement // 5 (does exclude from) -}; - -//-------------------------------------------------------------------------- - // Image types -//-------------------------------------------------------------------------- - -enum ImageType -{ - ImageTypeUnknown, // 0 - ImageTypeBitmap, // 1 - ImageTypeMetafile // 2 -}; - -//-------------------------------------------------------------------------- -// Interpolation modes -//-------------------------------------------------------------------------- - -enum InterpolationMode -{ - InterpolationModeInvalid = QualityModeInvalid, - InterpolationModeDefault = QualityModeDefault, - InterpolationModeLowQuality = QualityModeLow, - InterpolationModeHighQuality = QualityModeHigh, - InterpolationModeBilinear, - InterpolationModeBicubic, - InterpolationModeNearestNeighbor, - InterpolationModeHighQualityBilinear, - InterpolationModeHighQualityBicubic -}; - -//-------------------------------------------------------------------------- -// Pen types -//-------------------------------------------------------------------------- -enum PenAlignment -{ - PenAlignmentCenter = 0, - PenAlignmentInset = 1, - PenAlignmentOutset = 2, - PenAlignmentLeft = 3, - PenAlignmentRight = 4 -}; - -//-------------------------------------------------------------------------- -// Brush types -//-------------------------------------------------------------------------- - -enum BrushType -{ - BrushTypeSolidColor = 0, - BrushTypeHatchFill = 1, - BrushTypeTextureFill = 2, - BrushTypePathGradient = 3, - BrushTypeLinearGradient = 4 -}; - -//-------------------------------------------------------------------------- -// Pen's Fill types -//-------------------------------------------------------------------------- - -enum PenType -{ - PenTypeSolidColor = BrushTypeSolidColor, - PenTypeHatchFill = BrushTypeHatchFill, - PenTypeTextureFill = BrushTypeTextureFill, - PenTypePathGradient = BrushTypePathGradient, - PenTypeLinearGradient = BrushTypeLinearGradient, - PenTypeUnknown = -1 -}; - -//-------------------------------------------------------------------------- -// Matrix Order -//-------------------------------------------------------------------------- - -enum MatrixOrder -{ - MatrixOrderPrepend = 0, - MatrixOrderAppend = 1 -}; - -//-------------------------------------------------------------------------- -// Generic font families -//-------------------------------------------------------------------------- - -enum GenericFontFamily -{ - GenericFontFamilySerif, - GenericFontFamilySansSerif, - GenericFontFamilyMonospace - -}; - -//-------------------------------------------------------------------------- -// FontStyle: face types and common styles -//-------------------------------------------------------------------------- - -// These should probably be flags - -// Must have: -// Regular = 0 -// Bold = 1 -// Italic = 2 -// BoldItalic = 3 - -enum FontStyle -{ - FontStyleRegular = 0, - FontStyleBold = 1, - FontStyleItalic = 2, - FontStyleBoldItalic = 3, - FontStyleUnderline = 4, - FontStyleStrikeout = 8 -}; - -//--------------------------------------------------------------------------- -// Smoothing Mode -//--------------------------------------------------------------------------- - -enum SmoothingMode -{ - SmoothingModeInvalid = QualityModeInvalid, - SmoothingModeDefault = QualityModeDefault, - SmoothingModeHighSpeed = QualityModeLow, - SmoothingModeHighQuality = QualityModeHigh, - SmoothingModeNone, - SmoothingModeAntiAlias -}; - -//--------------------------------------------------------------------------- -// Pixel Format Mode -//--------------------------------------------------------------------------- - -enum PixelOffsetMode -{ - PixelOffsetModeInvalid = QualityModeInvalid, - PixelOffsetModeDefault = QualityModeDefault, - PixelOffsetModeHighSpeed = QualityModeLow, - PixelOffsetModeHighQuality = QualityModeHigh, - PixelOffsetModeNone, // no pixel offset - PixelOffsetModeHalf // offset by -0.5, -0.5 for fast anti-alias perf -}; - -//--------------------------------------------------------------------------- -// Text Rendering Hint -//--------------------------------------------------------------------------- - -enum TextRenderingHint -{ -#ifdef DCR_USE_NEW_186764 - TextRenderingHintSystemDefault = 0, // Glyph with system default rendering hint - TextRenderingHintSingleBitPerPixelGridFit, // Glyph bitmap with hinting -#else - TextRenderingHintSingleBitPerPixelGridFit = 0, // Glyph bitmap with hinting -#endif // DCR_USE_NEW_186764 - TextRenderingHintSingleBitPerPixel, // Glyph bitmap without hinting - TextRenderingHintAntiAliasGridFit, // Glyph anti-alias bitmap with hinting - TextRenderingHintAntiAlias, // Glyph anti-alias bitmap without hinting - TextRenderingHintClearTypeGridFit // Glyph CT bitmap with hinting -}; - -//--------------------------------------------------------------------------- -// Metafile Types -//--------------------------------------------------------------------------- -enum MetafileType -{ - MetafileTypeInvalid, // Invalid metafile - MetafileTypeWmf, // Standard WMF - MetafileTypeWmfAldus, // Aldus Placeable Metafile format - MetafileTypeEmf, // EMF (not EMF+) - MetafileTypeEmfPlusOnly, // EMF+ without dual, down-level records - MetafileTypeEmfPlusDual // EMF+ with dual, down-level records -}; - -// Specifies the type of EMF to record -enum EmfType -{ - EmfTypeEmfOnly = MetafileTypeEmf, // no EMF+, only EMF - EmfTypeEmfPlusOnly = MetafileTypeEmfPlusOnly, // no EMF, only EMF+ - EmfTypeEmfPlusDual = MetafileTypeEmfPlusDual // both EMF+ and EMF -}; - -// All persistent objects must have a type listed here -enum ObjectType -{ - ObjectTypeInvalid, - ObjectTypeBrush, - ObjectTypePen, - ObjectTypePath, - ObjectTypeRegion, - ObjectTypeImage, - ObjectTypeFont, - ObjectTypeStringFormat, - ObjectTypeImageAttributes, - ObjectTypeCustomLineCap, - - ObjectTypeMax = ObjectTypeCustomLineCap, - ObjectTypeMin = ObjectTypeBrush -}; - -inline BOOL -ObjectTypeIsValid( - ObjectType type - ) -{ - return ((type >= ObjectTypeMin) && (type <= ObjectTypeMax)); -} - -//--------------------------------------------------------------------------- -// EMF+ Records -//--------------------------------------------------------------------------- - -// We have to change the WMF record numbers so that they don't conflict with -// the EMF and EMF+ record numbers. -enum EmfPlusRecordType; -#define GDIP_EMFPLUS_RECORD_BASE 0x00004000 -#define GDIP_WMF_RECORD_BASE 0x00010000 -#define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE)) -#define GDIP_EMFPLUS_RECORD_TO_WMF(n) ((n) & (~GDIP_WMF_RECORD_BASE)) -#define GDIP_IS_WMF_RECORDTYPE(n) (((n) & GDIP_WMF_RECORD_BASE) != 0) - -enum EmfPlusRecordType -{ - // Since we have to enumerate GDI records right along with GDI+ records, - // we list all the GDI records here so that they can be part of the - // same enumeration type which is used in the enumeration callback. - - WmfRecordTypeSetBkColor = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKCOLOR), - WmfRecordTypeSetBkMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKMODE), - WmfRecordTypeSetMapMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPMODE), - WmfRecordTypeSetROP2 = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETROP2), - WmfRecordTypeSetRelAbs = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETRELABS), - WmfRecordTypeSetPolyFillMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPOLYFILLMODE), - WmfRecordTypeSetStretchBltMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETSTRETCHBLTMODE), - WmfRecordTypeSetTextCharExtra = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCHAREXTRA), - WmfRecordTypeSetTextColor = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCOLOR), - WmfRecordTypeSetTextJustification = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTJUSTIFICATION), - WmfRecordTypeSetWindowOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWORG), - WmfRecordTypeSetWindowExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWEXT), - WmfRecordTypeSetViewportOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTORG), - WmfRecordTypeSetViewportExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTEXT), - WmfRecordTypeOffsetWindowOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETWINDOWORG), - WmfRecordTypeScaleWindowExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEWINDOWEXT), - WmfRecordTypeOffsetViewportOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETVIEWPORTORG), - WmfRecordTypeScaleViewportExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEVIEWPORTEXT), - WmfRecordTypeLineTo = GDIP_WMF_RECORD_TO_EMFPLUS(META_LINETO), - WmfRecordTypeMoveTo = GDIP_WMF_RECORD_TO_EMFPLUS(META_MOVETO), - WmfRecordTypeExcludeClipRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXCLUDECLIPRECT), - WmfRecordTypeIntersectClipRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_INTERSECTCLIPRECT), - WmfRecordTypeArc = GDIP_WMF_RECORD_TO_EMFPLUS(META_ARC), - WmfRecordTypeEllipse = GDIP_WMF_RECORD_TO_EMFPLUS(META_ELLIPSE), - WmfRecordTypeFloodFill = GDIP_WMF_RECORD_TO_EMFPLUS(META_FLOODFILL), - WmfRecordTypePie = GDIP_WMF_RECORD_TO_EMFPLUS(META_PIE), - WmfRecordTypeRectangle = GDIP_WMF_RECORD_TO_EMFPLUS(META_RECTANGLE), - WmfRecordTypeRoundRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_ROUNDRECT), - WmfRecordTypePatBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_PATBLT), - WmfRecordTypeSaveDC = GDIP_WMF_RECORD_TO_EMFPLUS(META_SAVEDC), - WmfRecordTypeSetPixel = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPIXEL), - WmfRecordTypeOffsetClipRgn = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETCLIPRGN), - WmfRecordTypeTextOut = GDIP_WMF_RECORD_TO_EMFPLUS(META_TEXTOUT), - WmfRecordTypeBitBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_BITBLT), - WmfRecordTypeStretchBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_STRETCHBLT), - WmfRecordTypePolygon = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYGON), - WmfRecordTypePolyline = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYLINE), - WmfRecordTypeEscape = GDIP_WMF_RECORD_TO_EMFPLUS(META_ESCAPE), - WmfRecordTypeRestoreDC = GDIP_WMF_RECORD_TO_EMFPLUS(META_RESTOREDC), - WmfRecordTypeFillRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_FILLREGION), - WmfRecordTypeFrameRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_FRAMEREGION), - WmfRecordTypeInvertRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_INVERTREGION), - WmfRecordTypePaintRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_PAINTREGION), - WmfRecordTypeSelectClipRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTCLIPREGION), - WmfRecordTypeSelectObject = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTOBJECT), - WmfRecordTypeSetTextAlign = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTALIGN), - WmfRecordTypeDrawText = GDIP_WMF_RECORD_TO_EMFPLUS(0x062F), // META_DRAWTEXT - WmfRecordTypeChord = GDIP_WMF_RECORD_TO_EMFPLUS(META_CHORD), - WmfRecordTypeSetMapperFlags = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPPERFLAGS), - WmfRecordTypeExtTextOut = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXTTEXTOUT), - WmfRecordTypeSetDIBToDev = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETDIBTODEV), - WmfRecordTypeSelectPalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTPALETTE), - WmfRecordTypeRealizePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_REALIZEPALETTE), - WmfRecordTypeAnimatePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_ANIMATEPALETTE), - WmfRecordTypeSetPalEntries = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPALENTRIES), - WmfRecordTypePolyPolygon = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYPOLYGON), - WmfRecordTypeResizePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_RESIZEPALETTE), - WmfRecordTypeDIBBitBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBBITBLT), - WmfRecordTypeDIBStretchBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBSTRETCHBLT), - WmfRecordTypeDIBCreatePatternBrush = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBCREATEPATTERNBRUSH), - WmfRecordTypeStretchDIB = GDIP_WMF_RECORD_TO_EMFPLUS(META_STRETCHDIB), - WmfRecordTypeExtFloodFill = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXTFLOODFILL), - WmfRecordTypeSetLayout = GDIP_WMF_RECORD_TO_EMFPLUS(0x0149), // META_SETLAYOUT - WmfRecordTypeResetDC = GDIP_WMF_RECORD_TO_EMFPLUS(0x014C), // META_RESETDC - WmfRecordTypeStartDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x014D), // META_STARTDOC - WmfRecordTypeStartPage = GDIP_WMF_RECORD_TO_EMFPLUS(0x004F), // META_STARTPAGE - WmfRecordTypeEndPage = GDIP_WMF_RECORD_TO_EMFPLUS(0x0050), // META_ENDPAGE - WmfRecordTypeAbortDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x0052), // META_ABORTDOC - WmfRecordTypeEndDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x005E), // META_ENDDOC - WmfRecordTypeDeleteObject = GDIP_WMF_RECORD_TO_EMFPLUS(META_DELETEOBJECT), - WmfRecordTypeCreatePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPALETTE), - WmfRecordTypeCreateBrush = GDIP_WMF_RECORD_TO_EMFPLUS(0x00F8), // META_CREATEBRUSH - WmfRecordTypeCreatePatternBrush = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPATTERNBRUSH), - WmfRecordTypeCreatePenIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPENINDIRECT), - WmfRecordTypeCreateFontIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEFONTINDIRECT), - WmfRecordTypeCreateBrushIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEBRUSHINDIRECT), - WmfRecordTypeCreateBitmapIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(0x02FD), // META_CREATEBITMAPINDIRECT - WmfRecordTypeCreateBitmap = GDIP_WMF_RECORD_TO_EMFPLUS(0x06FE), // META_CREATEBITMAP - WmfRecordTypeCreateRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEREGION), - - EmfRecordTypeHeader = EMR_HEADER, - EmfRecordTypePolyBezier = EMR_POLYBEZIER, - EmfRecordTypePolygon = EMR_POLYGON, - EmfRecordTypePolyline = EMR_POLYLINE, - EmfRecordTypePolyBezierTo = EMR_POLYBEZIERTO, - EmfRecordTypePolyLineTo = EMR_POLYLINETO, - EmfRecordTypePolyPolyline = EMR_POLYPOLYLINE, - EmfRecordTypePolyPolygon = EMR_POLYPOLYGON, - EmfRecordTypeSetWindowExtEx = EMR_SETWINDOWEXTEX, - EmfRecordTypeSetWindowOrgEx = EMR_SETWINDOWORGEX, - EmfRecordTypeSetViewportExtEx = EMR_SETVIEWPORTEXTEX, - EmfRecordTypeSetViewportOrgEx = EMR_SETVIEWPORTORGEX, - EmfRecordTypeSetBrushOrgEx = EMR_SETBRUSHORGEX, - EmfRecordTypeEOF = EMR_EOF, - EmfRecordTypeSetPixelV = EMR_SETPIXELV, - EmfRecordTypeSetMapperFlags = EMR_SETMAPPERFLAGS, - EmfRecordTypeSetMapMode = EMR_SETMAPMODE, - EmfRecordTypeSetBkMode = EMR_SETBKMODE, - EmfRecordTypeSetPolyFillMode = EMR_SETPOLYFILLMODE, - EmfRecordTypeSetROP2 = EMR_SETROP2, - EmfRecordTypeSetStretchBltMode = EMR_SETSTRETCHBLTMODE, - EmfRecordTypeSetTextAlign = EMR_SETTEXTALIGN, - EmfRecordTypeSetColorAdjustment = EMR_SETCOLORADJUSTMENT, - EmfRecordTypeSetTextColor = EMR_SETTEXTCOLOR, - EmfRecordTypeSetBkColor = EMR_SETBKCOLOR, - EmfRecordTypeOffsetClipRgn = EMR_OFFSETCLIPRGN, - EmfRecordTypeMoveToEx = EMR_MOVETOEX, - EmfRecordTypeSetMetaRgn = EMR_SETMETARGN, - EmfRecordTypeExcludeClipRect = EMR_EXCLUDECLIPRECT, - EmfRecordTypeIntersectClipRect = EMR_INTERSECTCLIPRECT, - EmfRecordTypeScaleViewportExtEx = EMR_SCALEVIEWPORTEXTEX, - EmfRecordTypeScaleWindowExtEx = EMR_SCALEWINDOWEXTEX, - EmfRecordTypeSaveDC = EMR_SAVEDC, - EmfRecordTypeRestoreDC = EMR_RESTOREDC, - EmfRecordTypeSetWorldTransform = EMR_SETWORLDTRANSFORM, - EmfRecordTypeModifyWorldTransform = EMR_MODIFYWORLDTRANSFORM, - EmfRecordTypeSelectObject = EMR_SELECTOBJECT, - EmfRecordTypeCreatePen = EMR_CREATEPEN, - EmfRecordTypeCreateBrushIndirect = EMR_CREATEBRUSHINDIRECT, - EmfRecordTypeDeleteObject = EMR_DELETEOBJECT, - EmfRecordTypeAngleArc = EMR_ANGLEARC, - EmfRecordTypeEllipse = EMR_ELLIPSE, - EmfRecordTypeRectangle = EMR_RECTANGLE, - EmfRecordTypeRoundRect = EMR_ROUNDRECT, - EmfRecordTypeArc = EMR_ARC, - EmfRecordTypeChord = EMR_CHORD, - EmfRecordTypePie = EMR_PIE, - EmfRecordTypeSelectPalette = EMR_SELECTPALETTE, - EmfRecordTypeCreatePalette = EMR_CREATEPALETTE, - EmfRecordTypeSetPaletteEntries = EMR_SETPALETTEENTRIES, - EmfRecordTypeResizePalette = EMR_RESIZEPALETTE, - EmfRecordTypeRealizePalette = EMR_REALIZEPALETTE, - EmfRecordTypeExtFloodFill = EMR_EXTFLOODFILL, - EmfRecordTypeLineTo = EMR_LINETO, - EmfRecordTypeArcTo = EMR_ARCTO, - EmfRecordTypePolyDraw = EMR_POLYDRAW, - EmfRecordTypeSetArcDirection = EMR_SETARCDIRECTION, - EmfRecordTypeSetMiterLimit = EMR_SETMITERLIMIT, - EmfRecordTypeBeginPath = EMR_BEGINPATH, - EmfRecordTypeEndPath = EMR_ENDPATH, - EmfRecordTypeCloseFigure = EMR_CLOSEFIGURE, - EmfRecordTypeFillPath = EMR_FILLPATH, - EmfRecordTypeStrokeAndFillPath = EMR_STROKEANDFILLPATH, - EmfRecordTypeStrokePath = EMR_STROKEPATH, - EmfRecordTypeFlattenPath = EMR_FLATTENPATH, - EmfRecordTypeWidenPath = EMR_WIDENPATH, - EmfRecordTypeSelectClipPath = EMR_SELECTCLIPPATH, - EmfRecordTypeAbortPath = EMR_ABORTPATH, - EmfRecordTypeReserved_069 = 69, // Not Used - EmfRecordTypeGdiComment = EMR_GDICOMMENT, - EmfRecordTypeFillRgn = EMR_FILLRGN, - EmfRecordTypeFrameRgn = EMR_FRAMERGN, - EmfRecordTypeInvertRgn = EMR_INVERTRGN, - EmfRecordTypePaintRgn = EMR_PAINTRGN, - EmfRecordTypeExtSelectClipRgn = EMR_EXTSELECTCLIPRGN, - EmfRecordTypeBitBlt = EMR_BITBLT, - EmfRecordTypeStretchBlt = EMR_STRETCHBLT, - EmfRecordTypeMaskBlt = EMR_MASKBLT, - EmfRecordTypePlgBlt = EMR_PLGBLT, - EmfRecordTypeSetDIBitsToDevice = EMR_SETDIBITSTODEVICE, - EmfRecordTypeStretchDIBits = EMR_STRETCHDIBITS, - EmfRecordTypeExtCreateFontIndirect = EMR_EXTCREATEFONTINDIRECTW, - EmfRecordTypeExtTextOutA = EMR_EXTTEXTOUTA, - EmfRecordTypeExtTextOutW = EMR_EXTTEXTOUTW, - EmfRecordTypePolyBezier16 = EMR_POLYBEZIER16, - EmfRecordTypePolygon16 = EMR_POLYGON16, - EmfRecordTypePolyline16 = EMR_POLYLINE16, - EmfRecordTypePolyBezierTo16 = EMR_POLYBEZIERTO16, - EmfRecordTypePolylineTo16 = EMR_POLYLINETO16, - EmfRecordTypePolyPolyline16 = EMR_POLYPOLYLINE16, - EmfRecordTypePolyPolygon16 = EMR_POLYPOLYGON16, - EmfRecordTypePolyDraw16 = EMR_POLYDRAW16, - EmfRecordTypeCreateMonoBrush = EMR_CREATEMONOBRUSH, - EmfRecordTypeCreateDIBPatternBrushPt = EMR_CREATEDIBPATTERNBRUSHPT, - EmfRecordTypeExtCreatePen = EMR_EXTCREATEPEN, - EmfRecordTypePolyTextOutA = EMR_POLYTEXTOUTA, - EmfRecordTypePolyTextOutW = EMR_POLYTEXTOUTW, - EmfRecordTypeSetICMMode = 98, // EMR_SETICMMODE, - EmfRecordTypeCreateColorSpace = 99, // EMR_CREATECOLORSPACE, - EmfRecordTypeSetColorSpace = 100, // EMR_SETCOLORSPACE, - EmfRecordTypeDeleteColorSpace = 101, // EMR_DELETECOLORSPACE, - EmfRecordTypeGLSRecord = 102, // EMR_GLSRECORD, - EmfRecordTypeGLSBoundedRecord = 103, // EMR_GLSBOUNDEDRECORD, - EmfRecordTypePixelFormat = 104, // EMR_PIXELFORMAT, - EmfRecordTypeDrawEscape = 105, // EMR_RESERVED_105, - EmfRecordTypeExtEscape = 106, // EMR_RESERVED_106, - EmfRecordTypeStartDoc = 107, // EMR_RESERVED_107, - EmfRecordTypeSmallTextOut = 108, // EMR_RESERVED_108, - EmfRecordTypeForceUFIMapping = 109, // EMR_RESERVED_109, - EmfRecordTypeNamedEscape = 110, // EMR_RESERVED_110, - EmfRecordTypeColorCorrectPalette = 111, // EMR_COLORCORRECTPALETTE, - EmfRecordTypeSetICMProfileA = 112, // EMR_SETICMPROFILEA, - EmfRecordTypeSetICMProfileW = 113, // EMR_SETICMPROFILEW, - EmfRecordTypeAlphaBlend = 114, // EMR_ALPHABLEND, - EmfRecordTypeSetLayout = 115, // EMR_SETLAYOUT, - EmfRecordTypeTransparentBlt = 116, // EMR_TRANSPARENTBLT, - EmfRecordTypeReserved_117 = 117, // Not Used - EmfRecordTypeGradientFill = 118, // EMR_GRADIENTFILL, - EmfRecordTypeSetLinkedUFIs = 119, // EMR_RESERVED_119, - EmfRecordTypeSetTextJustification = 120, // EMR_RESERVED_120, - EmfRecordTypeColorMatchToTargetW = 121, // EMR_COLORMATCHTOTARGETW, - EmfRecordTypeCreateColorSpaceW = 122, // EMR_CREATECOLORSPACEW, - EmfRecordTypeMax = 122, - EmfRecordTypeMin = 1, - - // That is the END of the GDI EMF records. - - // Now we start the list of EMF+ records. We leave quite - // a bit of room here for the addition of any new GDI - // records that may be added later. - - EmfPlusRecordTypeInvalid = GDIP_EMFPLUS_RECORD_BASE, - EmfPlusRecordTypeHeader, - EmfPlusRecordTypeEndOfFile, - - EmfPlusRecordTypeComment, - - EmfPlusRecordTypeGetDC, // the application grabbed the metafile dc - - EmfPlusRecordTypeMultiFormatStart, - EmfPlusRecordTypeMultiFormatSection, - EmfPlusRecordTypeMultiFormatEnd, - - // For all persistent objects - EmfPlusRecordTypeObject, // brush,pen,path,region,image,font,string-format - - // Drawing Records - EmfPlusRecordTypeClear, - EmfPlusRecordTypeFillRects, - EmfPlusRecordTypeDrawRects, - EmfPlusRecordTypeFillPolygon, - EmfPlusRecordTypeDrawLines, - EmfPlusRecordTypeFillEllipse, - EmfPlusRecordTypeDrawEllipse, - EmfPlusRecordTypeFillPie, - EmfPlusRecordTypeDrawPie, - EmfPlusRecordTypeDrawArc, - EmfPlusRecordTypeFillRegion, - EmfPlusRecordTypeFillPath, - EmfPlusRecordTypeDrawPath, - EmfPlusRecordTypeFillClosedCurve, - EmfPlusRecordTypeDrawClosedCurve, - EmfPlusRecordTypeDrawCurve, - EmfPlusRecordTypeDrawBeziers, - EmfPlusRecordTypeDrawImage, - EmfPlusRecordTypeDrawImagePoints, - EmfPlusRecordTypeDrawString, - - // Graphics State Records - EmfPlusRecordTypeSetRenderingOrigin, - EmfPlusRecordTypeSetAntiAliasMode, - EmfPlusRecordTypeSetTextRenderingHint, -#ifdef DCR_USE_NEW_188922 - EmfPlusRecordTypeSetTextContrast, -#else - EmfPlusRecordTypeSetGammaValue, -#endif // DCR_USE_NEW_188922 - EmfPlusRecordTypeSetInterpolationMode, - EmfPlusRecordTypeSetPixelOffsetMode, - EmfPlusRecordTypeSetCompositingMode, - EmfPlusRecordTypeSetCompositingQuality, - EmfPlusRecordTypeSave, - EmfPlusRecordTypeRestore, - EmfPlusRecordTypeBeginContainer, - EmfPlusRecordTypeBeginContainerNoParams, - EmfPlusRecordTypeEndContainer, - EmfPlusRecordTypeSetWorldTransform, - EmfPlusRecordTypeResetWorldTransform, - EmfPlusRecordTypeMultiplyWorldTransform, - EmfPlusRecordTypeTranslateWorldTransform, - EmfPlusRecordTypeScaleWorldTransform, - EmfPlusRecordTypeRotateWorldTransform, - EmfPlusRecordTypeSetPageTransform, - EmfPlusRecordTypeResetClip, - EmfPlusRecordTypeSetClipRect, - EmfPlusRecordTypeSetClipPath, - EmfPlusRecordTypeSetClipRegion, - EmfPlusRecordTypeOffsetClip, - - // New record types must be added here (at the end) -- do not add above, - // since that will invalidate previous metafiles! - EmfPlusRecordTypeDrawDriverString, - - // Have this here so you don't need to keep changing the value of - // EmfPlusRecordTypeMax every time you add a new record. - - EmfPlusRecordTotal, - - EmfPlusRecordTypeMax = EmfPlusRecordTotal-1, - EmfPlusRecordTypeMin = EmfPlusRecordTypeHeader, -}; - -//--------------------------------------------------------------------------- -// StringFormatFlags -//--------------------------------------------------------------------------- - -//--------------------------------------------------------------------------- -// String format flags -// -// DirectionRightToLeft - For horizontal text, the reading order is -// right to left. This value is called -// the base embedding level by the Unicode -// bidirectional engine. -// For vertical text, columns are read from -// right to left. -// By default, horizontal or vertical text is -// read from left to right. -// -// DirectionVertical - Individual lines of text are vertical. In -// each line, characters progress from top to -// bottom. -// By default, lines of text are horizontal, -// each new line below the previous line. -// -// NoFitBlackBox - Allows parts of glyphs to overhang the -// bounding rectangle. -// By default glyphs are first aligned -// inside the margines, then any glyphs which -// still overhang the bounding box are -// repositioned to avoid any overhang. -// For example when an italic -// lower case letter f in a font such as -// Garamond is aligned at the far left of a -// rectangle, the lower part of the f will -// reach slightly further left than the left -// edge of the rectangle. Setting this flag -// will ensure the character aligns visually -// with the lines above and below, but may -// cause some pixels outside the formatting -// rectangle to be clipped or painted. -// -#ifndef DCR_USE_NEW_137252 -// NumberContextArabic - Causes any initial numeric in the string to -// be analysed for bidirection layout as if -// it was preceeded by Arabic text. -// -// DisableKashidaJustification - Arabic text will not be justified by the -// insertion of kashidas (i.e. extending the -// joining line between characters). Instead -// Arabic script will be justified by the -// widening of the whitespace between words. -// -#endif -// DisplayFormatControl - Causes control characters such as the -// left-to-right mark to be shown in the -// output with a representative glyph. -// -#ifndef DCR_USE_NEW_137252 -// DisableKerning - Disables Truetype and OpenType kerning. -// -// DisableLigatures - Disables Truetype and OpenType ligatures. -// -// LayoutLegacyBidi - Causes the bidirection algorithm to use -// slightly different classifications for -// '+', '-' and '/' that make their layout -// much closer to that expected by files -// generated in Windows or by Windows -// applications. -// -// NoChanges - A text imager created with this flag set -// does not support those APIs that change -// it's contents or formatting, but for most -// simple text will be significantly faster in -// performing measurement and drawing -// functions. -// -#endif -// NoFontFallback - Disables fallback to alternate fonts for -// characters not supported in the requested -// font. Any missing characters will be -// be displayed with the fonts missing glyph, -// usually an open square. -// -// NoWrap - Disables wrapping of text between lines -// when formatting within a rectangle. -// NoWrap is implied when a point is passed -// instead of a rectangle, or when the -// specified rectangle has a zero line length. -// -// NoClip - By default text is clipped to the -// formatting rectangle. Setting NoClip -// allows overhanging pixels to affect the -// device outside the formatting rectangle. -// Pixels at the end of the line may be -// affected if the glyphs overhang their -// cells, and either the NoFitBlackBox flag -// has been set, or the glyph extends to far -// to be fitted. -// Pixels above/before the first line or -// below/after the last line may be affected -// if the glyphs extend beyond their cell -// ascent / descent. This can occur rarely -// with unusual diacritic mark combinations. - -//--------------------------------------------------------------------------- - -enum StringFormatFlags -{ - StringFormatFlagsDirectionRightToLeft = 0x00000001, - StringFormatFlagsDirectionVertical = 0x00000002, - StringFormatFlagsNoFitBlackBox = 0x00000004, -#ifndef DCR_USE_NEW_137252 - StringFormatFlagsNumberContextArabic = 0x00000008, - StringFormatFlagsDisableKashidaJustification = 0x00000010, -#endif - StringFormatFlagsDisplayFormatControl = 0x00000020, -#ifndef DCR_USE_NEW_137252 - StringFormatFlagsDisableKerning = 0x00000040, - StringFormatFlagsDisableLigatures = 0x00000080, - StringFormatFlagsLayoutLegacyBidi = 0x00000100, - StringFormatFlagsNoChanges = 0x00000200, -#endif - StringFormatFlagsNoFontFallback = 0x00000400, - StringFormatFlagsMeasureTrailingSpaces = 0x00000800, - StringFormatFlagsNoWrap = 0x00001000, - StringFormatFlagsLineLimit = 0x00002000, - - StringFormatFlagsNoClip = 0x00004000 -}; - -//--------------------------------------------------------------------------- -// StringTrimming -//--------------------------------------------------------------------------- - -enum StringTrimming { - StringTrimmingNone = 0, - StringTrimmingCharacter = 1, - StringTrimmingWord = 2, - StringTrimmingEllipsisCharacter = 3, - StringTrimmingEllipsisWord = 4, - StringTrimmingEllipsisPath = 5 -}; - -#ifndef DCR_USE_NEW_137252 -//--------------------------------------------------------------------------- -// String units -// -// String units are like length units in CSS, they may be absolute, or -// they may be relative to a font size. -// -//--------------------------------------------------------------------------- - -enum StringUnit { - StringUnitWorld = UnitWorld, - StringUnitDisplay = UnitDisplay, - StringUnitPixel = UnitPixel, - StringUnitPoint = UnitPoint, - StringUnitInch = UnitInch, - StringUnitDocument = UnitDocument, - StringUnitMillimeter = UnitMillimeter, - StringUnitEm = 32 -}; -#endif - -#ifndef DCR_USE_NEW_152154 -//--------------------------------------------------------------------------- -// Line spacing flags -//--------------------------------------------------------------------------- - -enum LineSpacing { - LineSpacingWorld = UnitWorld, - LineSpacingDisplay = UnitDisplay, - LineSpacingPixel = UnitPixel, - LineSpacingPoint = UnitPoint, - LineSpacingInch = UnitInch, - LineSpacingDocument = UnitDocument, - LineSpacingMillimeter = UnitMillimeter, - - LineSpacingRecommended = 32, - LineSpacingAtLeast = 33, - LineSpacingAtLeastMultiple = 34, - LineSpacingCell = 35, - LineSpacingCellAtLeast = 36, - LineSpacingCellAtLeastMultiple = 37 -}; - -/// The following methods of linespacing are relative to the font size -// -// =========== Method =========== =============== Relative to =============== -// -// LineSpacingRecommended recommended line spacing specified by font -// LineSpacingAtLeast max(recommended, tallest glyph cell) -// LineSpacingAtLeastMultiple smallest multiple of recommended big enough -// for all glyph cells on the line -// LineSpacingCell cell height -// LineSpacingCellAtLeast max(font cell height, tallest glyph cell) -// LineSpacingCellAtLeastMultiple smallest multiple of cell height big enough -// for all glyph cells on the line -#endif - - -//--------------------------------------------------------------------------- -// National language digit substitution -//--------------------------------------------------------------------------- - -enum StringDigitSubstitute -{ - StringDigitSubstituteUser = 0, // As NLS setting - StringDigitSubstituteNone = 1, - StringDigitSubstituteNational = 2, - StringDigitSubstituteTraditional = 3 -}; - -//--------------------------------------------------------------------------- -// Hotkey prefix interpretation -//--------------------------------------------------------------------------- - -enum HotkeyPrefix -{ - HotkeyPrefixNone = 0, - HotkeyPrefixShow = 1, - HotkeyPrefixHide = 2 -}; - -//--------------------------------------------------------------------------- -// Text alignment flags -//--------------------------------------------------------------------------- - -enum StringAlignment -{ - // Left edge for left-to-right text, - // right for right-to-left text, - // and top for vertical - StringAlignmentNear = 0, - StringAlignmentCenter = 1, - StringAlignmentFar = 2 -}; - -//--------------------------------------------------------------------------- -// DriverStringOptions -//--------------------------------------------------------------------------- - -enum DriverStringOptions -{ - DriverStringOptionsCmapLookup = 1, - DriverStringOptionsVertical = 2, - DriverStringOptionsRealizedAdvance = 4, -#ifndef DCR_USE_NEW_137252 - DriverStringOptionsCompensateResolution = 8 -#endif -}; - -//--------------------------------------------------------------------------- -// Flush Intention flags -//--------------------------------------------------------------------------- - -enum FlushIntention -{ - FlushIntentionFlush = 0, // Flush all batched rendering operations - FlushIntentionSync = 1 // Flush all batched rendering operations - // and wait for them to complete -}; - -#ifndef DCR_USE_NEW_175866 - -//--------------------------------------------------------------------------- -// Window Change Notification types -//--------------------------------------------------------------------------- - -enum WindowNotifyEnum -{ - WindowNotifyEnumEnable = 0, - WindowNotifyEnumDisable, - WindowNotifyEnumPalette, - WindowNotifyEnumDisplay, - WindowNotifyEnumSysColor -}; - -#endif - -//--------------------------------------------------------------------------- -// Image encoder parameter related types -//--------------------------------------------------------------------------- - -#ifdef DCR_USE_NEW_145804 -enum EncoderParameterValueType -{ - EncoderParameterValueTypeByte = 1, // 8-bit unsigned int - EncoderParameterValueTypeASCII = 2, // 8-bit byte containing one 7-bit ASCII - // code. NULL terminated. - EncoderParameterValueTypeShort = 3, // 16-bit unsigned int - EncoderParameterValueTypeLong = 4, // 32-bit unsigned int - EncoderParameterValueTypeRational = 5, // Two Longs. The first Long is the - // numerator, the second Long expresses the - // denomintor. - EncoderParameterValueTypeLongRange = 6, // Two longs which specify a range of - // integer values. The first Long specifies - // the lower end and the second one - // specifies the higher end. All values - // are inclusive at both ends - EncoderParameterValueTypeUndefined = 7, // 8-bit byte that can take any value - // depending on field definition - EncoderParameterValueTypeRationalRange = 8 // Two Rationals. The first Rational - // specifies the lower end and the second - // specifies the higher end. All values - // are inclusive at both ends -}; -#else -enum ValueType -{ - ValueTypeByte = 1, // 8-bit unsigned int - ValueTypeASCII = 2, // 8-bit byte containing one 7-bit ASCII - // code. NULL terminated. - ValueTypeShort = 3, // 16-bit unsigned int - ValueTypeLong = 4, // 32-bit unsigned int - ValueTypeRational = 5, // Two Longs. The first Long is the - // numerator, the second Long expresses the - // denomintor. - ValueTypeLongRange = 6, // Two longs which specify a range of - // integer values. The first Long specifies - // the lower end and the second one - // specifies the higher end. All values - // are inclusive at both ends - ValueTypeUndefined = 7, // 8-bit byte that can take any value - // depending on field definition - ValueTypeRationalRange = 8 // Two Rationals. The first Rational - // specifies the lower end and the second - // specifies the higher end. All values - // are inclusive at both ends -}; -#endif - -//--------------------------------------------------------------------------- -// Image encoder value types -//--------------------------------------------------------------------------- - -enum EncoderValue -{ - EncoderValueColorTypeCMYK, - EncoderValueColorTypeYCCK, - EncoderValueCompressionLZW, - EncoderValueCompressionCCITT3, - EncoderValueCompressionCCITT4, - EncoderValueCompressionRle, - EncoderValueCompressionNone, - EncoderValueScanMethodInterlaced, - EncoderValueScanMethodNonInterlaced, - EncoderValueVersionGif87, - EncoderValueVersionGif89, - EncoderValueRenderProgressive, - EncoderValueRenderNonProgressive, - EncoderValueTransformRotate90, - EncoderValueTransformRotate180, - EncoderValueTransformRotate270, - EncoderValueTransformFlipHorizontal, - EncoderValueTransformFlipVertical, - #ifdef DCR_USE_NEW_140861 - EncoderValueMultiFrame, - #else - EncodeValueMultiFrame, - #endif - EncoderValueLastFrame, - EncoderValueFlush, - #ifdef DCR_USE_NEW_140861 - EncoderValueFrameDimensionTime, - EncoderValueFrameDimensionResolution, - EncoderValueFrameDimensionPage - #else - EncodeValueFrameDimensionTime, - EncodeValueFrameDimensionResolution, - EncodeValueFrameDimensionPage - #endif -}; - -//--------------------------------------------------------------------------- -// Graphics layout values (support for Middle East localization) -//--------------------------------------------------------------------------- - -enum GraphicsLayout -{ - GraphicsLayoutNormal, - GraphicsLayoutMirrored, - GraphicsLayoutMirroredIgnoreImages, - GraphicsLayoutMirroredForceImages -}; - -//--------------------------------------------------------------------------- -// Image layout values (support for Middle East localization) -//--------------------------------------------------------------------------- - -enum ImageLayout -{ - ImageLayoutNormal, - ImageLayoutIgnoreMirrored -}; - -enum EmfToWmfBitsFlags -{ - EmfToWmfBitsFlagsDefault = 0x00000000, - EmfToWmfBitsFlagsEmbedEmf = 0x00000001, - EmfToWmfBitsFlagsIncludeAPM = 0x00000002, - EmfToWmfBitsFlagsNoXORClip = 0x00000004 -}; - -#endif // !_GDIPLUSENUMS_H +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusEnums.h +* +* Abstract: +* +* Various enumeration types +* +\**************************************************************************/ + +#ifndef _GDIPLUSENUMS_H +#define _GDIPLUSENUMS_H + + +//-------------------------------------------------------------------------- +// Default bezier flattening tolerance in device pixels. +//-------------------------------------------------------------------------- + +const float FlatnessDefault = 1.0f/4.0f; + +//-------------------------------------------------------------------------- +// Graphics and Container State cookies +//-------------------------------------------------------------------------- + +typedef UINT GraphicsState; +typedef UINT GraphicsContainer; + +//-------------------------------------------------------------------------- +// Fill mode constants +//-------------------------------------------------------------------------- + +enum FillMode +{ + FillModeAlternate, // 0 + FillModeWinding // 1 +}; + +//-------------------------------------------------------------------------- +// Quality mode constants +//-------------------------------------------------------------------------- + +enum QualityMode +{ + QualityModeInvalid = -1, + QualityModeDefault = 0, + QualityModeLow = 1, // for apps that need the best performance + QualityModeHigh = 2 // for apps that need the best rendering quality +}; + +//-------------------------------------------------------------------------- +// Alpha compositing mode constants +//-------------------------------------------------------------------------- + +enum CompositingMode +{ + CompositingModeSourceOver, // 0 + CompositingModeSourceCopy // 1 +}; + +//-------------------------------------------------------------------------- +// Alpha compositing quality constants +//-------------------------------------------------------------------------- + +enum CompositingQuality +{ + CompositingQualityInvalid = QualityModeInvalid, + CompositingQualityDefault = QualityModeDefault, + CompositingQualityHighSpeed = QualityModeLow, + CompositingQualityHighQuality = QualityModeHigh, + CompositingQualityGammaCorrected, + CompositingQualityAssumeLinear +}; + +//-------------------------------------------------------------------------- +// Unit constants +//-------------------------------------------------------------------------- + +enum Unit +{ + UnitWorld, // 0 -- World coordinate (non-physical unit) + UnitDisplay, // 1 -- Variable -- for PageTransform only + UnitPixel, // 2 -- Each unit is one device pixel. + UnitPoint, // 3 -- Each unit is a printer's point, or 1/72 inch. + UnitInch, // 4 -- Each unit is 1 inch. + UnitDocument, // 5 -- Each unit is 1/300 inch. + UnitMillimeter // 6 -- Each unit is 1 millimeter. +}; + +//-------------------------------------------------------------------------- +// MetafileFrameUnit +// +// The frameRect for creating a metafile can be specified in any of these +// units. There is an extra frame unit value (MetafileFrameUnitGdi) so +// that units can be supplied in the same units that GDI expects for +// frame rects -- these units are in .01 (1/100ths) millimeter units +// as defined by GDI. +//-------------------------------------------------------------------------- +enum MetafileFrameUnit +{ + MetafileFrameUnitPixel = UnitPixel, + MetafileFrameUnitPoint = UnitPoint, + MetafileFrameUnitInch = UnitInch, + MetafileFrameUnitDocument = UnitDocument, + MetafileFrameUnitMillimeter = UnitMillimeter, + MetafileFrameUnitGdi // GDI compatible .01 MM units +}; + +//-------------------------------------------------------------------------- +// Coordinate space identifiers +//-------------------------------------------------------------------------- + +enum CoordinateSpace +{ + CoordinateSpaceWorld, // 0 + CoordinateSpacePage, // 1 + CoordinateSpaceDevice // 2 +}; + +//-------------------------------------------------------------------------- +// Various wrap modes for brushes +//-------------------------------------------------------------------------- + +enum WrapMode +{ + WrapModeTile, // 0 + WrapModeTileFlipX, // 1 + WrapModeTileFlipY, // 2 + WrapModeTileFlipXY, // 3 + WrapModeClamp // 4 +}; + +//-------------------------------------------------------------------------- +// Various hatch styles +//-------------------------------------------------------------------------- + +enum HatchStyle +{ + HatchStyleHorizontal, // 0 + HatchStyleVertical, // 1 + HatchStyleForwardDiagonal, // 2 + HatchStyleBackwardDiagonal, // 3 + HatchStyleCross, // 4 + HatchStyleDiagonalCross, // 5 + HatchStyle05Percent, // 6 + HatchStyle10Percent, // 7 + HatchStyle20Percent, // 8 + HatchStyle25Percent, // 9 + HatchStyle30Percent, // 10 + HatchStyle40Percent, // 11 + HatchStyle50Percent, // 12 + HatchStyle60Percent, // 13 + HatchStyle70Percent, // 14 + HatchStyle75Percent, // 15 + HatchStyle80Percent, // 16 + HatchStyle90Percent, // 17 + HatchStyleLightDownwardDiagonal, // 18 + HatchStyleLightUpwardDiagonal, // 19 + HatchStyleDarkDownwardDiagonal, // 20 + HatchStyleDarkUpwardDiagonal, // 21 + HatchStyleWideDownwardDiagonal, // 22 + HatchStyleWideUpwardDiagonal, // 23 + HatchStyleLightVertical, // 24 + HatchStyleLightHorizontal, // 25 + HatchStyleNarrowVertical, // 26 + HatchStyleNarrowHorizontal, // 27 + HatchStyleDarkVertical, // 28 + HatchStyleDarkHorizontal, // 29 + HatchStyleDashedDownwardDiagonal, // 30 + HatchStyleDashedUpwardDiagonal, // 31 + HatchStyleDashedHorizontal, // 32 + HatchStyleDashedVertical, // 33 + HatchStyleSmallConfetti, // 34 + HatchStyleLargeConfetti, // 35 + HatchStyleZigZag, // 36 + HatchStyleWave, // 37 + HatchStyleDiagonalBrick, // 38 + HatchStyleHorizontalBrick, // 39 + HatchStyleWeave, // 40 + HatchStylePlaid, // 41 + HatchStyleDivot, // 42 + HatchStyleDottedGrid, // 43 + HatchStyleDottedDiamond, // 44 + HatchStyleShingle, // 45 + HatchStyleTrellis, // 46 + HatchStyleSphere, // 47 + HatchStyleSmallGrid, // 48 + HatchStyleSmallCheckerBoard, // 49 + HatchStyleLargeCheckerBoard, // 50 + HatchStyleOutlinedDiamond, // 51 + HatchStyleSolidDiamond, // 52 + + HatchStyleTotal, // must be after all unique hatch styles + + HatchStyleLargeGrid = HatchStyleCross, // 4 an alias for the cross style + + HatchStyleMin = HatchStyleHorizontal, + HatchStyleMax = HatchStyleTotal - 1, +}; + +//-------------------------------------------------------------------------- +// Dash style constants +//-------------------------------------------------------------------------- + +enum DashStyle +{ + DashStyleSolid, // 0 + DashStyleDash, // 1 + DashStyleDot, // 2 + DashStyleDashDot, // 3 + DashStyleDashDotDot, // 4 + DashStyleCustom // 5 +}; + +//-------------------------------------------------------------------------- +// Dash cap constants +//-------------------------------------------------------------------------- + +enum DashCap +{ + DashCapFlat = 0, + DashCapRound = 2, + DashCapTriangle = 3 +}; + +//-------------------------------------------------------------------------- +// Line cap constants (only the lowest 8 bits are used). +//-------------------------------------------------------------------------- + +enum LineCap +{ + LineCapFlat = 0, + LineCapSquare = 1, + LineCapRound = 2, + LineCapTriangle = 3, + + LineCapNoAnchor = 0x10, // corresponds to flat cap + LineCapSquareAnchor = 0x11, // corresponds to square cap + LineCapRoundAnchor = 0x12, // corresponds to round cap + LineCapDiamondAnchor = 0x13, // corresponds to triangle cap + LineCapArrowAnchor = 0x14, // no correspondence + + LineCapCustom = 0xff, // custom cap + + LineCapAnchorMask = 0xf0 // mask to check for anchor or not. +}; + +//-------------------------------------------------------------------------- +// Custom Line cap type constants +//-------------------------------------------------------------------------- + +enum CustomLineCapType +{ + CustomLineCapTypeDefault = 0, + CustomLineCapTypeAdjustableArrow = 1 +}; + +//-------------------------------------------------------------------------- +// Line join constants +//-------------------------------------------------------------------------- + +enum LineJoin +{ + LineJoinMiter = 0, + LineJoinBevel = 1, + LineJoinRound = 2, + LineJoinMiterClipped = 3 +}; + +//-------------------------------------------------------------------------- +// Path point types (only the lowest 8 bits are used.) +// The lowest 3 bits are interpreted as point type +// The higher 5 bits are reserved for flags. +//-------------------------------------------------------------------------- + +enum PathPointType +{ + PathPointTypeStart = 0, // move + PathPointTypeLine = 1, // line + PathPointTypeBezier = 3, // default Beizer (= cubic Bezier) + PathPointTypePathTypeMask = 0x07, // type mask (lowest 3 bits). + PathPointTypeDashMode = 0x10, // currently in dash mode. + PathPointTypePathMarker = 0x20, // a marker for the path. + PathPointTypeCloseSubpath = 0x80, // closed flag + + // Path types used for advanced path. + + PathPointTypeBezier2 = 2, // quadratic Beizer + PathPointTypeBezier3 = 3, // cubic Bezier + PathPointTypeBezier4 = 4, // quartic (4th order) Beizer + PathPointTypeBezier5 = 5, // quintic (5th order) Bezier + PathPointTypeBezier6 = 6 // hexaic (6th order) Bezier +}; + + +//-------------------------------------------------------------------------- +// WarpMode constants +//-------------------------------------------------------------------------- + +enum WarpMode +{ + WarpModePerspective, // 0 + WarpModeBilinear // 1 +}; + +//-------------------------------------------------------------------------- +// LineGradient Mode +//-------------------------------------------------------------------------- + +enum LinearGradientMode +{ + LinearGradientModeHorizontal, // 0 + LinearGradientModeVertical, // 1 + LinearGradientModeForwardDiagonal, // 2 + LinearGradientModeBackwardDiagonal // 3 +}; + +//-------------------------------------------------------------------------- +// Region Comine Modes +//-------------------------------------------------------------------------- + +enum CombineMode +{ + CombineModeReplace, // 0 + CombineModeIntersect, // 1 + CombineModeUnion, // 2 + CombineModeXor, // 3 + CombineModeExclude, // 4 + CombineModeComplement // 5 (does exclude from) +}; + +//-------------------------------------------------------------------------- + // Image types +//-------------------------------------------------------------------------- + +enum ImageType +{ + ImageTypeUnknown, // 0 + ImageTypeBitmap, // 1 + ImageTypeMetafile // 2 +}; + +//-------------------------------------------------------------------------- +// Interpolation modes +//-------------------------------------------------------------------------- + +enum InterpolationMode +{ + InterpolationModeInvalid = QualityModeInvalid, + InterpolationModeDefault = QualityModeDefault, + InterpolationModeLowQuality = QualityModeLow, + InterpolationModeHighQuality = QualityModeHigh, + InterpolationModeBilinear, + InterpolationModeBicubic, + InterpolationModeNearestNeighbor, + InterpolationModeHighQualityBilinear, + InterpolationModeHighQualityBicubic +}; + +//-------------------------------------------------------------------------- +// Pen types +//-------------------------------------------------------------------------- +enum PenAlignment +{ + PenAlignmentCenter = 0, + PenAlignmentInset = 1, + PenAlignmentOutset = 2, + PenAlignmentLeft = 3, + PenAlignmentRight = 4 +}; + +//-------------------------------------------------------------------------- +// Brush types +//-------------------------------------------------------------------------- + +enum BrushType +{ + BrushTypeSolidColor = 0, + BrushTypeHatchFill = 1, + BrushTypeTextureFill = 2, + BrushTypePathGradient = 3, + BrushTypeLinearGradient = 4 +}; + +//-------------------------------------------------------------------------- +// Pen's Fill types +//-------------------------------------------------------------------------- + +enum PenType +{ + PenTypeSolidColor = BrushTypeSolidColor, + PenTypeHatchFill = BrushTypeHatchFill, + PenTypeTextureFill = BrushTypeTextureFill, + PenTypePathGradient = BrushTypePathGradient, + PenTypeLinearGradient = BrushTypeLinearGradient, + PenTypeUnknown = -1 +}; + +//-------------------------------------------------------------------------- +// Matrix Order +//-------------------------------------------------------------------------- + +enum MatrixOrder +{ + MatrixOrderPrepend = 0, + MatrixOrderAppend = 1 +}; + +//-------------------------------------------------------------------------- +// Generic font families +//-------------------------------------------------------------------------- + +enum GenericFontFamily +{ + GenericFontFamilySerif, + GenericFontFamilySansSerif, + GenericFontFamilyMonospace + +}; + +//-------------------------------------------------------------------------- +// FontStyle: face types and common styles +//-------------------------------------------------------------------------- + +// These should probably be flags + +// Must have: +// Regular = 0 +// Bold = 1 +// Italic = 2 +// BoldItalic = 3 + +enum FontStyle +{ + FontStyleRegular = 0, + FontStyleBold = 1, + FontStyleItalic = 2, + FontStyleBoldItalic = 3, + FontStyleUnderline = 4, + FontStyleStrikeout = 8 +}; + +//--------------------------------------------------------------------------- +// Smoothing Mode +//--------------------------------------------------------------------------- + +enum SmoothingMode +{ + SmoothingModeInvalid = QualityModeInvalid, + SmoothingModeDefault = QualityModeDefault, + SmoothingModeHighSpeed = QualityModeLow, + SmoothingModeHighQuality = QualityModeHigh, + SmoothingModeNone, + SmoothingModeAntiAlias +}; + +//--------------------------------------------------------------------------- +// Pixel Format Mode +//--------------------------------------------------------------------------- + +enum PixelOffsetMode +{ + PixelOffsetModeInvalid = QualityModeInvalid, + PixelOffsetModeDefault = QualityModeDefault, + PixelOffsetModeHighSpeed = QualityModeLow, + PixelOffsetModeHighQuality = QualityModeHigh, + PixelOffsetModeNone, // no pixel offset + PixelOffsetModeHalf // offset by -0.5, -0.5 for fast anti-alias perf +}; + +//--------------------------------------------------------------------------- +// Text Rendering Hint +//--------------------------------------------------------------------------- + +enum TextRenderingHint +{ +#ifdef DCR_USE_NEW_186764 + TextRenderingHintSystemDefault = 0, // Glyph with system default rendering hint + TextRenderingHintSingleBitPerPixelGridFit, // Glyph bitmap with hinting +#else + TextRenderingHintSingleBitPerPixelGridFit = 0, // Glyph bitmap with hinting +#endif // DCR_USE_NEW_186764 + TextRenderingHintSingleBitPerPixel, // Glyph bitmap without hinting + TextRenderingHintAntiAliasGridFit, // Glyph anti-alias bitmap with hinting + TextRenderingHintAntiAlias, // Glyph anti-alias bitmap without hinting + TextRenderingHintClearTypeGridFit // Glyph CT bitmap with hinting +}; + +//--------------------------------------------------------------------------- +// Metafile Types +//--------------------------------------------------------------------------- +enum MetafileType +{ + MetafileTypeInvalid, // Invalid metafile + MetafileTypeWmf, // Standard WMF + MetafileTypeWmfAldus, // Aldus Placeable Metafile format + MetafileTypeEmf, // EMF (not EMF+) + MetafileTypeEmfPlusOnly, // EMF+ without dual, down-level records + MetafileTypeEmfPlusDual // EMF+ with dual, down-level records +}; + +// Specifies the type of EMF to record +enum EmfType +{ + EmfTypeEmfOnly = MetafileTypeEmf, // no EMF+, only EMF + EmfTypeEmfPlusOnly = MetafileTypeEmfPlusOnly, // no EMF, only EMF+ + EmfTypeEmfPlusDual = MetafileTypeEmfPlusDual // both EMF+ and EMF +}; + +// All persistent objects must have a type listed here +enum ObjectType +{ + ObjectTypeInvalid, + ObjectTypeBrush, + ObjectTypePen, + ObjectTypePath, + ObjectTypeRegion, + ObjectTypeImage, + ObjectTypeFont, + ObjectTypeStringFormat, + ObjectTypeImageAttributes, + ObjectTypeCustomLineCap, + + ObjectTypeMax = ObjectTypeCustomLineCap, + ObjectTypeMin = ObjectTypeBrush +}; + +inline BOOL +ObjectTypeIsValid( + ObjectType type + ) +{ + return ((type >= ObjectTypeMin) && (type <= ObjectTypeMax)); +} + +//--------------------------------------------------------------------------- +// EMF+ Records +//--------------------------------------------------------------------------- + +// We have to change the WMF record numbers so that they don't conflict with +// the EMF and EMF+ record numbers. +enum EmfPlusRecordType; +#define GDIP_EMFPLUS_RECORD_BASE 0x00004000 +#define GDIP_WMF_RECORD_BASE 0x00010000 +#define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE)) +#define GDIP_EMFPLUS_RECORD_TO_WMF(n) ((n) & (~GDIP_WMF_RECORD_BASE)) +#define GDIP_IS_WMF_RECORDTYPE(n) (((n) & GDIP_WMF_RECORD_BASE) != 0) + +enum EmfPlusRecordType +{ + // Since we have to enumerate GDI records right along with GDI+ records, + // we list all the GDI records here so that they can be part of the + // same enumeration type which is used in the enumeration callback. + + WmfRecordTypeSetBkColor = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKCOLOR), + WmfRecordTypeSetBkMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETBKMODE), + WmfRecordTypeSetMapMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPMODE), + WmfRecordTypeSetROP2 = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETROP2), + WmfRecordTypeSetRelAbs = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETRELABS), + WmfRecordTypeSetPolyFillMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPOLYFILLMODE), + WmfRecordTypeSetStretchBltMode = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETSTRETCHBLTMODE), + WmfRecordTypeSetTextCharExtra = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCHAREXTRA), + WmfRecordTypeSetTextColor = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTCOLOR), + WmfRecordTypeSetTextJustification = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTJUSTIFICATION), + WmfRecordTypeSetWindowOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWORG), + WmfRecordTypeSetWindowExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETWINDOWEXT), + WmfRecordTypeSetViewportOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTORG), + WmfRecordTypeSetViewportExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETVIEWPORTEXT), + WmfRecordTypeOffsetWindowOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETWINDOWORG), + WmfRecordTypeScaleWindowExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEWINDOWEXT), + WmfRecordTypeOffsetViewportOrg = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETVIEWPORTORG), + WmfRecordTypeScaleViewportExt = GDIP_WMF_RECORD_TO_EMFPLUS(META_SCALEVIEWPORTEXT), + WmfRecordTypeLineTo = GDIP_WMF_RECORD_TO_EMFPLUS(META_LINETO), + WmfRecordTypeMoveTo = GDIP_WMF_RECORD_TO_EMFPLUS(META_MOVETO), + WmfRecordTypeExcludeClipRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXCLUDECLIPRECT), + WmfRecordTypeIntersectClipRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_INTERSECTCLIPRECT), + WmfRecordTypeArc = GDIP_WMF_RECORD_TO_EMFPLUS(META_ARC), + WmfRecordTypeEllipse = GDIP_WMF_RECORD_TO_EMFPLUS(META_ELLIPSE), + WmfRecordTypeFloodFill = GDIP_WMF_RECORD_TO_EMFPLUS(META_FLOODFILL), + WmfRecordTypePie = GDIP_WMF_RECORD_TO_EMFPLUS(META_PIE), + WmfRecordTypeRectangle = GDIP_WMF_RECORD_TO_EMFPLUS(META_RECTANGLE), + WmfRecordTypeRoundRect = GDIP_WMF_RECORD_TO_EMFPLUS(META_ROUNDRECT), + WmfRecordTypePatBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_PATBLT), + WmfRecordTypeSaveDC = GDIP_WMF_RECORD_TO_EMFPLUS(META_SAVEDC), + WmfRecordTypeSetPixel = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPIXEL), + WmfRecordTypeOffsetClipRgn = GDIP_WMF_RECORD_TO_EMFPLUS(META_OFFSETCLIPRGN), + WmfRecordTypeTextOut = GDIP_WMF_RECORD_TO_EMFPLUS(META_TEXTOUT), + WmfRecordTypeBitBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_BITBLT), + WmfRecordTypeStretchBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_STRETCHBLT), + WmfRecordTypePolygon = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYGON), + WmfRecordTypePolyline = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYLINE), + WmfRecordTypeEscape = GDIP_WMF_RECORD_TO_EMFPLUS(META_ESCAPE), + WmfRecordTypeRestoreDC = GDIP_WMF_RECORD_TO_EMFPLUS(META_RESTOREDC), + WmfRecordTypeFillRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_FILLREGION), + WmfRecordTypeFrameRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_FRAMEREGION), + WmfRecordTypeInvertRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_INVERTREGION), + WmfRecordTypePaintRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_PAINTREGION), + WmfRecordTypeSelectClipRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTCLIPREGION), + WmfRecordTypeSelectObject = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTOBJECT), + WmfRecordTypeSetTextAlign = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETTEXTALIGN), + WmfRecordTypeDrawText = GDIP_WMF_RECORD_TO_EMFPLUS(0x062F), // META_DRAWTEXT + WmfRecordTypeChord = GDIP_WMF_RECORD_TO_EMFPLUS(META_CHORD), + WmfRecordTypeSetMapperFlags = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETMAPPERFLAGS), + WmfRecordTypeExtTextOut = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXTTEXTOUT), + WmfRecordTypeSetDIBToDev = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETDIBTODEV), + WmfRecordTypeSelectPalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_SELECTPALETTE), + WmfRecordTypeRealizePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_REALIZEPALETTE), + WmfRecordTypeAnimatePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_ANIMATEPALETTE), + WmfRecordTypeSetPalEntries = GDIP_WMF_RECORD_TO_EMFPLUS(META_SETPALENTRIES), + WmfRecordTypePolyPolygon = GDIP_WMF_RECORD_TO_EMFPLUS(META_POLYPOLYGON), + WmfRecordTypeResizePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_RESIZEPALETTE), + WmfRecordTypeDIBBitBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBBITBLT), + WmfRecordTypeDIBStretchBlt = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBSTRETCHBLT), + WmfRecordTypeDIBCreatePatternBrush = GDIP_WMF_RECORD_TO_EMFPLUS(META_DIBCREATEPATTERNBRUSH), + WmfRecordTypeStretchDIB = GDIP_WMF_RECORD_TO_EMFPLUS(META_STRETCHDIB), + WmfRecordTypeExtFloodFill = GDIP_WMF_RECORD_TO_EMFPLUS(META_EXTFLOODFILL), + WmfRecordTypeSetLayout = GDIP_WMF_RECORD_TO_EMFPLUS(0x0149), // META_SETLAYOUT + WmfRecordTypeResetDC = GDIP_WMF_RECORD_TO_EMFPLUS(0x014C), // META_RESETDC + WmfRecordTypeStartDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x014D), // META_STARTDOC + WmfRecordTypeStartPage = GDIP_WMF_RECORD_TO_EMFPLUS(0x004F), // META_STARTPAGE + WmfRecordTypeEndPage = GDIP_WMF_RECORD_TO_EMFPLUS(0x0050), // META_ENDPAGE + WmfRecordTypeAbortDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x0052), // META_ABORTDOC + WmfRecordTypeEndDoc = GDIP_WMF_RECORD_TO_EMFPLUS(0x005E), // META_ENDDOC + WmfRecordTypeDeleteObject = GDIP_WMF_RECORD_TO_EMFPLUS(META_DELETEOBJECT), + WmfRecordTypeCreatePalette = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPALETTE), + WmfRecordTypeCreateBrush = GDIP_WMF_RECORD_TO_EMFPLUS(0x00F8), // META_CREATEBRUSH + WmfRecordTypeCreatePatternBrush = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPATTERNBRUSH), + WmfRecordTypeCreatePenIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEPENINDIRECT), + WmfRecordTypeCreateFontIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEFONTINDIRECT), + WmfRecordTypeCreateBrushIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEBRUSHINDIRECT), + WmfRecordTypeCreateBitmapIndirect = GDIP_WMF_RECORD_TO_EMFPLUS(0x02FD), // META_CREATEBITMAPINDIRECT + WmfRecordTypeCreateBitmap = GDIP_WMF_RECORD_TO_EMFPLUS(0x06FE), // META_CREATEBITMAP + WmfRecordTypeCreateRegion = GDIP_WMF_RECORD_TO_EMFPLUS(META_CREATEREGION), + + EmfRecordTypeHeader = EMR_HEADER, + EmfRecordTypePolyBezier = EMR_POLYBEZIER, + EmfRecordTypePolygon = EMR_POLYGON, + EmfRecordTypePolyline = EMR_POLYLINE, + EmfRecordTypePolyBezierTo = EMR_POLYBEZIERTO, + EmfRecordTypePolyLineTo = EMR_POLYLINETO, + EmfRecordTypePolyPolyline = EMR_POLYPOLYLINE, + EmfRecordTypePolyPolygon = EMR_POLYPOLYGON, + EmfRecordTypeSetWindowExtEx = EMR_SETWINDOWEXTEX, + EmfRecordTypeSetWindowOrgEx = EMR_SETWINDOWORGEX, + EmfRecordTypeSetViewportExtEx = EMR_SETVIEWPORTEXTEX, + EmfRecordTypeSetViewportOrgEx = EMR_SETVIEWPORTORGEX, + EmfRecordTypeSetBrushOrgEx = EMR_SETBRUSHORGEX, + EmfRecordTypeEOF = EMR_EOF, + EmfRecordTypeSetPixelV = EMR_SETPIXELV, + EmfRecordTypeSetMapperFlags = EMR_SETMAPPERFLAGS, + EmfRecordTypeSetMapMode = EMR_SETMAPMODE, + EmfRecordTypeSetBkMode = EMR_SETBKMODE, + EmfRecordTypeSetPolyFillMode = EMR_SETPOLYFILLMODE, + EmfRecordTypeSetROP2 = EMR_SETROP2, + EmfRecordTypeSetStretchBltMode = EMR_SETSTRETCHBLTMODE, + EmfRecordTypeSetTextAlign = EMR_SETTEXTALIGN, + EmfRecordTypeSetColorAdjustment = EMR_SETCOLORADJUSTMENT, + EmfRecordTypeSetTextColor = EMR_SETTEXTCOLOR, + EmfRecordTypeSetBkColor = EMR_SETBKCOLOR, + EmfRecordTypeOffsetClipRgn = EMR_OFFSETCLIPRGN, + EmfRecordTypeMoveToEx = EMR_MOVETOEX, + EmfRecordTypeSetMetaRgn = EMR_SETMETARGN, + EmfRecordTypeExcludeClipRect = EMR_EXCLUDECLIPRECT, + EmfRecordTypeIntersectClipRect = EMR_INTERSECTCLIPRECT, + EmfRecordTypeScaleViewportExtEx = EMR_SCALEVIEWPORTEXTEX, + EmfRecordTypeScaleWindowExtEx = EMR_SCALEWINDOWEXTEX, + EmfRecordTypeSaveDC = EMR_SAVEDC, + EmfRecordTypeRestoreDC = EMR_RESTOREDC, + EmfRecordTypeSetWorldTransform = EMR_SETWORLDTRANSFORM, + EmfRecordTypeModifyWorldTransform = EMR_MODIFYWORLDTRANSFORM, + EmfRecordTypeSelectObject = EMR_SELECTOBJECT, + EmfRecordTypeCreatePen = EMR_CREATEPEN, + EmfRecordTypeCreateBrushIndirect = EMR_CREATEBRUSHINDIRECT, + EmfRecordTypeDeleteObject = EMR_DELETEOBJECT, + EmfRecordTypeAngleArc = EMR_ANGLEARC, + EmfRecordTypeEllipse = EMR_ELLIPSE, + EmfRecordTypeRectangle = EMR_RECTANGLE, + EmfRecordTypeRoundRect = EMR_ROUNDRECT, + EmfRecordTypeArc = EMR_ARC, + EmfRecordTypeChord = EMR_CHORD, + EmfRecordTypePie = EMR_PIE, + EmfRecordTypeSelectPalette = EMR_SELECTPALETTE, + EmfRecordTypeCreatePalette = EMR_CREATEPALETTE, + EmfRecordTypeSetPaletteEntries = EMR_SETPALETTEENTRIES, + EmfRecordTypeResizePalette = EMR_RESIZEPALETTE, + EmfRecordTypeRealizePalette = EMR_REALIZEPALETTE, + EmfRecordTypeExtFloodFill = EMR_EXTFLOODFILL, + EmfRecordTypeLineTo = EMR_LINETO, + EmfRecordTypeArcTo = EMR_ARCTO, + EmfRecordTypePolyDraw = EMR_POLYDRAW, + EmfRecordTypeSetArcDirection = EMR_SETARCDIRECTION, + EmfRecordTypeSetMiterLimit = EMR_SETMITERLIMIT, + EmfRecordTypeBeginPath = EMR_BEGINPATH, + EmfRecordTypeEndPath = EMR_ENDPATH, + EmfRecordTypeCloseFigure = EMR_CLOSEFIGURE, + EmfRecordTypeFillPath = EMR_FILLPATH, + EmfRecordTypeStrokeAndFillPath = EMR_STROKEANDFILLPATH, + EmfRecordTypeStrokePath = EMR_STROKEPATH, + EmfRecordTypeFlattenPath = EMR_FLATTENPATH, + EmfRecordTypeWidenPath = EMR_WIDENPATH, + EmfRecordTypeSelectClipPath = EMR_SELECTCLIPPATH, + EmfRecordTypeAbortPath = EMR_ABORTPATH, + EmfRecordTypeReserved_069 = 69, // Not Used + EmfRecordTypeGdiComment = EMR_GDICOMMENT, + EmfRecordTypeFillRgn = EMR_FILLRGN, + EmfRecordTypeFrameRgn = EMR_FRAMERGN, + EmfRecordTypeInvertRgn = EMR_INVERTRGN, + EmfRecordTypePaintRgn = EMR_PAINTRGN, + EmfRecordTypeExtSelectClipRgn = EMR_EXTSELECTCLIPRGN, + EmfRecordTypeBitBlt = EMR_BITBLT, + EmfRecordTypeStretchBlt = EMR_STRETCHBLT, + EmfRecordTypeMaskBlt = EMR_MASKBLT, + EmfRecordTypePlgBlt = EMR_PLGBLT, + EmfRecordTypeSetDIBitsToDevice = EMR_SETDIBITSTODEVICE, + EmfRecordTypeStretchDIBits = EMR_STRETCHDIBITS, + EmfRecordTypeExtCreateFontIndirect = EMR_EXTCREATEFONTINDIRECTW, + EmfRecordTypeExtTextOutA = EMR_EXTTEXTOUTA, + EmfRecordTypeExtTextOutW = EMR_EXTTEXTOUTW, + EmfRecordTypePolyBezier16 = EMR_POLYBEZIER16, + EmfRecordTypePolygon16 = EMR_POLYGON16, + EmfRecordTypePolyline16 = EMR_POLYLINE16, + EmfRecordTypePolyBezierTo16 = EMR_POLYBEZIERTO16, + EmfRecordTypePolylineTo16 = EMR_POLYLINETO16, + EmfRecordTypePolyPolyline16 = EMR_POLYPOLYLINE16, + EmfRecordTypePolyPolygon16 = EMR_POLYPOLYGON16, + EmfRecordTypePolyDraw16 = EMR_POLYDRAW16, + EmfRecordTypeCreateMonoBrush = EMR_CREATEMONOBRUSH, + EmfRecordTypeCreateDIBPatternBrushPt = EMR_CREATEDIBPATTERNBRUSHPT, + EmfRecordTypeExtCreatePen = EMR_EXTCREATEPEN, + EmfRecordTypePolyTextOutA = EMR_POLYTEXTOUTA, + EmfRecordTypePolyTextOutW = EMR_POLYTEXTOUTW, + EmfRecordTypeSetICMMode = 98, // EMR_SETICMMODE, + EmfRecordTypeCreateColorSpace = 99, // EMR_CREATECOLORSPACE, + EmfRecordTypeSetColorSpace = 100, // EMR_SETCOLORSPACE, + EmfRecordTypeDeleteColorSpace = 101, // EMR_DELETECOLORSPACE, + EmfRecordTypeGLSRecord = 102, // EMR_GLSRECORD, + EmfRecordTypeGLSBoundedRecord = 103, // EMR_GLSBOUNDEDRECORD, + EmfRecordTypePixelFormat = 104, // EMR_PIXELFORMAT, + EmfRecordTypeDrawEscape = 105, // EMR_RESERVED_105, + EmfRecordTypeExtEscape = 106, // EMR_RESERVED_106, + EmfRecordTypeStartDoc = 107, // EMR_RESERVED_107, + EmfRecordTypeSmallTextOut = 108, // EMR_RESERVED_108, + EmfRecordTypeForceUFIMapping = 109, // EMR_RESERVED_109, + EmfRecordTypeNamedEscape = 110, // EMR_RESERVED_110, + EmfRecordTypeColorCorrectPalette = 111, // EMR_COLORCORRECTPALETTE, + EmfRecordTypeSetICMProfileA = 112, // EMR_SETICMPROFILEA, + EmfRecordTypeSetICMProfileW = 113, // EMR_SETICMPROFILEW, + EmfRecordTypeAlphaBlend = 114, // EMR_ALPHABLEND, + EmfRecordTypeSetLayout = 115, // EMR_SETLAYOUT, + EmfRecordTypeTransparentBlt = 116, // EMR_TRANSPARENTBLT, + EmfRecordTypeReserved_117 = 117, // Not Used + EmfRecordTypeGradientFill = 118, // EMR_GRADIENTFILL, + EmfRecordTypeSetLinkedUFIs = 119, // EMR_RESERVED_119, + EmfRecordTypeSetTextJustification = 120, // EMR_RESERVED_120, + EmfRecordTypeColorMatchToTargetW = 121, // EMR_COLORMATCHTOTARGETW, + EmfRecordTypeCreateColorSpaceW = 122, // EMR_CREATECOLORSPACEW, + EmfRecordTypeMax = 122, + EmfRecordTypeMin = 1, + + // That is the END of the GDI EMF records. + + // Now we start the list of EMF+ records. We leave quite + // a bit of room here for the addition of any new GDI + // records that may be added later. + + EmfPlusRecordTypeInvalid = GDIP_EMFPLUS_RECORD_BASE, + EmfPlusRecordTypeHeader, + EmfPlusRecordTypeEndOfFile, + + EmfPlusRecordTypeComment, + + EmfPlusRecordTypeGetDC, // the application grabbed the metafile dc + + EmfPlusRecordTypeMultiFormatStart, + EmfPlusRecordTypeMultiFormatSection, + EmfPlusRecordTypeMultiFormatEnd, + + // For all persistent objects + EmfPlusRecordTypeObject, // brush,pen,path,region,image,font,string-format + + // Drawing Records + EmfPlusRecordTypeClear, + EmfPlusRecordTypeFillRects, + EmfPlusRecordTypeDrawRects, + EmfPlusRecordTypeFillPolygon, + EmfPlusRecordTypeDrawLines, + EmfPlusRecordTypeFillEllipse, + EmfPlusRecordTypeDrawEllipse, + EmfPlusRecordTypeFillPie, + EmfPlusRecordTypeDrawPie, + EmfPlusRecordTypeDrawArc, + EmfPlusRecordTypeFillRegion, + EmfPlusRecordTypeFillPath, + EmfPlusRecordTypeDrawPath, + EmfPlusRecordTypeFillClosedCurve, + EmfPlusRecordTypeDrawClosedCurve, + EmfPlusRecordTypeDrawCurve, + EmfPlusRecordTypeDrawBeziers, + EmfPlusRecordTypeDrawImage, + EmfPlusRecordTypeDrawImagePoints, + EmfPlusRecordTypeDrawString, + + // Graphics State Records + EmfPlusRecordTypeSetRenderingOrigin, + EmfPlusRecordTypeSetAntiAliasMode, + EmfPlusRecordTypeSetTextRenderingHint, +#ifdef DCR_USE_NEW_188922 + EmfPlusRecordTypeSetTextContrast, +#else + EmfPlusRecordTypeSetGammaValue, +#endif // DCR_USE_NEW_188922 + EmfPlusRecordTypeSetInterpolationMode, + EmfPlusRecordTypeSetPixelOffsetMode, + EmfPlusRecordTypeSetCompositingMode, + EmfPlusRecordTypeSetCompositingQuality, + EmfPlusRecordTypeSave, + EmfPlusRecordTypeRestore, + EmfPlusRecordTypeBeginContainer, + EmfPlusRecordTypeBeginContainerNoParams, + EmfPlusRecordTypeEndContainer, + EmfPlusRecordTypeSetWorldTransform, + EmfPlusRecordTypeResetWorldTransform, + EmfPlusRecordTypeMultiplyWorldTransform, + EmfPlusRecordTypeTranslateWorldTransform, + EmfPlusRecordTypeScaleWorldTransform, + EmfPlusRecordTypeRotateWorldTransform, + EmfPlusRecordTypeSetPageTransform, + EmfPlusRecordTypeResetClip, + EmfPlusRecordTypeSetClipRect, + EmfPlusRecordTypeSetClipPath, + EmfPlusRecordTypeSetClipRegion, + EmfPlusRecordTypeOffsetClip, + + // New record types must be added here (at the end) -- do not add above, + // since that will invalidate previous metafiles! + EmfPlusRecordTypeDrawDriverString, + + // Have this here so you don't need to keep changing the value of + // EmfPlusRecordTypeMax every time you add a new record. + + EmfPlusRecordTotal, + + EmfPlusRecordTypeMax = EmfPlusRecordTotal-1, + EmfPlusRecordTypeMin = EmfPlusRecordTypeHeader, +}; + +//--------------------------------------------------------------------------- +// StringFormatFlags +//--------------------------------------------------------------------------- + +//--------------------------------------------------------------------------- +// String format flags +// +// DirectionRightToLeft - For horizontal text, the reading order is +// right to left. This value is called +// the base embedding level by the Unicode +// bidirectional engine. +// For vertical text, columns are read from +// right to left. +// By default, horizontal or vertical text is +// read from left to right. +// +// DirectionVertical - Individual lines of text are vertical. In +// each line, characters progress from top to +// bottom. +// By default, lines of text are horizontal, +// each new line below the previous line. +// +// NoFitBlackBox - Allows parts of glyphs to overhang the +// bounding rectangle. +// By default glyphs are first aligned +// inside the margines, then any glyphs which +// still overhang the bounding box are +// repositioned to avoid any overhang. +// For example when an italic +// lower case letter f in a font such as +// Garamond is aligned at the far left of a +// rectangle, the lower part of the f will +// reach slightly further left than the left +// edge of the rectangle. Setting this flag +// will ensure the character aligns visually +// with the lines above and below, but may +// cause some pixels outside the formatting +// rectangle to be clipped or painted. +// +#ifndef DCR_USE_NEW_137252 +// NumberContextArabic - Causes any initial numeric in the string to +// be analysed for bidirection layout as if +// it was preceeded by Arabic text. +// +// DisableKashidaJustification - Arabic text will not be justified by the +// insertion of kashidas (i.e. extending the +// joining line between characters). Instead +// Arabic script will be justified by the +// widening of the whitespace between words. +// +#endif +// DisplayFormatControl - Causes control characters such as the +// left-to-right mark to be shown in the +// output with a representative glyph. +// +#ifndef DCR_USE_NEW_137252 +// DisableKerning - Disables Truetype and OpenType kerning. +// +// DisableLigatures - Disables Truetype and OpenType ligatures. +// +// LayoutLegacyBidi - Causes the bidirection algorithm to use +// slightly different classifications for +// '+', '-' and '/' that make their layout +// much closer to that expected by files +// generated in Windows or by Windows +// applications. +// +// NoChanges - A text imager created with this flag set +// does not support those APIs that change +// it's contents or formatting, but for most +// simple text will be significantly faster in +// performing measurement and drawing +// functions. +// +#endif +// NoFontFallback - Disables fallback to alternate fonts for +// characters not supported in the requested +// font. Any missing characters will be +// be displayed with the fonts missing glyph, +// usually an open square. +// +// NoWrap - Disables wrapping of text between lines +// when formatting within a rectangle. +// NoWrap is implied when a point is passed +// instead of a rectangle, or when the +// specified rectangle has a zero line length. +// +// NoClip - By default text is clipped to the +// formatting rectangle. Setting NoClip +// allows overhanging pixels to affect the +// device outside the formatting rectangle. +// Pixels at the end of the line may be +// affected if the glyphs overhang their +// cells, and either the NoFitBlackBox flag +// has been set, or the glyph extends to far +// to be fitted. +// Pixels above/before the first line or +// below/after the last line may be affected +// if the glyphs extend beyond their cell +// ascent / descent. This can occur rarely +// with unusual diacritic mark combinations. + +//--------------------------------------------------------------------------- + +enum StringFormatFlags +{ + StringFormatFlagsDirectionRightToLeft = 0x00000001, + StringFormatFlagsDirectionVertical = 0x00000002, + StringFormatFlagsNoFitBlackBox = 0x00000004, +#ifndef DCR_USE_NEW_137252 + StringFormatFlagsNumberContextArabic = 0x00000008, + StringFormatFlagsDisableKashidaJustification = 0x00000010, +#endif + StringFormatFlagsDisplayFormatControl = 0x00000020, +#ifndef DCR_USE_NEW_137252 + StringFormatFlagsDisableKerning = 0x00000040, + StringFormatFlagsDisableLigatures = 0x00000080, + StringFormatFlagsLayoutLegacyBidi = 0x00000100, + StringFormatFlagsNoChanges = 0x00000200, +#endif + StringFormatFlagsNoFontFallback = 0x00000400, + StringFormatFlagsMeasureTrailingSpaces = 0x00000800, + StringFormatFlagsNoWrap = 0x00001000, + StringFormatFlagsLineLimit = 0x00002000, + + StringFormatFlagsNoClip = 0x00004000 +}; + +//--------------------------------------------------------------------------- +// StringTrimming +//--------------------------------------------------------------------------- + +enum StringTrimming { + StringTrimmingNone = 0, + StringTrimmingCharacter = 1, + StringTrimmingWord = 2, + StringTrimmingEllipsisCharacter = 3, + StringTrimmingEllipsisWord = 4, + StringTrimmingEllipsisPath = 5 +}; + +#ifndef DCR_USE_NEW_137252 +//--------------------------------------------------------------------------- +// String units +// +// String units are like length units in CSS, they may be absolute, or +// they may be relative to a font size. +// +//--------------------------------------------------------------------------- + +enum StringUnit { + StringUnitWorld = UnitWorld, + StringUnitDisplay = UnitDisplay, + StringUnitPixel = UnitPixel, + StringUnitPoint = UnitPoint, + StringUnitInch = UnitInch, + StringUnitDocument = UnitDocument, + StringUnitMillimeter = UnitMillimeter, + StringUnitEm = 32 +}; +#endif + +#ifndef DCR_USE_NEW_152154 +//--------------------------------------------------------------------------- +// Line spacing flags +//--------------------------------------------------------------------------- + +enum LineSpacing { + LineSpacingWorld = UnitWorld, + LineSpacingDisplay = UnitDisplay, + LineSpacingPixel = UnitPixel, + LineSpacingPoint = UnitPoint, + LineSpacingInch = UnitInch, + LineSpacingDocument = UnitDocument, + LineSpacingMillimeter = UnitMillimeter, + + LineSpacingRecommended = 32, + LineSpacingAtLeast = 33, + LineSpacingAtLeastMultiple = 34, + LineSpacingCell = 35, + LineSpacingCellAtLeast = 36, + LineSpacingCellAtLeastMultiple = 37 +}; + +/// The following methods of linespacing are relative to the font size +// +// =========== Method =========== =============== Relative to =============== +// +// LineSpacingRecommended recommended line spacing specified by font +// LineSpacingAtLeast max(recommended, tallest glyph cell) +// LineSpacingAtLeastMultiple smallest multiple of recommended big enough +// for all glyph cells on the line +// LineSpacingCell cell height +// LineSpacingCellAtLeast max(font cell height, tallest glyph cell) +// LineSpacingCellAtLeastMultiple smallest multiple of cell height big enough +// for all glyph cells on the line +#endif + + +//--------------------------------------------------------------------------- +// National language digit substitution +//--------------------------------------------------------------------------- + +enum StringDigitSubstitute +{ + StringDigitSubstituteUser = 0, // As NLS setting + StringDigitSubstituteNone = 1, + StringDigitSubstituteNational = 2, + StringDigitSubstituteTraditional = 3 +}; + +//--------------------------------------------------------------------------- +// Hotkey prefix interpretation +//--------------------------------------------------------------------------- + +enum HotkeyPrefix +{ + HotkeyPrefixNone = 0, + HotkeyPrefixShow = 1, + HotkeyPrefixHide = 2 +}; + +//--------------------------------------------------------------------------- +// Text alignment flags +//--------------------------------------------------------------------------- + +enum StringAlignment +{ + // Left edge for left-to-right text, + // right for right-to-left text, + // and top for vertical + StringAlignmentNear = 0, + StringAlignmentCenter = 1, + StringAlignmentFar = 2 +}; + +//--------------------------------------------------------------------------- +// DriverStringOptions +//--------------------------------------------------------------------------- + +enum DriverStringOptions +{ + DriverStringOptionsCmapLookup = 1, + DriverStringOptionsVertical = 2, + DriverStringOptionsRealizedAdvance = 4, +#ifndef DCR_USE_NEW_137252 + DriverStringOptionsCompensateResolution = 8 +#endif +}; + +//--------------------------------------------------------------------------- +// Flush Intention flags +//--------------------------------------------------------------------------- + +enum FlushIntention +{ + FlushIntentionFlush = 0, // Flush all batched rendering operations + FlushIntentionSync = 1 // Flush all batched rendering operations + // and wait for them to complete +}; + +#ifndef DCR_USE_NEW_175866 + +//--------------------------------------------------------------------------- +// Window Change Notification types +//--------------------------------------------------------------------------- + +enum WindowNotifyEnum +{ + WindowNotifyEnumEnable = 0, + WindowNotifyEnumDisable, + WindowNotifyEnumPalette, + WindowNotifyEnumDisplay, + WindowNotifyEnumSysColor +}; + +#endif + +//--------------------------------------------------------------------------- +// Image encoder parameter related types +//--------------------------------------------------------------------------- + +#ifdef DCR_USE_NEW_145804 +enum EncoderParameterValueType +{ + EncoderParameterValueTypeByte = 1, // 8-bit unsigned int + EncoderParameterValueTypeASCII = 2, // 8-bit byte containing one 7-bit ASCII + // code. NULL terminated. + EncoderParameterValueTypeShort = 3, // 16-bit unsigned int + EncoderParameterValueTypeLong = 4, // 32-bit unsigned int + EncoderParameterValueTypeRational = 5, // Two Longs. The first Long is the + // numerator, the second Long expresses the + // denomintor. + EncoderParameterValueTypeLongRange = 6, // Two longs which specify a range of + // integer values. The first Long specifies + // the lower end and the second one + // specifies the higher end. All values + // are inclusive at both ends + EncoderParameterValueTypeUndefined = 7, // 8-bit byte that can take any value + // depending on field definition + EncoderParameterValueTypeRationalRange = 8 // Two Rationals. The first Rational + // specifies the lower end and the second + // specifies the higher end. All values + // are inclusive at both ends +}; +#else +enum ValueType +{ + ValueTypeByte = 1, // 8-bit unsigned int + ValueTypeASCII = 2, // 8-bit byte containing one 7-bit ASCII + // code. NULL terminated. + ValueTypeShort = 3, // 16-bit unsigned int + ValueTypeLong = 4, // 32-bit unsigned int + ValueTypeRational = 5, // Two Longs. The first Long is the + // numerator, the second Long expresses the + // denomintor. + ValueTypeLongRange = 6, // Two longs which specify a range of + // integer values. The first Long specifies + // the lower end and the second one + // specifies the higher end. All values + // are inclusive at both ends + ValueTypeUndefined = 7, // 8-bit byte that can take any value + // depending on field definition + ValueTypeRationalRange = 8 // Two Rationals. The first Rational + // specifies the lower end and the second + // specifies the higher end. All values + // are inclusive at both ends +}; +#endif + +//--------------------------------------------------------------------------- +// Image encoder value types +//--------------------------------------------------------------------------- + +enum EncoderValue +{ + EncoderValueColorTypeCMYK, + EncoderValueColorTypeYCCK, + EncoderValueCompressionLZW, + EncoderValueCompressionCCITT3, + EncoderValueCompressionCCITT4, + EncoderValueCompressionRle, + EncoderValueCompressionNone, + EncoderValueScanMethodInterlaced, + EncoderValueScanMethodNonInterlaced, + EncoderValueVersionGif87, + EncoderValueVersionGif89, + EncoderValueRenderProgressive, + EncoderValueRenderNonProgressive, + EncoderValueTransformRotate90, + EncoderValueTransformRotate180, + EncoderValueTransformRotate270, + EncoderValueTransformFlipHorizontal, + EncoderValueTransformFlipVertical, + #ifdef DCR_USE_NEW_140861 + EncoderValueMultiFrame, + #else + EncodeValueMultiFrame, + #endif + EncoderValueLastFrame, + EncoderValueFlush, + #ifdef DCR_USE_NEW_140861 + EncoderValueFrameDimensionTime, + EncoderValueFrameDimensionResolution, + EncoderValueFrameDimensionPage + #else + EncodeValueFrameDimensionTime, + EncodeValueFrameDimensionResolution, + EncodeValueFrameDimensionPage + #endif +}; + +//--------------------------------------------------------------------------- +// Graphics layout values (support for Middle East localization) +//--------------------------------------------------------------------------- + +enum GraphicsLayout +{ + GraphicsLayoutNormal, + GraphicsLayoutMirrored, + GraphicsLayoutMirroredIgnoreImages, + GraphicsLayoutMirroredForceImages +}; + +//--------------------------------------------------------------------------- +// Image layout values (support for Middle East localization) +//--------------------------------------------------------------------------- + +enum ImageLayout +{ + ImageLayoutNormal, + ImageLayoutIgnoreMirrored +}; + +enum EmfToWmfBitsFlags +{ + EmfToWmfBitsFlagsDefault = 0x00000000, + EmfToWmfBitsFlagsEmbedEmf = 0x00000001, + EmfToWmfBitsFlagsIncludeAPM = 0x00000002, + EmfToWmfBitsFlagsNoXORClip = 0x00000004 +}; + +#endif // !_GDIPLUSENUMS_H diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusFlat.h b/core/src/fxge/Microsoft SDK/include/GdiPlusFlat.h index 8b5369e793..1dd8d466e9 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusFlat.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusFlat.h @@ -1,2740 +1,2740 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusFlat.h -* -* Abstract: -* -* Flat GDI+ API wrappers - header file -* -\**************************************************************************/ - -// TODO: this file style needs to be made internally consistent with the way -// it handles breaking the long argument lists across multiple lines - -#ifndef _FLATAPI_H -#define _FLATAPI_H - -#define WINGDIPAPI __stdcall - -// currently, only C++ wrapper API's force const. - -#define GDIPCONST const - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef DCR_USE_NEW_175866 - -VOID -WINGDIPAPI -GdipDisplayPaletteWindowNotify(WindowNotifyEnum notify); - -#endif - -//---------------------------------------------------------------------------- -// GraphicsPath methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreatePath(GpFillMode brushMode, GpPath **path); - -GpStatus WINGDIPAPI -GdipCreatePath2(GDIPCONST GpPointF*, GDIPCONST BYTE*, INT, GpFillMode, - GpPath **path); - -GpStatus WINGDIPAPI -GdipCreatePath2I(GDIPCONST GpPoint*, GDIPCONST BYTE*, INT, GpFillMode, - GpPath **path); - -GpStatus WINGDIPAPI -GdipClonePath(GpPath* path, GpPath **clonePath); - -GpStatus WINGDIPAPI -GdipDeletePath(GpPath* path); - -GpStatus WINGDIPAPI -GdipResetPath(GpPath* path); - -GpStatus WINGDIPAPI -GdipGetPointCount(GpPath* path, INT* count); - -GpStatus WINGDIPAPI -GdipGetPathTypes(GpPath* path, BYTE* types, INT count); - -GpStatus WINGDIPAPI -GdipGetPathPoints(GpPath*, GpPointF* points, INT count); - -GpStatus WINGDIPAPI -GdipGetPathPointsI(GpPath*, GpPoint* points, INT count); - -GpStatus WINGDIPAPI -GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode); - -GpStatus WINGDIPAPI -GdipSetPathFillMode(GpPath *path, GpFillMode fillmode); - -GpStatus WINGDIPAPI -GdipGetPathData(GpPath *path, GpPathData* pathData); - -GpStatus WINGDIPAPI -GdipStartPathFigure(GpPath *path); - -GpStatus WINGDIPAPI -GdipClosePathFigure(GpPath *path); - -GpStatus WINGDIPAPI -GdipClosePathFigures(GpPath *path); - -GpStatus WINGDIPAPI -GdipSetPathMarker(GpPath* path); - -GpStatus WINGDIPAPI -GdipClearPathMarkers(GpPath* path); - -GpStatus WINGDIPAPI -GdipReversePath(GpPath* path); - -GpStatus WINGDIPAPI -GdipGetPathLastPoint(GpPath* path, GpPointF* lastPoint); - -GpStatus WINGDIPAPI -GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2); - -GpStatus WINGDIPAPI -GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width, REAL height, - REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipAddPathBezier(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2, - REAL x3, REAL y3, REAL x4, REAL y4); - -GpStatus WINGDIPAPI -GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathCurve(GpPath *path, GDIPCONST GpPointF *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, - REAL tension); - -GpStatus WINGDIPAPI -GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, INT count, - INT offset, INT numberOfSegments, REAL tension); - -GpStatus WINGDIPAPI -GdipAddPathClosedCurve(GpPath *path, GDIPCONST GpPointF *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, - REAL tension); - -GpStatus WINGDIPAPI -GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height); - -GpStatus WINGDIPAPI -GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects, INT count); - -GpStatus WINGDIPAPI -GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, - REAL height); - -GpStatus WINGDIPAPI -GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REAL height, - REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipAddPathPolygon(GpPath *path, GDIPCONST GpPointF *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathPath(GpPath *path, GDIPCONST GpPath* addingPath, BOOL connect); - -GpStatus WINGDIPAPI -GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, - INT length, GDIPCONST GpFontFamily *family, INT style, - REAL emSize, GDIPCONST RectF *layoutRect, - GDIPCONST GpStringFormat *format); - -GpStatus WINGDIPAPI -GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, - INT length, GDIPCONST GpFontFamily *family, INT style, - REAL emSize, GDIPCONST Rect *layoutRect, - GDIPCONST GpStringFormat *format); - -GpStatus WINGDIPAPI -GdipAddPathLineI(GpPath *path, INT x1, INT y1, INT x2, INT y2); - -GpStatus WINGDIPAPI -GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathArcI(GpPath *path, INT x, INT y, INT width, INT height, - REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipAddPathBezierI(GpPath *path, INT x1, INT y1, INT x2, INT y2, - INT x3, INT y3, INT x4, INT y4); - -GpStatus WINGDIPAPI -GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, - REAL tension); - -GpStatus WINGDIPAPI -GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points, INT count, - INT offset, INT numberOfSegments, REAL tension); - -GpStatus WINGDIPAPI -GdipAddPathClosedCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count); - -GpStatus WINGDIPAPI -GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, - REAL tension); - -GpStatus WINGDIPAPI -GdipAddPathRectangleI(GpPath *path, INT x, INT y, INT width, INT height); - -GpStatus WINGDIPAPI -GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects, INT count); - -GpStatus WINGDIPAPI -GdipAddPathEllipseI(GpPath *path, INT x, INT y, INT width, INT height); - -GpStatus WINGDIPAPI -GdipAddPathPieI(GpPath *path, INT x, INT y, INT width, INT height, - REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points, INT count); - -GpStatus WINGDIPAPI -GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatness); - -GpStatus WINGDIPAPI -GdipWindingModeOutline( - GpPath *path, - GpMatrix *matrix, - REAL flatness -); - - -#ifdef DCR_USE_NEW_202903 - -GpStatus WINGDIPAPI -GdipWidenPath( - GpPath *nativePath, - GpPen *pen, - GpMatrix *matrix, - REAL flatness -); - -#else - -GpStatus WINGDIPAPI -GdipWidenPathWithMinimumResolutions(GpPath *path, GpPen *pen, REAL minXres, - REAL minYres, GpMatrix *matrix, BOOL removeSelftIntersects); - -#endif - -GpStatus WINGDIPAPI -GdipWarpPath(GpPath *path, GpMatrix* matrix, - GDIPCONST GpPointF *points, INT count, - REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, - WarpMode warpMode, REAL flatness); - -GpStatus WINGDIPAPI -GdipTransformPath(GpPath* path, GpMatrix* matrix); - -GpStatus WINGDIPAPI -GdipGetPathWorldBounds(GpPath* path, GpRectF* bounds, GDIPCONST GpMatrix *matrix, - GDIPCONST GpPen *pen); - -GpStatus WINGDIPAPI -GdipGetPathWorldBoundsI(GpPath* path, GpRect* bounds, GDIPCONST GpMatrix *matrix, - GDIPCONST GpPen *pen); - -GpStatus WINGDIPAPI -GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, - GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsVisiblePathPointI(GpPath* path, INT x, INT y, - GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsOutlineVisiblePathPoint(GpPath* path, REAL x, REAL y, GpPen *pen, - GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsOutlineVisiblePathPointI(GpPath* path, INT x, INT y, GpPen *pen, - GpGraphics *graphics, BOOL *result); - - -//---------------------------------------------------------------------------- -// Path Enumeration methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreatePathIter(GpPathIterator **iterator, GpPath* path); - -GpStatus WINGDIPAPI -GdipDeletePathIter(GpPathIterator *iterator); - -GpStatus WINGDIPAPI -GdipPathIterNextSubpath(GpPathIterator* iterator, INT *resultCount, - INT* startIndex, INT* endIndex, BOOL* isClosed); - -GpStatus WINGDIPAPI -GdipPathIterNextSubpathPath(GpPathIterator* iterator, INT* resultCount, - GpPath* path, BOOL* isClosed); - -GpStatus WINGDIPAPI -GdipPathIterNextPathType(GpPathIterator* iterator, INT* resultCount, - BYTE* pathType, INT* startIndex, INT* endIndex); - -GpStatus WINGDIPAPI -GdipPathIterNextMarker(GpPathIterator* iterator, INT *resultCount, - INT* startIndex, INT* endIndex); - -GpStatus WINGDIPAPI -GdipPathIterNextMarkerPath(GpPathIterator* iterator, INT* resultCount, - GpPath* path); - -GpStatus WINGDIPAPI -GdipPathIterGetCount(GpPathIterator* iterator, INT* count); - -GpStatus WINGDIPAPI -GdipPathIterGetSubpathCount(GpPathIterator* iterator, INT* count); - -GpStatus WINGDIPAPI -GdipPathIterIsValid(GpPathIterator* iterator, BOOL* valid); - -GpStatus WINGDIPAPI -GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurve); - -GpStatus WINGDIPAPI -GdipPathIterRewind(GpPathIterator* iterator); - -GpStatus WINGDIPAPI -GdipPathIterEnumerate(GpPathIterator* iterator, INT* resultCount, - GpPointF *points, BYTE *types, INT count); - -GpStatus WINGDIPAPI -GdipPathIterCopyData(GpPathIterator* iterator, INT* resultCount, - GpPointF* points, BYTE* types, INT startIndex, INT endIndex); - -//---------------------------------------------------------------------------- -// Matrix methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateMatrix(GpMatrix **matrix); - -GpStatus WINGDIPAPI -GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, - REAL dy, GpMatrix **matrix); - -GpStatus WINGDIPAPI -GdipCreateMatrix3(GDIPCONST GpRectF *rect, GDIPCONST GpPointF *dstplg, - GpMatrix **matrix); - -GpStatus WINGDIPAPI -GdipCreateMatrix3I(GDIPCONST GpRect *rect, GDIPCONST GpPoint *dstplg, - GpMatrix **matrix); - -GpStatus WINGDIPAPI -GdipCloneMatrix(GpMatrix *matrix, GpMatrix **cloneMatrix); - -GpStatus WINGDIPAPI -GdipDeleteMatrix(GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, - REAL dx, REAL dy); - -GpStatus WINGDIPAPI -GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipShearMatrix(GpMatrix *matrix, REAL shearX, REAL shearY, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipInvertMatrix(GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count); - -GpStatus WINGDIPAPI -GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count); - -GpStatus WINGDIPAPI -GdipVectorTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, - INT count); - -GpStatus WINGDIPAPI -GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, - INT count); - -GpStatus WINGDIPAPI -GdipGetMatrixElements(GDIPCONST GpMatrix *matrix, REAL *matrixOut); - -GpStatus WINGDIPAPI -GdipIsMatrixInvertible(GDIPCONST GpMatrix *matrix, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsMatrixEqual(GDIPCONST GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, BOOL *result); - -//---------------------------------------------------------------------------- -// Region methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateRegion(GpRegion **region); - -GpStatus WINGDIPAPI -GdipCreateRegionRect(GDIPCONST GpRectF *rect, GpRegion **region); - -GpStatus WINGDIPAPI -GdipCreateRegionRectI(GDIPCONST GpRect *rect, GpRegion **region); - -GpStatus WINGDIPAPI -GdipCreateRegionPath(GpPath *path, GpRegion **region); - -GpStatus WINGDIPAPI -GdipCreateRegionRgnData(GDIPCONST BYTE *regionData, INT size, GpRegion **region); - -GpStatus WINGDIPAPI -GdipCreateRegionHrgn(HRGN hRgn, GpRegion **region); - -GpStatus WINGDIPAPI -GdipCloneRegion(GpRegion *region, GpRegion **cloneRegion); - -GpStatus WINGDIPAPI -GdipDeleteRegion(GpRegion *region); - -GpStatus WINGDIPAPI -GdipSetInfinite(GpRegion *region); - -GpStatus WINGDIPAPI -GdipSetEmpty(GpRegion *region); - -GpStatus WINGDIPAPI -GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, - CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipCombineRegionRectI(GpRegion *region, GDIPCONST GpRect *rect, - CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipCombineRegionRegion(GpRegion *region, GpRegion *region2, - CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipTranslateRegion(GpRegion *region, REAL dx, REAL dy); - -GpStatus WINGDIPAPI -GdipTranslateRegionI(GpRegion *region, INT dx, INT dy); - -GpStatus WINGDIPAPI -GdipTransformRegion(GpRegion *region, GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, - GpRectF *rect); - -GpStatus WINGDIPAPI -GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics, - GpRect *rect); - -GpStatus WINGDIPAPI -GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hRgn); - -GpStatus WINGDIPAPI -GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, - BOOL *result); - -GpStatus WINGDIPAPI -GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, - BOOL *result); - -GpStatus WINGDIPAPI -GdipIsEqualRegion(GpRegion *region, GpRegion *region2, - GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipGetRegionDataSize(GpRegion *region, UINT * bufferSize); - -GpStatus WINGDIPAPI -GdipGetRegionData(GpRegion *region, BYTE * buffer, UINT bufferSize, UINT * sizeFilled); - -GpStatus WINGDIPAPI -GdipIsVisibleRegionPoint(GpRegion *region, REAL x, REAL y, - GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsVisibleRegionPointI(GpRegion *region, INT x, INT y, - GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsVisibleRegionRect(GpRegion *region, REAL x, REAL y, REAL width, - REAL height, GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsVisibleRegionRectI(GpRegion *region, INT x, INT y, INT width, - INT height, GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipGetRegionScansCount(GpRegion *region, UINT* count, GpMatrix* matrix); - -GpStatus WINGDIPAPI -GdipGetRegionScans(GpRegion *region, GpRectF* rects, INT* count, GpMatrix* matrix); - -GpStatus WINGDIPAPI -GdipGetRegionScansI(GpRegion *region, GpRect* rects, INT* count, GpMatrix* matrix); - -//---------------------------------------------------------------------------- -// Brush methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCloneBrush(GpBrush *brush, GpBrush **cloneBrush); - -GpStatus WINGDIPAPI -GdipDeleteBrush(GpBrush *brush); - -GpStatus WINGDIPAPI -GdipGetBrushType(GpBrush *brush, GpBrushType *type); - -//---------------------------------------------------------------------------- -// Hatch Brush methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, - ARGB backcol, GpHatch **brush); - -GpStatus WINGDIPAPI -GdipGetHatchStyle(GpHatch *brush, GpHatchStyle *hatchstyle); - -GpStatus WINGDIPAPI -GdipGetHatchForegroundColor(GpHatch *brush, ARGB* forecol); - -GpStatus WINGDIPAPI -GdipGetHatchBackgroundColor(GpHatch *brush, ARGB* backcol); - -//---------------------------------------------------------------------------- -// Texture Brush methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateTexture(GpImage *image, GpWrapMode wrapmode, - GpTexture **texture); - -GpStatus WINGDIPAPI -GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode, REAL x, - REAL y, REAL width, REAL height, GpTexture **texture); - -GpStatus WINGDIPAPI -GdipCreateTextureIA(GpImage *image, GDIPCONST GpImageAttributes *imageAttributes, - REAL x, REAL y, REAL width, REAL height, - GpTexture **texture); - -GpStatus WINGDIPAPI -GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode, INT x, - INT y, INT width, INT height, GpTexture **texture); - -GpStatus WINGDIPAPI -GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageAttributes, - INT x, INT y, INT width, INT height, - GpTexture **texture); - - -GpStatus WINGDIPAPI -GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipSetTextureTransform(GpTexture *brush, GDIPCONST GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipResetTextureTransform(GpTexture* brush); - -GpStatus WINGDIPAPI -GdipMultiplyTextureTransform(GpTexture* brush, GDIPCONST GpMatrix *matrix, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipTranslateTextureTransform(GpTexture* brush, REAL dx, REAL dy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipScaleTextureTransform(GpTexture* brush, REAL sx, REAL sy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipRotateTextureTransform(GpTexture* brush, REAL angle, GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode); - -GpStatus WINGDIPAPI -GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode); - -GpStatus WINGDIPAPI -GdipGetTextureImage(GpTexture *brush, GpImage **image); - -//---------------------------------------------------------------------------- -// Solid Brush methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateSolidFill(ARGB color, GpSolidFill **brush); - -GpStatus WINGDIPAPI -GdipSetSolidFillColor(GpSolidFill *brush, ARGB color); - -GpStatus WINGDIPAPI -GdipGetSolidFillColor(GpSolidFill *brush, ARGB *color); - -//---------------------------------------------------------------------------- -// LineBrush methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateLineBrush(GDIPCONST GpPointF* point1, - GDIPCONST GpPointF* point2, - ARGB color1, ARGB color2, - GpWrapMode wrapMode, - GpLineGradient **lineGradient); - -GpStatus WINGDIPAPI -GdipCreateLineBrushI(GDIPCONST GpPoint* point1, - GDIPCONST GpPoint* point2, - ARGB color1, ARGB color2, - GpWrapMode wrapMode, - GpLineGradient **lineGradient); - -GpStatus WINGDIPAPI -GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, - ARGB color1, ARGB color2, - LinearGradientMode mode, - GpWrapMode wrapMode, - GpLineGradient **lineGradient); - -GpStatus WINGDIPAPI -GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect, - ARGB color1, ARGB color2, - LinearGradientMode mode, - GpWrapMode wrapMode, - GpLineGradient **lineGradient); - -GpStatus WINGDIPAPI -GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect, - ARGB color1, ARGB color2, - REAL angle, - BOOL isAngleScalable, - GpWrapMode wrapMode, - GpLineGradient **lineGradient); - -GpStatus WINGDIPAPI -GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect, - ARGB color1, ARGB color2, - REAL angle, - BOOL isAngleScalable, - GpWrapMode wrapMode, - GpLineGradient **lineGradient); - -GpStatus WINGDIPAPI -GdipSetLinePoints(GpLineGradient *brush, - GDIPCONST GpPointF* point1, - GDIPCONST GpPointF* point2); - -GpStatus WINGDIPAPI -GdipSetLinePointsI(GpLineGradient *brush, - GDIPCONST GpPoint* point1, - GDIPCONST GpPoint* point2); - -GpStatus WINGDIPAPI -GdipGetLinePoints(GpLineGradient *brush, GpPointF* points); - -GpStatus WINGDIPAPI -GdipGetLinePointsI(GpLineGradient *brush, GpPoint* points); - -GpStatus WINGDIPAPI -GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2); - -GpStatus WINGDIPAPI -GdipGetLineColors(GpLineGradient *brush, ARGB* colors); - -GpStatus WINGDIPAPI -GdipGetLineRect(GpLineGradient *brush, GpRectF *rect); - -GpStatus WINGDIPAPI -GdipGetLineRectI(GpLineGradient *brush, GpRect *rect); - -GpStatus WINGDIPAPI -GdipSetLineGammaCorrection(GpLineGradient *brush, BOOL useGammaCorrection); - -GpStatus WINGDIPAPI -GdipGetLineGammaCorrection(GpLineGradient *brush, BOOL *useGammaCorrection); - -GpStatus WINGDIPAPI -GdipGetLineBlendCount(GpLineGradient *brush, INT *count); - -GpStatus WINGDIPAPI -GdipGetLineBlend(GpLineGradient *brush, REAL *blend, REAL* positions, - INT count); - -GpStatus WINGDIPAPI -GdipSetLineBlend(GpLineGradient *brush, GDIPCONST REAL *blend, - GDIPCONST REAL* positions, INT count); - -GpStatus WINGDIPAPI -GdipGetLinePresetBlendCount(GpLineGradient *brush, INT *count); - -GpStatus WINGDIPAPI -GdipGetLinePresetBlend(GpLineGradient *brush, ARGB *blend, - REAL* positions, INT count); - -GpStatus WINGDIPAPI -GdipSetLinePresetBlend(GpLineGradient *brush, GDIPCONST ARGB *blend, - GDIPCONST REAL* positions, INT count); - -GpStatus WINGDIPAPI -GdipSetLineSigmaBlend(GpLineGradient *brush, REAL focus, REAL scale); - -GpStatus WINGDIPAPI -GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus, REAL scale); - -GpStatus WINGDIPAPI -GdipSetLineWrapMode(GpLineGradient *brush, GpWrapMode wrapmode); - -GpStatus WINGDIPAPI -GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode); - -GpStatus WINGDIPAPI -GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipSetLineTransform(GpLineGradient *brush, GDIPCONST GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipResetLineTransform(GpLineGradient* brush); - -GpStatus WINGDIPAPI -GdipMultiplyLineTransform(GpLineGradient* brush, GDIPCONST GpMatrix *matrix, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipTranslateLineTransform(GpLineGradient* brush, REAL dx, REAL dy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipScaleLineTransform(GpLineGradient* brush, REAL sx, REAL sy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipRotateLineTransform(GpLineGradient* brush, REAL angle, GpMatrixOrder order); - -//---------------------------------------------------------------------------- -// PathGradient Brush -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreatePathGradient(GDIPCONST GpPointF* points, - INT count, - GpWrapMode wrapMode, - GpPathGradient **polyGradient); - -GpStatus WINGDIPAPI -GdipCreatePathGradientI(GDIPCONST GpPoint* points, - INT count, - GpWrapMode wrapMode, - GpPathGradient **polyGradient); - -GpStatus WINGDIPAPI -GdipCreatePathGradientFromPath(GDIPCONST GpPath* path, - GpPathGradient **polyGradient); - -GpStatus WINGDIPAPI -GdipGetPathGradientCenterColor( - GpPathGradient *brush, ARGB* colors); - -GpStatus WINGDIPAPI -GdipSetPathGradientCenterColor( - GpPathGradient *brush, ARGB colors); - -GpStatus WINGDIPAPI -GdipGetPathGradientSurroundColorsWithCount( - GpPathGradient *brush, ARGB* color, INT* count); - -GpStatus WINGDIPAPI -GdipSetPathGradientSurroundColorsWithCount( - GpPathGradient *brush, - GDIPCONST ARGB* color, INT* count); - -GpStatus WINGDIPAPI -GdipGetPathGradientPath(GpPathGradient *brush, GpPath *path); - -GpStatus WINGDIPAPI -GdipSetPathGradientPath(GpPathGradient *brush, GDIPCONST GpPath *path); - -GpStatus WINGDIPAPI -GdipGetPathGradientCenterPoint( - GpPathGradient *brush, GpPointF* points); - -GpStatus WINGDIPAPI -GdipGetPathGradientCenterPointI( - GpPathGradient *brush, GpPoint* points); - -GpStatus WINGDIPAPI -GdipSetPathGradientCenterPoint( - GpPathGradient *brush, GDIPCONST GpPointF* points); - -GpStatus WINGDIPAPI -GdipSetPathGradientCenterPointI( - GpPathGradient *brush, GDIPCONST GpPoint* points); - -GpStatus WINGDIPAPI -GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect); - -GpStatus WINGDIPAPI -GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect); - -GpStatus WINGDIPAPI -GdipGetPathGradientPointCount(GpPathGradient *brush, INT* count); - -GpStatus WINGDIPAPI -GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT* count); - -GpStatus WINGDIPAPI -GdipSetPathGradientGammaCorrection(GpPathGradient *brush, BOOL useGammaCorrection); - -GpStatus WINGDIPAPI -GdipGetPathGradientGammaCorrection(GpPathGradient *brush, BOOL *useGammaCorrection); - -GpStatus WINGDIPAPI -GdipGetPathGradientBlendCount(GpPathGradient *brush, - INT *count); - -GpStatus WINGDIPAPI -GdipGetPathGradientBlend(GpPathGradient *brush, - REAL *blend, REAL *positions, INT count); - -GpStatus WINGDIPAPI -GdipSetPathGradientBlend(GpPathGradient *brush, - GDIPCONST REAL *blend, GDIPCONST REAL *positions, INT count); - -GpStatus WINGDIPAPI -GdipGetPathGradientPresetBlendCount(GpPathGradient *brush, INT *count); - -GpStatus WINGDIPAPI -GdipGetPathGradientPresetBlend(GpPathGradient *brush, ARGB *blend, - REAL* positions, INT count); - -GpStatus WINGDIPAPI -GdipSetPathGradientPresetBlend(GpPathGradient *brush, GDIPCONST ARGB *blend, - GDIPCONST REAL* positions, INT count); - -GpStatus WINGDIPAPI -GdipSetPathGradientSigmaBlend(GpPathGradient *brush, REAL focus, REAL scale); - -GpStatus WINGDIPAPI -GdipSetPathGradientLinearBlend(GpPathGradient *brush, REAL focus, REAL scale); - -GpStatus WINGDIPAPI -GdipGetPathGradientWrapMode(GpPathGradient *brush, - GpWrapMode *wrapmode); - -GpStatus WINGDIPAPI -GdipSetPathGradientWrapMode(GpPathGradient *brush, - GpWrapMode wrapmode); - -GpStatus WINGDIPAPI -GdipGetPathGradientTransform(GpPathGradient *brush, - GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipSetPathGradientTransform(GpPathGradient *brush, - GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipResetPathGradientTransform(GpPathGradient* brush); - -GpStatus WINGDIPAPI -GdipMultiplyPathGradientTransform(GpPathGradient* brush, GDIPCONST GpMatrix *matrix, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipTranslatePathGradientTransform(GpPathGradient* brush, REAL dx, REAL dy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipScalePathGradientTransform(GpPathGradient* brush, REAL sx, REAL sy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipRotatePathGradientTransform(GpPathGradient* brush, REAL angle, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipGetPathGradientFocusScales(GpPathGradient *brush, REAL* xScale, REAL* yScale); - -GpStatus WINGDIPAPI -GdipSetPathGradientFocusScales(GpPathGradient *brush, REAL xScale, REAL yScale); - -//---------------------------------------------------------------------------- -// Pen methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreatePen1(ARGB color, REAL width, GpUnit unit, GpPen **pen); - -GpStatus WINGDIPAPI -GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, - GpPen **pen); - -GpStatus WINGDIPAPI -GdipClonePen(GpPen *pen, GpPen **clonepen); - -GpStatus WINGDIPAPI -GdipDeletePen(GpPen *pen); - -GpStatus WINGDIPAPI -GdipSetPenWidth(GpPen *pen, REAL width); - -GpStatus WINGDIPAPI -GdipGetPenWidth(GpPen *pen, REAL *width); - -GpStatus WINGDIPAPI -GdipSetPenUnit(GpPen *pen, GpUnit unit); - -GpStatus WINGDIPAPI -GdipGetPenUnit(GpPen *pen, GpUnit *unit); - -#ifdef DCR_USE_NEW_197819 -GpStatus WINGDIPAPI -GdipSetPenLineCap197819(GpPen *pen, GpLineCap startCap, GpLineCap endCap, - GpDashCap dashCap); -#else -GpStatus WINGDIPAPI -GdipSetPenLineCap(GpPen *pen, GpLineCap startCap, GpLineCap endCap, - GpLineCap dashCap); -#endif // DCR_USE_NEW_197819 - - -GpStatus WINGDIPAPI -GdipSetPenStartCap(GpPen *pen, GpLineCap startCap); - -GpStatus WINGDIPAPI -GdipSetPenEndCap(GpPen *pen, GpLineCap endCap); - -#ifdef DCR_USE_NEW_197819 -GpStatus WINGDIPAPI -GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap); -#else -GpStatus WINGDIPAPI -GdipSetPenDashCap(GpPen *pen, GpLineCap dashCap); -#endif // DCR_USE_NEW_197819 - -GpStatus WINGDIPAPI -GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap); - -GpStatus WINGDIPAPI -GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap); - -#ifdef DCR_USE_NEW_197819 -GpStatus WINGDIPAPI -GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap); -#else -GpStatus WINGDIPAPI -GdipGetPenDashCap(GpPen *pen, GpLineCap *dashCap); -#endif // DCR_USE_NEW_197819 - -GpStatus WINGDIPAPI -GdipSetPenLineJoin(GpPen *pen, GpLineJoin lineJoin); - -GpStatus WINGDIPAPI -GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin); - -GpStatus WINGDIPAPI -GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap); - -GpStatus WINGDIPAPI -GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap); - -GpStatus WINGDIPAPI -GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap); - -GpStatus WINGDIPAPI -GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap); - -GpStatus WINGDIPAPI -GdipSetPenMiterLimit(GpPen *pen, REAL miterLimit); - -GpStatus WINGDIPAPI -GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit); - -GpStatus WINGDIPAPI -GdipSetPenMode(GpPen *pen, GpPenAlignment penMode); - -GpStatus WINGDIPAPI -GdipGetPenMode(GpPen *pen, GpPenAlignment *penMode); - -GpStatus WINGDIPAPI -GdipSetPenTransform(GpPen *pen, GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipGetPenTransform(GpPen *pen, GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipResetPenTransform(GpPen *pen); - -GpStatus WINGDIPAPI -GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipSetPenColor(GpPen *pen, ARGB argb); - -GpStatus WINGDIPAPI -GdipGetPenColor(GpPen *pen, ARGB *argb); - -GpStatus WINGDIPAPI -GdipSetPenBrushFill(GpPen *pen, GpBrush *brush); - -GpStatus WINGDIPAPI -GdipGetPenBrushFill(GpPen *pen, GpBrush **brush); - -GpStatus WINGDIPAPI -GdipGetPenFillType(GpPen *pen, GpPenType* type); - -GpStatus WINGDIPAPI -GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dashstyle); - -GpStatus WINGDIPAPI -GdipSetPenDashStyle(GpPen *pen, GpDashStyle dashstyle); - -GpStatus WINGDIPAPI -GdipGetPenDashOffset(GpPen *pen, REAL *offset); - -GpStatus WINGDIPAPI -GdipSetPenDashOffset(GpPen *pen, REAL offset); - -GpStatus WINGDIPAPI -GdipGetPenDashCount(GpPen *pen, INT *count); - -GpStatus WINGDIPAPI -GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash, INT count); - -GpStatus WINGDIPAPI -GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count); - -GpStatus WINGDIPAPI -GdipGetPenCompoundCount(GpPen *pen, INT *count); - -GpStatus WINGDIPAPI -GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash, INT count); - -GpStatus WINGDIPAPI -GdipGetPenCompoundArray(GpPen *pen, REAL *dash, INT count); - -//---------------------------------------------------------------------------- -// CustomLineCap methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath, - GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap); - -GpStatus WINGDIPAPI -GdipDeleteCustomLineCap(GpCustomLineCap* customCap); - -GpStatus WINGDIPAPI -GdipCloneCustomLineCap(GpCustomLineCap* customCap, - GpCustomLineCap** clonedCap); - -GpStatus WINGDIPAPI -GdipGetCustomLineCapType(GpCustomLineCap* customCap, - CustomLineCapType* capType); - -GpStatus WINGDIPAPI -GdipSetCustomLineCapStrokeCaps(GpCustomLineCap* customCap, - GpLineCap startCap, GpLineCap endCap); - -GpStatus WINGDIPAPI -GdipGetCustomLineCapStrokeCaps(GpCustomLineCap* customCap, - GpLineCap* startCap, GpLineCap* endCap); - -GpStatus WINGDIPAPI -GdipSetCustomLineCapStrokeJoin(GpCustomLineCap* customCap, GpLineJoin lineJoin); - -GpStatus WINGDIPAPI -GdipGetCustomLineCapStrokeJoin(GpCustomLineCap* customCap, GpLineJoin* lineJoin); - -GpStatus WINGDIPAPI -GdipSetCustomLineCapBaseCap(GpCustomLineCap* customCap, GpLineCap baseCap); - -GpStatus WINGDIPAPI -GdipGetCustomLineCapBaseCap(GpCustomLineCap* customCap, GpLineCap* baseCap); - -GpStatus WINGDIPAPI -GdipSetCustomLineCapBaseInset(GpCustomLineCap* customCap, REAL inset); - -GpStatus WINGDIPAPI -GdipGetCustomLineCapBaseInset(GpCustomLineCap* customCap, REAL* inset); - -GpStatus WINGDIPAPI -GdipSetCustomLineCapWidthScale(GpCustomLineCap* customCap, REAL widthScale); - -GpStatus WINGDIPAPI -GdipGetCustomLineCapWidthScale(GpCustomLineCap* customCap, REAL* widthScale); - -//---------------------------------------------------------------------------- -// AdjustableArrowCap methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL isFilled, - GpAdjustableArrowCap **cap); - -GpStatus WINGDIPAPI -GdipSetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL height); - -GpStatus WINGDIPAPI -GdipGetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL* height); - -GpStatus WINGDIPAPI -GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL width); - -GpStatus WINGDIPAPI -GdipGetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL* width); - -GpStatus WINGDIPAPI -GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL middleInset); - -GpStatus WINGDIPAPI -GdipGetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL* middleInset); - -GpStatus WINGDIPAPI -GdipSetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL fillState); - -GpStatus WINGDIPAPI -GdipGetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL* fillState); - -//---------------------------------------------------------------------------- -// Image methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipLoadImageFromStream(IStream* stream, GpImage **image); - -GpStatus WINGDIPAPI -GdipLoadImageFromFile(GDIPCONST WCHAR* filename, GpImage **image); - -GpStatus WINGDIPAPI -GdipLoadImageFromStreamICM(IStream* stream, GpImage **image); - -GpStatus WINGDIPAPI -GdipLoadImageFromFileICM(GDIPCONST WCHAR* filename, GpImage **image); - -GpStatus WINGDIPAPI -GdipCloneImage(GpImage *image, GpImage **cloneImage); - -GpStatus WINGDIPAPI -GdipDisposeImage(GpImage *image); - -GpStatus WINGDIPAPI -GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filename, - GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams); - -GpStatus WINGDIPAPI -GdipSaveImageToStream(GpImage *image, IStream* stream, - GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams); - -GpStatus WINGDIPAPI -GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters* encoderParams); - -GpStatus WINGDIPAPI -GdipSaveAddImage(GpImage *image, GpImage* newImage, - GDIPCONST EncoderParameters* encoderParams); - -GpStatus WINGDIPAPI -GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics); - -GpStatus WINGDIPAPI -GdipGetImageBounds(GpImage *image, GpRectF *srcRect, GpUnit *srcUnit); - -GpStatus WINGDIPAPI -GdipGetImageDimension(GpImage *image, REAL *width, REAL *height); - -GpStatus WINGDIPAPI -GdipGetImageType(GpImage *image, ImageType *type); - -GpStatus WINGDIPAPI -GdipGetImageWidth(GpImage *image, UINT *width); - -GpStatus WINGDIPAPI -GdipGetImageHeight(GpImage *image, UINT *height); - -GpStatus WINGDIPAPI -GdipGetImageHorizontalResolution(GpImage *image, REAL *resolution); - -GpStatus WINGDIPAPI -GdipGetImageVerticalResolution(GpImage *image, REAL *resolution); - -GpStatus WINGDIPAPI -GdipGetImageFlags(GpImage *image, UINT *flags); - -GpStatus WINGDIPAPI -GdipGetImageRawFormat(GpImage *image, GUID *format); - -GpStatus WINGDIPAPI -GdipGetImagePixelFormat(GpImage *image, PixelFormat *format); - -GpStatus WINGDIPAPI -GdipGetImageThumbnail(GpImage *image, UINT thumbWidth, UINT thumbHeight, - GpImage **thumbImage, - GetThumbnailImageAbort callback, VOID * callbackData); - -GpStatus WINGDIPAPI -GdipGetEncoderParameterListSize(GpImage *image, GDIPCONST CLSID* clsidEncoder, - UINT* size); - -GpStatus WINGDIPAPI -GdipGetEncoderParameterList(GpImage *image, GDIPCONST CLSID* clsidEncoder, - UINT size, EncoderParameters* buffer); - -GpStatus WINGDIPAPI -GdipImageGetFrameDimensionsCount(GpImage* image, UINT* count); - -GpStatus WINGDIPAPI -GdipImageGetFrameDimensionsList(GpImage* image, GUID* dimensionIDs, UINT count); - -GpStatus WINGDIPAPI -GdipImageGetFrameCount(GpImage *image, GDIPCONST GUID* dimensionID, UINT* count); - -GpStatus WINGDIPAPI -GdipImageSelectActiveFrame(GpImage *image, GDIPCONST GUID* dimensionID, - UINT frameIndex); - -GpStatus WINGDIPAPI -GdipImageRotateFlip(GpImage *image, RotateFlipType rfType); - -GpStatus WINGDIPAPI -GdipGetImagePalette(GpImage *image, ColorPalette *palette, INT size); - -GpStatus WINGDIPAPI -GdipSetImagePalette(GpImage *image, GDIPCONST ColorPalette *palette); - -GpStatus WINGDIPAPI -GdipGetImagePaletteSize(GpImage *image, INT *size); - -GpStatus WINGDIPAPI -GdipGetPropertyCount(GpImage *image, UINT* numOfProperty); - -GpStatus WINGDIPAPI -GdipGetPropertyIdList(GpImage *image, UINT numOfProperty, PROPID* list); - -GpStatus WINGDIPAPI -GdipGetPropertyItemSize(GpImage *image, PROPID propId, UINT* size); - -GpStatus WINGDIPAPI -GdipGetPropertyItem(GpImage *image, PROPID propId,UINT propSize, - PropertyItem* buffer); - -GpStatus WINGDIPAPI -GdipGetPropertySize(GpImage *image, UINT* totalBufferSize, UINT* numProperties); - -GpStatus WINGDIPAPI -GdipGetAllPropertyItems(GpImage *image, UINT totalBufferSize, - UINT numProperties, PropertyItem* allItems); - -GpStatus WINGDIPAPI -GdipRemovePropertyItem(GpImage *image, PROPID propId); - -GpStatus WINGDIPAPI -GdipSetPropertyItem(GpImage *image, GDIPCONST PropertyItem* item); - -GpStatus WINGDIPAPI -GdipImageForceValidation(GpImage *image); - -GpStatus WINGDIPAPI -GdipGetImageLayout(GpImage *image, ImageLayout* layout); - -GpStatus WINGDIPAPI -GdipSetImageLayout(GpImage *image, GDIPCONST ImageLayout layout); - -//---------------------------------------------------------------------------- -// Bitmap methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateBitmapFromStream(IStream* stream, GpBitmap **bitmap); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename, GpBitmap **bitmap); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromStreamICM(IStream* stream, GpBitmap **bitmap); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromFileICM(GDIPCONST WCHAR* filename, GpBitmap **bitmap); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromScan0(INT width, - INT height, - INT stride, - PixelFormat format, - BYTE* scan0, - GpBitmap** bitmap); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromGraphics(INT width, - INT height, - GpGraphics* target, - GpBitmap** bitmap); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromDirectDrawSurface(IDirectDrawSurface7* surface, - GpBitmap** bitmap); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO* gdiBitmapInfo, - VOID* gdiBitmapData, - GpBitmap** bitmap); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromHBITMAP(HBITMAP hbm, - HPALETTE hpal, - GpBitmap** bitmap); - -GpStatus WINGDIPAPI -GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, - HBITMAP* hbmReturn, - ARGB background); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromHICON(HICON hicon, - GpBitmap** bitmap); - -GpStatus WINGDIPAPI -GdipCreateHICONFromBitmap(GpBitmap* bitmap, - HICON* hbmReturn); - -GpStatus WINGDIPAPI -GdipCreateBitmapFromResource(HINSTANCE hInstance, - GDIPCONST WCHAR* lpBitmapName, - GpBitmap** bitmap); - -GpStatus WINGDIPAPI -GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height, - PixelFormat format, - GpBitmap *srcBitmap, - GpBitmap **dstBitmap); - -GpStatus WINGDIPAPI -GdipCloneBitmapAreaI(INT x, - INT y, - INT width, - INT height, - PixelFormat format, - GpBitmap *srcBitmap, - GpBitmap **dstBitmap); - -GpStatus WINGDIPAPI -GdipBitmapLockBits(GpBitmap* bitmap, - GDIPCONST GpRect* rect, - UINT flags, - PixelFormat format, - BitmapData* lockedBitmapData); - -GpStatus WINGDIPAPI -GdipBitmapUnlockBits(GpBitmap* bitmap, - BitmapData* lockedBitmapData); - -GpStatus WINGDIPAPI -GdipBitmapGetPixel(GpBitmap* bitmap, INT x, INT y, ARGB *color); - -GpStatus WINGDIPAPI -GdipBitmapSetPixel(GpBitmap* bitmap, INT x, INT y, ARGB color); - -GpStatus WINGDIPAPI -GdipBitmapSetResolution(GpBitmap* bitmap, REAL xdpi, REAL ydpi); - -//---------------------------------------------------------------------------- -// ImageAttributes methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateImageAttributes(GpImageAttributes **imageattr); - -GpStatus WINGDIPAPI -GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, - GpImageAttributes **cloneImageattr); - -GpStatus WINGDIPAPI -GdipDisposeImageAttributes(GpImageAttributes *imageattr); - -GpStatus WINGDIPAPI -GdipSetImageAttributesToIdentity(GpImageAttributes *imageattr, - ColorAdjustType type); -GpStatus WINGDIPAPI -GdipResetImageAttributes(GpImageAttributes *imageattr, - ColorAdjustType type); - -GpStatus WINGDIPAPI -GdipSetImageAttributesColorMatrix(GpImageAttributes *imageattr, - ColorAdjustType type, - BOOL enableFlag, - GDIPCONST ColorMatrix* colorMatrix, - GDIPCONST ColorMatrix* grayMatrix, - ColorMatrixFlags flags); - -GpStatus WINGDIPAPI -GdipSetImageAttributesThreshold(GpImageAttributes *imageattr, - ColorAdjustType type, - BOOL enableFlag, - REAL threshold); - -GpStatus WINGDIPAPI -GdipSetImageAttributesGamma(GpImageAttributes *imageattr, - ColorAdjustType type, - BOOL enableFlag, - REAL gamma); - -GpStatus WINGDIPAPI -GdipSetImageAttributesNoOp(GpImageAttributes *imageattr, - ColorAdjustType type, - BOOL enableFlag); - -GpStatus WINGDIPAPI -GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr, - ColorAdjustType type, - BOOL enableFlag, - ARGB colorLow, - ARGB colorHigh); - -GpStatus WINGDIPAPI -GdipSetImageAttributesOutputChannel(GpImageAttributes *imageattr, - ColorAdjustType type, - BOOL enableFlag, - ColorChannelFlags channelFlags); - -GpStatus WINGDIPAPI -GdipSetImageAttributesOutputChannelColorProfile(GpImageAttributes *imageattr, - ColorAdjustType type, - BOOL enableFlag, - GDIPCONST WCHAR *colorProfileFilename); - -GpStatus WINGDIPAPI -GdipSetImageAttributesRemapTable(GpImageAttributes *imageattr, - ColorAdjustType type, - BOOL enableFlag, - UINT mapSize, - GDIPCONST ColorMap *map); -GpStatus WINGDIPAPI -GdipSetImageAttributesWrapMode( - GpImageAttributes *imageAttr, - WrapMode wrap, - ARGB argb, - BOOL clamp -); - -GpStatus WINGDIPAPI -GdipSetImageAttributesICMMode( - GpImageAttributes *imageAttr, - BOOL on -); - -GpStatus WINGDIPAPI -GdipGetImageAttributesAdjustedPalette( - GpImageAttributes *imageAttr, - ColorPalette * colorPalette, - ColorAdjustType colorAdjustType -); - -//---------------------------------------------------------------------------- -// Graphics methods -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipFlush(GpGraphics *graphics, GpFlushIntention intention); - -GpStatus WINGDIPAPI -GdipCreateFromHDC(HDC hdc, GpGraphics **graphics); - -GpStatus WINGDIPAPI -GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **graphics); - -GpStatus WINGDIPAPI -GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics); - -GpStatus WINGDIPAPI -GdipCreateFromHWNDICM(HWND hwnd, GpGraphics **graphics); - -GpStatus WINGDIPAPI -GdipDeleteGraphics(GpGraphics *graphics); - -GpStatus WINGDIPAPI -GdipGetDC(GpGraphics* graphics, HDC * hdc); - -GpStatus WINGDIPAPI -GdipReleaseDC(GpGraphics* graphics, HDC hdc); - -GpStatus WINGDIPAPI -GdipSetCompositingMode(GpGraphics *graphics, CompositingMode compositingMode); - -GpStatus WINGDIPAPI -GdipGetCompositingMode(GpGraphics *graphics, CompositingMode *compositingMode); - -GpStatus WINGDIPAPI -GdipSetRenderingOrigin(GpGraphics *graphics, INT x, INT y); - -GpStatus WINGDIPAPI -GdipGetRenderingOrigin(GpGraphics *graphics, INT *x, INT *y); - -GpStatus WINGDIPAPI -GdipSetCompositingQuality(GpGraphics *graphics, CompositingQuality compositingQuality); - -GpStatus WINGDIPAPI -GdipGetCompositingQuality(GpGraphics *graphics, CompositingQuality *compositingQuality); - -GpStatus WINGDIPAPI -GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode smoothingMode); - -GpStatus WINGDIPAPI -GdipGetSmoothingMode(GpGraphics *graphics, SmoothingMode *smoothingMode); - -GpStatus WINGDIPAPI -GdipSetPixelOffsetMode(GpGraphics* graphics, PixelOffsetMode pixelOffsetMode); - -GpStatus WINGDIPAPI -GdipGetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode *pixelOffsetMode); - -GpStatus WINGDIPAPI -GdipSetTextRenderingHint(GpGraphics *graphics, TextRenderingHint mode); - -GpStatus WINGDIPAPI -GdipGetTextRenderingHint(GpGraphics *graphics, TextRenderingHint *mode); - -#ifdef DCR_USE_NEW_188922 -GpStatus WINGDIPAPI -GdipSetTextContrast(GpGraphics *graphics, UINT contrast); - -GpStatus WINGDIPAPI -GdipGetTextContrast(GpGraphics *graphics, UINT * contrast); -#else -GpStatus WINGDIPAPI -GdipSetTextGammaValue(GpGraphics *graphics, UINT gammaValue); - -GpStatus WINGDIPAPI -GdipGetTextGammaValue(GpGraphics *graphics, UINT * gammaValue); -#endif // DCR_USE_NEW_188922 - - -GpStatus WINGDIPAPI -GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode interpolationMode); - -GpStatus WINGDIPAPI -GdipGetInterpolationMode(GpGraphics *graphics, InterpolationMode *interpolationMode); - -GpStatus WINGDIPAPI -GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipResetWorldTransform(GpGraphics *graphics); - -GpStatus WINGDIPAPI -GdipMultiplyWorldTransform(GpGraphics *graphics, GDIPCONST GpMatrix *matrix, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipTranslateWorldTransform(GpGraphics *graphics, REAL dx, REAL dy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, - GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipRotateWorldTransform(GpGraphics *graphics, REAL angle, GpMatrixOrder order); - -GpStatus WINGDIPAPI -GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix); - -GpStatus WINGDIPAPI -GdipResetPageTransform(GpGraphics *graphics); - -GpStatus WINGDIPAPI -GdipGetPageUnit(GpGraphics *graphics, GpUnit *unit); - -GpStatus WINGDIPAPI -GdipGetPageScale(GpGraphics *graphics, REAL *scale); - -GpStatus WINGDIPAPI -GdipSetPageUnit(GpGraphics *graphics, GpUnit unit); - -GpStatus WINGDIPAPI -GdipSetPageScale(GpGraphics *graphics, REAL scale); - -GpStatus WINGDIPAPI -GdipGetDpiX(GpGraphics *graphics, REAL* dpi); - -GpStatus WINGDIPAPI -GdipGetDpiY(GpGraphics *graphics, REAL* dpi); - -GpStatus WINGDIPAPI -GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace destSpace, - GpCoordinateSpace srcSpace, GpPointF *points, - INT count); - -GpStatus WINGDIPAPI -GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace destSpace, - GpCoordinateSpace srcSpace, GpPoint *points, - INT count); - -GpStatus WINGDIPAPI -GdipGetNearestColor(GpGraphics *graphics, ARGB* argb); - -// Create the Win9x Halftone Palette (even on NT) with correct Desktop colors -HPALETTE WINGDIPAPI -GdipCreateHalftonePalette(); - -GpStatus WINGDIPAPI -GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, - REAL x2, REAL y2); - -GpStatus WINGDIPAPI -GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1, INT y1, - INT x2, INT y2); - -GpStatus WINGDIPAPI -GdipDrawLines(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, - INT count); - -GpStatus WINGDIPAPI -GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, - INT count); - -GpStatus WINGDIPAPI -GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, - REAL width, REAL height, REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipDrawArcI(GpGraphics *graphics, GpPen *pen, INT x, INT y, - INT width, INT height, REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, - REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4); - -GpStatus WINGDIPAPI -GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1, INT y1, - INT x2, INT y2, INT x3, INT y3, INT x4, INT y4); - -GpStatus WINGDIPAPI -GdipDrawBeziers(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, - INT count); - -GpStatus WINGDIPAPI -GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, - INT count); - -GpStatus WINGDIPAPI -GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, - REAL width, REAL height); - -GpStatus WINGDIPAPI -GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x, INT y, - INT width, INT height); - -GpStatus WINGDIPAPI -GdipDrawRectangles(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, - INT count); - -GpStatus WINGDIPAPI -GdipDrawRectanglesI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, - INT count); - -GpStatus WINGDIPAPI -GdipDrawEllipse(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, - REAL width, REAL height); - -GpStatus WINGDIPAPI -GdipDrawEllipseI(GpGraphics *graphics, GpPen *pen, INT x, INT y, - INT width, INT height); - -GpStatus WINGDIPAPI -GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, - REAL width, REAL height, REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipDrawPieI(GpGraphics *graphics, GpPen *pen, INT x, INT y, - INT width, INT height, REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipDrawPolygon(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, - INT count); - -GpStatus WINGDIPAPI -GdipDrawPolygonI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, - INT count); - -GpStatus WINGDIPAPI -GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path); - -GpStatus WINGDIPAPI -GdipDrawCurve(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, - INT count); - -GpStatus WINGDIPAPI -GdipDrawCurveI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, - INT count); - -GpStatus WINGDIPAPI -GdipDrawCurve2(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, - INT count, REAL tension); - -GpStatus WINGDIPAPI -GdipDrawCurve2I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, - INT count, REAL tension); - -GpStatus WINGDIPAPI -GdipDrawCurve3(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, - INT count, INT offset, INT numberOfSegments, REAL tension); - -GpStatus WINGDIPAPI -GdipDrawCurve3I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, - INT count, INT offset, INT numberOfSegments, REAL tension); - -GpStatus WINGDIPAPI -GdipDrawClosedCurve(GpGraphics *graphics, GpPen *pen, - GDIPCONST GpPointF *points, INT count); - -GpStatus WINGDIPAPI -GdipDrawClosedCurveI(GpGraphics *graphics, GpPen *pen, - GDIPCONST GpPoint *points, INT count); - -GpStatus WINGDIPAPI -GdipDrawClosedCurve2(GpGraphics *graphics, GpPen *pen, - GDIPCONST GpPointF *points, INT count, REAL tension); - -GpStatus WINGDIPAPI -GdipDrawClosedCurve2I(GpGraphics *graphics, GpPen *pen, - GDIPCONST GpPoint *points, INT count, REAL tension); - -GpStatus WINGDIPAPI -GdipGraphicsClear(GpGraphics *graphics, ARGB color); - -GpStatus WINGDIPAPI -GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, - REAL width, REAL height); - -GpStatus WINGDIPAPI -GdipFillRectangleI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, - INT width, INT height); - -GpStatus WINGDIPAPI -GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpRectF *rects, INT count); - -GpStatus WINGDIPAPI -GdipFillRectanglesI(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpRect *rects, INT count); - -GpStatus WINGDIPAPI -GdipFillPolygon(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpPointF *points, INT count, GpFillMode fillMode); - -GpStatus WINGDIPAPI -GdipFillPolygonI(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpPoint *points, INT count, GpFillMode fillMode); - -GpStatus WINGDIPAPI -GdipFillPolygon2(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpPointF *points, INT count); - -GpStatus WINGDIPAPI -GdipFillPolygon2I(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpPoint *points, INT count); - -GpStatus WINGDIPAPI -GdipFillEllipse(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, - REAL width, REAL height); - -GpStatus WINGDIPAPI -GdipFillEllipseI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, - INT width, INT height); - -GpStatus WINGDIPAPI -GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, - REAL width, REAL height, REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipFillPieI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, - INT width, INT height, REAL startAngle, REAL sweepAngle); - -GpStatus WINGDIPAPI -GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path); - -GpStatus WINGDIPAPI -GdipFillClosedCurve(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpPointF *points, INT count); - -GpStatus WINGDIPAPI -GdipFillClosedCurveI(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpPoint *points, INT count); - -GpStatus WINGDIPAPI -GdipFillClosedCurve2(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpPointF *points, INT count, - REAL tension, GpFillMode fillMode); - -GpStatus WINGDIPAPI -GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush, - GDIPCONST GpPoint *points, INT count, - REAL tension, GpFillMode fillMode); - -GpStatus WINGDIPAPI -GdipFillRegion(GpGraphics *graphics, GpBrush *brush, - GpRegion *region); - -GpStatus WINGDIPAPI -GdipDrawImage(GpGraphics *graphics, GpImage *image, REAL x, REAL y); - -GpStatus WINGDIPAPI -GdipDrawImageI(GpGraphics *graphics, GpImage *image, INT x, INT y); - -GpStatus WINGDIPAPI -GdipDrawImageRect(GpGraphics *graphics, GpImage *image, REAL x, REAL y, - REAL width, REAL height); - -GpStatus WINGDIPAPI -GdipDrawImageRectI(GpGraphics *graphics, GpImage *image, INT x, INT y, - INT width, INT height); - -GpStatus WINGDIPAPI -GdipDrawImagePoints(GpGraphics *graphics, GpImage *image, - GDIPCONST GpPointF *dstpoints, INT count); - -GpStatus WINGDIPAPI -GdipDrawImagePointsI(GpGraphics *graphics, GpImage *image, - GDIPCONST GpPoint *dstpoints, INT count); - -GpStatus WINGDIPAPI -GdipDrawImagePointRect(GpGraphics *graphics, GpImage *image, REAL x, - REAL y, REAL srcx, REAL srcy, REAL srcwidth, - REAL srcheight, GpUnit srcUnit); - -GpStatus WINGDIPAPI -GdipDrawImagePointRectI(GpGraphics *graphics, GpImage *image, INT x, - INT y, INT srcx, INT srcy, INT srcwidth, - INT srcheight, GpUnit srcUnit); - -GpStatus WINGDIPAPI -GdipDrawImageRectRect(GpGraphics *graphics, GpImage *image, REAL dstx, - REAL dsty, REAL dstwidth, REAL dstheight, - REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, - GpUnit srcUnit, - GDIPCONST GpImageAttributes* imageAttributes, - DrawImageAbort callback, VOID * callbackData); - -GpStatus WINGDIPAPI -GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image, INT dstx, - INT dsty, INT dstwidth, INT dstheight, - INT srcx, INT srcy, INT srcwidth, INT srcheight, - GpUnit srcUnit, - GDIPCONST GpImageAttributes* imageAttributes, - DrawImageAbort callback, VOID * callbackData); - -GpStatus WINGDIPAPI -GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image, - GDIPCONST GpPointF *points, INT count, REAL srcx, - REAL srcy, REAL srcwidth, REAL srcheight, - GpUnit srcUnit, - GDIPCONST GpImageAttributes* imageAttributes, - DrawImageAbort callback, VOID * callbackData); - -GpStatus WINGDIPAPI -GdipDrawImagePointsRectI(GpGraphics *graphics, GpImage *image, - GDIPCONST GpPoint *points, INT count, INT srcx, - INT srcy, INT srcwidth, INT srcheight, - GpUnit srcUnit, - GDIPCONST GpImageAttributes* imageAttributes, - DrawImageAbort callback, VOID * callbackData); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileDestPoint( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST PointF & destPoint, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileDestPointI( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST Point & destPoint, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileDestRect( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST RectF & destRect, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileDestRectI( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST Rect & destRect, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileDestPoints( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST PointF * destPoints, - INT count, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileDestPointsI( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST Point * destPoints, - INT count, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileSrcRectDestPoint( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST PointF & destPoint, - GDIPCONST RectF & srcRect, - Unit srcUnit, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileSrcRectDestPointI( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST Point & destPoint, - GDIPCONST Rect & srcRect, - Unit srcUnit, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileSrcRectDestRect( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST RectF & destRect, - GDIPCONST RectF & srcRect, - Unit srcUnit, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileSrcRectDestRectI( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST Rect & destRect, - GDIPCONST Rect & srcRect, - Unit srcUnit, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileSrcRectDestPoints( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST PointF * destPoints, - INT count, - GDIPCONST RectF & srcRect, - Unit srcUnit, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipEnumerateMetafileSrcRectDestPointsI( - GpGraphics * graphics, - GDIPCONST GpMetafile * metafile, - GDIPCONST Point * destPoints, - INT count, - GDIPCONST Rect & srcRect, - Unit srcUnit, - EnumerateMetafileProc callback, - VOID * callbackData, - GDIPCONST GpImageAttributes * imageAttributes - ); - -GpStatus WINGDIPAPI -GdipPlayMetafileRecord( - GDIPCONST GpMetafile * metafile, - EmfPlusRecordType recordType, - UINT flags, - UINT dataSize, - GDIPCONST BYTE * data - ); - -GpStatus WINGDIPAPI -GdipSetClipGraphics(GpGraphics *graphics, GpGraphics *srcgraphics, - CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipSetClipRect(GpGraphics *graphics, REAL x, REAL y, - REAL width, REAL height, CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipSetClipRectI(GpGraphics *graphics, INT x, INT y, - INT width, INT height, CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipSetClipPath(GpGraphics *graphics, GpPath *path, CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, - CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipSetClipHrgn(GpGraphics *graphics, HRGN hRgn, CombineMode combineMode); - -GpStatus WINGDIPAPI -GdipResetClip(GpGraphics *graphics); - -GpStatus WINGDIPAPI -GdipTranslateClip(GpGraphics *graphics, REAL dx, REAL dy); - -GpStatus WINGDIPAPI -GdipTranslateClipI(GpGraphics *graphics, INT dx, INT dy); - -GpStatus WINGDIPAPI -GdipGetClip(GpGraphics *graphics, GpRegion *region); - -GpStatus WINGDIPAPI -GdipGetClipBounds(GpGraphics *graphics, GpRectF *rect); - -GpStatus WINGDIPAPI -GdipGetClipBoundsI(GpGraphics *graphics, GpRect *rect); - -GpStatus WINGDIPAPI -GdipIsClipEmpty(GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect); - -GpStatus WINGDIPAPI -GdipGetVisibleClipBoundsI(GpGraphics *graphics, GpRect *rect); - -GpStatus WINGDIPAPI -GdipIsVisibleClipEmpty(GpGraphics *graphics, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsVisiblePoint(GpGraphics *graphics, REAL x, REAL y, - BOOL *result); - -GpStatus WINGDIPAPI -GdipIsVisiblePointI(GpGraphics *graphics, INT x, INT y, - BOOL *result); - -GpStatus WINGDIPAPI -GdipIsVisibleRect(GpGraphics *graphics, REAL x, REAL y, - REAL width, REAL height, BOOL *result); - -GpStatus WINGDIPAPI -GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, - INT width, INT height, BOOL *result); - -GpStatus WINGDIPAPI -GdipSaveGraphics(GpGraphics *graphics, GraphicsState *state); - -GpStatus WINGDIPAPI -GdipRestoreGraphics(GpGraphics *graphics, GraphicsState state); - -GpStatus WINGDIPAPI -GdipBeginContainer(GpGraphics *graphics, GDIPCONST GpRectF* dstrect, - GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state); - -GpStatus WINGDIPAPI -GdipBeginContainerI(GpGraphics *graphics, GDIPCONST GpRect* dstrect, - GDIPCONST GpRect *srcrect, GpUnit unit, GraphicsContainer *state); - -GpStatus WINGDIPAPI -GdipBeginContainer2(GpGraphics *graphics, GraphicsContainer* state); - -GpStatus WINGDIPAPI -GdipEndContainer(GpGraphics *graphics, GraphicsContainer state); - -GpStatus -GdipGetMetafileHeaderFromWmf( - HMETAFILE hWmf, - GDIPCONST APMFileHeader * apmFileHeader, - MetafileHeader * header - ); - -GpStatus -WINGDIPAPI -GdipGetMetafileHeaderFromEmf( - HENHMETAFILE hEmf, - MetafileHeader * header - ); - -GpStatus -WINGDIPAPI -GdipGetMetafileHeaderFromFile( - GDIPCONST WCHAR* filename, - MetafileHeader * header - ); - -GpStatus -WINGDIPAPI -GdipGetMetafileHeaderFromStream( - IStream * stream, - MetafileHeader * header - ); - -GpStatus -WINGDIPAPI -GdipGetMetafileHeaderFromMetafile( - GpMetafile * metafile, - MetafileHeader * header - ); - -GpStatus -WINGDIPAPI -GdipGetHemfFromMetafile( - GpMetafile * metafile, - HENHMETAFILE * hEmf - ); - -GpStatus WINGDIPAPI -GdipCreateStreamOnFile(GDIPCONST WCHAR * filename, UINT access, IStream **stream); - -GpStatus WINGDIPAPI -GdipCreateMetafileFromWmf(HMETAFILE hWmf, BOOL deleteWmf, - GDIPCONST APMFileHeader * apmFileHeader, GpMetafile **metafile); - -GpStatus WINGDIPAPI -GdipCreateMetafileFromEmf(HENHMETAFILE hEmf, BOOL deleteEmf, - GpMetafile **metafile); - -GpStatus WINGDIPAPI -GdipCreateMetafileFromFile(GDIPCONST WCHAR* file, GpMetafile **metafile); - -GpStatus WINGDIPAPI -GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR* file, GDIPCONST APMFileHeader * apmFileHeader, GpMetafile **metafile); - -GpStatus WINGDIPAPI -GdipCreateMetafileFromStream(IStream * stream, GpMetafile **metafile); - -GpStatus WINGDIPAPI -GdipRecordMetafile( - HDC referenceHdc, - EmfType type, - GDIPCONST GpRectF * frameRect, - MetafileFrameUnit frameUnit, - GDIPCONST WCHAR * description, - GpMetafile ** metafile - ); - -GpStatus WINGDIPAPI -GdipRecordMetafileI( - HDC referenceHdc, - EmfType type, - GDIPCONST GpRect * frameRect, - MetafileFrameUnit frameUnit, - GDIPCONST WCHAR * description, - GpMetafile ** metafile - ); - -GpStatus WINGDIPAPI -GdipRecordMetafileFileName( - GDIPCONST WCHAR* fileName, - HDC referenceHdc, - EmfType type, - GDIPCONST GpRectF * frameRect, - MetafileFrameUnit frameUnit, - GDIPCONST WCHAR * description, - GpMetafile ** metafile - ); - -GpStatus WINGDIPAPI -GdipRecordMetafileFileNameI( - GDIPCONST WCHAR* fileName, - HDC referenceHdc, - EmfType type, - GDIPCONST GpRect * frameRect, - MetafileFrameUnit frameUnit, - GDIPCONST WCHAR * description, - GpMetafile ** metafile - ); - -GpStatus WINGDIPAPI -GdipRecordMetafileStream( - IStream * stream, - HDC referenceHdc, - EmfType type, - GDIPCONST GpRectF * frameRect, - MetafileFrameUnit frameUnit, - GDIPCONST WCHAR * description, - GpMetafile ** metafile - ); - -GpStatus WINGDIPAPI -GdipRecordMetafileStreamI( - IStream * stream, - HDC referenceHdc, - EmfType type, - GDIPCONST GpRect * frameRect, - MetafileFrameUnit frameUnit, - GDIPCONST WCHAR * description, - GpMetafile ** metafile - ); - -GpStatus WINGDIPAPI -GdipSetMetafileDownLevelRasterizationLimit( - GpMetafile * metafile, - UINT metafileRasterizationLimitDpi - ); - -GpStatus WINGDIPAPI -GdipGetMetafileDownLevelRasterizationLimit( - GDIPCONST GpMetafile * metafile, - UINT * metafileRasterizationLimitDpi - ); - -GpStatus WINGDIPAPI -GdipGetImageDecodersSize(UINT *numDecoders, UINT *size); - -GpStatus WINGDIPAPI -GdipGetImageDecoders(UINT numDecoders, - UINT size, - ImageCodecInfo *decoders); - -GpStatus WINGDIPAPI -GdipGetImageEncodersSize(UINT *numEncoders, UINT *size); - -GpStatus WINGDIPAPI -GdipGetImageEncoders(UINT numEncoders, - UINT size, - ImageCodecInfo *encoders); - -GpStatus WINGDIPAPI -GdipAddImageCodec(GDIPCONST ImageCodecInfo *codec); - -GpStatus WINGDIPAPI -GdipRemoveImageCodec(GDIPCONST ImageCodecInfo *codec); - -#ifndef DCR_USE_NEW_186091 -GpStatus WINGDIPAPI -GdipGetGraphicsPixel(GpGraphics* graphics, REAL x, REAL y, ARGB* argb); -#endif - -GpStatus WINGDIPAPI -GdipComment(GpGraphics* graphics, UINT sizeData, GDIPCONST BYTE * data); - -GpStatus WINGDIPAPI -GdipGetGraphicsLayout(GpGraphics* graphics, GraphicsLayout* layout); - -GpStatus WINGDIPAPI -GdipSetGraphicsLayout(GpGraphics* graphics, GDIPCONST GraphicsLayout layout); - -//---------------------------------------------------------------------------- -// FontFamily -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, - GpFontCollection *fontCollection, - GpFontFamily **FontFamily); - -GpStatus WINGDIPAPI -GdipDeleteFontFamily(GpFontFamily *FontFamily); - -GpStatus WINGDIPAPI -GdipCloneFontFamily(GpFontFamily *FontFamily, GpFontFamily **clonedFontFamily); - -GpStatus WINGDIPAPI -GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily); - -GpStatus WINGDIPAPI -GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily); - -GpStatus WINGDIPAPI -GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily); - - -GpStatus WINGDIPAPI -GdipGetFamilyName( - GDIPCONST GpFontFamily *family, - WCHAR name[LF_FACESIZE], - LANGID language -); - -GpStatus WINGDIPAPI -GdipIsStyleAvailable(GDIPCONST GpFontFamily *family, INT style, BOOL * IsStyleAvailable); - -GpStatus WINGDIPAPI -GdipFontCollectionEnumerable( - GpFontCollection* fontCollection, - GpGraphics* graphics, - INT * numFound -); - -GpStatus WINGDIPAPI GdipFontCollectionEnumerate( - GpFontCollection* fontCollection, - INT numSought, - GpFontFamily* gpfamilies[], - INT* numFound, - GpGraphics* graphics -); - -//----------------------------------- -// New API -//----------------------------------- - -GpStatus WINGDIPAPI -GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16 * EmHeight); - -GpStatus WINGDIPAPI -GdipGetCellAscent(GDIPCONST GpFontFamily *family, INT style, UINT16 * CellAscent); - -GpStatus WINGDIPAPI -GdipGetCellDescent(GDIPCONST GpFontFamily *family, INT style, UINT16 * CellDescent); - -GpStatus WINGDIPAPI -GdipGetLineSpacing(GDIPCONST GpFontFamily *family, INT style, UINT16 * LineSpacing); - - -//---------------------------------------------------------------------------- -// Font -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateFontFromDC( - HDC hdc, - GpFont **font -); - -GpStatus WINGDIPAPI -GdipCreateFontFromLogfontA( - HDC hdc, - GDIPCONST LOGFONTA *logfont, - GpFont **font -); - -GpStatus WINGDIPAPI -GdipCreateFontFromLogfontW( - HDC hdc, - GDIPCONST LOGFONTW *logfont, - GpFont **font -); - -GpStatus WINGDIPAPI -GdipCreateFont( - GDIPCONST GpFontFamily *fontFamily, - REAL emSize, - INT style, - Unit unit, - GpFont **font -); - -GpStatus WINGDIPAPI -GdipCloneFont(GpFont* font, GpFont** cloneFont); - -GpStatus WINGDIPAPI -GdipDeleteFont(GpFont* font); - -GpStatus WINGDIPAPI -GdipGetFamily(GpFont *font, GpFontFamily **family); - -GpStatus WINGDIPAPI -GdipGetFontStyle(GpFont *font, INT *style); - -GpStatus WINGDIPAPI -GdipGetFontSize(GpFont *font, REAL *size); - -GpStatus WINGDIPAPI -GdipGetFontUnit(GpFont *font, Unit *unit); - -GpStatus WINGDIPAPI -GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height); - -#ifdef DCR_USE_NEW_125467 -GpStatus WINGDIPAPI -GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height); -#endif - -GpStatus WINGDIPAPI -GdipGetLogFontA(GpFont * font, GpGraphics *graphics, LOGFONTA * logfontA); - -GpStatus WINGDIPAPI -GdipGetLogFontW(GpFont * font, GpGraphics *graphics, LOGFONTW * logfontW); - -// FontCollection - -GpStatus WINGDIPAPI -GdipNewInstalledFontCollection(GpFontCollection** fontCollection); - -GpStatus WINGDIPAPI -GdipNewPrivateFontCollection(GpFontCollection** fontCollection); - -GpStatus WINGDIPAPI -GdipDeletePrivateFontCollection(GpFontCollection** fontCollection); - -GpStatus WINGDIPAPI -GdipGetFontCollectionFamilyCount( - GpFontCollection* fontCollection, - INT * numFound -); - -GpStatus WINGDIPAPI -GdipGetFontCollectionFamilyList( - GpFontCollection* fontCollection, - INT numSought, - GpFontFamily* gpfamilies[], - INT* numFound -); - -#ifndef DCR_USE_NEW_235072 -GpStatus WINGDIPAPI -GdipInstallFontFile( - GpFontCollection* fontCollection, - GDIPCONST WCHAR* filename -); - -GpStatus WINGDIPAPI -GdipUninstallFontFile( - GpFontCollection* fontCollection, - GDIPCONST WCHAR* filename -); -#endif - -GpStatus WINGDIPAPI -GdipPrivateAddFontFile( - GpFontCollection* fontCollection, - GDIPCONST WCHAR* filename -); - -GpStatus WINGDIPAPI -GdipPrivateAddMemoryFont( - GpFontCollection* fontCollection, - GDIPCONST void* memory, - INT length -); - -//---------------------------------------------------------------------------- -// Text -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipDrawString( - GpGraphics *graphics, - GDIPCONST WCHAR *string, - INT length, - GDIPCONST GpFont *font, - GDIPCONST RectF *layoutRect, - GDIPCONST GpStringFormat *stringFormat, - GDIPCONST GpBrush *brush -); - -GpStatus WINGDIPAPI -GdipMeasureString( - GpGraphics *graphics, - GDIPCONST WCHAR *string, - INT length, - GDIPCONST GpFont *font, - GDIPCONST RectF *layoutRect, - GDIPCONST GpStringFormat *stringFormat, - RectF *boundingBox, - INT *codepointsFitted, - INT *linesFilled -); - -#ifndef DCR_USE_NEW_174340 -GpStatus WINGDIPAPI -GdipMeasureStringRegion( - GpGraphics *graphics, - GDIPCONST WCHAR *string, - INT length, - GDIPCONST GpFont *font, - GDIPCONST RectF &layoutRect, - GDIPCONST GpStringFormat *stringFormat, - INT firstCharacterIndex, - INT characterCount, - GpRegion *region -); -#endif - -#ifdef DCR_USE_NEW_174340 -GpStatus -WINGDIPAPI -GdipMeasureCharacterRanges( - GpGraphics *graphics, - GDIPCONST WCHAR *string, - INT length, - GDIPCONST GpFont *font, - GDIPCONST RectF &layoutRect, - GDIPCONST GpStringFormat *stringFormat, - INT regionCount, - GpRegion **regions -); -#endif - -GpStatus WINGDIPAPI -GdipDrawDriverString( - GpGraphics *graphics, - GDIPCONST UINT16 *text, - INT length, - GDIPCONST GpFont *font, - GDIPCONST GpBrush *brush, - GDIPCONST PointF *positions, - INT flags, - GDIPCONST GpMatrix *matrix -); - -GpStatus WINGDIPAPI -GdipMeasureDriverString( - GpGraphics *graphics, - GDIPCONST UINT16 *text, - INT length, - GDIPCONST GpFont *font, - GDIPCONST PointF *positions, - INT flags, - GDIPCONST GpMatrix *matrix, - RectF *boundingBox -); - -#ifndef DCR_USE_NEW_168772 -GpStatus WINGDIPAPI -GdipDriverStringPointToCodepoint( - GpGraphics *graphics, - GDIPCONST UINT16 *text, - INT length, - GDIPCONST GpFont *font, - GDIPCONST PointF *positions, - INT flags, - GpMatrix *matrix, - GDIPCONST PointF *hit, - INT *index, - BOOL *rightEdge, - REAL *distance -); -#endif - -//---------------------------------------------------------------------------- -// String format APIs -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateStringFormat( - INT formatAttributes, - LANGID language, - GpStringFormat **format -); - -GpStatus WINGDIPAPI -GdipStringFormatGetGenericDefault(GpStringFormat **format); - -GpStatus WINGDIPAPI -GdipStringFormatGetGenericTypographic(GpStringFormat **format); - -GpStatus WINGDIPAPI -GdipDeleteStringFormat(GpStringFormat *format); - -GpStatus WINGDIPAPI -GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat); - -GpStatus WINGDIPAPI -GdipSetStringFormatFlags(GpStringFormat *format, INT flags); - -GpStatus WINGDIPAPI GdipGetStringFormatFlags(GDIPCONST GpStringFormat *format, INT *flags); - -#ifndef DCR_USE_NEW_152154 -GpStatus WINGDIPAPI -GdipSetStringFormatLineSpacing(GpStringFormat *format, REAL amount, - LineSpacing method); - -GpStatus WINGDIPAPI -GdipGetStringFormatLineSpacingAmount(GDIPCONST GpStringFormat *format, REAL *amount); -GpStatus WINGDIPAPI -GdipGetStringFormatLineSpacingMethod(GDIPCONST GpStringFormat *format, LineSpacing *method); -#endif - -GpStatus WINGDIPAPI -GdipSetStringFormatAlign(GpStringFormat *format, StringAlignment align); - -GpStatus WINGDIPAPI -GdipGetStringFormatAlign(GDIPCONST GpStringFormat *format, StringAlignment *align); - -GpStatus WINGDIPAPI -GdipSetStringFormatLineAlign(GpStringFormat *format, - StringAlignment align); - -GpStatus WINGDIPAPI -GdipGetStringFormatLineAlign(GDIPCONST GpStringFormat *format, - StringAlignment *align); - -GpStatus WINGDIPAPI -GdipSetStringFormatTrimming( - GpStringFormat *format, - StringTrimming trimming -); - -GpStatus WINGDIPAPI -GdipGetStringFormatTrimming( - GDIPCONST GpStringFormat *format, - StringTrimming *trimming -); - -GpStatus WINGDIPAPI -GdipSetStringFormatHotkeyPrefix(GpStringFormat *format, INT hotkeyPrefix); - -GpStatus WINGDIPAPI -GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat *format, INT *hotkeyPrefix); - -GpStatus WINGDIPAPI -GdipSetStringFormatTabStops(GpStringFormat *format, REAL firstTabOffset, INT count, GDIPCONST REAL *tabStops); - -GpStatus WINGDIPAPI -GdipGetStringFormatTabStops(GDIPCONST GpStringFormat *format, INT count, REAL *firstTabOffset, REAL *tabStops); - -GpStatus WINGDIPAPI -GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat *format, INT * count); - -#ifdef DCR_USE_NEW_146933 -GpStatus WINGDIPAPI -GdipSetStringFormatDigitSubstitution(GpStringFormat *format, LANGID language, - StringDigitSubstitute substitute); - -GpStatus WINGDIPAPI -GdipGetStringFormatDigitSubstitution(GDIPCONST GpStringFormat *format, LANGID *language, - StringDigitSubstitute *substitute); -#endif // DCR_USE_NEW_146933 - -#ifdef DCR_USE_NEW_174340 -GpStatus WINGDIPAPI -GdipGetStringFormatMeasurableCharacterRangeCount( - GDIPCONST GpStringFormat *format, - INT *count -); - -GpStatus WINGDIPAPI -GdipSetStringFormatMeasurableCharacterRanges( - GpStringFormat *format, - INT rangeCount, - GDIPCONST CharacterRange *ranges -); -#endif - -//---------------------------------------------------------------------------- -// Cached Bitmap APIs -//---------------------------------------------------------------------------- - -GpStatus WINGDIPAPI -GdipCreateCachedBitmap( - GpBitmap *bitmap, - GpGraphics *graphics, - GpCachedBitmap **cachedBitmap -); - -GpStatus WINGDIPAPI -GdipDeleteCachedBitmap(GpCachedBitmap *cachedBitmap); - -GpStatus WINGDIPAPI -GdipDrawCachedBitmap( - GpGraphics *graphics, - GpCachedBitmap *cachedBitmap, - INT x, - INT y -); - -UINT WINGDIPAPI -GdipEmfToWmfBits( - HENHMETAFILE hemf, - UINT cbData16, - LPBYTE pData16, - INT iMapMode, - INT eFlags -); - -#ifdef __cplusplus -} -#endif - -#endif // !_FLATAPI_H +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusFlat.h +* +* Abstract: +* +* Flat GDI+ API wrappers - header file +* +\**************************************************************************/ + +// TODO: this file style needs to be made internally consistent with the way +// it handles breaking the long argument lists across multiple lines + +#ifndef _FLATAPI_H +#define _FLATAPI_H + +#define WINGDIPAPI __stdcall + +// currently, only C++ wrapper API's force const. + +#define GDIPCONST const + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef DCR_USE_NEW_175866 + +VOID +WINGDIPAPI +GdipDisplayPaletteWindowNotify(WindowNotifyEnum notify); + +#endif + +//---------------------------------------------------------------------------- +// GraphicsPath methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreatePath(GpFillMode brushMode, GpPath **path); + +GpStatus WINGDIPAPI +GdipCreatePath2(GDIPCONST GpPointF*, GDIPCONST BYTE*, INT, GpFillMode, + GpPath **path); + +GpStatus WINGDIPAPI +GdipCreatePath2I(GDIPCONST GpPoint*, GDIPCONST BYTE*, INT, GpFillMode, + GpPath **path); + +GpStatus WINGDIPAPI +GdipClonePath(GpPath* path, GpPath **clonePath); + +GpStatus WINGDIPAPI +GdipDeletePath(GpPath* path); + +GpStatus WINGDIPAPI +GdipResetPath(GpPath* path); + +GpStatus WINGDIPAPI +GdipGetPointCount(GpPath* path, INT* count); + +GpStatus WINGDIPAPI +GdipGetPathTypes(GpPath* path, BYTE* types, INT count); + +GpStatus WINGDIPAPI +GdipGetPathPoints(GpPath*, GpPointF* points, INT count); + +GpStatus WINGDIPAPI +GdipGetPathPointsI(GpPath*, GpPoint* points, INT count); + +GpStatus WINGDIPAPI +GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode); + +GpStatus WINGDIPAPI +GdipSetPathFillMode(GpPath *path, GpFillMode fillmode); + +GpStatus WINGDIPAPI +GdipGetPathData(GpPath *path, GpPathData* pathData); + +GpStatus WINGDIPAPI +GdipStartPathFigure(GpPath *path); + +GpStatus WINGDIPAPI +GdipClosePathFigure(GpPath *path); + +GpStatus WINGDIPAPI +GdipClosePathFigures(GpPath *path); + +GpStatus WINGDIPAPI +GdipSetPathMarker(GpPath* path); + +GpStatus WINGDIPAPI +GdipClearPathMarkers(GpPath* path); + +GpStatus WINGDIPAPI +GdipReversePath(GpPath* path); + +GpStatus WINGDIPAPI +GdipGetPathLastPoint(GpPath* path, GpPointF* lastPoint); + +GpStatus WINGDIPAPI +GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2); + +GpStatus WINGDIPAPI +GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width, REAL height, + REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipAddPathBezier(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2, + REAL x3, REAL y3, REAL x4, REAL y4); + +GpStatus WINGDIPAPI +GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathCurve(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, + REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, INT count, + INT offset, INT numberOfSegments, REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathClosedCurve(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, + REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects, INT count); + +GpStatus WINGDIPAPI +GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, + REAL height); + +GpStatus WINGDIPAPI +GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REAL height, + REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipAddPathPolygon(GpPath *path, GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathPath(GpPath *path, GDIPCONST GpPath* addingPath, BOOL connect); + +GpStatus WINGDIPAPI +GdipAddPathString(GpPath *path, GDIPCONST WCHAR *string, + INT length, GDIPCONST GpFontFamily *family, INT style, + REAL emSize, GDIPCONST RectF *layoutRect, + GDIPCONST GpStringFormat *format); + +GpStatus WINGDIPAPI +GdipAddPathStringI(GpPath *path, GDIPCONST WCHAR *string, + INT length, GDIPCONST GpFontFamily *family, INT style, + REAL emSize, GDIPCONST Rect *layoutRect, + GDIPCONST GpStringFormat *format); + +GpStatus WINGDIPAPI +GdipAddPathLineI(GpPath *path, INT x1, INT y1, INT x2, INT y2); + +GpStatus WINGDIPAPI +GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathArcI(GpPath *path, INT x, INT y, INT width, INT height, + REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipAddPathBezierI(GpPath *path, INT x1, INT y1, INT x2, INT y2, + INT x3, INT y3, INT x4, INT y4); + +GpStatus WINGDIPAPI +GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, + REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points, INT count, + INT offset, INT numberOfSegments, REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathClosedCurveI(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipAddPathClosedCurve2I(GpPath *path, GDIPCONST GpPoint *points, INT count, + REAL tension); + +GpStatus WINGDIPAPI +GdipAddPathRectangleI(GpPath *path, INT x, INT y, INT width, INT height); + +GpStatus WINGDIPAPI +GdipAddPathRectanglesI(GpPath *path, GDIPCONST GpRect *rects, INT count); + +GpStatus WINGDIPAPI +GdipAddPathEllipseI(GpPath *path, INT x, INT y, INT width, INT height); + +GpStatus WINGDIPAPI +GdipAddPathPieI(GpPath *path, INT x, INT y, INT width, INT height, + REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipAddPathPolygonI(GpPath *path, GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatness); + +GpStatus WINGDIPAPI +GdipWindingModeOutline( + GpPath *path, + GpMatrix *matrix, + REAL flatness +); + + +#ifdef DCR_USE_NEW_202903 + +GpStatus WINGDIPAPI +GdipWidenPath( + GpPath *nativePath, + GpPen *pen, + GpMatrix *matrix, + REAL flatness +); + +#else + +GpStatus WINGDIPAPI +GdipWidenPathWithMinimumResolutions(GpPath *path, GpPen *pen, REAL minXres, + REAL minYres, GpMatrix *matrix, BOOL removeSelftIntersects); + +#endif + +GpStatus WINGDIPAPI +GdipWarpPath(GpPath *path, GpMatrix* matrix, + GDIPCONST GpPointF *points, INT count, + REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, + WarpMode warpMode, REAL flatness); + +GpStatus WINGDIPAPI +GdipTransformPath(GpPath* path, GpMatrix* matrix); + +GpStatus WINGDIPAPI +GdipGetPathWorldBounds(GpPath* path, GpRectF* bounds, GDIPCONST GpMatrix *matrix, + GDIPCONST GpPen *pen); + +GpStatus WINGDIPAPI +GdipGetPathWorldBoundsI(GpPath* path, GpRect* bounds, GDIPCONST GpMatrix *matrix, + GDIPCONST GpPen *pen); + +GpStatus WINGDIPAPI +GdipIsVisiblePathPoint(GpPath* path, REAL x, REAL y, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisiblePathPointI(GpPath* path, INT x, INT y, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsOutlineVisiblePathPoint(GpPath* path, REAL x, REAL y, GpPen *pen, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsOutlineVisiblePathPointI(GpPath* path, INT x, INT y, GpPen *pen, + GpGraphics *graphics, BOOL *result); + + +//---------------------------------------------------------------------------- +// Path Enumeration methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreatePathIter(GpPathIterator **iterator, GpPath* path); + +GpStatus WINGDIPAPI +GdipDeletePathIter(GpPathIterator *iterator); + +GpStatus WINGDIPAPI +GdipPathIterNextSubpath(GpPathIterator* iterator, INT *resultCount, + INT* startIndex, INT* endIndex, BOOL* isClosed); + +GpStatus WINGDIPAPI +GdipPathIterNextSubpathPath(GpPathIterator* iterator, INT* resultCount, + GpPath* path, BOOL* isClosed); + +GpStatus WINGDIPAPI +GdipPathIterNextPathType(GpPathIterator* iterator, INT* resultCount, + BYTE* pathType, INT* startIndex, INT* endIndex); + +GpStatus WINGDIPAPI +GdipPathIterNextMarker(GpPathIterator* iterator, INT *resultCount, + INT* startIndex, INT* endIndex); + +GpStatus WINGDIPAPI +GdipPathIterNextMarkerPath(GpPathIterator* iterator, INT* resultCount, + GpPath* path); + +GpStatus WINGDIPAPI +GdipPathIterGetCount(GpPathIterator* iterator, INT* count); + +GpStatus WINGDIPAPI +GdipPathIterGetSubpathCount(GpPathIterator* iterator, INT* count); + +GpStatus WINGDIPAPI +GdipPathIterIsValid(GpPathIterator* iterator, BOOL* valid); + +GpStatus WINGDIPAPI +GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurve); + +GpStatus WINGDIPAPI +GdipPathIterRewind(GpPathIterator* iterator); + +GpStatus WINGDIPAPI +GdipPathIterEnumerate(GpPathIterator* iterator, INT* resultCount, + GpPointF *points, BYTE *types, INT count); + +GpStatus WINGDIPAPI +GdipPathIterCopyData(GpPathIterator* iterator, INT* resultCount, + GpPointF* points, BYTE* types, INT startIndex, INT endIndex); + +//---------------------------------------------------------------------------- +// Matrix methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateMatrix(GpMatrix **matrix); + +GpStatus WINGDIPAPI +GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, + REAL dy, GpMatrix **matrix); + +GpStatus WINGDIPAPI +GdipCreateMatrix3(GDIPCONST GpRectF *rect, GDIPCONST GpPointF *dstplg, + GpMatrix **matrix); + +GpStatus WINGDIPAPI +GdipCreateMatrix3I(GDIPCONST GpRect *rect, GDIPCONST GpPoint *dstplg, + GpMatrix **matrix); + +GpStatus WINGDIPAPI +GdipCloneMatrix(GpMatrix *matrix, GpMatrix **cloneMatrix); + +GpStatus WINGDIPAPI +GdipDeleteMatrix(GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, + REAL dx, REAL dy); + +GpStatus WINGDIPAPI +GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipShearMatrix(GpMatrix *matrix, REAL shearX, REAL shearY, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipInvertMatrix(GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, INT count); + +GpStatus WINGDIPAPI +GdipTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, INT count); + +GpStatus WINGDIPAPI +GdipVectorTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts, + INT count); + +GpStatus WINGDIPAPI +GdipVectorTransformMatrixPointsI(GpMatrix *matrix, GpPoint *pts, + INT count); + +GpStatus WINGDIPAPI +GdipGetMatrixElements(GDIPCONST GpMatrix *matrix, REAL *matrixOut); + +GpStatus WINGDIPAPI +GdipIsMatrixInvertible(GDIPCONST GpMatrix *matrix, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsMatrixIdentity(GDIPCONST GpMatrix *matrix, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsMatrixEqual(GDIPCONST GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, BOOL *result); + +//---------------------------------------------------------------------------- +// Region methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateRegion(GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionRect(GDIPCONST GpRectF *rect, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionRectI(GDIPCONST GpRect *rect, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionPath(GpPath *path, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionRgnData(GDIPCONST BYTE *regionData, INT size, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCreateRegionHrgn(HRGN hRgn, GpRegion **region); + +GpStatus WINGDIPAPI +GdipCloneRegion(GpRegion *region, GpRegion **cloneRegion); + +GpStatus WINGDIPAPI +GdipDeleteRegion(GpRegion *region); + +GpStatus WINGDIPAPI +GdipSetInfinite(GpRegion *region); + +GpStatus WINGDIPAPI +GdipSetEmpty(GpRegion *region); + +GpStatus WINGDIPAPI +GdipCombineRegionRect(GpRegion *region, GDIPCONST GpRectF *rect, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipCombineRegionRectI(GpRegion *region, GDIPCONST GpRect *rect, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipCombineRegionRegion(GpRegion *region, GpRegion *region2, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipTranslateRegion(GpRegion *region, REAL dx, REAL dy); + +GpStatus WINGDIPAPI +GdipTranslateRegionI(GpRegion *region, INT dx, INT dy); + +GpStatus WINGDIPAPI +GdipTransformRegion(GpRegion *region, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, + GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetRegionBoundsI(GpRegion *region, GpGraphics *graphics, + GpRect *rect); + +GpStatus WINGDIPAPI +GdipGetRegionHRgn(GpRegion *region, GpGraphics *graphics, HRGN *hRgn); + +GpStatus WINGDIPAPI +GdipIsEmptyRegion(GpRegion *region, GpGraphics *graphics, + BOOL *result); + +GpStatus WINGDIPAPI +GdipIsInfiniteRegion(GpRegion *region, GpGraphics *graphics, + BOOL *result); + +GpStatus WINGDIPAPI +GdipIsEqualRegion(GpRegion *region, GpRegion *region2, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipGetRegionDataSize(GpRegion *region, UINT * bufferSize); + +GpStatus WINGDIPAPI +GdipGetRegionData(GpRegion *region, BYTE * buffer, UINT bufferSize, UINT * sizeFilled); + +GpStatus WINGDIPAPI +GdipIsVisibleRegionPoint(GpRegion *region, REAL x, REAL y, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRegionPointI(GpRegion *region, INT x, INT y, + GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRegionRect(GpRegion *region, REAL x, REAL y, REAL width, + REAL height, GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRegionRectI(GpRegion *region, INT x, INT y, INT width, + INT height, GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipGetRegionScansCount(GpRegion *region, UINT* count, GpMatrix* matrix); + +GpStatus WINGDIPAPI +GdipGetRegionScans(GpRegion *region, GpRectF* rects, INT* count, GpMatrix* matrix); + +GpStatus WINGDIPAPI +GdipGetRegionScansI(GpRegion *region, GpRect* rects, INT* count, GpMatrix* matrix); + +//---------------------------------------------------------------------------- +// Brush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCloneBrush(GpBrush *brush, GpBrush **cloneBrush); + +GpStatus WINGDIPAPI +GdipDeleteBrush(GpBrush *brush); + +GpStatus WINGDIPAPI +GdipGetBrushType(GpBrush *brush, GpBrushType *type); + +//---------------------------------------------------------------------------- +// Hatch Brush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateHatchBrush(GpHatchStyle hatchstyle, ARGB forecol, + ARGB backcol, GpHatch **brush); + +GpStatus WINGDIPAPI +GdipGetHatchStyle(GpHatch *brush, GpHatchStyle *hatchstyle); + +GpStatus WINGDIPAPI +GdipGetHatchForegroundColor(GpHatch *brush, ARGB* forecol); + +GpStatus WINGDIPAPI +GdipGetHatchBackgroundColor(GpHatch *brush, ARGB* backcol); + +//---------------------------------------------------------------------------- +// Texture Brush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateTexture(GpImage *image, GpWrapMode wrapmode, + GpTexture **texture); + +GpStatus WINGDIPAPI +GdipCreateTexture2(GpImage *image, GpWrapMode wrapmode, REAL x, + REAL y, REAL width, REAL height, GpTexture **texture); + +GpStatus WINGDIPAPI +GdipCreateTextureIA(GpImage *image, GDIPCONST GpImageAttributes *imageAttributes, + REAL x, REAL y, REAL width, REAL height, + GpTexture **texture); + +GpStatus WINGDIPAPI +GdipCreateTexture2I(GpImage *image, GpWrapMode wrapmode, INT x, + INT y, INT width, INT height, GpTexture **texture); + +GpStatus WINGDIPAPI +GdipCreateTextureIAI(GpImage *image, GDIPCONST GpImageAttributes *imageAttributes, + INT x, INT y, INT width, INT height, + GpTexture **texture); + + +GpStatus WINGDIPAPI +GdipGetTextureTransform(GpTexture *brush, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipSetTextureTransform(GpTexture *brush, GDIPCONST GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetTextureTransform(GpTexture* brush); + +GpStatus WINGDIPAPI +GdipMultiplyTextureTransform(GpTexture* brush, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslateTextureTransform(GpTexture* brush, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScaleTextureTransform(GpTexture* brush, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotateTextureTransform(GpTexture* brush, REAL angle, GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipSetTextureWrapMode(GpTexture *brush, GpWrapMode wrapmode); + +GpStatus WINGDIPAPI +GdipGetTextureWrapMode(GpTexture *brush, GpWrapMode *wrapmode); + +GpStatus WINGDIPAPI +GdipGetTextureImage(GpTexture *brush, GpImage **image); + +//---------------------------------------------------------------------------- +// Solid Brush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateSolidFill(ARGB color, GpSolidFill **brush); + +GpStatus WINGDIPAPI +GdipSetSolidFillColor(GpSolidFill *brush, ARGB color); + +GpStatus WINGDIPAPI +GdipGetSolidFillColor(GpSolidFill *brush, ARGB *color); + +//---------------------------------------------------------------------------- +// LineBrush methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateLineBrush(GDIPCONST GpPointF* point1, + GDIPCONST GpPointF* point2, + ARGB color1, ARGB color2, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushI(GDIPCONST GpPoint* point1, + GDIPCONST GpPoint* point2, + ARGB color1, ARGB color2, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushFromRect(GDIPCONST GpRectF* rect, + ARGB color1, ARGB color2, + LinearGradientMode mode, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushFromRectI(GDIPCONST GpRect* rect, + ARGB color1, ARGB color2, + LinearGradientMode mode, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushFromRectWithAngle(GDIPCONST GpRectF* rect, + ARGB color1, ARGB color2, + REAL angle, + BOOL isAngleScalable, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipCreateLineBrushFromRectWithAngleI(GDIPCONST GpRect* rect, + ARGB color1, ARGB color2, + REAL angle, + BOOL isAngleScalable, + GpWrapMode wrapMode, + GpLineGradient **lineGradient); + +GpStatus WINGDIPAPI +GdipSetLinePoints(GpLineGradient *brush, + GDIPCONST GpPointF* point1, + GDIPCONST GpPointF* point2); + +GpStatus WINGDIPAPI +GdipSetLinePointsI(GpLineGradient *brush, + GDIPCONST GpPoint* point1, + GDIPCONST GpPoint* point2); + +GpStatus WINGDIPAPI +GdipGetLinePoints(GpLineGradient *brush, GpPointF* points); + +GpStatus WINGDIPAPI +GdipGetLinePointsI(GpLineGradient *brush, GpPoint* points); + +GpStatus WINGDIPAPI +GdipSetLineColors(GpLineGradient *brush, ARGB color1, ARGB color2); + +GpStatus WINGDIPAPI +GdipGetLineColors(GpLineGradient *brush, ARGB* colors); + +GpStatus WINGDIPAPI +GdipGetLineRect(GpLineGradient *brush, GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetLineRectI(GpLineGradient *brush, GpRect *rect); + +GpStatus WINGDIPAPI +GdipSetLineGammaCorrection(GpLineGradient *brush, BOOL useGammaCorrection); + +GpStatus WINGDIPAPI +GdipGetLineGammaCorrection(GpLineGradient *brush, BOOL *useGammaCorrection); + +GpStatus WINGDIPAPI +GdipGetLineBlendCount(GpLineGradient *brush, INT *count); + +GpStatus WINGDIPAPI +GdipGetLineBlend(GpLineGradient *brush, REAL *blend, REAL* positions, + INT count); + +GpStatus WINGDIPAPI +GdipSetLineBlend(GpLineGradient *brush, GDIPCONST REAL *blend, + GDIPCONST REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipGetLinePresetBlendCount(GpLineGradient *brush, INT *count); + +GpStatus WINGDIPAPI +GdipGetLinePresetBlend(GpLineGradient *brush, ARGB *blend, + REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipSetLinePresetBlend(GpLineGradient *brush, GDIPCONST ARGB *blend, + GDIPCONST REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipSetLineSigmaBlend(GpLineGradient *brush, REAL focus, REAL scale); + +GpStatus WINGDIPAPI +GdipSetLineLinearBlend(GpLineGradient *brush, REAL focus, REAL scale); + +GpStatus WINGDIPAPI +GdipSetLineWrapMode(GpLineGradient *brush, GpWrapMode wrapmode); + +GpStatus WINGDIPAPI +GdipGetLineWrapMode(GpLineGradient *brush, GpWrapMode *wrapmode); + +GpStatus WINGDIPAPI +GdipGetLineTransform(GpLineGradient *brush, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipSetLineTransform(GpLineGradient *brush, GDIPCONST GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetLineTransform(GpLineGradient* brush); + +GpStatus WINGDIPAPI +GdipMultiplyLineTransform(GpLineGradient* brush, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslateLineTransform(GpLineGradient* brush, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScaleLineTransform(GpLineGradient* brush, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotateLineTransform(GpLineGradient* brush, REAL angle, GpMatrixOrder order); + +//---------------------------------------------------------------------------- +// PathGradient Brush +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreatePathGradient(GDIPCONST GpPointF* points, + INT count, + GpWrapMode wrapMode, + GpPathGradient **polyGradient); + +GpStatus WINGDIPAPI +GdipCreatePathGradientI(GDIPCONST GpPoint* points, + INT count, + GpWrapMode wrapMode, + GpPathGradient **polyGradient); + +GpStatus WINGDIPAPI +GdipCreatePathGradientFromPath(GDIPCONST GpPath* path, + GpPathGradient **polyGradient); + +GpStatus WINGDIPAPI +GdipGetPathGradientCenterColor( + GpPathGradient *brush, ARGB* colors); + +GpStatus WINGDIPAPI +GdipSetPathGradientCenterColor( + GpPathGradient *brush, ARGB colors); + +GpStatus WINGDIPAPI +GdipGetPathGradientSurroundColorsWithCount( + GpPathGradient *brush, ARGB* color, INT* count); + +GpStatus WINGDIPAPI +GdipSetPathGradientSurroundColorsWithCount( + GpPathGradient *brush, + GDIPCONST ARGB* color, INT* count); + +GpStatus WINGDIPAPI +GdipGetPathGradientPath(GpPathGradient *brush, GpPath *path); + +GpStatus WINGDIPAPI +GdipSetPathGradientPath(GpPathGradient *brush, GDIPCONST GpPath *path); + +GpStatus WINGDIPAPI +GdipGetPathGradientCenterPoint( + GpPathGradient *brush, GpPointF* points); + +GpStatus WINGDIPAPI +GdipGetPathGradientCenterPointI( + GpPathGradient *brush, GpPoint* points); + +GpStatus WINGDIPAPI +GdipSetPathGradientCenterPoint( + GpPathGradient *brush, GDIPCONST GpPointF* points); + +GpStatus WINGDIPAPI +GdipSetPathGradientCenterPointI( + GpPathGradient *brush, GDIPCONST GpPoint* points); + +GpStatus WINGDIPAPI +GdipGetPathGradientRect(GpPathGradient *brush, GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetPathGradientRectI(GpPathGradient *brush, GpRect *rect); + +GpStatus WINGDIPAPI +GdipGetPathGradientPointCount(GpPathGradient *brush, INT* count); + +GpStatus WINGDIPAPI +GdipGetPathGradientSurroundColorCount(GpPathGradient *brush, INT* count); + +GpStatus WINGDIPAPI +GdipSetPathGradientGammaCorrection(GpPathGradient *brush, BOOL useGammaCorrection); + +GpStatus WINGDIPAPI +GdipGetPathGradientGammaCorrection(GpPathGradient *brush, BOOL *useGammaCorrection); + +GpStatus WINGDIPAPI +GdipGetPathGradientBlendCount(GpPathGradient *brush, + INT *count); + +GpStatus WINGDIPAPI +GdipGetPathGradientBlend(GpPathGradient *brush, + REAL *blend, REAL *positions, INT count); + +GpStatus WINGDIPAPI +GdipSetPathGradientBlend(GpPathGradient *brush, + GDIPCONST REAL *blend, GDIPCONST REAL *positions, INT count); + +GpStatus WINGDIPAPI +GdipGetPathGradientPresetBlendCount(GpPathGradient *brush, INT *count); + +GpStatus WINGDIPAPI +GdipGetPathGradientPresetBlend(GpPathGradient *brush, ARGB *blend, + REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipSetPathGradientPresetBlend(GpPathGradient *brush, GDIPCONST ARGB *blend, + GDIPCONST REAL* positions, INT count); + +GpStatus WINGDIPAPI +GdipSetPathGradientSigmaBlend(GpPathGradient *brush, REAL focus, REAL scale); + +GpStatus WINGDIPAPI +GdipSetPathGradientLinearBlend(GpPathGradient *brush, REAL focus, REAL scale); + +GpStatus WINGDIPAPI +GdipGetPathGradientWrapMode(GpPathGradient *brush, + GpWrapMode *wrapmode); + +GpStatus WINGDIPAPI +GdipSetPathGradientWrapMode(GpPathGradient *brush, + GpWrapMode wrapmode); + +GpStatus WINGDIPAPI +GdipGetPathGradientTransform(GpPathGradient *brush, + GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipSetPathGradientTransform(GpPathGradient *brush, + GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetPathGradientTransform(GpPathGradient* brush); + +GpStatus WINGDIPAPI +GdipMultiplyPathGradientTransform(GpPathGradient* brush, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslatePathGradientTransform(GpPathGradient* brush, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScalePathGradientTransform(GpPathGradient* brush, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotatePathGradientTransform(GpPathGradient* brush, REAL angle, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipGetPathGradientFocusScales(GpPathGradient *brush, REAL* xScale, REAL* yScale); + +GpStatus WINGDIPAPI +GdipSetPathGradientFocusScales(GpPathGradient *brush, REAL xScale, REAL yScale); + +//---------------------------------------------------------------------------- +// Pen methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreatePen1(ARGB color, REAL width, GpUnit unit, GpPen **pen); + +GpStatus WINGDIPAPI +GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, + GpPen **pen); + +GpStatus WINGDIPAPI +GdipClonePen(GpPen *pen, GpPen **clonepen); + +GpStatus WINGDIPAPI +GdipDeletePen(GpPen *pen); + +GpStatus WINGDIPAPI +GdipSetPenWidth(GpPen *pen, REAL width); + +GpStatus WINGDIPAPI +GdipGetPenWidth(GpPen *pen, REAL *width); + +GpStatus WINGDIPAPI +GdipSetPenUnit(GpPen *pen, GpUnit unit); + +GpStatus WINGDIPAPI +GdipGetPenUnit(GpPen *pen, GpUnit *unit); + +#ifdef DCR_USE_NEW_197819 +GpStatus WINGDIPAPI +GdipSetPenLineCap197819(GpPen *pen, GpLineCap startCap, GpLineCap endCap, + GpDashCap dashCap); +#else +GpStatus WINGDIPAPI +GdipSetPenLineCap(GpPen *pen, GpLineCap startCap, GpLineCap endCap, + GpLineCap dashCap); +#endif // DCR_USE_NEW_197819 + + +GpStatus WINGDIPAPI +GdipSetPenStartCap(GpPen *pen, GpLineCap startCap); + +GpStatus WINGDIPAPI +GdipSetPenEndCap(GpPen *pen, GpLineCap endCap); + +#ifdef DCR_USE_NEW_197819 +GpStatus WINGDIPAPI +GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap); +#else +GpStatus WINGDIPAPI +GdipSetPenDashCap(GpPen *pen, GpLineCap dashCap); +#endif // DCR_USE_NEW_197819 + +GpStatus WINGDIPAPI +GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap); + +GpStatus WINGDIPAPI +GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap); + +#ifdef DCR_USE_NEW_197819 +GpStatus WINGDIPAPI +GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap); +#else +GpStatus WINGDIPAPI +GdipGetPenDashCap(GpPen *pen, GpLineCap *dashCap); +#endif // DCR_USE_NEW_197819 + +GpStatus WINGDIPAPI +GdipSetPenLineJoin(GpPen *pen, GpLineJoin lineJoin); + +GpStatus WINGDIPAPI +GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin); + +GpStatus WINGDIPAPI +GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap* customCap); + +GpStatus WINGDIPAPI +GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap** customCap); + +GpStatus WINGDIPAPI +GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap* customCap); + +GpStatus WINGDIPAPI +GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap** customCap); + +GpStatus WINGDIPAPI +GdipSetPenMiterLimit(GpPen *pen, REAL miterLimit); + +GpStatus WINGDIPAPI +GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit); + +GpStatus WINGDIPAPI +GdipSetPenMode(GpPen *pen, GpPenAlignment penMode); + +GpStatus WINGDIPAPI +GdipGetPenMode(GpPen *pen, GpPenAlignment *penMode); + +GpStatus WINGDIPAPI +GdipSetPenTransform(GpPen *pen, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipGetPenTransform(GpPen *pen, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetPenTransform(GpPen *pen); + +GpStatus WINGDIPAPI +GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipSetPenColor(GpPen *pen, ARGB argb); + +GpStatus WINGDIPAPI +GdipGetPenColor(GpPen *pen, ARGB *argb); + +GpStatus WINGDIPAPI +GdipSetPenBrushFill(GpPen *pen, GpBrush *brush); + +GpStatus WINGDIPAPI +GdipGetPenBrushFill(GpPen *pen, GpBrush **brush); + +GpStatus WINGDIPAPI +GdipGetPenFillType(GpPen *pen, GpPenType* type); + +GpStatus WINGDIPAPI +GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dashstyle); + +GpStatus WINGDIPAPI +GdipSetPenDashStyle(GpPen *pen, GpDashStyle dashstyle); + +GpStatus WINGDIPAPI +GdipGetPenDashOffset(GpPen *pen, REAL *offset); + +GpStatus WINGDIPAPI +GdipSetPenDashOffset(GpPen *pen, REAL offset); + +GpStatus WINGDIPAPI +GdipGetPenDashCount(GpPen *pen, INT *count); + +GpStatus WINGDIPAPI +GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash, INT count); + +GpStatus WINGDIPAPI +GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count); + +GpStatus WINGDIPAPI +GdipGetPenCompoundCount(GpPen *pen, INT *count); + +GpStatus WINGDIPAPI +GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash, INT count); + +GpStatus WINGDIPAPI +GdipGetPenCompoundArray(GpPen *pen, REAL *dash, INT count); + +//---------------------------------------------------------------------------- +// CustomLineCap methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath, + GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap); + +GpStatus WINGDIPAPI +GdipDeleteCustomLineCap(GpCustomLineCap* customCap); + +GpStatus WINGDIPAPI +GdipCloneCustomLineCap(GpCustomLineCap* customCap, + GpCustomLineCap** clonedCap); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapType(GpCustomLineCap* customCap, + CustomLineCapType* capType); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapStrokeCaps(GpCustomLineCap* customCap, + GpLineCap startCap, GpLineCap endCap); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapStrokeCaps(GpCustomLineCap* customCap, + GpLineCap* startCap, GpLineCap* endCap); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapStrokeJoin(GpCustomLineCap* customCap, GpLineJoin lineJoin); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapStrokeJoin(GpCustomLineCap* customCap, GpLineJoin* lineJoin); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapBaseCap(GpCustomLineCap* customCap, GpLineCap baseCap); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapBaseCap(GpCustomLineCap* customCap, GpLineCap* baseCap); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapBaseInset(GpCustomLineCap* customCap, REAL inset); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapBaseInset(GpCustomLineCap* customCap, REAL* inset); + +GpStatus WINGDIPAPI +GdipSetCustomLineCapWidthScale(GpCustomLineCap* customCap, REAL widthScale); + +GpStatus WINGDIPAPI +GdipGetCustomLineCapWidthScale(GpCustomLineCap* customCap, REAL* widthScale); + +//---------------------------------------------------------------------------- +// AdjustableArrowCap methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL isFilled, + GpAdjustableArrowCap **cap); + +GpStatus WINGDIPAPI +GdipSetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL height); + +GpStatus WINGDIPAPI +GdipGetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL* height); + +GpStatus WINGDIPAPI +GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL width); + +GpStatus WINGDIPAPI +GdipGetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL* width); + +GpStatus WINGDIPAPI +GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL middleInset); + +GpStatus WINGDIPAPI +GdipGetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL* middleInset); + +GpStatus WINGDIPAPI +GdipSetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL fillState); + +GpStatus WINGDIPAPI +GdipGetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL* fillState); + +//---------------------------------------------------------------------------- +// Image methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipLoadImageFromStream(IStream* stream, GpImage **image); + +GpStatus WINGDIPAPI +GdipLoadImageFromFile(GDIPCONST WCHAR* filename, GpImage **image); + +GpStatus WINGDIPAPI +GdipLoadImageFromStreamICM(IStream* stream, GpImage **image); + +GpStatus WINGDIPAPI +GdipLoadImageFromFileICM(GDIPCONST WCHAR* filename, GpImage **image); + +GpStatus WINGDIPAPI +GdipCloneImage(GpImage *image, GpImage **cloneImage); + +GpStatus WINGDIPAPI +GdipDisposeImage(GpImage *image); + +GpStatus WINGDIPAPI +GdipSaveImageToFile(GpImage *image, GDIPCONST WCHAR* filename, + GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams); + +GpStatus WINGDIPAPI +GdipSaveImageToStream(GpImage *image, IStream* stream, + GDIPCONST CLSID* clsidEncoder, GDIPCONST EncoderParameters* encoderParams); + +GpStatus WINGDIPAPI +GdipSaveAdd(GpImage *image, GDIPCONST EncoderParameters* encoderParams); + +GpStatus WINGDIPAPI +GdipSaveAddImage(GpImage *image, GpImage* newImage, + GDIPCONST EncoderParameters* encoderParams); + +GpStatus WINGDIPAPI +GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipGetImageBounds(GpImage *image, GpRectF *srcRect, GpUnit *srcUnit); + +GpStatus WINGDIPAPI +GdipGetImageDimension(GpImage *image, REAL *width, REAL *height); + +GpStatus WINGDIPAPI +GdipGetImageType(GpImage *image, ImageType *type); + +GpStatus WINGDIPAPI +GdipGetImageWidth(GpImage *image, UINT *width); + +GpStatus WINGDIPAPI +GdipGetImageHeight(GpImage *image, UINT *height); + +GpStatus WINGDIPAPI +GdipGetImageHorizontalResolution(GpImage *image, REAL *resolution); + +GpStatus WINGDIPAPI +GdipGetImageVerticalResolution(GpImage *image, REAL *resolution); + +GpStatus WINGDIPAPI +GdipGetImageFlags(GpImage *image, UINT *flags); + +GpStatus WINGDIPAPI +GdipGetImageRawFormat(GpImage *image, GUID *format); + +GpStatus WINGDIPAPI +GdipGetImagePixelFormat(GpImage *image, PixelFormat *format); + +GpStatus WINGDIPAPI +GdipGetImageThumbnail(GpImage *image, UINT thumbWidth, UINT thumbHeight, + GpImage **thumbImage, + GetThumbnailImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipGetEncoderParameterListSize(GpImage *image, GDIPCONST CLSID* clsidEncoder, + UINT* size); + +GpStatus WINGDIPAPI +GdipGetEncoderParameterList(GpImage *image, GDIPCONST CLSID* clsidEncoder, + UINT size, EncoderParameters* buffer); + +GpStatus WINGDIPAPI +GdipImageGetFrameDimensionsCount(GpImage* image, UINT* count); + +GpStatus WINGDIPAPI +GdipImageGetFrameDimensionsList(GpImage* image, GUID* dimensionIDs, UINT count); + +GpStatus WINGDIPAPI +GdipImageGetFrameCount(GpImage *image, GDIPCONST GUID* dimensionID, UINT* count); + +GpStatus WINGDIPAPI +GdipImageSelectActiveFrame(GpImage *image, GDIPCONST GUID* dimensionID, + UINT frameIndex); + +GpStatus WINGDIPAPI +GdipImageRotateFlip(GpImage *image, RotateFlipType rfType); + +GpStatus WINGDIPAPI +GdipGetImagePalette(GpImage *image, ColorPalette *palette, INT size); + +GpStatus WINGDIPAPI +GdipSetImagePalette(GpImage *image, GDIPCONST ColorPalette *palette); + +GpStatus WINGDIPAPI +GdipGetImagePaletteSize(GpImage *image, INT *size); + +GpStatus WINGDIPAPI +GdipGetPropertyCount(GpImage *image, UINT* numOfProperty); + +GpStatus WINGDIPAPI +GdipGetPropertyIdList(GpImage *image, UINT numOfProperty, PROPID* list); + +GpStatus WINGDIPAPI +GdipGetPropertyItemSize(GpImage *image, PROPID propId, UINT* size); + +GpStatus WINGDIPAPI +GdipGetPropertyItem(GpImage *image, PROPID propId,UINT propSize, + PropertyItem* buffer); + +GpStatus WINGDIPAPI +GdipGetPropertySize(GpImage *image, UINT* totalBufferSize, UINT* numProperties); + +GpStatus WINGDIPAPI +GdipGetAllPropertyItems(GpImage *image, UINT totalBufferSize, + UINT numProperties, PropertyItem* allItems); + +GpStatus WINGDIPAPI +GdipRemovePropertyItem(GpImage *image, PROPID propId); + +GpStatus WINGDIPAPI +GdipSetPropertyItem(GpImage *image, GDIPCONST PropertyItem* item); + +GpStatus WINGDIPAPI +GdipImageForceValidation(GpImage *image); + +GpStatus WINGDIPAPI +GdipGetImageLayout(GpImage *image, ImageLayout* layout); + +GpStatus WINGDIPAPI +GdipSetImageLayout(GpImage *image, GDIPCONST ImageLayout layout); + +//---------------------------------------------------------------------------- +// Bitmap methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateBitmapFromStream(IStream* stream, GpBitmap **bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromFile(GDIPCONST WCHAR* filename, GpBitmap **bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromStreamICM(IStream* stream, GpBitmap **bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromFileICM(GDIPCONST WCHAR* filename, GpBitmap **bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromScan0(INT width, + INT height, + INT stride, + PixelFormat format, + BYTE* scan0, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromGraphics(INT width, + INT height, + GpGraphics* target, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromDirectDrawSurface(IDirectDrawSurface7* surface, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromGdiDib(GDIPCONST BITMAPINFO* gdiBitmapInfo, + VOID* gdiBitmapData, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromHBITMAP(HBITMAP hbm, + HPALETTE hpal, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateHBITMAPFromBitmap(GpBitmap* bitmap, + HBITMAP* hbmReturn, + ARGB background); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromHICON(HICON hicon, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCreateHICONFromBitmap(GpBitmap* bitmap, + HICON* hbmReturn); + +GpStatus WINGDIPAPI +GdipCreateBitmapFromResource(HINSTANCE hInstance, + GDIPCONST WCHAR* lpBitmapName, + GpBitmap** bitmap); + +GpStatus WINGDIPAPI +GdipCloneBitmapArea(REAL x, REAL y, REAL width, REAL height, + PixelFormat format, + GpBitmap *srcBitmap, + GpBitmap **dstBitmap); + +GpStatus WINGDIPAPI +GdipCloneBitmapAreaI(INT x, + INT y, + INT width, + INT height, + PixelFormat format, + GpBitmap *srcBitmap, + GpBitmap **dstBitmap); + +GpStatus WINGDIPAPI +GdipBitmapLockBits(GpBitmap* bitmap, + GDIPCONST GpRect* rect, + UINT flags, + PixelFormat format, + BitmapData* lockedBitmapData); + +GpStatus WINGDIPAPI +GdipBitmapUnlockBits(GpBitmap* bitmap, + BitmapData* lockedBitmapData); + +GpStatus WINGDIPAPI +GdipBitmapGetPixel(GpBitmap* bitmap, INT x, INT y, ARGB *color); + +GpStatus WINGDIPAPI +GdipBitmapSetPixel(GpBitmap* bitmap, INT x, INT y, ARGB color); + +GpStatus WINGDIPAPI +GdipBitmapSetResolution(GpBitmap* bitmap, REAL xdpi, REAL ydpi); + +//---------------------------------------------------------------------------- +// ImageAttributes methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateImageAttributes(GpImageAttributes **imageattr); + +GpStatus WINGDIPAPI +GdipCloneImageAttributes(GDIPCONST GpImageAttributes *imageattr, + GpImageAttributes **cloneImageattr); + +GpStatus WINGDIPAPI +GdipDisposeImageAttributes(GpImageAttributes *imageattr); + +GpStatus WINGDIPAPI +GdipSetImageAttributesToIdentity(GpImageAttributes *imageattr, + ColorAdjustType type); +GpStatus WINGDIPAPI +GdipResetImageAttributes(GpImageAttributes *imageattr, + ColorAdjustType type); + +GpStatus WINGDIPAPI +GdipSetImageAttributesColorMatrix(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + GDIPCONST ColorMatrix* colorMatrix, + GDIPCONST ColorMatrix* grayMatrix, + ColorMatrixFlags flags); + +GpStatus WINGDIPAPI +GdipSetImageAttributesThreshold(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + REAL threshold); + +GpStatus WINGDIPAPI +GdipSetImageAttributesGamma(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + REAL gamma); + +GpStatus WINGDIPAPI +GdipSetImageAttributesNoOp(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag); + +GpStatus WINGDIPAPI +GdipSetImageAttributesColorKeys(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + ARGB colorLow, + ARGB colorHigh); + +GpStatus WINGDIPAPI +GdipSetImageAttributesOutputChannel(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + ColorChannelFlags channelFlags); + +GpStatus WINGDIPAPI +GdipSetImageAttributesOutputChannelColorProfile(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + GDIPCONST WCHAR *colorProfileFilename); + +GpStatus WINGDIPAPI +GdipSetImageAttributesRemapTable(GpImageAttributes *imageattr, + ColorAdjustType type, + BOOL enableFlag, + UINT mapSize, + GDIPCONST ColorMap *map); +GpStatus WINGDIPAPI +GdipSetImageAttributesWrapMode( + GpImageAttributes *imageAttr, + WrapMode wrap, + ARGB argb, + BOOL clamp +); + +GpStatus WINGDIPAPI +GdipSetImageAttributesICMMode( + GpImageAttributes *imageAttr, + BOOL on +); + +GpStatus WINGDIPAPI +GdipGetImageAttributesAdjustedPalette( + GpImageAttributes *imageAttr, + ColorPalette * colorPalette, + ColorAdjustType colorAdjustType +); + +//---------------------------------------------------------------------------- +// Graphics methods +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipFlush(GpGraphics *graphics, GpFlushIntention intention); + +GpStatus WINGDIPAPI +GdipCreateFromHDC(HDC hdc, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipCreateFromHDC2(HDC hdc, HANDLE hDevice, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipCreateFromHWNDICM(HWND hwnd, GpGraphics **graphics); + +GpStatus WINGDIPAPI +GdipDeleteGraphics(GpGraphics *graphics); + +GpStatus WINGDIPAPI +GdipGetDC(GpGraphics* graphics, HDC * hdc); + +GpStatus WINGDIPAPI +GdipReleaseDC(GpGraphics* graphics, HDC hdc); + +GpStatus WINGDIPAPI +GdipSetCompositingMode(GpGraphics *graphics, CompositingMode compositingMode); + +GpStatus WINGDIPAPI +GdipGetCompositingMode(GpGraphics *graphics, CompositingMode *compositingMode); + +GpStatus WINGDIPAPI +GdipSetRenderingOrigin(GpGraphics *graphics, INT x, INT y); + +GpStatus WINGDIPAPI +GdipGetRenderingOrigin(GpGraphics *graphics, INT *x, INT *y); + +GpStatus WINGDIPAPI +GdipSetCompositingQuality(GpGraphics *graphics, CompositingQuality compositingQuality); + +GpStatus WINGDIPAPI +GdipGetCompositingQuality(GpGraphics *graphics, CompositingQuality *compositingQuality); + +GpStatus WINGDIPAPI +GdipSetSmoothingMode(GpGraphics *graphics, SmoothingMode smoothingMode); + +GpStatus WINGDIPAPI +GdipGetSmoothingMode(GpGraphics *graphics, SmoothingMode *smoothingMode); + +GpStatus WINGDIPAPI +GdipSetPixelOffsetMode(GpGraphics* graphics, PixelOffsetMode pixelOffsetMode); + +GpStatus WINGDIPAPI +GdipGetPixelOffsetMode(GpGraphics *graphics, PixelOffsetMode *pixelOffsetMode); + +GpStatus WINGDIPAPI +GdipSetTextRenderingHint(GpGraphics *graphics, TextRenderingHint mode); + +GpStatus WINGDIPAPI +GdipGetTextRenderingHint(GpGraphics *graphics, TextRenderingHint *mode); + +#ifdef DCR_USE_NEW_188922 +GpStatus WINGDIPAPI +GdipSetTextContrast(GpGraphics *graphics, UINT contrast); + +GpStatus WINGDIPAPI +GdipGetTextContrast(GpGraphics *graphics, UINT * contrast); +#else +GpStatus WINGDIPAPI +GdipSetTextGammaValue(GpGraphics *graphics, UINT gammaValue); + +GpStatus WINGDIPAPI +GdipGetTextGammaValue(GpGraphics *graphics, UINT * gammaValue); +#endif // DCR_USE_NEW_188922 + + +GpStatus WINGDIPAPI +GdipSetInterpolationMode(GpGraphics *graphics, InterpolationMode interpolationMode); + +GpStatus WINGDIPAPI +GdipGetInterpolationMode(GpGraphics *graphics, InterpolationMode *interpolationMode); + +GpStatus WINGDIPAPI +GdipSetWorldTransform(GpGraphics *graphics, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetWorldTransform(GpGraphics *graphics); + +GpStatus WINGDIPAPI +GdipMultiplyWorldTransform(GpGraphics *graphics, GDIPCONST GpMatrix *matrix, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipTranslateWorldTransform(GpGraphics *graphics, REAL dx, REAL dy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, + GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipRotateWorldTransform(GpGraphics *graphics, REAL angle, GpMatrixOrder order); + +GpStatus WINGDIPAPI +GdipGetWorldTransform(GpGraphics *graphics, GpMatrix *matrix); + +GpStatus WINGDIPAPI +GdipResetPageTransform(GpGraphics *graphics); + +GpStatus WINGDIPAPI +GdipGetPageUnit(GpGraphics *graphics, GpUnit *unit); + +GpStatus WINGDIPAPI +GdipGetPageScale(GpGraphics *graphics, REAL *scale); + +GpStatus WINGDIPAPI +GdipSetPageUnit(GpGraphics *graphics, GpUnit unit); + +GpStatus WINGDIPAPI +GdipSetPageScale(GpGraphics *graphics, REAL scale); + +GpStatus WINGDIPAPI +GdipGetDpiX(GpGraphics *graphics, REAL* dpi); + +GpStatus WINGDIPAPI +GdipGetDpiY(GpGraphics *graphics, REAL* dpi); + +GpStatus WINGDIPAPI +GdipTransformPoints(GpGraphics *graphics, GpCoordinateSpace destSpace, + GpCoordinateSpace srcSpace, GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipTransformPointsI(GpGraphics *graphics, GpCoordinateSpace destSpace, + GpCoordinateSpace srcSpace, GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipGetNearestColor(GpGraphics *graphics, ARGB* argb); + +// Create the Win9x Halftone Palette (even on NT) with correct Desktop colors +HPALETTE WINGDIPAPI +GdipCreateHalftonePalette(); + +GpStatus WINGDIPAPI +GdipDrawLine(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, + REAL x2, REAL y2); + +GpStatus WINGDIPAPI +GdipDrawLineI(GpGraphics *graphics, GpPen *pen, INT x1, INT y1, + INT x2, INT y2); + +GpStatus WINGDIPAPI +GdipDrawLines(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawLinesI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawArc(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, + REAL width, REAL height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipDrawArcI(GpGraphics *graphics, GpPen *pen, INT x, INT y, + INT width, INT height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipDrawBezier(GpGraphics *graphics, GpPen *pen, REAL x1, REAL y1, + REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4); + +GpStatus WINGDIPAPI +GdipDrawBezierI(GpGraphics *graphics, GpPen *pen, INT x1, INT y1, + INT x2, INT y2, INT x3, INT y3, INT x4, INT y4); + +GpStatus WINGDIPAPI +GdipDrawBeziers(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawBeziersI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawRectangle(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipDrawRectangleI(GpGraphics *graphics, GpPen *pen, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipDrawRectangles(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRectF *rects, + INT count); + +GpStatus WINGDIPAPI +GdipDrawRectanglesI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpRect *rects, + INT count); + +GpStatus WINGDIPAPI +GdipDrawEllipse(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipDrawEllipseI(GpGraphics *graphics, GpPen *pen, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipDrawPie(GpGraphics *graphics, GpPen *pen, REAL x, REAL y, + REAL width, REAL height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipDrawPieI(GpGraphics *graphics, GpPen *pen, INT x, INT y, + INT width, INT height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipDrawPolygon(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawPolygonI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawPath(GpGraphics *graphics, GpPen *pen, GpPath *path); + +GpStatus WINGDIPAPI +GdipDrawCurve(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawCurveI(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count); + +GpStatus WINGDIPAPI +GdipDrawCurve2(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawCurve2I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawCurve3(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPointF *points, + INT count, INT offset, INT numberOfSegments, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawCurve3I(GpGraphics *graphics, GpPen *pen, GDIPCONST GpPoint *points, + INT count, INT offset, INT numberOfSegments, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawClosedCurve(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipDrawClosedCurveI(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipDrawClosedCurve2(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPointF *points, INT count, REAL tension); + +GpStatus WINGDIPAPI +GdipDrawClosedCurve2I(GpGraphics *graphics, GpPen *pen, + GDIPCONST GpPoint *points, INT count, REAL tension); + +GpStatus WINGDIPAPI +GdipGraphicsClear(GpGraphics *graphics, ARGB color); + +GpStatus WINGDIPAPI +GdipFillRectangle(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipFillRectangleI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipFillRectangles(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpRectF *rects, INT count); + +GpStatus WINGDIPAPI +GdipFillRectanglesI(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpRect *rects, INT count); + +GpStatus WINGDIPAPI +GdipFillPolygon(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count, GpFillMode fillMode); + +GpStatus WINGDIPAPI +GdipFillPolygonI(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count, GpFillMode fillMode); + +GpStatus WINGDIPAPI +GdipFillPolygon2(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipFillPolygon2I(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipFillEllipse(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipFillEllipseI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipFillPie(GpGraphics *graphics, GpBrush *brush, REAL x, REAL y, + REAL width, REAL height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipFillPieI(GpGraphics *graphics, GpBrush *brush, INT x, INT y, + INT width, INT height, REAL startAngle, REAL sweepAngle); + +GpStatus WINGDIPAPI +GdipFillPath(GpGraphics *graphics, GpBrush *brush, GpPath *path); + +GpStatus WINGDIPAPI +GdipFillClosedCurve(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count); + +GpStatus WINGDIPAPI +GdipFillClosedCurveI(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count); + +GpStatus WINGDIPAPI +GdipFillClosedCurve2(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPointF *points, INT count, + REAL tension, GpFillMode fillMode); + +GpStatus WINGDIPAPI +GdipFillClosedCurve2I(GpGraphics *graphics, GpBrush *brush, + GDIPCONST GpPoint *points, INT count, + REAL tension, GpFillMode fillMode); + +GpStatus WINGDIPAPI +GdipFillRegion(GpGraphics *graphics, GpBrush *brush, + GpRegion *region); + +GpStatus WINGDIPAPI +GdipDrawImage(GpGraphics *graphics, GpImage *image, REAL x, REAL y); + +GpStatus WINGDIPAPI +GdipDrawImageI(GpGraphics *graphics, GpImage *image, INT x, INT y); + +GpStatus WINGDIPAPI +GdipDrawImageRect(GpGraphics *graphics, GpImage *image, REAL x, REAL y, + REAL width, REAL height); + +GpStatus WINGDIPAPI +GdipDrawImageRectI(GpGraphics *graphics, GpImage *image, INT x, INT y, + INT width, INT height); + +GpStatus WINGDIPAPI +GdipDrawImagePoints(GpGraphics *graphics, GpImage *image, + GDIPCONST GpPointF *dstpoints, INT count); + +GpStatus WINGDIPAPI +GdipDrawImagePointsI(GpGraphics *graphics, GpImage *image, + GDIPCONST GpPoint *dstpoints, INT count); + +GpStatus WINGDIPAPI +GdipDrawImagePointRect(GpGraphics *graphics, GpImage *image, REAL x, + REAL y, REAL srcx, REAL srcy, REAL srcwidth, + REAL srcheight, GpUnit srcUnit); + +GpStatus WINGDIPAPI +GdipDrawImagePointRectI(GpGraphics *graphics, GpImage *image, INT x, + INT y, INT srcx, INT srcy, INT srcwidth, + INT srcheight, GpUnit srcUnit); + +GpStatus WINGDIPAPI +GdipDrawImageRectRect(GpGraphics *graphics, GpImage *image, REAL dstx, + REAL dsty, REAL dstwidth, REAL dstheight, + REAL srcx, REAL srcy, REAL srcwidth, REAL srcheight, + GpUnit srcUnit, + GDIPCONST GpImageAttributes* imageAttributes, + DrawImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipDrawImageRectRectI(GpGraphics *graphics, GpImage *image, INT dstx, + INT dsty, INT dstwidth, INT dstheight, + INT srcx, INT srcy, INT srcwidth, INT srcheight, + GpUnit srcUnit, + GDIPCONST GpImageAttributes* imageAttributes, + DrawImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipDrawImagePointsRect(GpGraphics *graphics, GpImage *image, + GDIPCONST GpPointF *points, INT count, REAL srcx, + REAL srcy, REAL srcwidth, REAL srcheight, + GpUnit srcUnit, + GDIPCONST GpImageAttributes* imageAttributes, + DrawImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipDrawImagePointsRectI(GpGraphics *graphics, GpImage *image, + GDIPCONST GpPoint *points, INT count, INT srcx, + INT srcy, INT srcwidth, INT srcheight, + GpUnit srcUnit, + GDIPCONST GpImageAttributes* imageAttributes, + DrawImageAbort callback, VOID * callbackData); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestPoint( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST PointF & destPoint, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestPointI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Point & destPoint, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestRect( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST RectF & destRect, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestRectI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Rect & destRect, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestPoints( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST PointF * destPoints, + INT count, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileDestPointsI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Point * destPoints, + INT count, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestPoint( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST PointF & destPoint, + GDIPCONST RectF & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestPointI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Point & destPoint, + GDIPCONST Rect & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestRect( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST RectF & destRect, + GDIPCONST RectF & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestRectI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Rect & destRect, + GDIPCONST Rect & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestPoints( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST PointF * destPoints, + INT count, + GDIPCONST RectF & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipEnumerateMetafileSrcRectDestPointsI( + GpGraphics * graphics, + GDIPCONST GpMetafile * metafile, + GDIPCONST Point * destPoints, + INT count, + GDIPCONST Rect & srcRect, + Unit srcUnit, + EnumerateMetafileProc callback, + VOID * callbackData, + GDIPCONST GpImageAttributes * imageAttributes + ); + +GpStatus WINGDIPAPI +GdipPlayMetafileRecord( + GDIPCONST GpMetafile * metafile, + EmfPlusRecordType recordType, + UINT flags, + UINT dataSize, + GDIPCONST BYTE * data + ); + +GpStatus WINGDIPAPI +GdipSetClipGraphics(GpGraphics *graphics, GpGraphics *srcgraphics, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipRect(GpGraphics *graphics, REAL x, REAL y, + REAL width, REAL height, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipRectI(GpGraphics *graphics, INT x, INT y, + INT width, INT height, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipPath(GpGraphics *graphics, GpPath *path, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipRegion(GpGraphics *graphics, GpRegion *region, + CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipSetClipHrgn(GpGraphics *graphics, HRGN hRgn, CombineMode combineMode); + +GpStatus WINGDIPAPI +GdipResetClip(GpGraphics *graphics); + +GpStatus WINGDIPAPI +GdipTranslateClip(GpGraphics *graphics, REAL dx, REAL dy); + +GpStatus WINGDIPAPI +GdipTranslateClipI(GpGraphics *graphics, INT dx, INT dy); + +GpStatus WINGDIPAPI +GdipGetClip(GpGraphics *graphics, GpRegion *region); + +GpStatus WINGDIPAPI +GdipGetClipBounds(GpGraphics *graphics, GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetClipBoundsI(GpGraphics *graphics, GpRect *rect); + +GpStatus WINGDIPAPI +GdipIsClipEmpty(GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect); + +GpStatus WINGDIPAPI +GdipGetVisibleClipBoundsI(GpGraphics *graphics, GpRect *rect); + +GpStatus WINGDIPAPI +GdipIsVisibleClipEmpty(GpGraphics *graphics, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisiblePoint(GpGraphics *graphics, REAL x, REAL y, + BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisiblePointI(GpGraphics *graphics, INT x, INT y, + BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRect(GpGraphics *graphics, REAL x, REAL y, + REAL width, REAL height, BOOL *result); + +GpStatus WINGDIPAPI +GdipIsVisibleRectI(GpGraphics *graphics, INT x, INT y, + INT width, INT height, BOOL *result); + +GpStatus WINGDIPAPI +GdipSaveGraphics(GpGraphics *graphics, GraphicsState *state); + +GpStatus WINGDIPAPI +GdipRestoreGraphics(GpGraphics *graphics, GraphicsState state); + +GpStatus WINGDIPAPI +GdipBeginContainer(GpGraphics *graphics, GDIPCONST GpRectF* dstrect, + GDIPCONST GpRectF *srcrect, GpUnit unit, GraphicsContainer *state); + +GpStatus WINGDIPAPI +GdipBeginContainerI(GpGraphics *graphics, GDIPCONST GpRect* dstrect, + GDIPCONST GpRect *srcrect, GpUnit unit, GraphicsContainer *state); + +GpStatus WINGDIPAPI +GdipBeginContainer2(GpGraphics *graphics, GraphicsContainer* state); + +GpStatus WINGDIPAPI +GdipEndContainer(GpGraphics *graphics, GraphicsContainer state); + +GpStatus +GdipGetMetafileHeaderFromWmf( + HMETAFILE hWmf, + GDIPCONST APMFileHeader * apmFileHeader, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetMetafileHeaderFromEmf( + HENHMETAFILE hEmf, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetMetafileHeaderFromFile( + GDIPCONST WCHAR* filename, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetMetafileHeaderFromStream( + IStream * stream, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetMetafileHeaderFromMetafile( + GpMetafile * metafile, + MetafileHeader * header + ); + +GpStatus +WINGDIPAPI +GdipGetHemfFromMetafile( + GpMetafile * metafile, + HENHMETAFILE * hEmf + ); + +GpStatus WINGDIPAPI +GdipCreateStreamOnFile(GDIPCONST WCHAR * filename, UINT access, IStream **stream); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromWmf(HMETAFILE hWmf, BOOL deleteWmf, + GDIPCONST APMFileHeader * apmFileHeader, GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromEmf(HENHMETAFILE hEmf, BOOL deleteEmf, + GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromFile(GDIPCONST WCHAR* file, GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromWmfFile(GDIPCONST WCHAR* file, GDIPCONST APMFileHeader * apmFileHeader, GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipCreateMetafileFromStream(IStream * stream, GpMetafile **metafile); + +GpStatus WINGDIPAPI +GdipRecordMetafile( + HDC referenceHdc, + EmfType type, + GDIPCONST GpRectF * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileI( + HDC referenceHdc, + EmfType type, + GDIPCONST GpRect * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileFileName( + GDIPCONST WCHAR* fileName, + HDC referenceHdc, + EmfType type, + GDIPCONST GpRectF * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileFileNameI( + GDIPCONST WCHAR* fileName, + HDC referenceHdc, + EmfType type, + GDIPCONST GpRect * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileStream( + IStream * stream, + HDC referenceHdc, + EmfType type, + GDIPCONST GpRectF * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipRecordMetafileStreamI( + IStream * stream, + HDC referenceHdc, + EmfType type, + GDIPCONST GpRect * frameRect, + MetafileFrameUnit frameUnit, + GDIPCONST WCHAR * description, + GpMetafile ** metafile + ); + +GpStatus WINGDIPAPI +GdipSetMetafileDownLevelRasterizationLimit( + GpMetafile * metafile, + UINT metafileRasterizationLimitDpi + ); + +GpStatus WINGDIPAPI +GdipGetMetafileDownLevelRasterizationLimit( + GDIPCONST GpMetafile * metafile, + UINT * metafileRasterizationLimitDpi + ); + +GpStatus WINGDIPAPI +GdipGetImageDecodersSize(UINT *numDecoders, UINT *size); + +GpStatus WINGDIPAPI +GdipGetImageDecoders(UINT numDecoders, + UINT size, + ImageCodecInfo *decoders); + +GpStatus WINGDIPAPI +GdipGetImageEncodersSize(UINT *numEncoders, UINT *size); + +GpStatus WINGDIPAPI +GdipGetImageEncoders(UINT numEncoders, + UINT size, + ImageCodecInfo *encoders); + +GpStatus WINGDIPAPI +GdipAddImageCodec(GDIPCONST ImageCodecInfo *codec); + +GpStatus WINGDIPAPI +GdipRemoveImageCodec(GDIPCONST ImageCodecInfo *codec); + +#ifndef DCR_USE_NEW_186091 +GpStatus WINGDIPAPI +GdipGetGraphicsPixel(GpGraphics* graphics, REAL x, REAL y, ARGB* argb); +#endif + +GpStatus WINGDIPAPI +GdipComment(GpGraphics* graphics, UINT sizeData, GDIPCONST BYTE * data); + +GpStatus WINGDIPAPI +GdipGetGraphicsLayout(GpGraphics* graphics, GraphicsLayout* layout); + +GpStatus WINGDIPAPI +GdipSetGraphicsLayout(GpGraphics* graphics, GDIPCONST GraphicsLayout layout); + +//---------------------------------------------------------------------------- +// FontFamily +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name, + GpFontCollection *fontCollection, + GpFontFamily **FontFamily); + +GpStatus WINGDIPAPI +GdipDeleteFontFamily(GpFontFamily *FontFamily); + +GpStatus WINGDIPAPI +GdipCloneFontFamily(GpFontFamily *FontFamily, GpFontFamily **clonedFontFamily); + +GpStatus WINGDIPAPI +GdipGetGenericFontFamilySansSerif(GpFontFamily **nativeFamily); + +GpStatus WINGDIPAPI +GdipGetGenericFontFamilySerif(GpFontFamily **nativeFamily); + +GpStatus WINGDIPAPI +GdipGetGenericFontFamilyMonospace(GpFontFamily **nativeFamily); + + +GpStatus WINGDIPAPI +GdipGetFamilyName( + GDIPCONST GpFontFamily *family, + WCHAR name[LF_FACESIZE], + LANGID language +); + +GpStatus WINGDIPAPI +GdipIsStyleAvailable(GDIPCONST GpFontFamily *family, INT style, BOOL * IsStyleAvailable); + +GpStatus WINGDIPAPI +GdipFontCollectionEnumerable( + GpFontCollection* fontCollection, + GpGraphics* graphics, + INT * numFound +); + +GpStatus WINGDIPAPI GdipFontCollectionEnumerate( + GpFontCollection* fontCollection, + INT numSought, + GpFontFamily* gpfamilies[], + INT* numFound, + GpGraphics* graphics +); + +//----------------------------------- +// New API +//----------------------------------- + +GpStatus WINGDIPAPI +GdipGetEmHeight(GDIPCONST GpFontFamily *family, INT style, UINT16 * EmHeight); + +GpStatus WINGDIPAPI +GdipGetCellAscent(GDIPCONST GpFontFamily *family, INT style, UINT16 * CellAscent); + +GpStatus WINGDIPAPI +GdipGetCellDescent(GDIPCONST GpFontFamily *family, INT style, UINT16 * CellDescent); + +GpStatus WINGDIPAPI +GdipGetLineSpacing(GDIPCONST GpFontFamily *family, INT style, UINT16 * LineSpacing); + + +//---------------------------------------------------------------------------- +// Font +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateFontFromDC( + HDC hdc, + GpFont **font +); + +GpStatus WINGDIPAPI +GdipCreateFontFromLogfontA( + HDC hdc, + GDIPCONST LOGFONTA *logfont, + GpFont **font +); + +GpStatus WINGDIPAPI +GdipCreateFontFromLogfontW( + HDC hdc, + GDIPCONST LOGFONTW *logfont, + GpFont **font +); + +GpStatus WINGDIPAPI +GdipCreateFont( + GDIPCONST GpFontFamily *fontFamily, + REAL emSize, + INT style, + Unit unit, + GpFont **font +); + +GpStatus WINGDIPAPI +GdipCloneFont(GpFont* font, GpFont** cloneFont); + +GpStatus WINGDIPAPI +GdipDeleteFont(GpFont* font); + +GpStatus WINGDIPAPI +GdipGetFamily(GpFont *font, GpFontFamily **family); + +GpStatus WINGDIPAPI +GdipGetFontStyle(GpFont *font, INT *style); + +GpStatus WINGDIPAPI +GdipGetFontSize(GpFont *font, REAL *size); + +GpStatus WINGDIPAPI +GdipGetFontUnit(GpFont *font, Unit *unit); + +GpStatus WINGDIPAPI +GdipGetFontHeight(GDIPCONST GpFont *font, GDIPCONST GpGraphics *graphics, REAL *height); + +#ifdef DCR_USE_NEW_125467 +GpStatus WINGDIPAPI +GdipGetFontHeightGivenDPI(GDIPCONST GpFont *font, REAL dpi, REAL *height); +#endif + +GpStatus WINGDIPAPI +GdipGetLogFontA(GpFont * font, GpGraphics *graphics, LOGFONTA * logfontA); + +GpStatus WINGDIPAPI +GdipGetLogFontW(GpFont * font, GpGraphics *graphics, LOGFONTW * logfontW); + +// FontCollection + +GpStatus WINGDIPAPI +GdipNewInstalledFontCollection(GpFontCollection** fontCollection); + +GpStatus WINGDIPAPI +GdipNewPrivateFontCollection(GpFontCollection** fontCollection); + +GpStatus WINGDIPAPI +GdipDeletePrivateFontCollection(GpFontCollection** fontCollection); + +GpStatus WINGDIPAPI +GdipGetFontCollectionFamilyCount( + GpFontCollection* fontCollection, + INT * numFound +); + +GpStatus WINGDIPAPI +GdipGetFontCollectionFamilyList( + GpFontCollection* fontCollection, + INT numSought, + GpFontFamily* gpfamilies[], + INT* numFound +); + +#ifndef DCR_USE_NEW_235072 +GpStatus WINGDIPAPI +GdipInstallFontFile( + GpFontCollection* fontCollection, + GDIPCONST WCHAR* filename +); + +GpStatus WINGDIPAPI +GdipUninstallFontFile( + GpFontCollection* fontCollection, + GDIPCONST WCHAR* filename +); +#endif + +GpStatus WINGDIPAPI +GdipPrivateAddFontFile( + GpFontCollection* fontCollection, + GDIPCONST WCHAR* filename +); + +GpStatus WINGDIPAPI +GdipPrivateAddMemoryFont( + GpFontCollection* fontCollection, + GDIPCONST void* memory, + INT length +); + +//---------------------------------------------------------------------------- +// Text +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipDrawString( + GpGraphics *graphics, + GDIPCONST WCHAR *string, + INT length, + GDIPCONST GpFont *font, + GDIPCONST RectF *layoutRect, + GDIPCONST GpStringFormat *stringFormat, + GDIPCONST GpBrush *brush +); + +GpStatus WINGDIPAPI +GdipMeasureString( + GpGraphics *graphics, + GDIPCONST WCHAR *string, + INT length, + GDIPCONST GpFont *font, + GDIPCONST RectF *layoutRect, + GDIPCONST GpStringFormat *stringFormat, + RectF *boundingBox, + INT *codepointsFitted, + INT *linesFilled +); + +#ifndef DCR_USE_NEW_174340 +GpStatus WINGDIPAPI +GdipMeasureStringRegion( + GpGraphics *graphics, + GDIPCONST WCHAR *string, + INT length, + GDIPCONST GpFont *font, + GDIPCONST RectF &layoutRect, + GDIPCONST GpStringFormat *stringFormat, + INT firstCharacterIndex, + INT characterCount, + GpRegion *region +); +#endif + +#ifdef DCR_USE_NEW_174340 +GpStatus +WINGDIPAPI +GdipMeasureCharacterRanges( + GpGraphics *graphics, + GDIPCONST WCHAR *string, + INT length, + GDIPCONST GpFont *font, + GDIPCONST RectF &layoutRect, + GDIPCONST GpStringFormat *stringFormat, + INT regionCount, + GpRegion **regions +); +#endif + +GpStatus WINGDIPAPI +GdipDrawDriverString( + GpGraphics *graphics, + GDIPCONST UINT16 *text, + INT length, + GDIPCONST GpFont *font, + GDIPCONST GpBrush *brush, + GDIPCONST PointF *positions, + INT flags, + GDIPCONST GpMatrix *matrix +); + +GpStatus WINGDIPAPI +GdipMeasureDriverString( + GpGraphics *graphics, + GDIPCONST UINT16 *text, + INT length, + GDIPCONST GpFont *font, + GDIPCONST PointF *positions, + INT flags, + GDIPCONST GpMatrix *matrix, + RectF *boundingBox +); + +#ifndef DCR_USE_NEW_168772 +GpStatus WINGDIPAPI +GdipDriverStringPointToCodepoint( + GpGraphics *graphics, + GDIPCONST UINT16 *text, + INT length, + GDIPCONST GpFont *font, + GDIPCONST PointF *positions, + INT flags, + GpMatrix *matrix, + GDIPCONST PointF *hit, + INT *index, + BOOL *rightEdge, + REAL *distance +); +#endif + +//---------------------------------------------------------------------------- +// String format APIs +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateStringFormat( + INT formatAttributes, + LANGID language, + GpStringFormat **format +); + +GpStatus WINGDIPAPI +GdipStringFormatGetGenericDefault(GpStringFormat **format); + +GpStatus WINGDIPAPI +GdipStringFormatGetGenericTypographic(GpStringFormat **format); + +GpStatus WINGDIPAPI +GdipDeleteStringFormat(GpStringFormat *format); + +GpStatus WINGDIPAPI +GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat); + +GpStatus WINGDIPAPI +GdipSetStringFormatFlags(GpStringFormat *format, INT flags); + +GpStatus WINGDIPAPI GdipGetStringFormatFlags(GDIPCONST GpStringFormat *format, INT *flags); + +#ifndef DCR_USE_NEW_152154 +GpStatus WINGDIPAPI +GdipSetStringFormatLineSpacing(GpStringFormat *format, REAL amount, + LineSpacing method); + +GpStatus WINGDIPAPI +GdipGetStringFormatLineSpacingAmount(GDIPCONST GpStringFormat *format, REAL *amount); +GpStatus WINGDIPAPI +GdipGetStringFormatLineSpacingMethod(GDIPCONST GpStringFormat *format, LineSpacing *method); +#endif + +GpStatus WINGDIPAPI +GdipSetStringFormatAlign(GpStringFormat *format, StringAlignment align); + +GpStatus WINGDIPAPI +GdipGetStringFormatAlign(GDIPCONST GpStringFormat *format, StringAlignment *align); + +GpStatus WINGDIPAPI +GdipSetStringFormatLineAlign(GpStringFormat *format, + StringAlignment align); + +GpStatus WINGDIPAPI +GdipGetStringFormatLineAlign(GDIPCONST GpStringFormat *format, + StringAlignment *align); + +GpStatus WINGDIPAPI +GdipSetStringFormatTrimming( + GpStringFormat *format, + StringTrimming trimming +); + +GpStatus WINGDIPAPI +GdipGetStringFormatTrimming( + GDIPCONST GpStringFormat *format, + StringTrimming *trimming +); + +GpStatus WINGDIPAPI +GdipSetStringFormatHotkeyPrefix(GpStringFormat *format, INT hotkeyPrefix); + +GpStatus WINGDIPAPI +GdipGetStringFormatHotkeyPrefix(GDIPCONST GpStringFormat *format, INT *hotkeyPrefix); + +GpStatus WINGDIPAPI +GdipSetStringFormatTabStops(GpStringFormat *format, REAL firstTabOffset, INT count, GDIPCONST REAL *tabStops); + +GpStatus WINGDIPAPI +GdipGetStringFormatTabStops(GDIPCONST GpStringFormat *format, INT count, REAL *firstTabOffset, REAL *tabStops); + +GpStatus WINGDIPAPI +GdipGetStringFormatTabStopCount(GDIPCONST GpStringFormat *format, INT * count); + +#ifdef DCR_USE_NEW_146933 +GpStatus WINGDIPAPI +GdipSetStringFormatDigitSubstitution(GpStringFormat *format, LANGID language, + StringDigitSubstitute substitute); + +GpStatus WINGDIPAPI +GdipGetStringFormatDigitSubstitution(GDIPCONST GpStringFormat *format, LANGID *language, + StringDigitSubstitute *substitute); +#endif // DCR_USE_NEW_146933 + +#ifdef DCR_USE_NEW_174340 +GpStatus WINGDIPAPI +GdipGetStringFormatMeasurableCharacterRangeCount( + GDIPCONST GpStringFormat *format, + INT *count +); + +GpStatus WINGDIPAPI +GdipSetStringFormatMeasurableCharacterRanges( + GpStringFormat *format, + INT rangeCount, + GDIPCONST CharacterRange *ranges +); +#endif + +//---------------------------------------------------------------------------- +// Cached Bitmap APIs +//---------------------------------------------------------------------------- + +GpStatus WINGDIPAPI +GdipCreateCachedBitmap( + GpBitmap *bitmap, + GpGraphics *graphics, + GpCachedBitmap **cachedBitmap +); + +GpStatus WINGDIPAPI +GdipDeleteCachedBitmap(GpCachedBitmap *cachedBitmap); + +GpStatus WINGDIPAPI +GdipDrawCachedBitmap( + GpGraphics *graphics, + GpCachedBitmap *cachedBitmap, + INT x, + INT y +); + +UINT WINGDIPAPI +GdipEmfToWmfBits( + HENHMETAFILE hemf, + UINT cbData16, + LPBYTE pData16, + INT iMapMode, + INT eFlags +); + +#ifdef __cplusplus +} +#endif + +#endif // !_FLATAPI_H diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusFont.h b/core/src/fxge/Microsoft SDK/include/GdiPlusFont.h index c9ff050561..4c9e01f589 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusFont.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusFont.h @@ -1,299 +1,299 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusFont.h -* -* Abstract: -* -* Font related declarations -* -\**************************************************************************/ - -#ifndef _GDIPLUSFONT_H -#define _GDIPLUSFONT_H - -inline -Font::Font(IN HDC hdc) -{ - GpFont *font = NULL; - lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); - -#ifndef DCR_USE_NEW_135429 - if ((INT) lastResult >= 10) - lastResult = NotFound; -#endif - - SetNativeFont(font); -} - -#ifdef DCR_USE_NEW_127084 -inline -Font::Font(IN HDC hdc, - IN const HFONT hfont) -{ - GpFont *font = NULL; - - if (hfont) - { - LOGFONTA lf; - - if(GetObjectA(hfont, sizeof(LOGFONTA), &lf)) - lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, &lf, &font); - else - lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); - } - else - { - lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); - } - -#ifndef DCR_USE_NEW_135429 - if ((INT) lastResult >= 10) - lastResult = NotFound; -#endif - - SetNativeFont(font); -} -#endif - -inline -Font::Font(IN HDC hdc, - IN const LOGFONTW* logfont) -{ - GpFont *font = NULL; - if (logfont) - { - lastResult = DllExports::GdipCreateFontFromLogfontW(hdc, logfont, &font); - } - else - { - lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); - } - -#ifndef DCR_USE_NEW_135429 - if ((INT) lastResult >= 10) - lastResult = NotFound; -#endif - - SetNativeFont(font); -} - -inline -Font::Font(IN HDC hdc, - IN const LOGFONTA* logfont) -{ - GpFont *font = NULL; - - if (logfont) - { - lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, logfont, &font); - } - else - { - lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); - } - -#ifndef DCR_USE_NEW_135429 - if ((INT) lastResult >= 10) - lastResult = NotFound; -#endif - - SetNativeFont(font); -} - -inline -Font::Font( - IN const FontFamily * family, - IN REAL emSize, - IN INT style, - IN Unit unit -) -{ - GpFont *font = NULL; - - lastResult = DllExports::GdipCreateFont(family ? family->nativeFamily : NULL, - emSize, - style, - unit, - &font); - -#ifndef DCR_USE_NEW_135429 - if ((INT) lastResult >= 10) - lastResult = NotFound; -#endif - - SetNativeFont(font); -} - -inline -Font::Font( - IN const WCHAR * familyName, - IN REAL emSize, - IN INT style, - IN Unit unit, - IN const FontCollection * fontCollection -) -{ - FontFamily family(familyName, fontCollection); - - GpFont * font = NULL; - - lastResult = family.GetLastStatus(); - - if (lastResult == Ok) - { - lastResult = DllExports::GdipCreateFont(family.nativeFamily, - emSize, - style, - unit, - &font); - } - -#ifndef DCR_USE_NEW_135429 - if ((INT) lastResult >= 10) - lastResult = NotFound; -#endif - - SetNativeFont(font); -} - -inline Status -Font::GetLogFontA(IN const Graphics *g, - OUT LOGFONTA *logfontA) const -{ - return SetStatus(DllExports::GdipGetLogFontA(nativeFont, g ? g->nativeGraphics : NULL, logfontA)); - -} - -inline Status -Font::GetLogFontW(IN const Graphics *g, - OUT LOGFONTW *logfontW) const -{ - return SetStatus(DllExports::GdipGetLogFontW(nativeFont, g ? g->nativeGraphics : NULL, logfontW)); -} - - -inline Font* -Font::Clone() const -{ - GpFont *cloneFont = NULL; - - SetStatus(DllExports::GdipCloneFont(nativeFont, &cloneFont)); - - return new Font(cloneFont, lastResult); -} - -inline -Font::~Font() -{ - DllExports::GdipDeleteFont(nativeFont); -} - -// Operations - -inline BOOL -Font::IsAvailable() const -{ - return (nativeFont ? TRUE : FALSE); -} - -inline Status -Font::GetFamily(OUT FontFamily *family) const -{ - if (family == NULL) - { - return SetStatus(InvalidParameter); - } - - Status status = DllExports::GdipGetFamily(nativeFont, &(family->nativeFamily)); - family->SetStatus(status); - - return SetStatus(status); -} - -inline INT -Font::GetStyle() const -{ - INT style; - - SetStatus(DllExports::GdipGetFontStyle(nativeFont, &style)); - - return style; -} - -inline REAL -Font::GetSize() const -{ - REAL size; - SetStatus(DllExports::GdipGetFontSize(nativeFont, &size)); - return size; -} - -inline Unit -Font::GetUnit() const -{ - Unit unit; - SetStatus(DllExports::GdipGetFontUnit(nativeFont, &unit)); - return unit; -} - -inline REAL -Font::GetHeight(IN const Graphics *graphics) const -{ - REAL height; - SetStatus(DllExports::GdipGetFontHeight( - nativeFont, - graphics ? graphics->nativeGraphics : NULL, - &height - )); - return height; -} - - -#ifdef DCR_USE_NEW_125467 -inline REAL -Font::GetHeight(IN REAL dpi = 0) const -{ - REAL height; - SetStatus(DllExports::GdipGetFontHeightGivenDPI(nativeFont, dpi, &height)); - return height; -} -#endif - - -// protected method -inline -Font::Font(IN GpFont* font, - IN Status status) -{ - lastResult = status; - SetNativeFont(font); -} - -// protected method -inline VOID -Font::SetNativeFont(GpFont *Font) -{ - nativeFont = Font; -} - -inline Status -Font::GetLastStatus(void) const -{ - return lastResult; -} - -// protected method -inline Status -Font::SetStatus(IN Status status) const -{ - if (status != Ok) - return (lastResult = status); - else - return status; -} - -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusFont.h +* +* Abstract: +* +* Font related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSFONT_H +#define _GDIPLUSFONT_H + +inline +Font::Font(IN HDC hdc) +{ + GpFont *font = NULL; + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +#ifdef DCR_USE_NEW_127084 +inline +Font::Font(IN HDC hdc, + IN const HFONT hfont) +{ + GpFont *font = NULL; + + if (hfont) + { + LOGFONTA lf; + + if(GetObjectA(hfont, sizeof(LOGFONTA), &lf)) + lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, &lf, &font); + else + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + } + else + { + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + } + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} +#endif + +inline +Font::Font(IN HDC hdc, + IN const LOGFONTW* logfont) +{ + GpFont *font = NULL; + if (logfont) + { + lastResult = DllExports::GdipCreateFontFromLogfontW(hdc, logfont, &font); + } + else + { + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + } + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +inline +Font::Font(IN HDC hdc, + IN const LOGFONTA* logfont) +{ + GpFont *font = NULL; + + if (logfont) + { + lastResult = DllExports::GdipCreateFontFromLogfontA(hdc, logfont, &font); + } + else + { + lastResult = DllExports::GdipCreateFontFromDC(hdc, &font); + } + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +inline +Font::Font( + IN const FontFamily * family, + IN REAL emSize, + IN INT style, + IN Unit unit +) +{ + GpFont *font = NULL; + + lastResult = DllExports::GdipCreateFont(family ? family->nativeFamily : NULL, + emSize, + style, + unit, + &font); + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +inline +Font::Font( + IN const WCHAR * familyName, + IN REAL emSize, + IN INT style, + IN Unit unit, + IN const FontCollection * fontCollection +) +{ + FontFamily family(familyName, fontCollection); + + GpFont * font = NULL; + + lastResult = family.GetLastStatus(); + + if (lastResult == Ok) + { + lastResult = DllExports::GdipCreateFont(family.nativeFamily, + emSize, + style, + unit, + &font); + } + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif + + SetNativeFont(font); +} + +inline Status +Font::GetLogFontA(IN const Graphics *g, + OUT LOGFONTA *logfontA) const +{ + return SetStatus(DllExports::GdipGetLogFontA(nativeFont, g ? g->nativeGraphics : NULL, logfontA)); + +} + +inline Status +Font::GetLogFontW(IN const Graphics *g, + OUT LOGFONTW *logfontW) const +{ + return SetStatus(DllExports::GdipGetLogFontW(nativeFont, g ? g->nativeGraphics : NULL, logfontW)); +} + + +inline Font* +Font::Clone() const +{ + GpFont *cloneFont = NULL; + + SetStatus(DllExports::GdipCloneFont(nativeFont, &cloneFont)); + + return new Font(cloneFont, lastResult); +} + +inline +Font::~Font() +{ + DllExports::GdipDeleteFont(nativeFont); +} + +// Operations + +inline BOOL +Font::IsAvailable() const +{ + return (nativeFont ? TRUE : FALSE); +} + +inline Status +Font::GetFamily(OUT FontFamily *family) const +{ + if (family == NULL) + { + return SetStatus(InvalidParameter); + } + + Status status = DllExports::GdipGetFamily(nativeFont, &(family->nativeFamily)); + family->SetStatus(status); + + return SetStatus(status); +} + +inline INT +Font::GetStyle() const +{ + INT style; + + SetStatus(DllExports::GdipGetFontStyle(nativeFont, &style)); + + return style; +} + +inline REAL +Font::GetSize() const +{ + REAL size; + SetStatus(DllExports::GdipGetFontSize(nativeFont, &size)); + return size; +} + +inline Unit +Font::GetUnit() const +{ + Unit unit; + SetStatus(DllExports::GdipGetFontUnit(nativeFont, &unit)); + return unit; +} + +inline REAL +Font::GetHeight(IN const Graphics *graphics) const +{ + REAL height; + SetStatus(DllExports::GdipGetFontHeight( + nativeFont, + graphics ? graphics->nativeGraphics : NULL, + &height + )); + return height; +} + + +#ifdef DCR_USE_NEW_125467 +inline REAL +Font::GetHeight(IN REAL dpi = 0) const +{ + REAL height; + SetStatus(DllExports::GdipGetFontHeightGivenDPI(nativeFont, dpi, &height)); + return height; +} +#endif + + +// protected method +inline +Font::Font(IN GpFont* font, + IN Status status) +{ + lastResult = status; + SetNativeFont(font); +} + +// protected method +inline VOID +Font::SetNativeFont(GpFont *Font) +{ + nativeFont = Font; +} + +inline Status +Font::GetLastStatus(void) const +{ + return lastResult; +} + +// protected method +inline Status +Font::SetStatus(IN Status status) const +{ + if (status != Ok) + return (lastResult = status); + else + return status; +} + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusFontCollection.h b/core/src/fxge/Microsoft SDK/include/GdiPlusFontCollection.h index d2257ba456..2f3351c95b 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusFontCollection.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusFontCollection.h @@ -1,149 +1,149 @@ -/**************************************************************************\ -* -* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusFontCollection.h -* -* Abstract: -* -* Font collections (Installed and Private) -* -\**************************************************************************/ - -#ifndef _GDIPLUSFONTCOLL_H -#define _GDIPLUSFONTCOLL_H - -inline -FontCollection::FontCollection() -{ - nativeFontCollection = NULL; -} - -inline -FontCollection::~FontCollection() -{ -} - -inline INT -FontCollection::GetFamilyCount() const -{ - INT numFound = 0; - - lastResult = DllExports::GdipGetFontCollectionFamilyCount( - nativeFontCollection, &numFound); - - - - return numFound; -} - -inline Status -FontCollection::GetFamilies( - IN INT numSought, - OUT FontFamily * gpfamilies, - OUT INT * numFound -) const -{ - if (numSought <= 0 || gpfamilies == NULL || numFound == NULL) - { - return SetStatus(InvalidParameter); - } - *numFound = 0; - GpFontFamily **nativeFamilyList = new GpFontFamily*[numSought]; - - if (nativeFamilyList == NULL) - { - return SetStatus(OutOfMemory); - } - - Status status = SetStatus(DllExports::GdipGetFontCollectionFamilyList( - nativeFontCollection, - numSought, - nativeFamilyList, - numFound - )); - if (status == Ok) - { - for (INT i = 0; i < *numFound; i++) - { - DllExports::GdipCloneFontFamily(nativeFamilyList[i], - &gpfamilies[i].nativeFamily); - } - } - - delete [] nativeFamilyList; - - return status; -} - -inline Status FontCollection::GetLastStatus () const -{ - return lastResult; -} - -// protected method -inline Status -FontCollection::SetStatus(IN Status status) const -{ - lastResult = status; - return lastResult; -} - -inline -InstalledFontCollection::InstalledFontCollection() -{ - nativeFontCollection = NULL; - lastResult = DllExports::GdipNewInstalledFontCollection(&nativeFontCollection); -} - -inline -InstalledFontCollection::~InstalledFontCollection() -{ -} - -#ifndef DCR_USE_NEW_235072 -inline Status -InstalledFontCollection::InstallFontFile(IN const WCHAR* filename) -{ - return SetStatus(DllExports::GdipInstallFontFile(nativeFontCollection, filename)); -} - -inline Status -InstalledFontCollection::UninstallFontFile(IN const WCHAR* filename) -{ - return SetStatus(DllExports::GdipUninstallFontFile(nativeFontCollection, filename)); -} -#endif - -inline -PrivateFontCollection::PrivateFontCollection() -{ - nativeFontCollection = NULL; - lastResult = DllExports::GdipNewPrivateFontCollection(&nativeFontCollection); -} - -inline -PrivateFontCollection::~PrivateFontCollection() -{ - DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection); -} - -inline Status -PrivateFontCollection::AddFontFile(IN const WCHAR* filename) -{ - return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection, filename)); -} - -inline Status -PrivateFontCollection::AddMemoryFont(IN const void* memory, - IN INT length) -{ - return SetStatus(DllExports::GdipPrivateAddMemoryFont( - nativeFontCollection, - memory, - length)); -} - -#endif // _GDIPLUSFONTCOLL_H +/**************************************************************************\ +* +* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusFontCollection.h +* +* Abstract: +* +* Font collections (Installed and Private) +* +\**************************************************************************/ + +#ifndef _GDIPLUSFONTCOLL_H +#define _GDIPLUSFONTCOLL_H + +inline +FontCollection::FontCollection() +{ + nativeFontCollection = NULL; +} + +inline +FontCollection::~FontCollection() +{ +} + +inline INT +FontCollection::GetFamilyCount() const +{ + INT numFound = 0; + + lastResult = DllExports::GdipGetFontCollectionFamilyCount( + nativeFontCollection, &numFound); + + + + return numFound; +} + +inline Status +FontCollection::GetFamilies( + IN INT numSought, + OUT FontFamily * gpfamilies, + OUT INT * numFound +) const +{ + if (numSought <= 0 || gpfamilies == NULL || numFound == NULL) + { + return SetStatus(InvalidParameter); + } + *numFound = 0; + GpFontFamily **nativeFamilyList = new GpFontFamily*[numSought]; + + if (nativeFamilyList == NULL) + { + return SetStatus(OutOfMemory); + } + + Status status = SetStatus(DllExports::GdipGetFontCollectionFamilyList( + nativeFontCollection, + numSought, + nativeFamilyList, + numFound + )); + if (status == Ok) + { + for (INT i = 0; i < *numFound; i++) + { + DllExports::GdipCloneFontFamily(nativeFamilyList[i], + &gpfamilies[i].nativeFamily); + } + } + + delete [] nativeFamilyList; + + return status; +} + +inline Status FontCollection::GetLastStatus () const +{ + return lastResult; +} + +// protected method +inline Status +FontCollection::SetStatus(IN Status status) const +{ + lastResult = status; + return lastResult; +} + +inline +InstalledFontCollection::InstalledFontCollection() +{ + nativeFontCollection = NULL; + lastResult = DllExports::GdipNewInstalledFontCollection(&nativeFontCollection); +} + +inline +InstalledFontCollection::~InstalledFontCollection() +{ +} + +#ifndef DCR_USE_NEW_235072 +inline Status +InstalledFontCollection::InstallFontFile(IN const WCHAR* filename) +{ + return SetStatus(DllExports::GdipInstallFontFile(nativeFontCollection, filename)); +} + +inline Status +InstalledFontCollection::UninstallFontFile(IN const WCHAR* filename) +{ + return SetStatus(DllExports::GdipUninstallFontFile(nativeFontCollection, filename)); +} +#endif + +inline +PrivateFontCollection::PrivateFontCollection() +{ + nativeFontCollection = NULL; + lastResult = DllExports::GdipNewPrivateFontCollection(&nativeFontCollection); +} + +inline +PrivateFontCollection::~PrivateFontCollection() +{ + DllExports::GdipDeletePrivateFontCollection(&nativeFontCollection); +} + +inline Status +PrivateFontCollection::AddFontFile(IN const WCHAR* filename) +{ + return SetStatus(DllExports::GdipPrivateAddFontFile(nativeFontCollection, filename)); +} + +inline Status +PrivateFontCollection::AddMemoryFont(IN const void* memory, + IN INT length) +{ + return SetStatus(DllExports::GdipPrivateAddMemoryFont( + nativeFontCollection, + memory, + length)); +} + +#endif // _GDIPLUSFONTCOLL_H diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusFontFamily.h b/core/src/fxge/Microsoft SDK/include/GdiPlusFontFamily.h index ef2f3dde9b..076e1572ac 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusFontFamily.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusFontFamily.h @@ -1,271 +1,271 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusFontFamily.h -* -* Abstract: -* -* Font family API related declarations -* -\**************************************************************************/ - -#ifndef _GDIPLUS_FONT_FAMILY_H -#define _GDIPLUS_FONT_FAMILY_H - -inline -FontFamily::FontFamily() : - nativeFamily (NULL), - lastResult (Ok) -{ -} - -inline -FontFamily::FontFamily( - IN const WCHAR* name, - IN const FontCollection* fontCollection -) -{ - nativeFamily = NULL; - lastResult = DllExports::GdipCreateFontFamilyFromName( - name, - fontCollection ? fontCollection->nativeFontCollection : NULL, - &nativeFamily - ); - -#ifndef DCR_USE_NEW_135429 - if ((INT) lastResult >= 10) - lastResult = NotFound; -#endif -} - -// private method -inline -FontFamily::FontFamily( - IN GpFontFamily *nativeOrig, - IN Status status -) -{ - lastResult = status; - nativeFamily = nativeOrig; -} - -// Generic font family access - -inline const FontFamily * -FontFamily::GenericSansSerif() -{ - if (GenericSansSerifFontFamily != NULL) - { - return GenericSansSerifFontFamily; - } - - GenericSansSerifFontFamily = - (FontFamily*) GenericSansSerifFontFamilyBuffer; - - GenericSansSerifFontFamily->lastResult = - DllExports::GdipGetGenericFontFamilySansSerif( - &(GenericSansSerifFontFamily->nativeFamily) - ); - -#ifndef DCR_USE_NEW_135429 - if ((INT) GenericSansSerifFontFamily->lastResult >= 10) - GenericSansSerifFontFamily->lastResult = NotFound; -#endif - - return GenericSansSerifFontFamily; -} - -inline const FontFamily * -FontFamily::GenericSerif() -{ - if (GenericSerifFontFamily != NULL) - { - return GenericSerifFontFamily; - } - - GenericSerifFontFamily = - (FontFamily*) GenericSerifFontFamilyBuffer; - - GenericSerifFontFamily->lastResult = - DllExports::GdipGetGenericFontFamilySerif( - &(GenericSerifFontFamily->nativeFamily) - ); - -#ifndef DCR_USE_NEW_135429 - if ((INT) GenericSerifFontFamily->lastResult >= 10) - GenericSerifFontFamily->lastResult = NotFound; -#endif - - return GenericSerifFontFamily; -} - -inline const FontFamily * -FontFamily::GenericMonospace() -{ - if (GenericMonospaceFontFamily != NULL) - { - return GenericMonospaceFontFamily; - } - - GenericMonospaceFontFamily = - (FontFamily*) GenericMonospaceFontFamilyBuffer; - - GenericMonospaceFontFamily->lastResult = - DllExports::GdipGetGenericFontFamilyMonospace( - &(GenericMonospaceFontFamily->nativeFamily) - ); - -#ifndef DCR_USE_NEW_135429 - if ((INT) GenericMonospaceFontFamily->lastResult >= 10) - GenericMonospaceFontFamily->lastResult = NotFound; -#endif - - return GenericMonospaceFontFamily; -} - -inline FontFamily::~FontFamily() -{ - DllExports::GdipDeleteFontFamily (nativeFamily); -} - -inline FontFamily * -FontFamily::Clone() const -{ - GpFontFamily * clonedFamily = NULL; - - SetStatus(DllExports::GdipCloneFontFamily (nativeFamily, &clonedFamily)); - - return new FontFamily(clonedFamily, lastResult); -} - -inline Status -FontFamily::GetFamilyName( - IN WCHAR name[LF_FACESIZE], - IN LANGID language -) const -{ - return SetStatus(DllExports::GdipGetFamilyName(nativeFamily, - name, - language)); -} - -inline BOOL -FontFamily::IsStyleAvailable(IN INT style) const -{ - BOOL StyleAvailable; - Status status; - - status = SetStatus(DllExports::GdipIsStyleAvailable(nativeFamily, style, &StyleAvailable)); - - if (status != Ok) - StyleAvailable = FALSE; - - return StyleAvailable; -} - - -inline UINT16 -FontFamily::GetEmHeight(IN INT style) const -{ - UINT16 EmHeight; - - SetStatus(DllExports::GdipGetEmHeight(nativeFamily, style, &EmHeight)); - - return EmHeight; -} - -inline UINT16 -FontFamily::GetCellAscent(IN INT style) const -{ - UINT16 CellAscent; - - SetStatus(DllExports::GdipGetCellAscent(nativeFamily, style, &CellAscent)); - - return CellAscent; -} - -inline UINT16 -FontFamily::GetCellDescent(IN INT style) const -{ - UINT16 CellDescent; - - SetStatus(DllExports::GdipGetCellDescent(nativeFamily, style, &CellDescent)); - - return CellDescent; -} - - -inline UINT16 -FontFamily::GetLineSpacing(IN INT style) const -{ - UINT16 LineSpacing; - - SetStatus(DllExports::GdipGetLineSpacing(nativeFamily, style, &LineSpacing)); - - return LineSpacing; - -} - -#ifdef TEXTV2 - -// The following APIs return data from the font OS/2 table - -inline INT16 -FontFamily::GetTypographicAscent(IN INT style) const -{ - INT16 TypographicAscent; - - SetStatus(DllExports::GdipGetTypographicAscent(nativeFamily, style, &TypographicAscent)); - - return TypographicAscent; -} - -inline INT16 -FontFamily::GetTypographicDescent(IN INT style) const -{ - INT16 TypographicDescent; - - SetStatus(DllExports::GdipGetTypographicDescent(nativeFamily, style, &TypographicDescent)); - - return TypographicDescent; -} - -inline INT16 -FontFamily::GetTypographicLineGap(IN INT style) const -{ - INT16 TypographicLineGap; - - SetStatus(DllExports::GdipGetTypographicLineGap(nativeFamily, style, &TypographicLineGap)); - - return TypographicLineGap; -} - -#endif - -/////////////////////////////////////////////////////////// - -// GetLastStatus - return last error code and clear error code - -inline Status -FontFamily::GetLastStatus() const -{ - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; -} - -// protected method -inline Status -FontFamily::SetStatus(Status status) const -{ - if (status != Ok) - return (lastResult = status); - else - return status; -} - -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusFontFamily.h +* +* Abstract: +* +* Font family API related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUS_FONT_FAMILY_H +#define _GDIPLUS_FONT_FAMILY_H + +inline +FontFamily::FontFamily() : + nativeFamily (NULL), + lastResult (Ok) +{ +} + +inline +FontFamily::FontFamily( + IN const WCHAR* name, + IN const FontCollection* fontCollection +) +{ + nativeFamily = NULL; + lastResult = DllExports::GdipCreateFontFamilyFromName( + name, + fontCollection ? fontCollection->nativeFontCollection : NULL, + &nativeFamily + ); + +#ifndef DCR_USE_NEW_135429 + if ((INT) lastResult >= 10) + lastResult = NotFound; +#endif +} + +// private method +inline +FontFamily::FontFamily( + IN GpFontFamily *nativeOrig, + IN Status status +) +{ + lastResult = status; + nativeFamily = nativeOrig; +} + +// Generic font family access + +inline const FontFamily * +FontFamily::GenericSansSerif() +{ + if (GenericSansSerifFontFamily != NULL) + { + return GenericSansSerifFontFamily; + } + + GenericSansSerifFontFamily = + (FontFamily*) GenericSansSerifFontFamilyBuffer; + + GenericSansSerifFontFamily->lastResult = + DllExports::GdipGetGenericFontFamilySansSerif( + &(GenericSansSerifFontFamily->nativeFamily) + ); + +#ifndef DCR_USE_NEW_135429 + if ((INT) GenericSansSerifFontFamily->lastResult >= 10) + GenericSansSerifFontFamily->lastResult = NotFound; +#endif + + return GenericSansSerifFontFamily; +} + +inline const FontFamily * +FontFamily::GenericSerif() +{ + if (GenericSerifFontFamily != NULL) + { + return GenericSerifFontFamily; + } + + GenericSerifFontFamily = + (FontFamily*) GenericSerifFontFamilyBuffer; + + GenericSerifFontFamily->lastResult = + DllExports::GdipGetGenericFontFamilySerif( + &(GenericSerifFontFamily->nativeFamily) + ); + +#ifndef DCR_USE_NEW_135429 + if ((INT) GenericSerifFontFamily->lastResult >= 10) + GenericSerifFontFamily->lastResult = NotFound; +#endif + + return GenericSerifFontFamily; +} + +inline const FontFamily * +FontFamily::GenericMonospace() +{ + if (GenericMonospaceFontFamily != NULL) + { + return GenericMonospaceFontFamily; + } + + GenericMonospaceFontFamily = + (FontFamily*) GenericMonospaceFontFamilyBuffer; + + GenericMonospaceFontFamily->lastResult = + DllExports::GdipGetGenericFontFamilyMonospace( + &(GenericMonospaceFontFamily->nativeFamily) + ); + +#ifndef DCR_USE_NEW_135429 + if ((INT) GenericMonospaceFontFamily->lastResult >= 10) + GenericMonospaceFontFamily->lastResult = NotFound; +#endif + + return GenericMonospaceFontFamily; +} + +inline FontFamily::~FontFamily() +{ + DllExports::GdipDeleteFontFamily (nativeFamily); +} + +inline FontFamily * +FontFamily::Clone() const +{ + GpFontFamily * clonedFamily = NULL; + + SetStatus(DllExports::GdipCloneFontFamily (nativeFamily, &clonedFamily)); + + return new FontFamily(clonedFamily, lastResult); +} + +inline Status +FontFamily::GetFamilyName( + IN WCHAR name[LF_FACESIZE], + IN LANGID language +) const +{ + return SetStatus(DllExports::GdipGetFamilyName(nativeFamily, + name, + language)); +} + +inline BOOL +FontFamily::IsStyleAvailable(IN INT style) const +{ + BOOL StyleAvailable; + Status status; + + status = SetStatus(DllExports::GdipIsStyleAvailable(nativeFamily, style, &StyleAvailable)); + + if (status != Ok) + StyleAvailable = FALSE; + + return StyleAvailable; +} + + +inline UINT16 +FontFamily::GetEmHeight(IN INT style) const +{ + UINT16 EmHeight; + + SetStatus(DllExports::GdipGetEmHeight(nativeFamily, style, &EmHeight)); + + return EmHeight; +} + +inline UINT16 +FontFamily::GetCellAscent(IN INT style) const +{ + UINT16 CellAscent; + + SetStatus(DllExports::GdipGetCellAscent(nativeFamily, style, &CellAscent)); + + return CellAscent; +} + +inline UINT16 +FontFamily::GetCellDescent(IN INT style) const +{ + UINT16 CellDescent; + + SetStatus(DllExports::GdipGetCellDescent(nativeFamily, style, &CellDescent)); + + return CellDescent; +} + + +inline UINT16 +FontFamily::GetLineSpacing(IN INT style) const +{ + UINT16 LineSpacing; + + SetStatus(DllExports::GdipGetLineSpacing(nativeFamily, style, &LineSpacing)); + + return LineSpacing; + +} + +#ifdef TEXTV2 + +// The following APIs return data from the font OS/2 table + +inline INT16 +FontFamily::GetTypographicAscent(IN INT style) const +{ + INT16 TypographicAscent; + + SetStatus(DllExports::GdipGetTypographicAscent(nativeFamily, style, &TypographicAscent)); + + return TypographicAscent; +} + +inline INT16 +FontFamily::GetTypographicDescent(IN INT style) const +{ + INT16 TypographicDescent; + + SetStatus(DllExports::GdipGetTypographicDescent(nativeFamily, style, &TypographicDescent)); + + return TypographicDescent; +} + +inline INT16 +FontFamily::GetTypographicLineGap(IN INT style) const +{ + INT16 TypographicLineGap; + + SetStatus(DllExports::GdipGetTypographicLineGap(nativeFamily, style, &TypographicLineGap)); + + return TypographicLineGap; +} + +#endif + +/////////////////////////////////////////////////////////// + +// GetLastStatus - return last error code and clear error code + +inline Status +FontFamily::GetLastStatus() const +{ + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; +} + +// protected method +inline Status +FontFamily::SetStatus(Status status) const +{ + if (status != Ok) + return (lastResult = status); + else + return status; +} + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusGpStubs.h b/core/src/fxge/Microsoft SDK/include/GdiPlusGpStubs.h index 121288de57..4f6066ccef 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusGpStubs.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusGpStubs.h @@ -1,107 +1,107 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusGpStubs.h -* -* Abstract: -* -* GDI+ Native C++ public header file -* -\**************************************************************************/ - -#ifndef _GDIPLUSGPSTUBS_H -#define _GDIPLUSGPSTUBS_H - -//--------------------------------------------------------------------------- -// GDI+ classes for forward reference -//--------------------------------------------------------------------------- - -class Graphics; -class Pen; -class Brush; -class Matrix; -class Bitmap; -class Metafile; -class GraphicsPath; -class PathIterator; -class Region; -class Image; -class TextureBrush; -class HatchBrush; -class SolidBrush; -class LinearGradientBrush; -class PathGradientBrush; -class Font; -class FontFamily; -class FontCollection; -class InstalledFontCollection; -class PrivateFontCollection; -class ImageAttributes; -class CachedBitmap; - -//--------------------------------------------------------------------------- -// Internal GDI+ classes for internal type checking -//--------------------------------------------------------------------------- -class GpGraphics {}; - -class GpBrush {}; -class GpTexture : public GpBrush {}; -class GpSolidFill : public GpBrush {}; -class GpLineGradient : public GpBrush {}; -class GpPathGradient : public GpBrush {}; -class GpHatch : public GpBrush {}; - -class GpPen {}; -class GpCustomLineCap {}; -class GpAdjustableArrowCap : public GpCustomLineCap {}; - -class GpImage {}; -class GpBitmap : public GpImage {}; -class GpMetafile : public GpImage {}; -class GpImageAttributes {}; - -class GpPath {}; -class GpRegion {}; -class GpPathIterator {}; - -class GpFontFamily {}; -class GpFont {}; -class GpStringFormat {}; -class GpFontCollection {}; -class GpInstalledFontCollection : public GpFontCollection {}; -class GpPrivateFontCollection : public GpFontCollection {}; - -class GpCachedBitmap; - -typedef Status GpStatus; -typedef FillMode GpFillMode; -typedef WrapMode GpWrapMode; -typedef Unit GpUnit; -typedef CoordinateSpace GpCoordinateSpace; -typedef PointF GpPointF; -typedef Point GpPoint; -typedef RectF GpRectF; -typedef Rect GpRect; -typedef SizeF GpSizeF; -typedef HatchStyle GpHatchStyle; -typedef DashStyle GpDashStyle; -typedef LineCap GpLineCap; -typedef DashCap GpDashCap; - - -typedef PenAlignment GpPenAlignment; - -typedef LineJoin GpLineJoin; -typedef PenType GpPenType; - -typedef Matrix GpMatrix; -typedef BrushType GpBrushType; -typedef MatrixOrder GpMatrixOrder; -typedef FlushIntention GpFlushIntention; -typedef PathData GpPathData; - -#endif // !_GDIPLUSGPSTUBS.HPP - +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusGpStubs.h +* +* Abstract: +* +* GDI+ Native C++ public header file +* +\**************************************************************************/ + +#ifndef _GDIPLUSGPSTUBS_H +#define _GDIPLUSGPSTUBS_H + +//--------------------------------------------------------------------------- +// GDI+ classes for forward reference +//--------------------------------------------------------------------------- + +class Graphics; +class Pen; +class Brush; +class Matrix; +class Bitmap; +class Metafile; +class GraphicsPath; +class PathIterator; +class Region; +class Image; +class TextureBrush; +class HatchBrush; +class SolidBrush; +class LinearGradientBrush; +class PathGradientBrush; +class Font; +class FontFamily; +class FontCollection; +class InstalledFontCollection; +class PrivateFontCollection; +class ImageAttributes; +class CachedBitmap; + +//--------------------------------------------------------------------------- +// Internal GDI+ classes for internal type checking +//--------------------------------------------------------------------------- +class GpGraphics {}; + +class GpBrush {}; +class GpTexture : public GpBrush {}; +class GpSolidFill : public GpBrush {}; +class GpLineGradient : public GpBrush {}; +class GpPathGradient : public GpBrush {}; +class GpHatch : public GpBrush {}; + +class GpPen {}; +class GpCustomLineCap {}; +class GpAdjustableArrowCap : public GpCustomLineCap {}; + +class GpImage {}; +class GpBitmap : public GpImage {}; +class GpMetafile : public GpImage {}; +class GpImageAttributes {}; + +class GpPath {}; +class GpRegion {}; +class GpPathIterator {}; + +class GpFontFamily {}; +class GpFont {}; +class GpStringFormat {}; +class GpFontCollection {}; +class GpInstalledFontCollection : public GpFontCollection {}; +class GpPrivateFontCollection : public GpFontCollection {}; + +class GpCachedBitmap; + +typedef Status GpStatus; +typedef FillMode GpFillMode; +typedef WrapMode GpWrapMode; +typedef Unit GpUnit; +typedef CoordinateSpace GpCoordinateSpace; +typedef PointF GpPointF; +typedef Point GpPoint; +typedef RectF GpRectF; +typedef Rect GpRect; +typedef SizeF GpSizeF; +typedef HatchStyle GpHatchStyle; +typedef DashStyle GpDashStyle; +typedef LineCap GpLineCap; +typedef DashCap GpDashCap; + + +typedef PenAlignment GpPenAlignment; + +typedef LineJoin GpLineJoin; +typedef PenType GpPenType; + +typedef Matrix GpMatrix; +typedef BrushType GpBrushType; +typedef MatrixOrder GpMatrixOrder; +typedef FlushIntention GpFlushIntention; +typedef PathData GpPathData; + +#endif // !_GDIPLUSGPSTUBS.HPP + diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusGraphics.h b/core/src/fxge/Microsoft SDK/include/GdiPlusGraphics.h index 7b39a6ea71..4e4e3dae12 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusGraphics.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusGraphics.h @@ -1,2726 +1,2726 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusGraphics.h -* -* Abstract: -* -* Declarations for Graphics class -* -\**************************************************************************/ - -#ifndef _GDIPLUSGRAPHICS_H -#define _GDIPLUSGRAPHICS_H - -/** - * Represent a graphics context - */ -class Graphics : public GdiplusBase -{ -public: - friend class Region; - friend class GraphicsPath; - friend class Image; - friend class Bitmap; - friend class Metafile; - friend class Font; - friend class FontFamily; - friend class FontCollection; - friend class CachedBitmap; - - // Get a graphics context from an existing Win32 HDC or HWND - static Graphics* FromHDC(IN HDC hdc) - { - return new Graphics(hdc); - } - - static Graphics* FromHDC(IN HDC hdc, - IN HANDLE hdevice) - { - return new Graphics(hdc, hdevice); - } - - static Graphics* FromHWND(IN HWND hwnd, - IN BOOL icm = FALSE) - { - return new Graphics(hwnd, icm); - } - - static Graphics* FromImage(IN Image *image) - { - return new Graphics(image); - } - - Graphics(IN HDC hdc) - { - GpGraphics *graphics = NULL; - - lastResult = DllExports::GdipCreateFromHDC(hdc, &graphics); - - SetNativeGraphics(graphics); - } - - Graphics(IN HDC hdc, - IN HANDLE hdevice) - { - GpGraphics *graphics = NULL; - - lastResult = DllExports::GdipCreateFromHDC2(hdc, hdevice, &graphics); - - SetNativeGraphics(graphics); - } - - Graphics(IN HWND hwnd, - IN BOOL icm = FALSE) - { - GpGraphics *graphics = NULL; - - if (icm) - { - lastResult = DllExports::GdipCreateFromHWNDICM(hwnd, &graphics); - } - else - { - lastResult = DllExports::GdipCreateFromHWND(hwnd, &graphics); - } - - SetNativeGraphics(graphics); - } - - Graphics(IN Image* image) - { - GpGraphics *graphics = NULL; - - if (image != NULL) - { - lastResult = DllExports::GdipGetImageGraphicsContext( - image->nativeImage, &graphics); - } - SetNativeGraphics(graphics); - } - - ~Graphics() - { - DllExports::GdipDeleteGraphics(nativeGraphics); - } - - VOID Flush(IN FlushIntention intention = FlushIntentionFlush) - { - DllExports::GdipFlush(nativeGraphics, intention); - } - - //------------------------------------------------------------------------ - // Interop methods - //------------------------------------------------------------------------ - - // Locks the graphics until ReleaseDC is called - HDC GetHDC() - { - HDC hdc = NULL; - - SetStatus(DllExports::GdipGetDC(nativeGraphics, &hdc)); - - return hdc; - } - - VOID ReleaseHDC(IN HDC hdc) - { - SetStatus(DllExports::GdipReleaseDC(nativeGraphics, hdc)); - } - - //------------------------------------------------------------------------ - // Rendering modes - //------------------------------------------------------------------------ - - Status SetRenderingOrigin(IN INT x, IN INT y) - { - return SetStatus( - DllExports::GdipSetRenderingOrigin( - nativeGraphics, x, y - ) - ); - } - - Status GetRenderingOrigin(OUT INT *x, OUT INT *y) const - { - return SetStatus( - DllExports::GdipGetRenderingOrigin( - nativeGraphics, x, y - ) - ); - } - - Status SetCompositingMode(IN CompositingMode compositingMode) - { - return SetStatus(DllExports::GdipSetCompositingMode(nativeGraphics, - compositingMode)); - } - - CompositingMode GetCompositingMode() const - { - CompositingMode mode; - - SetStatus(DllExports::GdipGetCompositingMode(nativeGraphics, - &mode)); - - return mode; - } - - Status SetCompositingQuality(IN CompositingQuality compositingQuality) - { - return SetStatus(DllExports::GdipSetCompositingQuality( - nativeGraphics, - compositingQuality)); - } - - CompositingQuality GetCompositingQuality() const - { - CompositingQuality quality; - - SetStatus(DllExports::GdipGetCompositingQuality( - nativeGraphics, - &quality)); - - return quality; - } - - Status SetTextRenderingHint(IN TextRenderingHint newMode) - { -#ifndef DCR_USE_NEW_186764 - /* temporarly set the high bit to warn that we are using the new definition for the flag */ - newMode = (TextRenderingHint) (newMode | 0x0f000); -#endif // DCR_USE_NEW_186764 - return SetStatus(DllExports::GdipSetTextRenderingHint(nativeGraphics, - newMode)); - } - - TextRenderingHint GetTextRenderingHint() const - { - TextRenderingHint hint; - - SetStatus(DllExports::GdipGetTextRenderingHint(nativeGraphics, - &hint)); - - return hint; - } - -#ifdef DCR_USE_NEW_188922 - Status SetTextContrast(IN UINT contrast) - { - return SetStatus(DllExports::GdipSetTextContrast(nativeGraphics, - contrast)); - } - - UINT GetTextContrast() const - { - UINT contrast; - - SetStatus(DllExports::GdipGetTextContrast(nativeGraphics, - &contrast)); - - return contrast; - } -#else - Status SetTextGammaValue(IN UINT gammaValue) - { - return SetStatus(DllExports::GdipSetTextGammaValue(nativeGraphics, - gammaValue)); - } - - UINT GetTextGammaValue() const - { - UINT gammaValue; - - SetStatus(DllExports::GdipGetTextGammaValue(nativeGraphics, - &gammaValue)); - - return gammaValue; - } - -#endif // DCR_USE_NEW_188922 - - - InterpolationMode GetInterpolationMode() const - { - InterpolationMode mode = InterpolationModeInvalid; - - SetStatus(DllExports::GdipGetInterpolationMode(nativeGraphics, - &mode)); - - return mode; - } - - Status SetInterpolationMode(IN InterpolationMode interpolationMode) - { - return SetStatus(DllExports::GdipSetInterpolationMode(nativeGraphics, - interpolationMode)); - } - - SmoothingMode GetSmoothingMode() const - { - SmoothingMode smoothingMode = SmoothingModeInvalid; - - SetStatus(DllExports::GdipGetSmoothingMode(nativeGraphics, - &smoothingMode)); - - return smoothingMode; - } - - Status SetSmoothingMode(IN SmoothingMode smoothingMode) - { - return SetStatus(DllExports::GdipSetSmoothingMode(nativeGraphics, - smoothingMode)); - } - - PixelOffsetMode GetPixelOffsetMode() const - { - PixelOffsetMode pixelOffsetMode = PixelOffsetModeInvalid; - - SetStatus(DllExports::GdipGetPixelOffsetMode(nativeGraphics, - &pixelOffsetMode)); - - return pixelOffsetMode; - } - - Status SetPixelOffsetMode(IN PixelOffsetMode pixelOffsetMode) - { - return SetStatus(DllExports::GdipSetPixelOffsetMode(nativeGraphics, - pixelOffsetMode)); - } - - //------------------------------------------------------------------------ - // Manipulate the current world transform - //------------------------------------------------------------------------ - - Status SetTransform(IN const Matrix* matrix) - { - return SetStatus(DllExports::GdipSetWorldTransform(nativeGraphics, - matrix->nativeMatrix)); - } - Status ResetTransform() - { - return SetStatus(DllExports::GdipResetWorldTransform(nativeGraphics)); - } - - Status MultiplyTransform(IN const Matrix* matrix, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipMultiplyWorldTransform(nativeGraphics, - matrix->nativeMatrix, - order)); - } - - Status TranslateTransform(IN REAL dx, - IN REAL dy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipTranslateWorldTransform(nativeGraphics, - dx, dy, order)); - } - - Status ScaleTransform(IN REAL sx, - IN REAL sy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipScaleWorldTransform(nativeGraphics, - sx, sy, order)); - } - - Status RotateTransform(IN REAL angle, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipRotateWorldTransform(nativeGraphics, - angle, order)); - } - - /** - * Return the current world transform - */ - - Status GetTransform(OUT Matrix* matrix) const - { - return SetStatus(DllExports::GdipGetWorldTransform(nativeGraphics, - matrix->nativeMatrix)); - } - - /** - * Manipulate the current page transform - */ - - Status SetPageUnit(IN Unit unit) - { - return SetStatus(DllExports::GdipSetPageUnit(nativeGraphics, - unit)); - } - - Status SetPageScale(IN REAL scale) - { - return SetStatus(DllExports::GdipSetPageScale(nativeGraphics, - scale)); - } - - /** - * Retrieve the current page transform information - * notes @ these are atomic - */ - Unit GetPageUnit() const - { - Unit unit; - - SetStatus(DllExports::GdipGetPageUnit(nativeGraphics, &unit)); - - return unit; - } - - REAL GetPageScale() const - { - REAL scale; - - SetStatus(DllExports::GdipGetPageScale(nativeGraphics, &scale)); - - return scale; - } - - REAL GetDpiX() const - { - REAL dpi; - - SetStatus(DllExports::GdipGetDpiX(nativeGraphics, &dpi)); - - return dpi; - } - - REAL GetDpiY() const - { - REAL dpi; - - SetStatus(DllExports::GdipGetDpiY(nativeGraphics, &dpi)); - - return dpi; - } - - /** - * Transform points in the current graphics context - */ - // float version - Status TransformPoints(IN CoordinateSpace destSpace, - IN CoordinateSpace srcSpace, - IN OUT PointF* pts, - IN INT count) const - { - return SetStatus(DllExports::GdipTransformPoints(nativeGraphics, - destSpace, - srcSpace, - pts, - count)); - } - - // integer version - Status TransformPoints(IN CoordinateSpace destSpace, - IN CoordinateSpace srcSpace, - IN OUT Point* pts, - IN INT count) const - { - - return SetStatus(DllExports::GdipTransformPointsI(nativeGraphics, - destSpace, - srcSpace, - pts, - count)); - } - - //------------------------------------------------------------------------ - // GetNearestColor (for <= 8bpp surfaces) - // Note: alpha is ignored - //------------------------------------------------------------------------ - Status GetNearestColor(IN OUT Color* color) const - { - if (color == NULL) - { - return SetStatus(InvalidParameter); - } - - ARGB argb = color->GetValue(); - - Status status = SetStatus(DllExports::GdipGetNearestColor(nativeGraphics, &argb)); - - color->SetValue(argb); - - return status; - } - - /** - * Vector drawing methods - * - * @notes Do we need a set of methods that take - * integer coordinate parameters? - */ - - // float version - Status DrawLine(IN const Pen* pen, - IN REAL x1, - IN REAL y1, - IN REAL x2, - IN REAL y2) - { - return SetStatus(DllExports::GdipDrawLine(nativeGraphics, - pen->nativePen, x1, y1, x2, - y2)); - } - - Status DrawLine(IN const Pen* pen, - IN const PointF& pt1, - IN const PointF& pt2) - { - return DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y); - } - - Status DrawLines(IN const Pen* pen, - IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawLines(nativeGraphics, - pen->nativePen, - points, count)); - } - - // int version - Status DrawLine(IN const Pen* pen, - IN INT x1, - IN INT y1, - IN INT x2, - IN INT y2) - { - return SetStatus(DllExports::GdipDrawLineI(nativeGraphics, - pen->nativePen, - x1, - y1, - x2, - y2)); - } - - Status DrawLine(IN const Pen* pen, - IN const Point& pt1, - IN const Point& pt2) - { - return DrawLine(pen, - pt1.X, - pt1.Y, - pt2.X, - pt2.Y); - } - - Status DrawLines(IN const Pen* pen, - IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawLinesI(nativeGraphics, - pen->nativePen, - points, - count)); - } - - // float version - Status DrawArc(IN const Pen* pen, - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipDrawArc(nativeGraphics, - pen->nativePen, - x, - y, - width, - height, - startAngle, - sweepAngle)); - } - - Status DrawArc(IN const Pen* pen, - IN const RectF& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, - startAngle, sweepAngle); - } - - // int version - Status DrawArc(IN const Pen* pen, - IN INT x, - IN INT y, - IN INT width, - IN INT height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipDrawArcI(nativeGraphics, - pen->nativePen, - x, - y, - width, - height, - startAngle, - sweepAngle)); - } - - - Status DrawArc(IN const Pen* pen, - IN const Rect& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return DrawArc(pen, - rect.X, - rect.Y, - rect.Width, - rect.Height, - startAngle, - sweepAngle); - } - - // float version - Status DrawBezier(IN const Pen* pen, - IN REAL x1, - IN REAL y1, - IN REAL x2, - IN REAL y2, - IN REAL x3, - IN REAL y3, - IN REAL x4, - IN REAL y4) - { - return SetStatus(DllExports::GdipDrawBezier(nativeGraphics, - pen->nativePen, x1, y1, - x2, y2, x3, y3, x4, y4)); - } - - Status DrawBezier(IN const Pen* pen, - IN const PointF& pt1, - IN const PointF& pt2, - IN const PointF& pt3, - IN const PointF& pt4) - { - return DrawBezier(pen, - pt1.X, - pt1.Y, - pt2.X, - pt2.Y, - pt3.X, - pt3.Y, - pt4.X, - pt4.Y); - } - - Status DrawBeziers(IN const Pen* pen, - IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawBeziers(nativeGraphics, - pen->nativePen, - points, - count)); - } - - // int version - Status DrawBezier(IN const Pen* pen, - IN INT x1, - IN INT y1, - IN INT x2, - IN INT y2, - IN INT x3, - IN INT y3, - IN INT x4, - IN INT y4) - { - return SetStatus(DllExports::GdipDrawBezierI(nativeGraphics, - pen->nativePen, - x1, - y1, - x2, - y2, - x3, - y3, - x4, - y4)); - } - - Status DrawBezier(IN const Pen* pen, - IN const Point& pt1, - IN const Point& pt2, - IN const Point& pt3, - IN const Point& pt4) - { - return DrawBezier(pen, - pt1.X, - pt1.Y, - pt2.X, - pt2.Y, - pt3.X, - pt3.Y, - pt4.X, - pt4.Y); - } - - Status DrawBeziers(IN const Pen* pen, - IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawBeziersI(nativeGraphics, - pen->nativePen, - points, - count)); - } - - // float version - Status DrawRectangle(IN const Pen* pen, - IN const RectF& rect) - { - return DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); - } - - Status DrawRectangle(IN const Pen* pen, - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height) - { - return SetStatus(DllExports::GdipDrawRectangle(nativeGraphics, - pen->nativePen, x, y, - width, height)); - } - - Status DrawRectangles(IN const Pen* pen, - IN const RectF* rects, - IN INT count) - { - return SetStatus(DllExports::GdipDrawRectangles(nativeGraphics, - pen->nativePen, - rects, count)); - } - - // integer version - Status DrawRectangle(IN const Pen* pen, - IN const Rect& rect) - { - return DrawRectangle(pen, - rect.X, - rect.Y, - rect.Width, - rect.Height); - } - - Status DrawRectangle(IN const Pen* pen, - IN INT x, - IN INT y, - IN INT width, - IN INT height) - { - return SetStatus(DllExports::GdipDrawRectangleI(nativeGraphics, - pen->nativePen, - x, - y, - width, - height)); - } - - Status DrawRectangles(IN const Pen* pen, - IN const Rect* rects, - IN INT count) - { - return SetStatus(DllExports::GdipDrawRectanglesI(nativeGraphics, - pen->nativePen, - rects, - count)); - } - - // float version - Status DrawEllipse(IN const Pen* pen, - IN const RectF& rect) - { - return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height); - } - - Status DrawEllipse(IN const Pen* pen, - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height) - { - return SetStatus(DllExports::GdipDrawEllipse(nativeGraphics, - pen->nativePen, - x, - y, - width, - height)); - } - - // integer version - Status DrawEllipse(IN const Pen* pen, - IN const Rect& rect) - { - return DrawEllipse(pen, - rect.X, - rect.Y, - rect.Width, - rect.Height); - } - - Status DrawEllipse(IN const Pen* pen, - IN INT x, - IN INT y, - IN INT width, - IN INT height) - { - return SetStatus(DllExports::GdipDrawEllipseI(nativeGraphics, - pen->nativePen, - x, - y, - width, - height)); - } - - // floating point version - Status DrawPie(IN const Pen* pen, - IN const RectF& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return DrawPie(pen, - rect.X, - rect.Y, - rect.Width, - rect.Height, - startAngle, - sweepAngle); - } - - Status DrawPie(IN const Pen* pen, - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipDrawPie(nativeGraphics, - pen->nativePen, - x, - y, - width, - height, - startAngle, - sweepAngle)); - } - - // integer point version - Status DrawPie(IN const Pen* pen, - IN const Rect& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return DrawPie(pen, - rect.X, - rect.Y, - rect.Width, - rect.Height, - startAngle, - sweepAngle); - } - - Status DrawPie(IN const Pen* pen, - IN INT x, - IN INT y, - IN INT width, - IN INT height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipDrawPieI(nativeGraphics, - pen->nativePen, - x, - y, - width, - height, - startAngle, - sweepAngle)); - } - - // float version - Status DrawPolygon(IN const Pen* pen, - IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawPolygon(nativeGraphics, - pen->nativePen, - points, - count)); - } - - // integer version - Status DrawPolygon(IN const Pen* pen, - IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawPolygonI(nativeGraphics, - pen->nativePen, - points, - count)); - } - - // float version - Status DrawPath(IN const Pen* pen, - IN const GraphicsPath* path) - { - return SetStatus(DllExports::GdipDrawPath(nativeGraphics, - pen ? pen->nativePen : NULL, - path ? path->nativePath : NULL)); - } - - // float version - Status DrawCurve(IN const Pen* pen, - IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawCurve(nativeGraphics, - pen->nativePen, points, - count)); - } - - Status DrawCurve(IN const Pen* pen, - IN const PointF* points, - IN INT count, - IN REAL tension) - { - return SetStatus(DllExports::GdipDrawCurve2(nativeGraphics, - pen->nativePen, points, - count, tension)); - } - - Status DrawCurve(IN const Pen* pen, - IN const PointF* points, - IN INT count, - IN INT offset, - IN INT numberOfSegments, - IN REAL tension = 0.5f) - { - return SetStatus(DllExports::GdipDrawCurve3(nativeGraphics, - pen->nativePen, points, - count, offset, - numberOfSegments, tension)); - } - - // integer version - Status DrawCurve(IN const Pen* pen, - IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawCurveI(nativeGraphics, - pen->nativePen, - points, - count)); - } - - Status DrawCurve(IN const Pen* pen, - IN const Point* points, - IN INT count, - IN REAL tension) - { - return SetStatus(DllExports::GdipDrawCurve2I(nativeGraphics, - pen->nativePen, - points, - count, - tension)); - } - - Status DrawCurve(IN const Pen* pen, - IN const Point* points, - IN INT count, - IN INT offset, - IN INT numberOfSegments, - IN REAL tension = 0.5f) - { - return SetStatus(DllExports::GdipDrawCurve3I(nativeGraphics, - pen->nativePen, - points, - count, - offset, - numberOfSegments, - tension)); - } - - // float version - Status DrawClosedCurve(IN const Pen* pen, - IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawClosedCurve(nativeGraphics, - pen->nativePen, - points, count)); - } - - Status DrawClosedCurve(IN const Pen *pen, - IN const PointF* points, - IN INT count, - IN REAL tension) - { - return SetStatus(DllExports::GdipDrawClosedCurve2(nativeGraphics, - pen->nativePen, - points, count, - tension)); - } - - // integer version - Status DrawClosedCurve(IN const Pen* pen, - IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipDrawClosedCurveI(nativeGraphics, - pen->nativePen, - points, - count)); - } - - Status DrawClosedCurve(IN const Pen *pen, - IN const Point* points, - IN INT count, - IN REAL tension) - { - return SetStatus(DllExports::GdipDrawClosedCurve2I(nativeGraphics, - pen->nativePen, - points, - count, - tension)); - } - - Status Clear(IN const Color &color) - { - return SetStatus(DllExports::GdipGraphicsClear( - nativeGraphics, - color.GetValue())); - } - - // float version - Status FillRectangle(IN const Brush* brush, - IN const RectF& rect) - { - return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height); - } - - Status FillRectangle(IN const Brush* brush, - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height) - { - return SetStatus(DllExports::GdipFillRectangle(nativeGraphics, - brush->nativeBrush, x, y, - width, height)); - } - - Status FillRectangles(IN const Brush* brush, - IN const RectF* rects, - IN INT count) - { - return SetStatus(DllExports::GdipFillRectangles(nativeGraphics, - brush->nativeBrush, - rects, count)); - } - - // integer version - Status FillRectangle(IN const Brush* brush, - IN const Rect& rect) - { - return FillRectangle(brush, - rect.X, - rect.Y, - rect.Width, - rect.Height); - } - - Status FillRectangle(IN const Brush* brush, - IN INT x, - IN INT y, - IN INT width, - IN INT height) - { - return SetStatus(DllExports::GdipFillRectangleI(nativeGraphics, - brush->nativeBrush, - x, - y, - width, - height)); - } - - Status FillRectangles(IN const Brush* brush, - IN const Rect* rects, - IN INT count) - { - return SetStatus(DllExports::GdipFillRectanglesI(nativeGraphics, - brush->nativeBrush, - rects, - count)); - } - - // float version - Status FillPolygon(IN const Brush* brush, - IN const PointF* points, - IN INT count) - { - return FillPolygon(brush, points, count, FillModeAlternate); - } - - Status FillPolygon(IN const Brush* brush, - IN const PointF* points, - IN INT count, - IN FillMode fillMode) - { - return SetStatus(DllExports::GdipFillPolygon(nativeGraphics, - brush->nativeBrush, - points, count, fillMode)); - } - - // integer version - Status FillPolygon(IN const Brush* brush, - IN const Point* points, - IN INT count) - { - return FillPolygon(brush, points, count, FillModeAlternate); - } - - Status FillPolygon(IN const Brush* brush, - IN const Point* points, - IN INT count, - IN FillMode fillMode) - { - return SetStatus(DllExports::GdipFillPolygonI(nativeGraphics, - brush->nativeBrush, - points, count, - fillMode)); - } - - // float version - Status FillEllipse(IN const Brush* brush, - IN const RectF& rect) - { - return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); - } - - Status FillEllipse(IN const Brush* brush, - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height) - { - return SetStatus(DllExports::GdipFillEllipse(nativeGraphics, - brush->nativeBrush, x, y, - width, height)); - } - - // integer version - Status FillEllipse(IN const Brush* brush, - IN const Rect& rect) - { - return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); - } - - Status FillEllipse(IN const Brush* brush, - IN INT x, - IN INT y, - IN INT width, - IN INT height) - { - return SetStatus(DllExports::GdipFillEllipseI(nativeGraphics, - brush->nativeBrush, - x, - y, - width, - height)); - } - - // float version - Status FillPie(IN const Brush* brush, - IN const RectF& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, - startAngle, sweepAngle); - } - - Status FillPie(IN const Brush* brush, - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipFillPie(nativeGraphics, - brush->nativeBrush, x, y, - width, height, startAngle, - sweepAngle)); - } - - // integer version - Status FillPie(IN const Brush* brush, - IN const Rect& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, - startAngle, sweepAngle); - } - - Status FillPie(IN const Brush* brush, - IN INT x, - IN INT y, - IN INT width, - IN INT height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipFillPieI(nativeGraphics, - brush->nativeBrush, - x, - y, - width, - height, - startAngle, - sweepAngle)); - } - - Status FillPath(IN const Brush* brush, - IN const GraphicsPath* path) - { - return SetStatus(DllExports::GdipFillPath(nativeGraphics, - brush->nativeBrush, - path->nativePath)); - } - - // float version - Status FillClosedCurve(IN const Brush* brush, - IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipFillClosedCurve(nativeGraphics, - brush->nativeBrush, - points, count)); - - } - - Status FillClosedCurve(IN const Brush* brush, - IN const PointF* points, - IN INT count, - IN FillMode fillMode, - IN REAL tension = 0.5f) - { - return SetStatus(DllExports::GdipFillClosedCurve2(nativeGraphics, - brush->nativeBrush, - points, count, - tension, fillMode)); - } - - // integer version - Status FillClosedCurve(IN const Brush* brush, - IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipFillClosedCurveI(nativeGraphics, - brush->nativeBrush, - points, - count)); - } - - Status FillClosedCurve(IN const Brush* brush, - IN const Point* points, - IN INT count, - IN FillMode fillMode, - IN REAL tension = 0.5f) - { - return SetStatus(DllExports::GdipFillClosedCurve2I(nativeGraphics, - brush->nativeBrush, - points, count, - tension, fillMode)); - } - - // float version - Status FillRegion(IN const Brush* brush, - IN const Region* region) - { - return SetStatus(DllExports::GdipFillRegion(nativeGraphics, - brush->nativeBrush, - region->nativeRegion)); - } - - // DrawString and MeasureString - Status - DrawString( - IN const WCHAR *string, - IN INT length, - IN const Font *font, - IN const RectF &layoutRect, - IN const StringFormat *stringFormat, - IN const Brush *brush - ) - { - return SetStatus(DllExports::GdipDrawString( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - &layoutRect, - stringFormat ? stringFormat->nativeFormat : NULL, - brush ? brush->nativeBrush : NULL - )); - } - - Status - DrawString( - const WCHAR *string, - INT length, - const Font *font, - const PointF &origin, - const Brush *brush - ) - { - RectF rect(origin.X, origin.Y, 0.0f, 0.0f); - - return SetStatus(DllExports::GdipDrawString( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - &rect, - NULL, - brush ? brush->nativeBrush : NULL - )); - } - - Status - DrawString( - const WCHAR *string, - INT length, - const Font *font, - const PointF &origin, - const StringFormat *stringFormat, - const Brush *brush - ) - { - RectF rect(origin.X, origin.Y, 0.0f, 0.0f); - - return SetStatus(DllExports::GdipDrawString( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - &rect, - stringFormat ? stringFormat->nativeFormat : NULL, - brush ? brush->nativeBrush : NULL - )); - } - - Status - MeasureString( - IN const WCHAR *string, - IN INT length, - IN const Font *font, - IN const RectF &layoutRect, - IN const StringFormat *stringFormat, - OUT RectF *boundingBox, - OUT INT *codepointsFitted = 0, - OUT INT *linesFilled = 0 - ) const - { - return SetStatus(DllExports::GdipMeasureString( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - &layoutRect, - stringFormat ? stringFormat->nativeFormat : NULL, - boundingBox, - codepointsFitted, - linesFilled - )); - } - - Status - MeasureString( - IN const WCHAR *string, - IN INT length, - IN const Font *font, - IN const SizeF &layoutRectSize, - IN const StringFormat *stringFormat, - OUT SizeF *size, - OUT INT *codepointsFitted = 0, - OUT INT *linesFilled = 0 - ) const - { - RectF layoutRect(0, 0, layoutRectSize.Width, layoutRectSize.Height); - RectF boundingBox; - Status status; - - if (size == NULL) - { - return SetStatus(InvalidParameter); - } - - status = SetStatus(DllExports::GdipMeasureString( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - &layoutRect, - stringFormat ? stringFormat->nativeFormat : NULL, - size ? &boundingBox : NULL, - codepointsFitted, - linesFilled - )); - - if (size && status == Ok) - { - size->Width = boundingBox.Width; - size->Height = boundingBox.Height; - } - - return status; - } - - Status - MeasureString( - IN const WCHAR *string, - IN INT length, - IN const Font *font, - IN const PointF &origin, - IN const StringFormat *stringFormat, - OUT RectF *boundingBox - ) const - { - RectF rect(origin.X, origin.Y, 0.0f, 0.0f); - - return SetStatus(DllExports::GdipMeasureString( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - &rect, - stringFormat ? stringFormat->nativeFormat : NULL, - boundingBox, - NULL, - NULL - )); - } - - - Status - MeasureString( - IN const WCHAR *string, - IN INT length, - IN const Font *font, - IN const RectF &layoutRect, - OUT RectF *boundingBox - ) const - { - return SetStatus(DllExports::GdipMeasureString( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - &layoutRect, - NULL, - boundingBox, - NULL, - NULL - )); - } - - Status - MeasureString( - IN const WCHAR *string, - IN INT length, - IN const Font *font, - IN const PointF &origin, - OUT RectF *boundingBox - ) const - { - RectF rect(origin.X, origin.Y, 0.0f, 0.0f); - - return SetStatus(DllExports::GdipMeasureString( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - &rect, - NULL, - boundingBox, - NULL, - NULL - )); - } - - -#ifdef DCR_USE_NEW_174340 - Status - MeasureCharacterRanges( - IN const WCHAR *string, - IN INT length, - IN const Font *font, - IN const RectF &layoutRect, - IN const StringFormat *stringFormat, - IN INT regionCount, - OUT Region *regions - ) const - { - if (!regions || regionCount <= 0) - { - return InvalidParameter; - } - - GpRegion **nativeRegions = new GpRegion* [regionCount]; - - if (!nativeRegions) - { - return OutOfMemory; - } - - for (INT i = 0; i < regionCount; i++) - { - nativeRegions[i] = regions[i].nativeRegion; - } - - Status status = SetStatus(DllExports::GdipMeasureCharacterRanges( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - layoutRect, - stringFormat ? stringFormat->nativeFormat : NULL, - regionCount, - nativeRegions - )); - - delete [] nativeRegions; - - return status; - } -#endif - - -#ifndef DCR_USE_NEW_174340 - Status - MeasureStringRegion( - IN const WCHAR *string, - IN INT length, - IN const Font *font, - IN const RectF &layoutRect, - IN const StringFormat *stringFormat, - IN INT firstCharacterIndex, - IN INT characterCount, - OUT Region *region - ) const - { - if (region == NULL) - { - return SetStatus(InvalidParameter); - } - - return (SetStatus(DllExports::GdipMeasureStringRegion( - nativeGraphics, - string, - length, - font ? font->nativeFont : NULL, - layoutRect, - stringFormat ? stringFormat->nativeFormat : NULL, - firstCharacterIndex, - characterCount, - region->nativeRegion))); - } -#endif - - Status DrawDriverString( - IN const UINT16 *text, - IN INT length, - IN const Font *font, - IN const Brush *brush, - IN const PointF *positions, - IN INT flags, - IN const Matrix *matrix - ) - { - return SetStatus(DllExports::GdipDrawDriverString( - nativeGraphics, - text, - length, - font ? font->nativeFont : NULL, - brush ? brush->nativeBrush : NULL, - positions, - flags, - matrix ? matrix->nativeMatrix : NULL - )); - } - - Status MeasureDriverString( - IN const UINT16 *text, - IN INT length, - IN const Font *font, - IN const PointF *positions, - IN INT flags, - IN const Matrix *matrix, - OUT RectF *boundingBox - ) const - { - return SetStatus(DllExports::GdipMeasureDriverString( - nativeGraphics, - text, - length, - font ? font->nativeFont : NULL, - positions, - flags, - matrix ? matrix->nativeMatrix : NULL, - boundingBox - )); - } - -#ifndef DCR_USE_NEW_168772 - Status DriverStringPointToCodepoint( - IN const UINT16 *text, - IN INT length, - IN const Font *font, - IN const PointF *positions, - IN INT flags, - IN const Matrix *matrix, - IN const PointF &hit, - OUT INT *index, - OUT BOOL *rightEdge, - OUT REAL *distance - ) - { - return SetStatus(DllExports::GdipDriverStringPointToCodepoint( - nativeGraphics, - text, - length, - font ? font->nativeFont : NULL, - positions, - flags, - matrix ? matrix->nativeMatrix : NULL, - &hit, - index, - rightEdge, - distance - )); - } -#endif - - // Draw a cached bitmap on this graphics destination offset by - // x, y. Note this will fail with WrongState if the CachedBitmap - // native format differs from this Graphics. - - Status DrawCachedBitmap(IN CachedBitmap *cb, - IN INT x, - IN INT y) - { - return SetStatus(DllExports::GdipDrawCachedBitmap( - nativeGraphics, - cb->nativeCachedBitmap, - x, y - )); - } - - /** - * Draw images (both bitmap and vector) - */ - // float version - Status DrawImage(IN Image* image, - IN const PointF& point) - { - return DrawImage(image, point.X, point.Y); - } - - Status DrawImage(IN Image* image, - IN REAL x, - IN REAL y) - { - return SetStatus(DllExports::GdipDrawImage(nativeGraphics, - image ? image->nativeImage - : NULL, - x, - y)); - } - - Status DrawImage(IN Image* image, - IN const RectF& rect) - { - return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height); - } - - Status DrawImage(IN Image* image, - IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height) - { - return SetStatus(DllExports::GdipDrawImageRect(nativeGraphics, - image ? image->nativeImage - : NULL, - x, - y, - width, - height)); - } - - // integer version - Status DrawImage(IN Image* image, - IN const Point& point) - { - return DrawImage(image, point.X, point.Y); - } - - Status DrawImage(IN Image* image, - IN INT x, - IN INT y) - { - return SetStatus(DllExports::GdipDrawImageI(nativeGraphics, - image ? image->nativeImage - : NULL, - x, - y)); - } - - Status DrawImage(IN Image* image, - IN const Rect& rect) - { - return DrawImage(image, - rect.X, - rect.Y, - rect.Width, - rect.Height); - } - - Status DrawImage(IN Image* image, - IN INT x, - IN INT y, - IN INT width, - IN INT height) { - return SetStatus(DllExports::GdipDrawImageRectI(nativeGraphics, - image ? image->nativeImage - : NULL, - x, - y, - width, - height)); - } - - /** - * Affine or perspective blt - * destPoints.length = 3: rect => parallelogram - * destPoints[0] <=> top-left corner of the source rectangle - * destPoints[1] <=> top-right corner - * destPoints[2] <=> bottom-left corner - * destPoints.length = 4: rect => quad - * destPoints[3] <=> bottom-right corner - * - * @notes Perspective blt only works for bitmap images. - */ - Status DrawImage(IN Image* image, - IN const PointF* destPoints, - IN INT count) - { - if (count != 3 && count != 4) - return SetStatus(InvalidParameter); - - return SetStatus(DllExports::GdipDrawImagePoints(nativeGraphics, - image ? image->nativeImage - : NULL, - destPoints, count)); - } - - Status DrawImage(IN Image* image, - IN const Point* destPoints, - IN INT count) - { - if (count != 3 && count != 4) - return SetStatus(InvalidParameter); - - return SetStatus(DllExports::GdipDrawImagePointsI(nativeGraphics, - image ? image->nativeImage - : NULL, - destPoints, - count)); - } - - /** - * We need another set of methods similar to the ones above - * that take an additional Rect parameter to specify the - * portion of the source image to be drawn. - */ - // float version - Status DrawImage(IN Image* image, - IN REAL x, - IN REAL y, - IN REAL srcx, - IN REAL srcy, - IN REAL srcwidth, - IN REAL srcheight, - IN Unit srcUnit) - { - return SetStatus(DllExports::GdipDrawImagePointRect(nativeGraphics, - image ? image->nativeImage - : NULL, - x, y, - srcx, srcy, - srcwidth, srcheight, srcUnit)); - } - - Status DrawImage(IN Image* image, - IN const RectF& destRect, - IN REAL srcx, - IN REAL srcy, - IN REAL srcwidth, - IN REAL srcheight, - IN Unit srcUnit, - IN const ImageAttributes* imageAttributes = NULL, - IN DrawImageAbort callback = NULL, - IN VOID* callbackData = NULL) - { - return SetStatus(DllExports::GdipDrawImageRectRect(nativeGraphics, - image ? image->nativeImage - : NULL, - destRect.X, - destRect.Y, - destRect.Width, - destRect.Height, - srcx, srcy, - srcwidth, srcheight, - srcUnit, - imageAttributes - ? imageAttributes->nativeImageAttr - : NULL, - callback, - callbackData)); - } - - Status DrawImage(IN Image* image, - IN const PointF* destPoints, - IN INT count, - IN REAL srcx, - IN REAL srcy, - IN REAL srcwidth, - IN REAL srcheight, - IN Unit srcUnit, - IN const ImageAttributes* imageAttributes = NULL, - IN DrawImageAbort callback = NULL, - IN VOID* callbackData = NULL) - { - return SetStatus(DllExports::GdipDrawImagePointsRect(nativeGraphics, - image ? image->nativeImage - : NULL, - destPoints, count, - srcx, srcy, - srcwidth, - srcheight, - srcUnit, - imageAttributes - ? imageAttributes->nativeImageAttr - : NULL, - callback, - callbackData)); - } - - // integer version - Status DrawImage(IN Image* image, - IN INT x, - IN INT y, - IN INT srcx, - IN INT srcy, - IN INT srcwidth, - IN INT srcheight, - IN Unit srcUnit) - { - return SetStatus(DllExports::GdipDrawImagePointRectI(nativeGraphics, - image ? image->nativeImage - : NULL, - x, - y, - srcx, - srcy, - srcwidth, - srcheight, - srcUnit)); - } - - Status DrawImage(IN Image* image, - IN const Rect& destRect, - IN INT srcx, - IN INT srcy, - IN INT srcwidth, - IN INT srcheight, - IN Unit srcUnit, - IN const ImageAttributes* imageAttributes = NULL, - IN DrawImageAbort callback = NULL, - IN VOID* callbackData = NULL) - { - return SetStatus(DllExports::GdipDrawImageRectRectI(nativeGraphics, - image ? image->nativeImage - : NULL, - destRect.X, - destRect.Y, - destRect.Width, - destRect.Height, - srcx, - srcy, - srcwidth, - srcheight, - srcUnit, - imageAttributes - ? imageAttributes->nativeImageAttr - : NULL, - callback, - callbackData)); - } - - Status DrawImage(IN Image* image, - IN const Point* destPoints, - IN INT count, - IN INT srcx, - IN INT srcy, - IN INT srcwidth, - IN INT srcheight, - IN Unit srcUnit, - IN const ImageAttributes* imageAttributes = NULL, - IN DrawImageAbort callback = NULL, - IN VOID* callbackData = NULL) - { - return SetStatus(DllExports::GdipDrawImagePointsRectI(nativeGraphics, - image ? image->nativeImage - : NULL, - destPoints, - count, - srcx, - srcy, - srcwidth, - srcheight, - srcUnit, - imageAttributes - ? imageAttributes->nativeImageAttr - : NULL, - callback, - callbackData)); - } - - // The following methods are for playing an EMF+ to a graphics - // via the enumeration interface. Each record of the EMF+ is - // sent to the callback (along with the callbackData). Then - // the callback can invoke the Metafile::PlayRecord method - // to play the particular record. - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const PointF & destPoint, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileDestPoint( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destPoint, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const Point & destPoint, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileDestPointI( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destPoint, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const RectF & destRect, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileDestRect( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destRect, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const Rect & destRect, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileDestRectI( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destRect, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const PointF * destPoints, - IN INT count, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileDestPoints( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destPoints, - count, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const Point * destPoints, - IN INT count, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileDestPointsI( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destPoints, - count, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const PointF & destPoint, - IN const RectF & srcRect, - IN Unit srcUnit, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoint( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destPoint, - srcRect, - srcUnit, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const Point & destPoint, - IN const Rect & srcRect, - IN Unit srcUnit, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointI( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destPoint, - srcRect, - srcUnit, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const RectF & destRect, - IN const RectF & srcRect, - IN Unit srcUnit, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestRect( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destRect, - srcRect, - srcUnit, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const Rect & destRect, - IN const Rect & srcRect, - IN Unit srcUnit, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestRectI( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destRect, - srcRect, - srcUnit, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const PointF * destPoints, - IN INT count, - IN const RectF & srcRect, - IN Unit srcUnit, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoints( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destPoints, - count, - srcRect, - srcUnit, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - Status - EnumerateMetafile( - IN const Metafile * metafile, - IN const Point * destPoints, - IN INT count, - IN const Rect & srcRect, - IN Unit srcUnit, - IN EnumerateMetafileProc callback, - IN VOID * callbackData = NULL, - IN const ImageAttributes * imageAttributes = NULL - ) - { - return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointsI( - nativeGraphics, - (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), - destPoints, - count, - srcRect, - srcUnit, - callback, - callbackData, - imageAttributes ? imageAttributes->nativeImageAttr : NULL)); - } - - /** - * Clipping region operations - * - * @notes Simply incredible redundancy here. - */ - Status SetClip(IN const Graphics* g, - IN CombineMode combineMode = CombineModeReplace) - { - return SetStatus(DllExports::GdipSetClipGraphics(nativeGraphics, - g->nativeGraphics, - combineMode)); - } - - Status SetClip(IN const RectF& rect, - IN CombineMode combineMode = CombineModeReplace) - { - return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, - rect.X, rect.Y, - rect.Width, rect.Height, - combineMode)); - } - - Status SetClip(IN const Rect& rect, - IN CombineMode combineMode = CombineModeReplace) - { - return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, - rect.X, rect.Y, - rect.Width, rect.Height, - combineMode)); - } - - Status SetClip(IN const GraphicsPath* path, - IN CombineMode combineMode = CombineModeReplace) - { - return SetStatus(DllExports::GdipSetClipPath(nativeGraphics, - path->nativePath, - combineMode)); - } - - Status SetClip(IN const Region* region, - IN CombineMode combineMode = CombineModeReplace) - { - return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, - region->nativeRegion, - combineMode)); - } - - // This is different than the other SetClip methods because it assumes - // that the HRGN is already in device units, so it doesn't transform - // the coordinates in the HRGN. - Status SetClip(IN HRGN hRgn, - IN CombineMode combineMode = CombineModeReplace) - { - return SetStatus(DllExports::GdipSetClipHrgn(nativeGraphics, hRgn, - combineMode)); - } - - Status IntersectClip(IN const RectF& rect) - { - return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, - rect.X, rect.Y, - rect.Width, rect.Height, - CombineModeIntersect)); - } - - Status IntersectClip(IN const Rect& rect) - { - return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, - rect.X, rect.Y, - rect.Width, rect.Height, - CombineModeIntersect)); - } - - Status IntersectClip(IN const Region* region) - { - return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, - region->nativeRegion, - CombineModeIntersect)); - } - - Status ExcludeClip(IN const RectF& rect) - { - return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, - rect.X, rect.Y, - rect.Width, rect.Height, - CombineModeExclude)); - } - - Status ExcludeClip(IN const Rect& rect) - { - return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, - rect.X, rect.Y, - rect.Width, rect.Height, - CombineModeExclude)); - } - - Status ExcludeClip(IN const Region* region) - { - return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, - region->nativeRegion, - CombineModeExclude)); - } - - Status ResetClip() - { - return SetStatus(DllExports::GdipResetClip(nativeGraphics)); - } - - Status TranslateClip(IN REAL dx, - IN REAL dy) - { - return SetStatus(DllExports::GdipTranslateClip(nativeGraphics, dx, dy)); - } - - Status TranslateClip(IN INT dx, - IN INT dy) - { - return SetStatus(DllExports::GdipTranslateClipI(nativeGraphics, - dx, dy)); - } - - /** - * GetClip region from graphics context - */ - Status GetClip(OUT Region* region) const - { - return SetStatus(DllExports::GdipGetClip(nativeGraphics, - region->nativeRegion)); - } - - /** - * Hit testing operations - */ - Status GetClipBounds(OUT RectF* rect) const - { - return SetStatus(DllExports::GdipGetClipBounds(nativeGraphics, rect)); - } - - Status GetClipBounds(OUT Rect* rect) const - { - return SetStatus(DllExports::GdipGetClipBoundsI(nativeGraphics, rect)); - } - - BOOL IsClipEmpty() const - { - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsClipEmpty(nativeGraphics, &booln)); - - return booln; - } - - Status GetVisibleClipBounds(OUT RectF *rect) const - { - - return SetStatus(DllExports::GdipGetVisibleClipBounds(nativeGraphics, - rect)); - } - - Status GetVisibleClipBounds(OUT Rect *rect) const - { - return SetStatus(DllExports::GdipGetVisibleClipBoundsI(nativeGraphics, - rect)); - } - - BOOL IsVisibleClipEmpty() const - { - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsVisibleClipEmpty(nativeGraphics, &booln)); - - return booln; - } - - BOOL IsVisible(IN INT x, - IN INT y) const - { - return IsVisible(Point(x,y)); - } - - BOOL IsVisible(IN const Point& point) const - { - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsVisiblePointI(nativeGraphics, - point.X, - point.Y, - &booln)); - - return booln; - } - - BOOL IsVisible(IN INT x, - IN INT y, - IN INT width, - IN INT height) const - { - return IsVisible(Rect(x, y, width, height)); - } - - BOOL IsVisible(IN const Rect& rect) const - { - - BOOL booln = TRUE; - - SetStatus(DllExports::GdipIsVisibleRectI(nativeGraphics, - rect.X, - rect.Y, - rect.Width, - rect.Height, - &booln)); - return booln; - } - - BOOL IsVisible(IN REAL x, - IN REAL y) const - { - return IsVisible(PointF(x, y)); - } - - BOOL IsVisible(IN const PointF& point) const - { - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsVisiblePoint(nativeGraphics, - point.X, - point.Y, - &booln)); - - return booln; - } - - BOOL IsVisible(IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height) const - { - return IsVisible(RectF(x, y, width, height)); - } - - BOOL IsVisible(IN const RectF& rect) const - { - BOOL booln = TRUE; - - SetStatus(DllExports::GdipIsVisibleRect(nativeGraphics, - rect.X, - rect.Y, - rect.Width, - rect.Height, - &booln)); - return booln; - } - - /** - * Save/restore graphics state - */ - GraphicsState Save() const - { - GraphicsState gstate; - - SetStatus(DllExports::GdipSaveGraphics(nativeGraphics, &gstate)); - - return gstate; - } - - Status Restore(IN GraphicsState gstate) - { - return SetStatus(DllExports::GdipRestoreGraphics(nativeGraphics, - gstate)); - } - - /** - * Begin and end container drawing - */ - GraphicsContainer BeginContainer(IN const RectF &dstrect, - IN const RectF &srcrect, - IN Unit unit) - { - GraphicsContainer state; - - SetStatus(DllExports::GdipBeginContainer(nativeGraphics, &dstrect, - &srcrect, unit, &state)); - - return state; - } - - /** - * Begin and end container drawing - */ - GraphicsContainer BeginContainer(IN const Rect &dstrect, - IN const Rect &srcrect, - IN Unit unit) - { - GraphicsContainer state; - - SetStatus(DllExports::GdipBeginContainerI(nativeGraphics, &dstrect, - &srcrect, unit, &state)); - - return state; - } - - GraphicsContainer BeginContainer() - { - GraphicsContainer state; - - SetStatus(DllExports::GdipBeginContainer2(nativeGraphics, &state)); - - return state; - } - - Status EndContainer(IN GraphicsContainer state) - { - return SetStatus(DllExports::GdipEndContainer(nativeGraphics, state)); - } - - // only valid when recording metafiles - Status AddMetafileComment(IN const BYTE * data, - IN UINT sizeData) - { - return SetStatus(DllExports::GdipComment(nativeGraphics, sizeData, data)); - } - - /** - * Get/SetLayout - * Support for Middle East localization (right-to-left mirroring) - */ - GraphicsLayout GetLayout() const - { - GraphicsLayout layout; - - SetStatus(DllExports::GdipGetGraphicsLayout(nativeGraphics, &layout)); - - return layout; - } - - Status SetLayout(IN const GraphicsLayout layout) - { - return SetStatus( - DllExports::GdipSetGraphicsLayout(nativeGraphics, layout) - ); - } - - static HPALETTE GetHalftonePalette() - { - return DllExports::GdipCreateHalftonePalette(); - } - - Status GetLastStatus() const - { - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; - } - -protected: - -#ifdef DCR_USE_NEW_250932 - -private: - Graphics(const Graphics &); - Graphics& operator=(const Graphics &); -protected: - -#else - - Graphics(const Graphics& graphics) - { - graphics; - SetStatus(NotImplemented); - } - - Graphics& operator=(const Graphics& graphics) - { - graphics; - SetStatus(NotImplemented); - return *this; - } - -#endif - - Graphics(GpGraphics* graphics) - { - lastResult = Ok; - SetNativeGraphics(graphics); - } - - VOID SetNativeGraphics(GpGraphics *graphics) - { - this->nativeGraphics = graphics; - } - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - - // Methods necessary to subclass Graphics for extension test. - - GpGraphics* GetNativeGraphics() const - { - return this->nativeGraphics; - } - - GpPen* GetNativePen(const Pen* pen) - { - return pen->nativePen; - } - -protected: - GpGraphics* nativeGraphics; - mutable Status lastResult; - -}; - -//---------------------------------------------------------------------------- -// Extra implementation of GraphicsPath methods that use Graphics -//---------------------------------------------------------------------------- - -/** - * Get the bounds of the path object with the given transform. - * This is not always the tightest bounds. - */ - -inline Status -GraphicsPath::GetBounds( - OUT RectF* bounds, - IN const Matrix* matrix, - IN const Pen* pen) const -{ - GpMatrix* nativeMatrix = NULL; - GpPen* nativePen = NULL; - - if (matrix) - nativeMatrix = matrix->nativeMatrix; - - if (pen) - nativePen = pen->nativePen; - - return SetStatus(DllExports::GdipGetPathWorldBounds(nativePath, bounds, - nativeMatrix, nativePen)); -} - -// integer version -inline Status -GraphicsPath::GetBounds( - OUT Rect* bounds, - IN const Matrix* matrix, - IN const Pen* pen -) const -{ - GpMatrix* nativeMatrix = NULL; - GpPen* nativePen = NULL; - - if (matrix) - nativeMatrix = matrix->nativeMatrix; - - if (pen) - nativePen = pen->nativePen; - - return SetStatus(DllExports::GdipGetPathWorldBoundsI(nativePath, bounds, - nativeMatrix, nativePen)); -} - -//---------------------------------------------------------------------------- -// Hit testing operations -//---------------------------------------------------------------------------- - -inline BOOL -GraphicsPath::IsVisible( - IN REAL x, - IN REAL y, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - GpGraphics* nativeGraphics = NULL; - - if (g) - nativeGraphics = g->nativeGraphics; - - SetStatus(DllExports::GdipIsVisiblePathPoint(nativePath, - x, y, nativeGraphics, - &booln)); - return booln; -} - -inline BOOL -GraphicsPath::IsVisible( - IN INT x, - IN INT y, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - GpGraphics* nativeGraphics = NULL; - - if (g) - nativeGraphics = g->nativeGraphics; - - SetStatus(DllExports::GdipIsVisiblePathPointI(nativePath, - x, y, nativeGraphics, - &booln)); - return booln; -} - -inline BOOL -GraphicsPath::IsOutlineVisible( - IN REAL x, - IN REAL y, - IN const Pen* pen, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - GpGraphics* nativeGraphics = NULL; - GpPen* nativePen = NULL; - - if(g) - nativeGraphics = g->nativeGraphics; - if(pen) - nativePen = pen->nativePen; - - SetStatus(DllExports::GdipIsOutlineVisiblePathPoint(nativePath, - x, y, nativePen, nativeGraphics, - &booln)); - return booln; -} - -inline BOOL -GraphicsPath::IsOutlineVisible( - IN INT x, - IN INT y, - IN const Pen* pen, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - GpGraphics* nativeGraphics = NULL; - GpPen* nativePen = NULL; - - if(g) - nativeGraphics = g->nativeGraphics; - if(pen) - nativePen = pen->nativePen; - - SetStatus(DllExports::GdipIsOutlineVisiblePathPointI(nativePath, - x, y, nativePen, nativeGraphics, - &booln)); - return booln; -} - -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusGraphics.h +* +* Abstract: +* +* Declarations for Graphics class +* +\**************************************************************************/ + +#ifndef _GDIPLUSGRAPHICS_H +#define _GDIPLUSGRAPHICS_H + +/** + * Represent a graphics context + */ +class Graphics : public GdiplusBase +{ +public: + friend class Region; + friend class GraphicsPath; + friend class Image; + friend class Bitmap; + friend class Metafile; + friend class Font; + friend class FontFamily; + friend class FontCollection; + friend class CachedBitmap; + + // Get a graphics context from an existing Win32 HDC or HWND + static Graphics* FromHDC(IN HDC hdc) + { + return new Graphics(hdc); + } + + static Graphics* FromHDC(IN HDC hdc, + IN HANDLE hdevice) + { + return new Graphics(hdc, hdevice); + } + + static Graphics* FromHWND(IN HWND hwnd, + IN BOOL icm = FALSE) + { + return new Graphics(hwnd, icm); + } + + static Graphics* FromImage(IN Image *image) + { + return new Graphics(image); + } + + Graphics(IN HDC hdc) + { + GpGraphics *graphics = NULL; + + lastResult = DllExports::GdipCreateFromHDC(hdc, &graphics); + + SetNativeGraphics(graphics); + } + + Graphics(IN HDC hdc, + IN HANDLE hdevice) + { + GpGraphics *graphics = NULL; + + lastResult = DllExports::GdipCreateFromHDC2(hdc, hdevice, &graphics); + + SetNativeGraphics(graphics); + } + + Graphics(IN HWND hwnd, + IN BOOL icm = FALSE) + { + GpGraphics *graphics = NULL; + + if (icm) + { + lastResult = DllExports::GdipCreateFromHWNDICM(hwnd, &graphics); + } + else + { + lastResult = DllExports::GdipCreateFromHWND(hwnd, &graphics); + } + + SetNativeGraphics(graphics); + } + + Graphics(IN Image* image) + { + GpGraphics *graphics = NULL; + + if (image != NULL) + { + lastResult = DllExports::GdipGetImageGraphicsContext( + image->nativeImage, &graphics); + } + SetNativeGraphics(graphics); + } + + ~Graphics() + { + DllExports::GdipDeleteGraphics(nativeGraphics); + } + + VOID Flush(IN FlushIntention intention = FlushIntentionFlush) + { + DllExports::GdipFlush(nativeGraphics, intention); + } + + //------------------------------------------------------------------------ + // Interop methods + //------------------------------------------------------------------------ + + // Locks the graphics until ReleaseDC is called + HDC GetHDC() + { + HDC hdc = NULL; + + SetStatus(DllExports::GdipGetDC(nativeGraphics, &hdc)); + + return hdc; + } + + VOID ReleaseHDC(IN HDC hdc) + { + SetStatus(DllExports::GdipReleaseDC(nativeGraphics, hdc)); + } + + //------------------------------------------------------------------------ + // Rendering modes + //------------------------------------------------------------------------ + + Status SetRenderingOrigin(IN INT x, IN INT y) + { + return SetStatus( + DllExports::GdipSetRenderingOrigin( + nativeGraphics, x, y + ) + ); + } + + Status GetRenderingOrigin(OUT INT *x, OUT INT *y) const + { + return SetStatus( + DllExports::GdipGetRenderingOrigin( + nativeGraphics, x, y + ) + ); + } + + Status SetCompositingMode(IN CompositingMode compositingMode) + { + return SetStatus(DllExports::GdipSetCompositingMode(nativeGraphics, + compositingMode)); + } + + CompositingMode GetCompositingMode() const + { + CompositingMode mode; + + SetStatus(DllExports::GdipGetCompositingMode(nativeGraphics, + &mode)); + + return mode; + } + + Status SetCompositingQuality(IN CompositingQuality compositingQuality) + { + return SetStatus(DllExports::GdipSetCompositingQuality( + nativeGraphics, + compositingQuality)); + } + + CompositingQuality GetCompositingQuality() const + { + CompositingQuality quality; + + SetStatus(DllExports::GdipGetCompositingQuality( + nativeGraphics, + &quality)); + + return quality; + } + + Status SetTextRenderingHint(IN TextRenderingHint newMode) + { +#ifndef DCR_USE_NEW_186764 + /* temporarly set the high bit to warn that we are using the new definition for the flag */ + newMode = (TextRenderingHint) (newMode | 0x0f000); +#endif // DCR_USE_NEW_186764 + return SetStatus(DllExports::GdipSetTextRenderingHint(nativeGraphics, + newMode)); + } + + TextRenderingHint GetTextRenderingHint() const + { + TextRenderingHint hint; + + SetStatus(DllExports::GdipGetTextRenderingHint(nativeGraphics, + &hint)); + + return hint; + } + +#ifdef DCR_USE_NEW_188922 + Status SetTextContrast(IN UINT contrast) + { + return SetStatus(DllExports::GdipSetTextContrast(nativeGraphics, + contrast)); + } + + UINT GetTextContrast() const + { + UINT contrast; + + SetStatus(DllExports::GdipGetTextContrast(nativeGraphics, + &contrast)); + + return contrast; + } +#else + Status SetTextGammaValue(IN UINT gammaValue) + { + return SetStatus(DllExports::GdipSetTextGammaValue(nativeGraphics, + gammaValue)); + } + + UINT GetTextGammaValue() const + { + UINT gammaValue; + + SetStatus(DllExports::GdipGetTextGammaValue(nativeGraphics, + &gammaValue)); + + return gammaValue; + } + +#endif // DCR_USE_NEW_188922 + + + InterpolationMode GetInterpolationMode() const + { + InterpolationMode mode = InterpolationModeInvalid; + + SetStatus(DllExports::GdipGetInterpolationMode(nativeGraphics, + &mode)); + + return mode; + } + + Status SetInterpolationMode(IN InterpolationMode interpolationMode) + { + return SetStatus(DllExports::GdipSetInterpolationMode(nativeGraphics, + interpolationMode)); + } + + SmoothingMode GetSmoothingMode() const + { + SmoothingMode smoothingMode = SmoothingModeInvalid; + + SetStatus(DllExports::GdipGetSmoothingMode(nativeGraphics, + &smoothingMode)); + + return smoothingMode; + } + + Status SetSmoothingMode(IN SmoothingMode smoothingMode) + { + return SetStatus(DllExports::GdipSetSmoothingMode(nativeGraphics, + smoothingMode)); + } + + PixelOffsetMode GetPixelOffsetMode() const + { + PixelOffsetMode pixelOffsetMode = PixelOffsetModeInvalid; + + SetStatus(DllExports::GdipGetPixelOffsetMode(nativeGraphics, + &pixelOffsetMode)); + + return pixelOffsetMode; + } + + Status SetPixelOffsetMode(IN PixelOffsetMode pixelOffsetMode) + { + return SetStatus(DllExports::GdipSetPixelOffsetMode(nativeGraphics, + pixelOffsetMode)); + } + + //------------------------------------------------------------------------ + // Manipulate the current world transform + //------------------------------------------------------------------------ + + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetWorldTransform(nativeGraphics, + matrix->nativeMatrix)); + } + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetWorldTransform(nativeGraphics)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyWorldTransform(nativeGraphics, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslateWorldTransform(nativeGraphics, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScaleWorldTransform(nativeGraphics, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotateWorldTransform(nativeGraphics, + angle, order)); + } + + /** + * Return the current world transform + */ + + Status GetTransform(OUT Matrix* matrix) const + { + return SetStatus(DllExports::GdipGetWorldTransform(nativeGraphics, + matrix->nativeMatrix)); + } + + /** + * Manipulate the current page transform + */ + + Status SetPageUnit(IN Unit unit) + { + return SetStatus(DllExports::GdipSetPageUnit(nativeGraphics, + unit)); + } + + Status SetPageScale(IN REAL scale) + { + return SetStatus(DllExports::GdipSetPageScale(nativeGraphics, + scale)); + } + + /** + * Retrieve the current page transform information + * notes @ these are atomic + */ + Unit GetPageUnit() const + { + Unit unit; + + SetStatus(DllExports::GdipGetPageUnit(nativeGraphics, &unit)); + + return unit; + } + + REAL GetPageScale() const + { + REAL scale; + + SetStatus(DllExports::GdipGetPageScale(nativeGraphics, &scale)); + + return scale; + } + + REAL GetDpiX() const + { + REAL dpi; + + SetStatus(DllExports::GdipGetDpiX(nativeGraphics, &dpi)); + + return dpi; + } + + REAL GetDpiY() const + { + REAL dpi; + + SetStatus(DllExports::GdipGetDpiY(nativeGraphics, &dpi)); + + return dpi; + } + + /** + * Transform points in the current graphics context + */ + // float version + Status TransformPoints(IN CoordinateSpace destSpace, + IN CoordinateSpace srcSpace, + IN OUT PointF* pts, + IN INT count) const + { + return SetStatus(DllExports::GdipTransformPoints(nativeGraphics, + destSpace, + srcSpace, + pts, + count)); + } + + // integer version + Status TransformPoints(IN CoordinateSpace destSpace, + IN CoordinateSpace srcSpace, + IN OUT Point* pts, + IN INT count) const + { + + return SetStatus(DllExports::GdipTransformPointsI(nativeGraphics, + destSpace, + srcSpace, + pts, + count)); + } + + //------------------------------------------------------------------------ + // GetNearestColor (for <= 8bpp surfaces) + // Note: alpha is ignored + //------------------------------------------------------------------------ + Status GetNearestColor(IN OUT Color* color) const + { + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + ARGB argb = color->GetValue(); + + Status status = SetStatus(DllExports::GdipGetNearestColor(nativeGraphics, &argb)); + + color->SetValue(argb); + + return status; + } + + /** + * Vector drawing methods + * + * @notes Do we need a set of methods that take + * integer coordinate parameters? + */ + + // float version + Status DrawLine(IN const Pen* pen, + IN REAL x1, + IN REAL y1, + IN REAL x2, + IN REAL y2) + { + return SetStatus(DllExports::GdipDrawLine(nativeGraphics, + pen->nativePen, x1, y1, x2, + y2)); + } + + Status DrawLine(IN const Pen* pen, + IN const PointF& pt1, + IN const PointF& pt2) + { + return DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y); + } + + Status DrawLines(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawLines(nativeGraphics, + pen->nativePen, + points, count)); + } + + // int version + Status DrawLine(IN const Pen* pen, + IN INT x1, + IN INT y1, + IN INT x2, + IN INT y2) + { + return SetStatus(DllExports::GdipDrawLineI(nativeGraphics, + pen->nativePen, + x1, + y1, + x2, + y2)); + } + + Status DrawLine(IN const Pen* pen, + IN const Point& pt1, + IN const Point& pt2) + { + return DrawLine(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y); + } + + Status DrawLines(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawLinesI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // float version + Status DrawArc(IN const Pen* pen, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipDrawArc(nativeGraphics, + pen->nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + Status DrawArc(IN const Pen* pen, + IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + // int version + Status DrawArc(IN const Pen* pen, + IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipDrawArcI(nativeGraphics, + pen->nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + + Status DrawArc(IN const Pen* pen, + IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return DrawArc(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + } + + // float version + Status DrawBezier(IN const Pen* pen, + IN REAL x1, + IN REAL y1, + IN REAL x2, + IN REAL y2, + IN REAL x3, + IN REAL y3, + IN REAL x4, + IN REAL y4) + { + return SetStatus(DllExports::GdipDrawBezier(nativeGraphics, + pen->nativePen, x1, y1, + x2, y2, x3, y3, x4, y4)); + } + + Status DrawBezier(IN const Pen* pen, + IN const PointF& pt1, + IN const PointF& pt2, + IN const PointF& pt3, + IN const PointF& pt4) + { + return DrawBezier(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y, + pt3.X, + pt3.Y, + pt4.X, + pt4.Y); + } + + Status DrawBeziers(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawBeziers(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // int version + Status DrawBezier(IN const Pen* pen, + IN INT x1, + IN INT y1, + IN INT x2, + IN INT y2, + IN INT x3, + IN INT y3, + IN INT x4, + IN INT y4) + { + return SetStatus(DllExports::GdipDrawBezierI(nativeGraphics, + pen->nativePen, + x1, + y1, + x2, + y2, + x3, + y3, + x4, + y4)); + } + + Status DrawBezier(IN const Pen* pen, + IN const Point& pt1, + IN const Point& pt2, + IN const Point& pt3, + IN const Point& pt4) + { + return DrawBezier(pen, + pt1.X, + pt1.Y, + pt2.X, + pt2.Y, + pt3.X, + pt3.Y, + pt4.X, + pt4.Y); + } + + Status DrawBeziers(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawBeziersI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // float version + Status DrawRectangle(IN const Pen* pen, + IN const RectF& rect) + { + return DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status DrawRectangle(IN const Pen* pen, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipDrawRectangle(nativeGraphics, + pen->nativePen, x, y, + width, height)); + } + + Status DrawRectangles(IN const Pen* pen, + IN const RectF* rects, + IN INT count) + { + return SetStatus(DllExports::GdipDrawRectangles(nativeGraphics, + pen->nativePen, + rects, count)); + } + + // integer version + Status DrawRectangle(IN const Pen* pen, + IN const Rect& rect) + { + return DrawRectangle(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height); + } + + Status DrawRectangle(IN const Pen* pen, + IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipDrawRectangleI(nativeGraphics, + pen->nativePen, + x, + y, + width, + height)); + } + + Status DrawRectangles(IN const Pen* pen, + IN const Rect* rects, + IN INT count) + { + return SetStatus(DllExports::GdipDrawRectanglesI(nativeGraphics, + pen->nativePen, + rects, + count)); + } + + // float version + Status DrawEllipse(IN const Pen* pen, + IN const RectF& rect) + { + return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status DrawEllipse(IN const Pen* pen, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipDrawEllipse(nativeGraphics, + pen->nativePen, + x, + y, + width, + height)); + } + + // integer version + Status DrawEllipse(IN const Pen* pen, + IN const Rect& rect) + { + return DrawEllipse(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height); + } + + Status DrawEllipse(IN const Pen* pen, + IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipDrawEllipseI(nativeGraphics, + pen->nativePen, + x, + y, + width, + height)); + } + + // floating point version + Status DrawPie(IN const Pen* pen, + IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return DrawPie(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + } + + Status DrawPie(IN const Pen* pen, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipDrawPie(nativeGraphics, + pen->nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + // integer point version + Status DrawPie(IN const Pen* pen, + IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return DrawPie(pen, + rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + } + + Status DrawPie(IN const Pen* pen, + IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipDrawPieI(nativeGraphics, + pen->nativePen, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + // float version + Status DrawPolygon(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawPolygon(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // integer version + Status DrawPolygon(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawPolygonI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + // float version + Status DrawPath(IN const Pen* pen, + IN const GraphicsPath* path) + { + return SetStatus(DllExports::GdipDrawPath(nativeGraphics, + pen ? pen->nativePen : NULL, + path ? path->nativePath : NULL)); + } + + // float version + Status DrawCurve(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawCurve(nativeGraphics, + pen->nativePen, points, + count)); + } + + Status DrawCurve(IN const Pen* pen, + IN const PointF* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipDrawCurve2(nativeGraphics, + pen->nativePen, points, + count, tension)); + } + + Status DrawCurve(IN const Pen* pen, + IN const PointF* points, + IN INT count, + IN INT offset, + IN INT numberOfSegments, + IN REAL tension = 0.5f) + { + return SetStatus(DllExports::GdipDrawCurve3(nativeGraphics, + pen->nativePen, points, + count, offset, + numberOfSegments, tension)); + } + + // integer version + Status DrawCurve(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawCurveI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + Status DrawCurve(IN const Pen* pen, + IN const Point* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipDrawCurve2I(nativeGraphics, + pen->nativePen, + points, + count, + tension)); + } + + Status DrawCurve(IN const Pen* pen, + IN const Point* points, + IN INT count, + IN INT offset, + IN INT numberOfSegments, + IN REAL tension = 0.5f) + { + return SetStatus(DllExports::GdipDrawCurve3I(nativeGraphics, + pen->nativePen, + points, + count, + offset, + numberOfSegments, + tension)); + } + + // float version + Status DrawClosedCurve(IN const Pen* pen, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawClosedCurve(nativeGraphics, + pen->nativePen, + points, count)); + } + + Status DrawClosedCurve(IN const Pen *pen, + IN const PointF* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipDrawClosedCurve2(nativeGraphics, + pen->nativePen, + points, count, + tension)); + } + + // integer version + Status DrawClosedCurve(IN const Pen* pen, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipDrawClosedCurveI(nativeGraphics, + pen->nativePen, + points, + count)); + } + + Status DrawClosedCurve(IN const Pen *pen, + IN const Point* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipDrawClosedCurve2I(nativeGraphics, + pen->nativePen, + points, + count, + tension)); + } + + Status Clear(IN const Color &color) + { + return SetStatus(DllExports::GdipGraphicsClear( + nativeGraphics, + color.GetValue())); + } + + // float version + Status FillRectangle(IN const Brush* brush, + IN const RectF& rect) + { + return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status FillRectangle(IN const Brush* brush, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipFillRectangle(nativeGraphics, + brush->nativeBrush, x, y, + width, height)); + } + + Status FillRectangles(IN const Brush* brush, + IN const RectF* rects, + IN INT count) + { + return SetStatus(DllExports::GdipFillRectangles(nativeGraphics, + brush->nativeBrush, + rects, count)); + } + + // integer version + Status FillRectangle(IN const Brush* brush, + IN const Rect& rect) + { + return FillRectangle(brush, + rect.X, + rect.Y, + rect.Width, + rect.Height); + } + + Status FillRectangle(IN const Brush* brush, + IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipFillRectangleI(nativeGraphics, + brush->nativeBrush, + x, + y, + width, + height)); + } + + Status FillRectangles(IN const Brush* brush, + IN const Rect* rects, + IN INT count) + { + return SetStatus(DllExports::GdipFillRectanglesI(nativeGraphics, + brush->nativeBrush, + rects, + count)); + } + + // float version + Status FillPolygon(IN const Brush* brush, + IN const PointF* points, + IN INT count) + { + return FillPolygon(brush, points, count, FillModeAlternate); + } + + Status FillPolygon(IN const Brush* brush, + IN const PointF* points, + IN INT count, + IN FillMode fillMode) + { + return SetStatus(DllExports::GdipFillPolygon(nativeGraphics, + brush->nativeBrush, + points, count, fillMode)); + } + + // integer version + Status FillPolygon(IN const Brush* brush, + IN const Point* points, + IN INT count) + { + return FillPolygon(brush, points, count, FillModeAlternate); + } + + Status FillPolygon(IN const Brush* brush, + IN const Point* points, + IN INT count, + IN FillMode fillMode) + { + return SetStatus(DllExports::GdipFillPolygonI(nativeGraphics, + brush->nativeBrush, + points, count, + fillMode)); + } + + // float version + Status FillEllipse(IN const Brush* brush, + IN const RectF& rect) + { + return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status FillEllipse(IN const Brush* brush, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipFillEllipse(nativeGraphics, + brush->nativeBrush, x, y, + width, height)); + } + + // integer version + Status FillEllipse(IN const Brush* brush, + IN const Rect& rect) + { + return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status FillEllipse(IN const Brush* brush, + IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipFillEllipseI(nativeGraphics, + brush->nativeBrush, + x, + y, + width, + height)); + } + + // float version + Status FillPie(IN const Brush* brush, + IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + Status FillPie(IN const Brush* brush, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipFillPie(nativeGraphics, + brush->nativeBrush, x, y, + width, height, startAngle, + sweepAngle)); + } + + // integer version + Status FillPie(IN const Brush* brush, + IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + Status FillPie(IN const Brush* brush, + IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipFillPieI(nativeGraphics, + brush->nativeBrush, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + Status FillPath(IN const Brush* brush, + IN const GraphicsPath* path) + { + return SetStatus(DllExports::GdipFillPath(nativeGraphics, + brush->nativeBrush, + path->nativePath)); + } + + // float version + Status FillClosedCurve(IN const Brush* brush, + IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipFillClosedCurve(nativeGraphics, + brush->nativeBrush, + points, count)); + + } + + Status FillClosedCurve(IN const Brush* brush, + IN const PointF* points, + IN INT count, + IN FillMode fillMode, + IN REAL tension = 0.5f) + { + return SetStatus(DllExports::GdipFillClosedCurve2(nativeGraphics, + brush->nativeBrush, + points, count, + tension, fillMode)); + } + + // integer version + Status FillClosedCurve(IN const Brush* brush, + IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipFillClosedCurveI(nativeGraphics, + brush->nativeBrush, + points, + count)); + } + + Status FillClosedCurve(IN const Brush* brush, + IN const Point* points, + IN INT count, + IN FillMode fillMode, + IN REAL tension = 0.5f) + { + return SetStatus(DllExports::GdipFillClosedCurve2I(nativeGraphics, + brush->nativeBrush, + points, count, + tension, fillMode)); + } + + // float version + Status FillRegion(IN const Brush* brush, + IN const Region* region) + { + return SetStatus(DllExports::GdipFillRegion(nativeGraphics, + brush->nativeBrush, + region->nativeRegion)); + } + + // DrawString and MeasureString + Status + DrawString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + IN const StringFormat *stringFormat, + IN const Brush *brush + ) + { + return SetStatus(DllExports::GdipDrawString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + brush ? brush->nativeBrush : NULL + )); + } + + Status + DrawString( + const WCHAR *string, + INT length, + const Font *font, + const PointF &origin, + const Brush *brush + ) + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipDrawString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &rect, + NULL, + brush ? brush->nativeBrush : NULL + )); + } + + Status + DrawString( + const WCHAR *string, + INT length, + const Font *font, + const PointF &origin, + const StringFormat *stringFormat, + const Brush *brush + ) + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipDrawString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &rect, + stringFormat ? stringFormat->nativeFormat : NULL, + brush ? brush->nativeBrush : NULL + )); + } + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + IN const StringFormat *stringFormat, + OUT RectF *boundingBox, + OUT INT *codepointsFitted = 0, + OUT INT *linesFilled = 0 + ) const + { + return SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + boundingBox, + codepointsFitted, + linesFilled + )); + } + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const SizeF &layoutRectSize, + IN const StringFormat *stringFormat, + OUT SizeF *size, + OUT INT *codepointsFitted = 0, + OUT INT *linesFilled = 0 + ) const + { + RectF layoutRect(0, 0, layoutRectSize.Width, layoutRectSize.Height); + RectF boundingBox; + Status status; + + if (size == NULL) + { + return SetStatus(InvalidParameter); + } + + status = SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + size ? &boundingBox : NULL, + codepointsFitted, + linesFilled + )); + + if (size && status == Ok) + { + size->Width = boundingBox.Width; + size->Height = boundingBox.Height; + } + + return status; + } + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const PointF &origin, + IN const StringFormat *stringFormat, + OUT RectF *boundingBox + ) const + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &rect, + stringFormat ? stringFormat->nativeFormat : NULL, + boundingBox, + NULL, + NULL + )); + } + + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + OUT RectF *boundingBox + ) const + { + return SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &layoutRect, + NULL, + boundingBox, + NULL, + NULL + )); + } + + Status + MeasureString( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const PointF &origin, + OUT RectF *boundingBox + ) const + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipMeasureString( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + &rect, + NULL, + boundingBox, + NULL, + NULL + )); + } + + +#ifdef DCR_USE_NEW_174340 + Status + MeasureCharacterRanges( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + IN const StringFormat *stringFormat, + IN INT regionCount, + OUT Region *regions + ) const + { + if (!regions || regionCount <= 0) + { + return InvalidParameter; + } + + GpRegion **nativeRegions = new GpRegion* [regionCount]; + + if (!nativeRegions) + { + return OutOfMemory; + } + + for (INT i = 0; i < regionCount; i++) + { + nativeRegions[i] = regions[i].nativeRegion; + } + + Status status = SetStatus(DllExports::GdipMeasureCharacterRanges( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + regionCount, + nativeRegions + )); + + delete [] nativeRegions; + + return status; + } +#endif + + +#ifndef DCR_USE_NEW_174340 + Status + MeasureStringRegion( + IN const WCHAR *string, + IN INT length, + IN const Font *font, + IN const RectF &layoutRect, + IN const StringFormat *stringFormat, + IN INT firstCharacterIndex, + IN INT characterCount, + OUT Region *region + ) const + { + if (region == NULL) + { + return SetStatus(InvalidParameter); + } + + return (SetStatus(DllExports::GdipMeasureStringRegion( + nativeGraphics, + string, + length, + font ? font->nativeFont : NULL, + layoutRect, + stringFormat ? stringFormat->nativeFormat : NULL, + firstCharacterIndex, + characterCount, + region->nativeRegion))); + } +#endif + + Status DrawDriverString( + IN const UINT16 *text, + IN INT length, + IN const Font *font, + IN const Brush *brush, + IN const PointF *positions, + IN INT flags, + IN const Matrix *matrix + ) + { + return SetStatus(DllExports::GdipDrawDriverString( + nativeGraphics, + text, + length, + font ? font->nativeFont : NULL, + brush ? brush->nativeBrush : NULL, + positions, + flags, + matrix ? matrix->nativeMatrix : NULL + )); + } + + Status MeasureDriverString( + IN const UINT16 *text, + IN INT length, + IN const Font *font, + IN const PointF *positions, + IN INT flags, + IN const Matrix *matrix, + OUT RectF *boundingBox + ) const + { + return SetStatus(DllExports::GdipMeasureDriverString( + nativeGraphics, + text, + length, + font ? font->nativeFont : NULL, + positions, + flags, + matrix ? matrix->nativeMatrix : NULL, + boundingBox + )); + } + +#ifndef DCR_USE_NEW_168772 + Status DriverStringPointToCodepoint( + IN const UINT16 *text, + IN INT length, + IN const Font *font, + IN const PointF *positions, + IN INT flags, + IN const Matrix *matrix, + IN const PointF &hit, + OUT INT *index, + OUT BOOL *rightEdge, + OUT REAL *distance + ) + { + return SetStatus(DllExports::GdipDriverStringPointToCodepoint( + nativeGraphics, + text, + length, + font ? font->nativeFont : NULL, + positions, + flags, + matrix ? matrix->nativeMatrix : NULL, + &hit, + index, + rightEdge, + distance + )); + } +#endif + + // Draw a cached bitmap on this graphics destination offset by + // x, y. Note this will fail with WrongState if the CachedBitmap + // native format differs from this Graphics. + + Status DrawCachedBitmap(IN CachedBitmap *cb, + IN INT x, + IN INT y) + { + return SetStatus(DllExports::GdipDrawCachedBitmap( + nativeGraphics, + cb->nativeCachedBitmap, + x, y + )); + } + + /** + * Draw images (both bitmap and vector) + */ + // float version + Status DrawImage(IN Image* image, + IN const PointF& point) + { + return DrawImage(image, point.X, point.Y); + } + + Status DrawImage(IN Image* image, + IN REAL x, + IN REAL y) + { + return SetStatus(DllExports::GdipDrawImage(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y)); + } + + Status DrawImage(IN Image* image, + IN const RectF& rect) + { + return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height); + } + + Status DrawImage(IN Image* image, + IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipDrawImageRect(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y, + width, + height)); + } + + // integer version + Status DrawImage(IN Image* image, + IN const Point& point) + { + return DrawImage(image, point.X, point.Y); + } + + Status DrawImage(IN Image* image, + IN INT x, + IN INT y) + { + return SetStatus(DllExports::GdipDrawImageI(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y)); + } + + Status DrawImage(IN Image* image, + IN const Rect& rect) + { + return DrawImage(image, + rect.X, + rect.Y, + rect.Width, + rect.Height); + } + + Status DrawImage(IN Image* image, + IN INT x, + IN INT y, + IN INT width, + IN INT height) { + return SetStatus(DllExports::GdipDrawImageRectI(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y, + width, + height)); + } + + /** + * Affine or perspective blt + * destPoints.length = 3: rect => parallelogram + * destPoints[0] <=> top-left corner of the source rectangle + * destPoints[1] <=> top-right corner + * destPoints[2] <=> bottom-left corner + * destPoints.length = 4: rect => quad + * destPoints[3] <=> bottom-right corner + * + * @notes Perspective blt only works for bitmap images. + */ + Status DrawImage(IN Image* image, + IN const PointF* destPoints, + IN INT count) + { + if (count != 3 && count != 4) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipDrawImagePoints(nativeGraphics, + image ? image->nativeImage + : NULL, + destPoints, count)); + } + + Status DrawImage(IN Image* image, + IN const Point* destPoints, + IN INT count) + { + if (count != 3 && count != 4) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipDrawImagePointsI(nativeGraphics, + image ? image->nativeImage + : NULL, + destPoints, + count)); + } + + /** + * We need another set of methods similar to the ones above + * that take an additional Rect parameter to specify the + * portion of the source image to be drawn. + */ + // float version + Status DrawImage(IN Image* image, + IN REAL x, + IN REAL y, + IN REAL srcx, + IN REAL srcy, + IN REAL srcwidth, + IN REAL srcheight, + IN Unit srcUnit) + { + return SetStatus(DllExports::GdipDrawImagePointRect(nativeGraphics, + image ? image->nativeImage + : NULL, + x, y, + srcx, srcy, + srcwidth, srcheight, srcUnit)); + } + + Status DrawImage(IN Image* image, + IN const RectF& destRect, + IN REAL srcx, + IN REAL srcy, + IN REAL srcwidth, + IN REAL srcheight, + IN Unit srcUnit, + IN const ImageAttributes* imageAttributes = NULL, + IN DrawImageAbort callback = NULL, + IN VOID* callbackData = NULL) + { + return SetStatus(DllExports::GdipDrawImageRectRect(nativeGraphics, + image ? image->nativeImage + : NULL, + destRect.X, + destRect.Y, + destRect.Width, + destRect.Height, + srcx, srcy, + srcwidth, srcheight, + srcUnit, + imageAttributes + ? imageAttributes->nativeImageAttr + : NULL, + callback, + callbackData)); + } + + Status DrawImage(IN Image* image, + IN const PointF* destPoints, + IN INT count, + IN REAL srcx, + IN REAL srcy, + IN REAL srcwidth, + IN REAL srcheight, + IN Unit srcUnit, + IN const ImageAttributes* imageAttributes = NULL, + IN DrawImageAbort callback = NULL, + IN VOID* callbackData = NULL) + { + return SetStatus(DllExports::GdipDrawImagePointsRect(nativeGraphics, + image ? image->nativeImage + : NULL, + destPoints, count, + srcx, srcy, + srcwidth, + srcheight, + srcUnit, + imageAttributes + ? imageAttributes->nativeImageAttr + : NULL, + callback, + callbackData)); + } + + // integer version + Status DrawImage(IN Image* image, + IN INT x, + IN INT y, + IN INT srcx, + IN INT srcy, + IN INT srcwidth, + IN INT srcheight, + IN Unit srcUnit) + { + return SetStatus(DllExports::GdipDrawImagePointRectI(nativeGraphics, + image ? image->nativeImage + : NULL, + x, + y, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit)); + } + + Status DrawImage(IN Image* image, + IN const Rect& destRect, + IN INT srcx, + IN INT srcy, + IN INT srcwidth, + IN INT srcheight, + IN Unit srcUnit, + IN const ImageAttributes* imageAttributes = NULL, + IN DrawImageAbort callback = NULL, + IN VOID* callbackData = NULL) + { + return SetStatus(DllExports::GdipDrawImageRectRectI(nativeGraphics, + image ? image->nativeImage + : NULL, + destRect.X, + destRect.Y, + destRect.Width, + destRect.Height, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit, + imageAttributes + ? imageAttributes->nativeImageAttr + : NULL, + callback, + callbackData)); + } + + Status DrawImage(IN Image* image, + IN const Point* destPoints, + IN INT count, + IN INT srcx, + IN INT srcy, + IN INT srcwidth, + IN INT srcheight, + IN Unit srcUnit, + IN const ImageAttributes* imageAttributes = NULL, + IN DrawImageAbort callback = NULL, + IN VOID* callbackData = NULL) + { + return SetStatus(DllExports::GdipDrawImagePointsRectI(nativeGraphics, + image ? image->nativeImage + : NULL, + destPoints, + count, + srcx, + srcy, + srcwidth, + srcheight, + srcUnit, + imageAttributes + ? imageAttributes->nativeImageAttr + : NULL, + callback, + callbackData)); + } + + // The following methods are for playing an EMF+ to a graphics + // via the enumeration interface. Each record of the EMF+ is + // sent to the callback (along with the callbackData). Then + // the callback can invoke the Metafile::PlayRecord method + // to play the particular record. + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const PointF & destPoint, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestPoint( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoint, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Point & destPoint, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestPointI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoint, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const RectF & destRect, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestRect( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destRect, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Rect & destRect, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestRectI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destRect, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const PointF * destPoints, + IN INT count, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestPoints( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoints, + count, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Point * destPoints, + IN INT count, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileDestPointsI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoints, + count, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const PointF & destPoint, + IN const RectF & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoint( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoint, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Point & destPoint, + IN const Rect & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoint, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const RectF & destRect, + IN const RectF & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestRect( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destRect, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Rect & destRect, + IN const Rect & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestRectI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destRect, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const PointF * destPoints, + IN INT count, + IN const RectF & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoints( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoints, + count, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + Status + EnumerateMetafile( + IN const Metafile * metafile, + IN const Point * destPoints, + IN INT count, + IN const Rect & srcRect, + IN Unit srcUnit, + IN EnumerateMetafileProc callback, + IN VOID * callbackData = NULL, + IN const ImageAttributes * imageAttributes = NULL + ) + { + return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointsI( + nativeGraphics, + (const GpMetafile *)(metafile ? metafile->nativeImage:NULL), + destPoints, + count, + srcRect, + srcUnit, + callback, + callbackData, + imageAttributes ? imageAttributes->nativeImageAttr : NULL)); + } + + /** + * Clipping region operations + * + * @notes Simply incredible redundancy here. + */ + Status SetClip(IN const Graphics* g, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipGraphics(nativeGraphics, + g->nativeGraphics, + combineMode)); + } + + Status SetClip(IN const RectF& rect, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + combineMode)); + } + + Status SetClip(IN const Rect& rect, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + combineMode)); + } + + Status SetClip(IN const GraphicsPath* path, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipPath(nativeGraphics, + path->nativePath, + combineMode)); + } + + Status SetClip(IN const Region* region, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, + region->nativeRegion, + combineMode)); + } + + // This is different than the other SetClip methods because it assumes + // that the HRGN is already in device units, so it doesn't transform + // the coordinates in the HRGN. + Status SetClip(IN HRGN hRgn, + IN CombineMode combineMode = CombineModeReplace) + { + return SetStatus(DllExports::GdipSetClipHrgn(nativeGraphics, hRgn, + combineMode)); + } + + Status IntersectClip(IN const RectF& rect) + { + return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeIntersect)); + } + + Status IntersectClip(IN const Rect& rect) + { + return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeIntersect)); + } + + Status IntersectClip(IN const Region* region) + { + return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, + region->nativeRegion, + CombineModeIntersect)); + } + + Status ExcludeClip(IN const RectF& rect) + { + return SetStatus(DllExports::GdipSetClipRect(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeExclude)); + } + + Status ExcludeClip(IN const Rect& rect) + { + return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics, + rect.X, rect.Y, + rect.Width, rect.Height, + CombineModeExclude)); + } + + Status ExcludeClip(IN const Region* region) + { + return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics, + region->nativeRegion, + CombineModeExclude)); + } + + Status ResetClip() + { + return SetStatus(DllExports::GdipResetClip(nativeGraphics)); + } + + Status TranslateClip(IN REAL dx, + IN REAL dy) + { + return SetStatus(DllExports::GdipTranslateClip(nativeGraphics, dx, dy)); + } + + Status TranslateClip(IN INT dx, + IN INT dy) + { + return SetStatus(DllExports::GdipTranslateClipI(nativeGraphics, + dx, dy)); + } + + /** + * GetClip region from graphics context + */ + Status GetClip(OUT Region* region) const + { + return SetStatus(DllExports::GdipGetClip(nativeGraphics, + region->nativeRegion)); + } + + /** + * Hit testing operations + */ + Status GetClipBounds(OUT RectF* rect) const + { + return SetStatus(DllExports::GdipGetClipBounds(nativeGraphics, rect)); + } + + Status GetClipBounds(OUT Rect* rect) const + { + return SetStatus(DllExports::GdipGetClipBoundsI(nativeGraphics, rect)); + } + + BOOL IsClipEmpty() const + { + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsClipEmpty(nativeGraphics, &booln)); + + return booln; + } + + Status GetVisibleClipBounds(OUT RectF *rect) const + { + + return SetStatus(DllExports::GdipGetVisibleClipBounds(nativeGraphics, + rect)); + } + + Status GetVisibleClipBounds(OUT Rect *rect) const + { + return SetStatus(DllExports::GdipGetVisibleClipBoundsI(nativeGraphics, + rect)); + } + + BOOL IsVisibleClipEmpty() const + { + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisibleClipEmpty(nativeGraphics, &booln)); + + return booln; + } + + BOOL IsVisible(IN INT x, + IN INT y) const + { + return IsVisible(Point(x,y)); + } + + BOOL IsVisible(IN const Point& point) const + { + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisiblePointI(nativeGraphics, + point.X, + point.Y, + &booln)); + + return booln; + } + + BOOL IsVisible(IN INT x, + IN INT y, + IN INT width, + IN INT height) const + { + return IsVisible(Rect(x, y, width, height)); + } + + BOOL IsVisible(IN const Rect& rect) const + { + + BOOL booln = TRUE; + + SetStatus(DllExports::GdipIsVisibleRectI(nativeGraphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + &booln)); + return booln; + } + + BOOL IsVisible(IN REAL x, + IN REAL y) const + { + return IsVisible(PointF(x, y)); + } + + BOOL IsVisible(IN const PointF& point) const + { + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisiblePoint(nativeGraphics, + point.X, + point.Y, + &booln)); + + return booln; + } + + BOOL IsVisible(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) const + { + return IsVisible(RectF(x, y, width, height)); + } + + BOOL IsVisible(IN const RectF& rect) const + { + BOOL booln = TRUE; + + SetStatus(DllExports::GdipIsVisibleRect(nativeGraphics, + rect.X, + rect.Y, + rect.Width, + rect.Height, + &booln)); + return booln; + } + + /** + * Save/restore graphics state + */ + GraphicsState Save() const + { + GraphicsState gstate; + + SetStatus(DllExports::GdipSaveGraphics(nativeGraphics, &gstate)); + + return gstate; + } + + Status Restore(IN GraphicsState gstate) + { + return SetStatus(DllExports::GdipRestoreGraphics(nativeGraphics, + gstate)); + } + + /** + * Begin and end container drawing + */ + GraphicsContainer BeginContainer(IN const RectF &dstrect, + IN const RectF &srcrect, + IN Unit unit) + { + GraphicsContainer state; + + SetStatus(DllExports::GdipBeginContainer(nativeGraphics, &dstrect, + &srcrect, unit, &state)); + + return state; + } + + /** + * Begin and end container drawing + */ + GraphicsContainer BeginContainer(IN const Rect &dstrect, + IN const Rect &srcrect, + IN Unit unit) + { + GraphicsContainer state; + + SetStatus(DllExports::GdipBeginContainerI(nativeGraphics, &dstrect, + &srcrect, unit, &state)); + + return state; + } + + GraphicsContainer BeginContainer() + { + GraphicsContainer state; + + SetStatus(DllExports::GdipBeginContainer2(nativeGraphics, &state)); + + return state; + } + + Status EndContainer(IN GraphicsContainer state) + { + return SetStatus(DllExports::GdipEndContainer(nativeGraphics, state)); + } + + // only valid when recording metafiles + Status AddMetafileComment(IN const BYTE * data, + IN UINT sizeData) + { + return SetStatus(DllExports::GdipComment(nativeGraphics, sizeData, data)); + } + + /** + * Get/SetLayout + * Support for Middle East localization (right-to-left mirroring) + */ + GraphicsLayout GetLayout() const + { + GraphicsLayout layout; + + SetStatus(DllExports::GdipGetGraphicsLayout(nativeGraphics, &layout)); + + return layout; + } + + Status SetLayout(IN const GraphicsLayout layout) + { + return SetStatus( + DllExports::GdipSetGraphicsLayout(nativeGraphics, layout) + ); + } + + static HPALETTE GetHalftonePalette() + { + return DllExports::GdipCreateHalftonePalette(); + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +protected: + +#ifdef DCR_USE_NEW_250932 + +private: + Graphics(const Graphics &); + Graphics& operator=(const Graphics &); +protected: + +#else + + Graphics(const Graphics& graphics) + { + graphics; + SetStatus(NotImplemented); + } + + Graphics& operator=(const Graphics& graphics) + { + graphics; + SetStatus(NotImplemented); + return *this; + } + +#endif + + Graphics(GpGraphics* graphics) + { + lastResult = Ok; + SetNativeGraphics(graphics); + } + + VOID SetNativeGraphics(GpGraphics *graphics) + { + this->nativeGraphics = graphics; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + + // Methods necessary to subclass Graphics for extension test. + + GpGraphics* GetNativeGraphics() const + { + return this->nativeGraphics; + } + + GpPen* GetNativePen(const Pen* pen) + { + return pen->nativePen; + } + +protected: + GpGraphics* nativeGraphics; + mutable Status lastResult; + +}; + +//---------------------------------------------------------------------------- +// Extra implementation of GraphicsPath methods that use Graphics +//---------------------------------------------------------------------------- + +/** + * Get the bounds of the path object with the given transform. + * This is not always the tightest bounds. + */ + +inline Status +GraphicsPath::GetBounds( + OUT RectF* bounds, + IN const Matrix* matrix, + IN const Pen* pen) const +{ + GpMatrix* nativeMatrix = NULL; + GpPen* nativePen = NULL; + + if (matrix) + nativeMatrix = matrix->nativeMatrix; + + if (pen) + nativePen = pen->nativePen; + + return SetStatus(DllExports::GdipGetPathWorldBounds(nativePath, bounds, + nativeMatrix, nativePen)); +} + +// integer version +inline Status +GraphicsPath::GetBounds( + OUT Rect* bounds, + IN const Matrix* matrix, + IN const Pen* pen +) const +{ + GpMatrix* nativeMatrix = NULL; + GpPen* nativePen = NULL; + + if (matrix) + nativeMatrix = matrix->nativeMatrix; + + if (pen) + nativePen = pen->nativePen; + + return SetStatus(DllExports::GdipGetPathWorldBoundsI(nativePath, bounds, + nativeMatrix, nativePen)); +} + +//---------------------------------------------------------------------------- +// Hit testing operations +//---------------------------------------------------------------------------- + +inline BOOL +GraphicsPath::IsVisible( + IN REAL x, + IN REAL y, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + GpGraphics* nativeGraphics = NULL; + + if (g) + nativeGraphics = g->nativeGraphics; + + SetStatus(DllExports::GdipIsVisiblePathPoint(nativePath, + x, y, nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +GraphicsPath::IsVisible( + IN INT x, + IN INT y, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + GpGraphics* nativeGraphics = NULL; + + if (g) + nativeGraphics = g->nativeGraphics; + + SetStatus(DllExports::GdipIsVisiblePathPointI(nativePath, + x, y, nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +GraphicsPath::IsOutlineVisible( + IN REAL x, + IN REAL y, + IN const Pen* pen, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + GpGraphics* nativeGraphics = NULL; + GpPen* nativePen = NULL; + + if(g) + nativeGraphics = g->nativeGraphics; + if(pen) + nativePen = pen->nativePen; + + SetStatus(DllExports::GdipIsOutlineVisiblePathPoint(nativePath, + x, y, nativePen, nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +GraphicsPath::IsOutlineVisible( + IN INT x, + IN INT y, + IN const Pen* pen, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + GpGraphics* nativeGraphics = NULL; + GpPen* nativePen = NULL; + + if(g) + nativeGraphics = g->nativeGraphics; + if(pen) + nativePen = pen->nativePen; + + SetStatus(DllExports::GdipIsOutlineVisiblePathPointI(nativePath, + x, y, nativePen, nativeGraphics, + &booln)); + return booln; +} + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusHeaders.h b/core/src/fxge/Microsoft SDK/include/GdiPlusHeaders.h index 215c4d09ea..9efcd89da2 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusHeaders.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusHeaders.h @@ -1,793 +1,793 @@ -/**************************************************************************\ -* -* 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 - Status InstallFontFile(IN const WCHAR* filename); - Status UninstallFontFile(IN const WCHAR* filename); -#endif - Status SetStatus(Status status) const ; -}; - - -class PrivateFontCollection : public FontCollection -{ -public: - PrivateFontCollection(); - ~PrivateFontCollection(); - - Status AddFontFile(IN const WCHAR* filename); - Status AddMemoryFont(IN const VOID* memory, - IN INT length); - -#ifdef DCR_USE_NEW_250932 - -private: - PrivateFontCollection(const PrivateFontCollection &); - PrivateFontCollection& operator=(const PrivateFontCollection &); - -#endif -}; - - -//-------------------------------------------------------------------------- -// Abstract base class for bitmap image and metafile -//-------------------------------------------------------------------------- - -// !!! Note: -// Include the class declarations here and have the inline class -// implementation in a separate file. This is done to resolve a -// circular dependency since one of the Bitmap methods needs to -// access the private member nativeGraphics of the Graphics object. - -class Image : public GdiplusBase -{ -public: - friend class Brush; - friend class TextureBrush; - friend class Graphics; - -#ifndef DCR_USE_NEW_140782 - Image( - IN const WCHAR* filename - ); - - Image( - IN IStream* stream - ); - - static Image* FromFile( - IN const WCHAR* filename - ); - - static Image* FromStream( - IN IStream* stream - ); -#else - Image( - IN const WCHAR* filename, - IN BOOL useEmbeddedColorManagement = FALSE - ); - - Image( - IN IStream* stream, - IN BOOL useEmbeddedColorManagement = FALSE - ); - - static Image* FromFile( - IN const WCHAR* filename, - IN BOOL useEmbeddedColorManagement = FALSE - ); - - static Image* FromStream( - IN IStream* stream, - IN BOOL useEmbeddedColorManagement = FALSE - ); -#endif - - virtual ~Image(); - virtual Image* Clone(); - - Status Save(IN const WCHAR* filename, - IN const CLSID* clsidEncoder, - IN const EncoderParameters *encoderParams = NULL); - Status Save(IN IStream* stream, - IN const CLSID* clsidEncoder, - IN const EncoderParameters *encoderParams = NULL); - Status SaveAdd(IN const EncoderParameters* encoderParams); - Status SaveAdd(IN Image* newImage, - IN const EncoderParameters* encoderParams); - - ImageType GetType() const; - Status GetPhysicalDimension(OUT SizeF* size); - Status GetBounds(OUT RectF* srcRect, - OUT Unit* srcUnit); - - UINT GetWidth(); - UINT GetHeight(); - REAL GetHorizontalResolution(); - REAL GetVerticalResolution(); - UINT GetFlags(); - Status GetRawFormat(OUT GUID *format); - PixelFormat GetPixelFormat(); - - INT GetPaletteSize(); - Status GetPalette(OUT ColorPalette* palette, - IN INT size); - Status SetPalette(IN const ColorPalette* palette); - - Image* GetThumbnailImage(IN UINT thumbWidth, - IN UINT thumbHeight, - IN GetThumbnailImageAbort callback = NULL, - IN VOID* callbackData = NULL); - UINT GetFrameDimensionsCount(); - Status GetFrameDimensionsList(OUT GUID* dimensionIDs, - IN UINT count); - UINT GetFrameCount(IN const GUID* dimensionID); - Status SelectActiveFrame(IN const GUID* dimensionID, - IN UINT frameIndex); - Status RotateFlip(IN RotateFlipType rotateFlipType); - UINT GetPropertyCount(); - Status GetPropertyIdList(IN UINT numOfProperty, - OUT PROPID* list); - UINT GetPropertyItemSize(IN PROPID propId); - Status GetPropertyItem(IN PROPID propId, - IN UINT propSize, - OUT PropertyItem* buffer); - Status GetPropertySize(OUT UINT* totalBufferSize, - OUT UINT* numProperties); - Status GetAllPropertyItems(IN UINT totalBufferSize, - IN UINT numProperties, - OUT PropertyItem* allItems); - Status RemovePropertyItem(IN PROPID propId); - Status SetPropertyItem(IN const PropertyItem* item); - - UINT GetEncoderParameterListSize(IN const CLSID* clsidEncoder); - Status GetEncoderParameterList(IN const CLSID* clsidEncoder, - IN UINT size, - OUT EncoderParameters* buffer); - - // Support for Middle East localization (right-to-left mirroring) - ImageLayout GetLayout() const; - Status SetLayout(IN const ImageLayout layout); - - Status GetLastStatus() const; - -protected: - - Image() {} - - Image(GpImage *nativeImage, Status status); - - VOID SetNativeImage(GpImage* nativeImage); - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - - GpImage* nativeImage; - mutable Status lastResult; - mutable Status loadStatus; - -#ifdef DCR_USE_NEW_250932 - -private: - -#else - -protected: - -#endif - - // Disable copy constructor and assignment operator - - Image(IN const Image& C); - Image& operator=(IN const Image& C); -}; - -class Bitmap : public Image -{ -public: - friend class Image; - friend class CachedBitmap; - - Bitmap( - IN const WCHAR *filename, - IN BOOL useEmbeddedColorManagement = FALSE - ); - - Bitmap( - IN IStream *stream, - IN BOOL useEmbeddedColorManagement = FALSE - ); - - static Bitmap* FromFile( - IN const WCHAR *filename, - IN BOOL useEmbeddedColorManagement = FALSE - ); - - static Bitmap* FromStream( - IN IStream *stream, - IN BOOL useEmbeddedColorManagement = FALSE - ); - - Bitmap(IN INT width, - IN INT height, - IN INT stride, PixelFormat format, - IN BYTE* scan0); - Bitmap(IN INT width, - IN INT height, - IN PixelFormat format = PixelFormat32bppARGB); - Bitmap(IN INT width, - IN INT height, - IN Graphics* target); - - Bitmap* Clone(IN const Rect& rect, - IN PixelFormat format); - Bitmap* Clone(IN INT x, - IN INT y, - IN INT width, - IN INT height, - IN PixelFormat format); - Bitmap* Clone(IN const RectF& rect, - IN PixelFormat format); - Bitmap* Clone(IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height, - IN PixelFormat format); - - Status LockBits(IN const Rect& rect, - IN UINT flags, - IN PixelFormat format, - OUT BitmapData* lockedBitmapData); - Status UnlockBits(IN BitmapData* lockedBitmapData); - Status GetPixel(IN INT x, - IN INT y, - OUT Color *color); - Status SetPixel(IN INT x, - IN INT y, - IN const Color &color); - Status SetResolution(IN REAL xdpi, - IN REAL ydpi); - - // GDI interop: - - Bitmap(IN IDirectDrawSurface7* surface); - Bitmap(IN const BITMAPINFO* gdiBitmapInfo, - IN VOID* gdiBitmapData); - Bitmap(IN HBITMAP hbm, - IN HPALETTE hpal); - Bitmap(IN HICON hicon); - Bitmap(IN HINSTANCE hInstance, - IN const WCHAR * bitmapName); - static Bitmap* FromDirectDrawSurface7(IN IDirectDrawSurface7* surface); - static Bitmap* FromBITMAPINFO(IN const BITMAPINFO* gdiBitmapInfo, - IN VOID* gdiBitmapData); - static Bitmap* FromHBITMAP(IN HBITMAP hbm, - IN HPALETTE hpal); - static Bitmap* FromHICON(IN HICON hicon); - static Bitmap* FromResource(IN HINSTANCE hInstance, - IN const WCHAR * bitmapName); - - Status GetHBITMAP(IN const Color& colorBackground, - OUT HBITMAP *hbmReturn); - Status GetHICON(HICON *hicon); - -#ifdef DCR_USE_NEW_250932 -private: - Bitmap(const Bitmap &); - Bitmap& operator=(const Bitmap &); -#endif - -protected: - Bitmap(GpBitmap *nativeBitmap); -}; - -class CustomLineCap : public GdiplusBase -{ -public: - friend class Pen; - - CustomLineCap( - IN const GraphicsPath* fillPath, - IN const GraphicsPath* strokePath, - IN LineCap baseCap = LineCapFlat, - IN REAL baseInset = 0 - ); - virtual ~CustomLineCap(); - - CustomLineCap* Clone() const; - - Status SetStrokeCap(IN LineCap strokeCap) - { - // This changes both start and and caps. - - return SetStrokeCaps(strokeCap, strokeCap); - } - - Status SetStrokeCaps(IN LineCap startCap, - IN LineCap endCap); - Status GetStrokeCaps(OUT LineCap* startCap, - OUT LineCap* endCap) const; - Status SetStrokeJoin(IN LineJoin lineJoin); - LineJoin GetStrokeJoin() const; - Status SetBaseCap(IN LineCap baseCap); - LineCap GetBaseCap() const; - Status SetBaseInset(IN REAL inset); - REAL GetBaseInset() const; - Status SetWidthScale(IN REAL widthScale); - REAL GetWidthScale() const; - -protected: - CustomLineCap(); - -#ifdef DCR_USE_NEW_250932 - -private: - CustomLineCap(const CustomLineCap &); - CustomLineCap& operator=(const CustomLineCap &); -protected: - -#else - - CustomLineCap(const CustomLineCap& customLineCap) - { - customLineCap; - SetStatus(NotImplemented); - } - - CustomLineCap& operator=(const CustomLineCap& customLineCap) - { - customLineCap; - SetStatus(NotImplemented); - return *this; - } - -#endif - - CustomLineCap(GpCustomLineCap* nativeCap, Status status) - { - lastResult = status; - SetNativeCap(nativeCap); - } - - VOID SetNativeCap(GpCustomLineCap* nativeCap) - { - this->nativeCap = nativeCap; - } - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - -protected: - GpCustomLineCap* nativeCap; - mutable Status lastResult; -}; - -class CachedBitmap : public GdiplusBase -{ - friend Graphics; - -public: - CachedBitmap(IN Bitmap *bitmap, - IN Graphics *graphics); - virtual ~CachedBitmap(); - - Status GetLastStatus() const; - -#ifdef DCR_USE_NEW_250932 - -private: - CachedBitmap(const CachedBitmap &); - CachedBitmap& operator=(const CachedBitmap &); - -#endif - -protected: - GpCachedBitmap *nativeCachedBitmap; - mutable Status lastResult; -}; - -#endif // !_GDIPLUSHEADERS.HPP +/**************************************************************************\ +* +* 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 + Status InstallFontFile(IN const WCHAR* filename); + Status UninstallFontFile(IN const WCHAR* filename); +#endif + Status SetStatus(Status status) const ; +}; + + +class PrivateFontCollection : public FontCollection +{ +public: + PrivateFontCollection(); + ~PrivateFontCollection(); + + Status AddFontFile(IN const WCHAR* filename); + Status AddMemoryFont(IN const VOID* memory, + IN INT length); + +#ifdef DCR_USE_NEW_250932 + +private: + PrivateFontCollection(const PrivateFontCollection &); + PrivateFontCollection& operator=(const PrivateFontCollection &); + +#endif +}; + + +//-------------------------------------------------------------------------- +// Abstract base class for bitmap image and metafile +//-------------------------------------------------------------------------- + +// !!! Note: +// Include the class declarations here and have the inline class +// implementation in a separate file. This is done to resolve a +// circular dependency since one of the Bitmap methods needs to +// access the private member nativeGraphics of the Graphics object. + +class Image : public GdiplusBase +{ +public: + friend class Brush; + friend class TextureBrush; + friend class Graphics; + +#ifndef DCR_USE_NEW_140782 + Image( + IN const WCHAR* filename + ); + + Image( + IN IStream* stream + ); + + static Image* FromFile( + IN const WCHAR* filename + ); + + static Image* FromStream( + IN IStream* stream + ); +#else + Image( + IN const WCHAR* filename, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + Image( + IN IStream* stream, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + static Image* FromFile( + IN const WCHAR* filename, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + static Image* FromStream( + IN IStream* stream, + IN BOOL useEmbeddedColorManagement = FALSE + ); +#endif + + virtual ~Image(); + virtual Image* Clone(); + + Status Save(IN const WCHAR* filename, + IN const CLSID* clsidEncoder, + IN const EncoderParameters *encoderParams = NULL); + Status Save(IN IStream* stream, + IN const CLSID* clsidEncoder, + IN const EncoderParameters *encoderParams = NULL); + Status SaveAdd(IN const EncoderParameters* encoderParams); + Status SaveAdd(IN Image* newImage, + IN const EncoderParameters* encoderParams); + + ImageType GetType() const; + Status GetPhysicalDimension(OUT SizeF* size); + Status GetBounds(OUT RectF* srcRect, + OUT Unit* srcUnit); + + UINT GetWidth(); + UINT GetHeight(); + REAL GetHorizontalResolution(); + REAL GetVerticalResolution(); + UINT GetFlags(); + Status GetRawFormat(OUT GUID *format); + PixelFormat GetPixelFormat(); + + INT GetPaletteSize(); + Status GetPalette(OUT ColorPalette* palette, + IN INT size); + Status SetPalette(IN const ColorPalette* palette); + + Image* GetThumbnailImage(IN UINT thumbWidth, + IN UINT thumbHeight, + IN GetThumbnailImageAbort callback = NULL, + IN VOID* callbackData = NULL); + UINT GetFrameDimensionsCount(); + Status GetFrameDimensionsList(OUT GUID* dimensionIDs, + IN UINT count); + UINT GetFrameCount(IN const GUID* dimensionID); + Status SelectActiveFrame(IN const GUID* dimensionID, + IN UINT frameIndex); + Status RotateFlip(IN RotateFlipType rotateFlipType); + UINT GetPropertyCount(); + Status GetPropertyIdList(IN UINT numOfProperty, + OUT PROPID* list); + UINT GetPropertyItemSize(IN PROPID propId); + Status GetPropertyItem(IN PROPID propId, + IN UINT propSize, + OUT PropertyItem* buffer); + Status GetPropertySize(OUT UINT* totalBufferSize, + OUT UINT* numProperties); + Status GetAllPropertyItems(IN UINT totalBufferSize, + IN UINT numProperties, + OUT PropertyItem* allItems); + Status RemovePropertyItem(IN PROPID propId); + Status SetPropertyItem(IN const PropertyItem* item); + + UINT GetEncoderParameterListSize(IN const CLSID* clsidEncoder); + Status GetEncoderParameterList(IN const CLSID* clsidEncoder, + IN UINT size, + OUT EncoderParameters* buffer); + + // Support for Middle East localization (right-to-left mirroring) + ImageLayout GetLayout() const; + Status SetLayout(IN const ImageLayout layout); + + Status GetLastStatus() const; + +protected: + + Image() {} + + Image(GpImage *nativeImage, Status status); + + VOID SetNativeImage(GpImage* nativeImage); + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + + GpImage* nativeImage; + mutable Status lastResult; + mutable Status loadStatus; + +#ifdef DCR_USE_NEW_250932 + +private: + +#else + +protected: + +#endif + + // Disable copy constructor and assignment operator + + Image(IN const Image& C); + Image& operator=(IN const Image& C); +}; + +class Bitmap : public Image +{ +public: + friend class Image; + friend class CachedBitmap; + + Bitmap( + IN const WCHAR *filename, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + Bitmap( + IN IStream *stream, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + static Bitmap* FromFile( + IN const WCHAR *filename, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + static Bitmap* FromStream( + IN IStream *stream, + IN BOOL useEmbeddedColorManagement = FALSE + ); + + Bitmap(IN INT width, + IN INT height, + IN INT stride, PixelFormat format, + IN BYTE* scan0); + Bitmap(IN INT width, + IN INT height, + IN PixelFormat format = PixelFormat32bppARGB); + Bitmap(IN INT width, + IN INT height, + IN Graphics* target); + + Bitmap* Clone(IN const Rect& rect, + IN PixelFormat format); + Bitmap* Clone(IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN PixelFormat format); + Bitmap* Clone(IN const RectF& rect, + IN PixelFormat format); + Bitmap* Clone(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN PixelFormat format); + + Status LockBits(IN const Rect& rect, + IN UINT flags, + IN PixelFormat format, + OUT BitmapData* lockedBitmapData); + Status UnlockBits(IN BitmapData* lockedBitmapData); + Status GetPixel(IN INT x, + IN INT y, + OUT Color *color); + Status SetPixel(IN INT x, + IN INT y, + IN const Color &color); + Status SetResolution(IN REAL xdpi, + IN REAL ydpi); + + // GDI interop: + + Bitmap(IN IDirectDrawSurface7* surface); + Bitmap(IN const BITMAPINFO* gdiBitmapInfo, + IN VOID* gdiBitmapData); + Bitmap(IN HBITMAP hbm, + IN HPALETTE hpal); + Bitmap(IN HICON hicon); + Bitmap(IN HINSTANCE hInstance, + IN const WCHAR * bitmapName); + static Bitmap* FromDirectDrawSurface7(IN IDirectDrawSurface7* surface); + static Bitmap* FromBITMAPINFO(IN const BITMAPINFO* gdiBitmapInfo, + IN VOID* gdiBitmapData); + static Bitmap* FromHBITMAP(IN HBITMAP hbm, + IN HPALETTE hpal); + static Bitmap* FromHICON(IN HICON hicon); + static Bitmap* FromResource(IN HINSTANCE hInstance, + IN const WCHAR * bitmapName); + + Status GetHBITMAP(IN const Color& colorBackground, + OUT HBITMAP *hbmReturn); + Status GetHICON(HICON *hicon); + +#ifdef DCR_USE_NEW_250932 +private: + Bitmap(const Bitmap &); + Bitmap& operator=(const Bitmap &); +#endif + +protected: + Bitmap(GpBitmap *nativeBitmap); +}; + +class CustomLineCap : public GdiplusBase +{ +public: + friend class Pen; + + CustomLineCap( + IN const GraphicsPath* fillPath, + IN const GraphicsPath* strokePath, + IN LineCap baseCap = LineCapFlat, + IN REAL baseInset = 0 + ); + virtual ~CustomLineCap(); + + CustomLineCap* Clone() const; + + Status SetStrokeCap(IN LineCap strokeCap) + { + // This changes both start and and caps. + + return SetStrokeCaps(strokeCap, strokeCap); + } + + Status SetStrokeCaps(IN LineCap startCap, + IN LineCap endCap); + Status GetStrokeCaps(OUT LineCap* startCap, + OUT LineCap* endCap) const; + Status SetStrokeJoin(IN LineJoin lineJoin); + LineJoin GetStrokeJoin() const; + Status SetBaseCap(IN LineCap baseCap); + LineCap GetBaseCap() const; + Status SetBaseInset(IN REAL inset); + REAL GetBaseInset() const; + Status SetWidthScale(IN REAL widthScale); + REAL GetWidthScale() const; + +protected: + CustomLineCap(); + +#ifdef DCR_USE_NEW_250932 + +private: + CustomLineCap(const CustomLineCap &); + CustomLineCap& operator=(const CustomLineCap &); +protected: + +#else + + CustomLineCap(const CustomLineCap& customLineCap) + { + customLineCap; + SetStatus(NotImplemented); + } + + CustomLineCap& operator=(const CustomLineCap& customLineCap) + { + customLineCap; + SetStatus(NotImplemented); + return *this; + } + +#endif + + CustomLineCap(GpCustomLineCap* nativeCap, Status status) + { + lastResult = status; + SetNativeCap(nativeCap); + } + + VOID SetNativeCap(GpCustomLineCap* nativeCap) + { + this->nativeCap = nativeCap; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpCustomLineCap* nativeCap; + mutable Status lastResult; +}; + +class CachedBitmap : public GdiplusBase +{ + friend Graphics; + +public: + CachedBitmap(IN Bitmap *bitmap, + IN Graphics *graphics); + virtual ~CachedBitmap(); + + Status GetLastStatus() const; + +#ifdef DCR_USE_NEW_250932 + +private: + CachedBitmap(const CachedBitmap &); + CachedBitmap& operator=(const CachedBitmap &); + +#endif + +protected: + GpCachedBitmap *nativeCachedBitmap; + mutable Status lastResult; +}; + +#endif // !_GDIPLUSHEADERS.HPP diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusImageCodec.h b/core/src/fxge/Microsoft SDK/include/GdiPlusImageCodec.h index e9c02deb7e..d9ea0386b2 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusImageCodec.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusImageCodec.h @@ -1,73 +1,73 @@ -/**************************************************************************\ -* -* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusImageCodec.h -* -* Abstract: -* -* APIs for imaging codecs. -* -\**************************************************************************/ - -#ifndef _GDIPLUSIMAGECODEC_H -#define _GDIPLUSIMAGECODEC_H - -//-------------------------------------------------------------------------- -// Codec Management APIs -//-------------------------------------------------------------------------- - -inline Status -GetImageDecodersSize( - OUT UINT *numDecoders, - OUT UINT *size) -{ - return DllExports::GdipGetImageDecodersSize(numDecoders, size); -} - - -inline Status -GetImageDecoders( - IN UINT numDecoders, - IN UINT size, - OUT ImageCodecInfo *decoders) -{ - return DllExports::GdipGetImageDecoders(numDecoders, size, decoders); -} - - -inline Status -GetImageEncodersSize( - OUT UINT *numEncoders, - OUT UINT *size) -{ - return DllExports::GdipGetImageEncodersSize(numEncoders, size); -} - - -inline Status -GetImageEncoders( - IN UINT numEncoders, - IN UINT size, - OUT ImageCodecInfo *encoders) -{ - return DllExports::GdipGetImageEncoders(numEncoders, size, encoders); -} - -inline Status -AddImageCodec( - IN const ImageCodecInfo* codec) -{ - return DllExports::GdipAddImageCodec(codec); -} - -inline Status -RemoveImageCodec( - IN const ImageCodecInfo* codec) -{ - return DllExports::GdipRemoveImageCodec(codec); -} - -#endif // _GDIPLUSIMAGECODEC_H +/**************************************************************************\ +* +* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusImageCodec.h +* +* Abstract: +* +* APIs for imaging codecs. +* +\**************************************************************************/ + +#ifndef _GDIPLUSIMAGECODEC_H +#define _GDIPLUSIMAGECODEC_H + +//-------------------------------------------------------------------------- +// Codec Management APIs +//-------------------------------------------------------------------------- + +inline Status +GetImageDecodersSize( + OUT UINT *numDecoders, + OUT UINT *size) +{ + return DllExports::GdipGetImageDecodersSize(numDecoders, size); +} + + +inline Status +GetImageDecoders( + IN UINT numDecoders, + IN UINT size, + OUT ImageCodecInfo *decoders) +{ + return DllExports::GdipGetImageDecoders(numDecoders, size, decoders); +} + + +inline Status +GetImageEncodersSize( + OUT UINT *numEncoders, + OUT UINT *size) +{ + return DllExports::GdipGetImageEncodersSize(numEncoders, size); +} + + +inline Status +GetImageEncoders( + IN UINT numEncoders, + IN UINT size, + OUT ImageCodecInfo *encoders) +{ + return DllExports::GdipGetImageEncoders(numEncoders, size, encoders); +} + +inline Status +AddImageCodec( + IN const ImageCodecInfo* codec) +{ + return DllExports::GdipAddImageCodec(codec); +} + +inline Status +RemoveImageCodec( + IN const ImageCodecInfo* codec) +{ + return DllExports::GdipRemoveImageCodec(codec); +} + +#endif // _GDIPLUSIMAGECODEC_H diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusImaging.h b/core/src/fxge/Microsoft SDK/include/GdiPlusImaging.h index 35dd4d0634..d6bd4f0d18 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusImaging.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusImaging.h @@ -1,540 +1,540 @@ -/**************************************************************************\ -* -* Copyright (c) 1999-2000 Microsoft Corporation -* -* Module Name: -* -* GdiplusImaging.h -* -* Abstract: -* -* GUIDs defined and used by the imaging library -* -\**************************************************************************/ -#ifndef _GDIPLUSIMAGING_H -#define _GDIPLUSIMAGING_H - -//--------------------------------------------------------------------------- -// Image file format identifiers -//--------------------------------------------------------------------------- - -DEFINE_GUID(ImageFormatUndefined, 0xb96b3ca9,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatMemoryBMP, 0xb96b3caa,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatBMP, 0xb96b3cab,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatEMF, 0xb96b3cac,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatWMF, 0xb96b3cad,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatJPEG, 0xb96b3cae,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatPNG, 0xb96b3caf,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatGIF, 0xb96b3cb0,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatTIFF, 0xb96b3cb1,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatEXIF, 0xb96b3cb2,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -#ifndef DCR_USE_NEW_140855 -DEFINE_GUID(ImageFormatPhotoCD, 0xb96b3cb3,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -DEFINE_GUID(ImageFormatFlashPIX, 0xb96b3cb4,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); -#endif -DEFINE_GUID(ImageFormatIcon, 0xb96b3cb5,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); - -//--------------------------------------------------------------------------- -// Predefined multi-frame dimension IDs -//--------------------------------------------------------------------------- - -DEFINE_GUID(FrameDimensionTime, 0x6aedbd6d,0x3fb5,0x418a,0x83,0xa6,0x7f,0x45,0x22,0x9d,0xc8,0x72); -DEFINE_GUID(FrameDimensionResolution, 0x84236f7b,0x3bd3,0x428f,0x8d,0xab,0x4e,0xa1,0x43,0x9c,0xa3,0x15); -DEFINE_GUID(FrameDimensionPage, 0x7462dc86,0x6180,0x4c7e,0x8e,0x3f,0xee,0x73,0x33,0xa7,0xa4,0x83); - -//--------------------------------------------------------------------------- -// Property sets -//--------------------------------------------------------------------------- - -DEFINE_GUID(FormatIDImageInformation, 0xe5836cbe,0x5eef,0x4f1d,0xac,0xde,0xae,0x4c,0x43,0xb6,0x08,0xce); -DEFINE_GUID(FormatIDJpegAppHeaders, 0x1c4afdcd,0x6177,0x43cf,0xab,0xc7,0x5f,0x51,0xaf,0x39,0xee,0x85); - -#ifndef DCR_USE_NEW_140855 -//--------------------------------------------------------------------------- -// Decoder parameter sets -//--------------------------------------------------------------------------- -DEFINE_GUID(DecoderTransColor, 0xb7a98c8f,0xdce7,0x457d,0xbf,0xa5,0xce,0xa7,0x1b,0xd1,0x4d,0xd6); -DEFINE_GUID(DecoderTransRange, 0xabeed189,0xd988,0x4d03,0xb4,0x25,0x57,0x10,0x55,0xc7,0x6a,0xd1); -DEFINE_GUID(DecoderOutputChannel, 0x2ff8f51e,0x724d,0x45fe,0x86,0xce,0x17,0x77,0xa0,0x56,0xda,0x60); -DEFINE_GUID(DecoderIconRes, 0x5c656eec,0xe94f,0x45ba,0xa6,0xf6,0x10,0x62,0xe8,0x5f,0x4a,0x7f); -#endif - -//--------------------------------------------------------------------------- -// Encoder parameter sets -//--------------------------------------------------------------------------- - -DEFINE_GUID(EncoderCompression, 0xe09d739d,0xccd4,0x44ee,0x8e,0xba,0x3f,0xbf,0x8b,0xe4,0xfc,0x58); -DEFINE_GUID(EncoderColorDepth, 0x66087055,0xad66,0x4c7c,0x9a,0x18,0x38,0xa2,0x31,0x0b,0x83,0x37); -DEFINE_GUID(EncoderScanMethod, 0x3a4e2661,0x3109,0x4e56,0x85,0x36,0x42,0xc1,0x56,0xe7,0xdc,0xfa); -DEFINE_GUID(EncoderVersion, 0x24d18c76,0x814a,0x41a4,0xbf,0x53,0x1c,0x21,0x9c,0xcc,0xf7,0x97); -DEFINE_GUID(EncoderRenderMethod, 0x6d42c53a,0x229a,0x4825,0x8b,0xb7,0x5c,0x99,0xe2,0xb9,0xa8,0xb8); -DEFINE_GUID(EncoderQuality, 0x1d5be4b5,0xfa4a,0x452d,0x9c,0xdd,0x5d,0xb3,0x51,0x05,0xe7,0xeb); -DEFINE_GUID(EncoderTransformation,0x8d0eb2d1,0xa58e,0x4ea8,0xaa,0x14,0x10,0x80,0x74,0xb7,0xb6,0xf9); -DEFINE_GUID(EncoderLuminanceTable,0xedb33bce,0x0266,0x4a77,0xb9,0x04,0x27,0x21,0x60,0x99,0xe7,0x17); -DEFINE_GUID(EncoderChrominanceTable,0xf2e455dc,0x09b3,0x4316,0x82,0x60,0x67,0x6a,0xda,0x32,0x48,0x1c); -DEFINE_GUID(EncoderSaveFlag,0x292266fc,0xac40,0x47bf,0x8c, 0xfc, 0xa8, 0x5b, 0x89, 0xa6, 0x55, 0xde); - -DEFINE_GUID(CodecIImageBytes,0x025d1823,0x6c7d,0x447b,0xbb, 0xdb, 0xa3, 0xcb, 0xc3, 0xdf, 0xa2, 0xfc); - -MIDL_INTERFACE("025D1823-6C7D-447B-BBDB-A3CBC3DFA2FC") -IImageBytes : public IUnknown -{ -public: - // Return total number of bytes in the IStream - - STDMETHOD(CountBytes)( - OUT UINT *pcb - ) = 0; - - // Locks "cb" bytes, starting from "ulOffset" in the stream, and returns the - // pointer to the beginning of the locked memory chunk in "ppvBytes" - - STDMETHOD(LockBytes)( - IN UINT cb, - IN ULONG ulOffset, - OUT const VOID ** ppvBytes - ) = 0; - - // Unlocks "cb" bytes, pointed by "pvBytes", starting from "ulOffset" in the - // stream - - STDMETHOD(UnlockBytes)( - IN const VOID *pvBytes, - IN UINT cb, - IN ULONG ulOffset - ) = 0; -}; - -//-------------------------------------------------------------------------- -// ImageCodecInfo structure -//-------------------------------------------------------------------------- - -class ImageCodecInfo -{ -public: - CLSID Clsid; - GUID FormatID; - const WCHAR* CodecName; - const WCHAR* DllName; - const WCHAR* FormatDescription; - const WCHAR* FilenameExtension; - const WCHAR* MimeType; - DWORD Flags; - DWORD Version; - DWORD SigCount; - DWORD SigSize; - const BYTE* SigPattern; - const BYTE* SigMask; -}; - -//-------------------------------------------------------------------------- -// Information flags about image codecs -//-------------------------------------------------------------------------- - -enum ImageCodecFlags -{ - ImageCodecFlagsEncoder = 0x00000001, - ImageCodecFlagsDecoder = 0x00000002, - ImageCodecFlagsSupportBitmap = 0x00000004, - ImageCodecFlagsSupportVector = 0x00000008, - ImageCodecFlagsSeekableEncode = 0x00000010, - ImageCodecFlagsBlockingDecode = 0x00000020, - - ImageCodecFlagsBuiltin = 0x00010000, - ImageCodecFlagsSystem = 0x00020000, - ImageCodecFlagsUser = 0x00040000 -}; - -//--------------------------------------------------------------------------- -// Access modes used when calling Image::LockBits -//--------------------------------------------------------------------------- - -enum ImageLockMode -{ - ImageLockModeRead = 0x0001, - ImageLockModeWrite = 0x0002, - ImageLockModeUserInputBuf= 0x0004 -}; - -//--------------------------------------------------------------------------- -// Information about image pixel data -//--------------------------------------------------------------------------- - -class BitmapData -{ -public: - UINT Width; - UINT Height; - INT Stride; - PixelFormat PixelFormat; - VOID* Scan0; - UINT_PTR Reserved; -}; - -//--------------------------------------------------------------------------- -// Image flags -//--------------------------------------------------------------------------- - -enum ImageFlags -{ - ImageFlagsNone = 0, - - // Low-word: shared with SINKFLAG_x - - ImageFlagsScalable = 0x0001, - ImageFlagsHasAlpha = 0x0002, - ImageFlagsHasTranslucent = 0x0004, - ImageFlagsPartiallyScalable = 0x0008, - - // Low-word: color space definition - - ImageFlagsColorSpaceRGB = 0x0010, - ImageFlagsColorSpaceCMYK = 0x0020, - ImageFlagsColorSpaceGRAY = 0x0040, - ImageFlagsColorSpaceYCBCR = 0x0080, - ImageFlagsColorSpaceYCCK = 0x0100, - - // Low-word: image size info - - ImageFlagsHasRealDPI = 0x1000, - ImageFlagsHasRealPixelSize = 0x2000, - - // High-word - - ImageFlagsReadOnly = 0x00010000, - ImageFlagsCaching = 0x00020000 -}; - -enum RotateFlipType -{ - RotateNoneFlipNone = 0, - Rotate90FlipNone = 1, - Rotate180FlipNone = 2, - Rotate270FlipNone = 3, - - RotateNoneFlipX = 4, - Rotate90FlipX = 5, - Rotate180FlipX = 6, - Rotate270FlipX = 7, - - RotateNoneFlipY = Rotate180FlipX, - Rotate90FlipY = Rotate270FlipX, - Rotate180FlipY = RotateNoneFlipX, - Rotate270FlipY = Rotate90FlipX, - - RotateNoneFlipXY = Rotate180FlipNone, - Rotate90FlipXY = Rotate270FlipNone, - Rotate180FlipXY = RotateNoneFlipNone, - Rotate270FlipXY = Rotate90FlipNone -}; - -//--------------------------------------------------------------------------- -// Encoder Parameter structure -//--------------------------------------------------------------------------- -class EncoderParameter -{ -public: - GUID Guid; // GUID of the parameter - ULONG NumberOfValues; // Number of the parameter values - ULONG Type; // Value type, like ValueTypeLONG etc. - VOID* Value; // A pointer to the parameter values -}; - -//--------------------------------------------------------------------------- -// Encoder Parameters structure -//--------------------------------------------------------------------------- -class EncoderParameters -{ -public: - UINT Count; // Number of parameters in this structure - EncoderParameter Parameter[1]; // Parameter values -}; - -//--------------------------------------------------------------------------- -// Property Item -//--------------------------------------------------------------------------- -class PropertyItem -{ -public: - PROPID id; // ID of this property - ULONG length; // Length of the property value, in bytes - WORD type; // Type of the value, as one of TAG_TYPE_XXX - // defined above - VOID* value; // property value -}; - -#ifdef DCR_USE_NEW_140857 -//--------------------------------------------------------------------------- -// Image property types -//--------------------------------------------------------------------------- -#define PropertyTagTypeByte 1 -#define PropertyTagTypeASCII 2 -#define PropertyTagTypeShort 3 -#define PropertyTagTypeLong 4 -#define PropertyTagTypeRational 5 -#define PropertyTagTypeUndefined 7 -#define PropertyTagTypeSLONG 9 -#define PropertyTagTypeSRational 10 -#endif - -//--------------------------------------------------------------------------- -// Image property ID tags -//--------------------------------------------------------------------------- - -#define PropertyTagExifIFD 0x8769 -#define PropertyTagGpsIFD 0x8825 - -#define PropertyTagNewSubfileType 0x00FE -#define PropertyTagSubfileType 0x00FF -#define PropertyTagImageWidth 0x0100 -#define PropertyTagImageHeight 0x0101 -#define PropertyTagBitsPerSample 0x0102 -#define PropertyTagCompression 0x0103 -#define PropertyTagPhotometricInterp 0x0106 -#define PropertyTagThreshHolding 0x0107 -#define PropertyTagCellWidth 0x0108 -#define PropertyTagCellHeight 0x0109 -#define PropertyTagFillOrder 0x010A -#define PropertyTagDocumentName 0x010D -#define PropertyTagImageDescription 0x010E -#define PropertyTagEquipMake 0x010F -#define PropertyTagEquipModel 0x0110 -#define PropertyTagStripOffsets 0x0111 -#define PropertyTagOrientation 0x0112 -#define PropertyTagSamplesPerPixel 0x0115 -#define PropertyTagRowsPerStrip 0x0116 -#define PropertyTagStripBytesCount 0x0117 -#define PropertyTagMinSampleValue 0x0118 -#define PropertyTagMaxSampleValue 0x0119 -#define PropertyTagXResolution 0x011A // Image resolution in width direction -#define PropertyTagYResolution 0x011B // Image resolution in height direction -#define PropertyTagPlanarConfig 0x011C // Image data arrangement -#define PropertyTagPageName 0x011D -#define PropertyTagXPosition 0x011E -#define PropertyTagYPosition 0x011F -#define PropertyTagFreeOffset 0x0120 -#define PropertyTagFreeByteCounts 0x0121 -#define PropertyTagGrayResponseUnit 0x0122 -#define PropertyTagGrayResponseCurve 0x0123 -#define PropertyTagT4Option 0x0124 -#define PropertyTagT6Option 0x0125 -#define PropertyTagResolutionUnit 0x0128 // Unit of X and Y resolution -#define PropertyTagPageNumber 0x0129 -#define PropertyTagTransferFuncition 0x012D -#define PropertyTagSoftwareUsed 0x0131 -#define PropertyTagDateTime 0x0132 -#define PropertyTagArtist 0x013B -#define PropertyTagHostComputer 0x013C -#define PropertyTagPredictor 0x013D -#define PropertyTagWhitePoint 0x013E -#define PropertyTagPrimaryChromaticities 0x013F -#define PropertyTagColorMap 0x0140 -#define PropertyTagHalftoneHints 0x0141 -#define PropertyTagTileWidth 0x0142 -#define PropertyTagTileLength 0x0143 -#define PropertyTagTileOffset 0x0144 -#define PropertyTagTileByteCounts 0x0145 -#define PropertyTagInkSet 0x014C -#define PropertyTagInkNames 0x014D -#define PropertyTagNumberOfInks 0x014E -#define PropertyTagDotRange 0x0150 -#define PropertyTagTargetPrinter 0x0151 -#define PropertyTagExtraSamples 0x0152 -#define PropertyTagSampleFormat 0x0153 -#define PropertyTagSMinSampleValue 0x0154 -#define PropertyTagSMaxSampleValue 0x0155 -#define PropertyTagTransferRange 0x0156 - -#define PropertyTagJPEGProc 0x0200 -#define PropertyTagJPEGInterFormat 0x0201 -#define PropertyTagJPEGInterLength 0x0202 -#define PropertyTagJPEGRestartInterval 0x0203 -#define PropertyTagJPEGLosslessPredictors 0x0205 -#define PropertyTagJPEGPointTransforms 0x0206 -#define PropertyTagJPEGQTables 0x0207 -#define PropertyTagJPEGDCTables 0x0208 -#define PropertyTagJPEGACTables 0x0209 - -#define PropertyTagYCbCrCoefficients 0x0211 -#define PropertyTagYCbCrSubsampling 0x0212 -#define PropertyTagYCbCrPositioning 0x0213 -#define PropertyTagREFBlackWhite 0x0214 - -#define PropertyTagICCProfile 0x8773 // This TAG is defined by ICC - // for embedded ICC in TIFF -#define PropertyTagGamma 0x0301 -#define PropertyTagICCProfileDescriptor 0x0302 -#define PropertyTagSRGBRenderingIntent 0x0303 - -#define PropertyTagImageTitle 0x0320 -#define PropertyTagCopyright 0x8298 - -// Extra TAGs (Like Adobe Image Information tags etc.) - -#define PropertyTagResolutionXUnit 0x5001 -#define PropertyTagResolutionYUnit 0x5002 -#define PropertyTagResolutionXLengthUnit 0x5003 -#define PropertyTagResolutionYLengthUnit 0x5004 -#define PropertyTagPrintFlags 0x5005 -#define PropertyTagPrintFlagsVersion 0x5006 -#define PropertyTagPrintFlagsCrop 0x5007 -#define PropertyTagPrintFlagsBleedWidth 0x5008 -#define PropertyTagPrintFlagsBleedWidthScale 0x5009 -#define PropertyTagHalftoneLPI 0x500A -#define PropertyTagHalftoneLPIUnit 0x500B -#define PropertyTagHalftoneDegree 0x500C -#define PropertyTagHalftoneShape 0x500D -#define PropertyTagHalftoneMisc 0x500E -#define PropertyTagHalftoneScreen 0x500F -#define PropertyTagJPEGQuality 0x5010 -#define PropertyTagGridSize 0x5011 -#define PropertyTagThumbnailFormat 0x5012 // 1 = JPEG, 0 = RAW RGB -#define PropertyTagThumbnailWidth 0x5013 -#define PropertyTagThumbnailHeight 0x5014 -#define PropertyTagThumbnailColorDepth 0x5015 -#define PropertyTagThumbnailPlanes 0x5016 -#define PropertyTagThumbnailRawBytes 0x5017 -#define PropertyTagThumbnailSize 0x5018 -#define PropertyTagThumbnailCompressedSize 0x5019 -#define PropertyTagColorTransferFunction 0x501A -#define PropertyTagThumbnailData 0x501B// RAW thumbnail bits in - // JPEG format or RGB format - // depends on - // PropertyTagThumbnailFormat - -// Thumbnail related TAGs - -#define PropertyTagThumbnailImageWidth 0x5020 // Thumbnail width -#define PropertyTagThumbnailImageHeight 0x5021 // Thumbnail height -#define PropertyTagThumbnailBitsPerSample 0x5022 // Number of bits per - // component -#define PropertyTagThumbnailCompression 0x5023 // Compression Scheme -#define PropertyTagThumbnailPhotometricInterp 0x5024 // Pixel composition -#define PropertyTagThumbnailImageDescription 0x5025 // Image Tile -#define PropertyTagThumbnailEquipMake 0x5026 // Manufacturer of Image - // Input equipment -#define PropertyTagThumbnailEquipModel 0x5027 // Model of Image input - // equipment -#define PropertyTagThumbnailStripOffsets 0x5028 // Image data location -#define PropertyTagThumbnailOrientation 0x5029 // Orientation of image -#define PropertyTagThumbnailSamplesPerPixel 0x502A // Number of components -#define PropertyTagThumbnailRowsPerStrip 0x502B // Number of rows per strip -#define PropertyTagThumbnailStripBytesCount 0x502C // Bytes per compressed - // strip -#define PropertyTagThumbnailResolutionX 0x502D // Resolution in width - // direction -#define PropertyTagThumbnailResolutionY 0x502E // Resolution in height - // direction -#define PropertyTagThumbnailPlanarConfig 0x502F // Image data arrangement -#define PropertyTagThumbnailResolutionUnit 0x5030 // Unit of X and Y - // Resolution -#define PropertyTagThumbnailTransferFunction 0x5031 // Transfer function -#define PropertyTagThumbnailSoftwareUsed 0x5032 // Software used -#define PropertyTagThumbnailDateTime 0x5033 // File change date and - // time -#define PropertyTagThumbnailArtist 0x5034 // Person who created the - // image -#define PropertyTagThumbnailWhitePoint 0x5035 // White point chromaticity -#define PropertyTagThumbnailPrimaryChromaticities 0x5036 - // Chromaticities of - // primaries -#define PropertyTagThumbnailYCbCrCoefficients 0x5037 // Color space transforma- - // tion coefficients -#define PropertyTagThumbnailYCbCrSubsampling 0x5038 // Subsampling ratio of Y - // to C -#define PropertyTagThumbnailYCbCrPositioning 0x5039 // Y and C position -#define PropertyTagThumbnailRefBlackWhite 0x503A // Pair of black and white - // reference values -#define PropertyTagThumbnailCopyRight 0x503B // CopyRight holder - -#define PropertyTagLuminanceTable 0x5090 -#define PropertyTagChrominanceTable 0x5091 - -#define PropertyTagFrameDelay 0x5100 -#define PropertyTagLoopCount 0x5101 - -#define PropertyTagPixelUnit 0x5110 // Unit specifier for pixel/unit -#define PropertyTagPixelPerUnitX 0x5111 // Pixels per unit in X -#define PropertyTagPixelPerUnitY 0x5112 // Pixels per unit in Y -#define PropertyTagPaletteHistogram 0x5113 // Palette histogram - -// EXIF specific tag - -#define PropertyTagExifExposureTime 0x829A -#define PropertyTagExifFNumber 0x829D - -#define PropertyTagExifExposureProg 0x8822 -#define PropertyTagExifSpectralSense 0x8824 -#define PropertyTagExifISOSpeed 0x8827 -#define PropertyTagExifOECF 0x8828 - -#define PropertyTagExifVer 0x9000 -#define PropertyTagExifDTOrig 0x9003 // Date & time of original -#define PropertyTagExifDTDigitized 0x9004 // Date & time of digital data generation - -#define PropertyTagExifCompConfig 0x9101 -#define PropertyTagExifCompBPP 0x9102 - -#define PropertyTagExifShutterSpeed 0x9201 -#define PropertyTagExifAperture 0x9202 -#define PropertyTagExifBrightness 0x9203 -#define PropertyTagExifExposureBias 0x9204 -#define PropertyTagExifMaxAperture 0x9205 -#define PropertyTagExifSubjectDist 0x9206 -#define PropertyTagExifMeteringMode 0x9207 -#define PropertyTagExifLightSource 0x9208 -#define PropertyTagExifFlash 0x9209 -#define PropertyTagExifFocalLength 0x920A -#define PropertyTagExifMakerNote 0x927C -#define PropertyTagExifUserComment 0x9286 -#define PropertyTagExifDTSubsec 0x9290 // Date & Time subseconds -#define PropertyTagExifDTOrigSS 0x9291 // Date & Time original subseconds -#define PropertyTagExifDTDigSS 0x9292 // Date & TIme digitized subseconds - -#define PropertyTagExifFPXVer 0xA000 -#define PropertyTagExifColorSpace 0xA001 -#define PropertyTagExifPixXDim 0xA002 -#define PropertyTagExifPixYDim 0xA003 -#define PropertyTagExifRelatedWav 0xA004 // related sound file -#define PropertyTagExifInterop 0xA005 -#define PropertyTagExifFlashEnergy 0xA20B -#define PropertyTagExifSpatialFR 0xA20C // Spatial Frequency Response -#define PropertyTagExifFocalXRes 0xA20E // Focal Plane X Resolution -#define PropertyTagExifFocalYRes 0xA20F // Focal Plane Y Resolution -#define PropertyTagExifFocalResUnit 0xA210 // Focal Plane Resolution Unit -#define PropertyTagExifSubjectLoc 0xA214 -#define PropertyTagExifExposureIndex 0xA215 -#define PropertyTagExifSensingMethod 0xA217 -#define PropertyTagExifFileSource 0xA300 -#define PropertyTagExifSceneType 0xA301 -#define PropertyTagExifCfaPattern 0xA302 - -#define PropertyTagGpsVer 0x0000 -#define PropertyTagGpsLatitudeRef 0x0001 -#define PropertyTagGpsLatitude 0x0002 -#define PropertyTagGpsLongitudeRef 0x0003 -#define PropertyTagGpsLongitude 0x0004 -#define PropertyTagGpsAltitudeRef 0x0005 -#define PropertyTagGpsAltitude 0x0006 -#define PropertyTagGpsGpsTime 0x0007 -#define PropertyTagGpsGpsSatellites 0x0008 -#define PropertyTagGpsGpsStatus 0x0009 -#define PropertyTagGpsGpsMeasureMode 0x00A -#define PropertyTagGpsGpsDop 0x000B // Measurement precision -#define PropertyTagGpsSpeedRef 0x000C -#define PropertyTagGpsSpeed 0x000D -#define PropertyTagGpsTrackRef 0x000E -#define PropertyTagGpsTrack 0x000F -#define PropertyTagGpsImgDirRef 0x0010 -#define PropertyTagGpsImgDir 0x0011 -#define PropertyTagGpsMapDatum 0x0012 -#define PropertyTagGpsDestLatRef 0x0013 -#define PropertyTagGpsDestLat 0x0014 -#define PropertyTagGpsDestLongRef 0x0015 -#define PropertyTagGpsDestLong 0x0016 -#define PropertyTagGpsDestBearRef 0x0017 -#define PropertyTagGpsDestBear 0x0018 -#define PropertyTagGpsDestDistRef 0x0019 -#define PropertyTagGpsDestDist 0x001A - -#endif +/**************************************************************************\ +* +* Copyright (c) 1999-2000 Microsoft Corporation +* +* Module Name: +* +* GdiplusImaging.h +* +* Abstract: +* +* GUIDs defined and used by the imaging library +* +\**************************************************************************/ +#ifndef _GDIPLUSIMAGING_H +#define _GDIPLUSIMAGING_H + +//--------------------------------------------------------------------------- +// Image file format identifiers +//--------------------------------------------------------------------------- + +DEFINE_GUID(ImageFormatUndefined, 0xb96b3ca9,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatMemoryBMP, 0xb96b3caa,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatBMP, 0xb96b3cab,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatEMF, 0xb96b3cac,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatWMF, 0xb96b3cad,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatJPEG, 0xb96b3cae,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatPNG, 0xb96b3caf,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatGIF, 0xb96b3cb0,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatTIFF, 0xb96b3cb1,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatEXIF, 0xb96b3cb2,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +#ifndef DCR_USE_NEW_140855 +DEFINE_GUID(ImageFormatPhotoCD, 0xb96b3cb3,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +DEFINE_GUID(ImageFormatFlashPIX, 0xb96b3cb4,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); +#endif +DEFINE_GUID(ImageFormatIcon, 0xb96b3cb5,0x0728,0x11d3,0x9d,0x7b,0x00,0x00,0xf8,0x1e,0xf3,0x2e); + +//--------------------------------------------------------------------------- +// Predefined multi-frame dimension IDs +//--------------------------------------------------------------------------- + +DEFINE_GUID(FrameDimensionTime, 0x6aedbd6d,0x3fb5,0x418a,0x83,0xa6,0x7f,0x45,0x22,0x9d,0xc8,0x72); +DEFINE_GUID(FrameDimensionResolution, 0x84236f7b,0x3bd3,0x428f,0x8d,0xab,0x4e,0xa1,0x43,0x9c,0xa3,0x15); +DEFINE_GUID(FrameDimensionPage, 0x7462dc86,0x6180,0x4c7e,0x8e,0x3f,0xee,0x73,0x33,0xa7,0xa4,0x83); + +//--------------------------------------------------------------------------- +// Property sets +//--------------------------------------------------------------------------- + +DEFINE_GUID(FormatIDImageInformation, 0xe5836cbe,0x5eef,0x4f1d,0xac,0xde,0xae,0x4c,0x43,0xb6,0x08,0xce); +DEFINE_GUID(FormatIDJpegAppHeaders, 0x1c4afdcd,0x6177,0x43cf,0xab,0xc7,0x5f,0x51,0xaf,0x39,0xee,0x85); + +#ifndef DCR_USE_NEW_140855 +//--------------------------------------------------------------------------- +// Decoder parameter sets +//--------------------------------------------------------------------------- +DEFINE_GUID(DecoderTransColor, 0xb7a98c8f,0xdce7,0x457d,0xbf,0xa5,0xce,0xa7,0x1b,0xd1,0x4d,0xd6); +DEFINE_GUID(DecoderTransRange, 0xabeed189,0xd988,0x4d03,0xb4,0x25,0x57,0x10,0x55,0xc7,0x6a,0xd1); +DEFINE_GUID(DecoderOutputChannel, 0x2ff8f51e,0x724d,0x45fe,0x86,0xce,0x17,0x77,0xa0,0x56,0xda,0x60); +DEFINE_GUID(DecoderIconRes, 0x5c656eec,0xe94f,0x45ba,0xa6,0xf6,0x10,0x62,0xe8,0x5f,0x4a,0x7f); +#endif + +//--------------------------------------------------------------------------- +// Encoder parameter sets +//--------------------------------------------------------------------------- + +DEFINE_GUID(EncoderCompression, 0xe09d739d,0xccd4,0x44ee,0x8e,0xba,0x3f,0xbf,0x8b,0xe4,0xfc,0x58); +DEFINE_GUID(EncoderColorDepth, 0x66087055,0xad66,0x4c7c,0x9a,0x18,0x38,0xa2,0x31,0x0b,0x83,0x37); +DEFINE_GUID(EncoderScanMethod, 0x3a4e2661,0x3109,0x4e56,0x85,0x36,0x42,0xc1,0x56,0xe7,0xdc,0xfa); +DEFINE_GUID(EncoderVersion, 0x24d18c76,0x814a,0x41a4,0xbf,0x53,0x1c,0x21,0x9c,0xcc,0xf7,0x97); +DEFINE_GUID(EncoderRenderMethod, 0x6d42c53a,0x229a,0x4825,0x8b,0xb7,0x5c,0x99,0xe2,0xb9,0xa8,0xb8); +DEFINE_GUID(EncoderQuality, 0x1d5be4b5,0xfa4a,0x452d,0x9c,0xdd,0x5d,0xb3,0x51,0x05,0xe7,0xeb); +DEFINE_GUID(EncoderTransformation,0x8d0eb2d1,0xa58e,0x4ea8,0xaa,0x14,0x10,0x80,0x74,0xb7,0xb6,0xf9); +DEFINE_GUID(EncoderLuminanceTable,0xedb33bce,0x0266,0x4a77,0xb9,0x04,0x27,0x21,0x60,0x99,0xe7,0x17); +DEFINE_GUID(EncoderChrominanceTable,0xf2e455dc,0x09b3,0x4316,0x82,0x60,0x67,0x6a,0xda,0x32,0x48,0x1c); +DEFINE_GUID(EncoderSaveFlag,0x292266fc,0xac40,0x47bf,0x8c, 0xfc, 0xa8, 0x5b, 0x89, 0xa6, 0x55, 0xde); + +DEFINE_GUID(CodecIImageBytes,0x025d1823,0x6c7d,0x447b,0xbb, 0xdb, 0xa3, 0xcb, 0xc3, 0xdf, 0xa2, 0xfc); + +MIDL_INTERFACE("025D1823-6C7D-447B-BBDB-A3CBC3DFA2FC") +IImageBytes : public IUnknown +{ +public: + // Return total number of bytes in the IStream + + STDMETHOD(CountBytes)( + OUT UINT *pcb + ) = 0; + + // Locks "cb" bytes, starting from "ulOffset" in the stream, and returns the + // pointer to the beginning of the locked memory chunk in "ppvBytes" + + STDMETHOD(LockBytes)( + IN UINT cb, + IN ULONG ulOffset, + OUT const VOID ** ppvBytes + ) = 0; + + // Unlocks "cb" bytes, pointed by "pvBytes", starting from "ulOffset" in the + // stream + + STDMETHOD(UnlockBytes)( + IN const VOID *pvBytes, + IN UINT cb, + IN ULONG ulOffset + ) = 0; +}; + +//-------------------------------------------------------------------------- +// ImageCodecInfo structure +//-------------------------------------------------------------------------- + +class ImageCodecInfo +{ +public: + CLSID Clsid; + GUID FormatID; + const WCHAR* CodecName; + const WCHAR* DllName; + const WCHAR* FormatDescription; + const WCHAR* FilenameExtension; + const WCHAR* MimeType; + DWORD Flags; + DWORD Version; + DWORD SigCount; + DWORD SigSize; + const BYTE* SigPattern; + const BYTE* SigMask; +}; + +//-------------------------------------------------------------------------- +// Information flags about image codecs +//-------------------------------------------------------------------------- + +enum ImageCodecFlags +{ + ImageCodecFlagsEncoder = 0x00000001, + ImageCodecFlagsDecoder = 0x00000002, + ImageCodecFlagsSupportBitmap = 0x00000004, + ImageCodecFlagsSupportVector = 0x00000008, + ImageCodecFlagsSeekableEncode = 0x00000010, + ImageCodecFlagsBlockingDecode = 0x00000020, + + ImageCodecFlagsBuiltin = 0x00010000, + ImageCodecFlagsSystem = 0x00020000, + ImageCodecFlagsUser = 0x00040000 +}; + +//--------------------------------------------------------------------------- +// Access modes used when calling Image::LockBits +//--------------------------------------------------------------------------- + +enum ImageLockMode +{ + ImageLockModeRead = 0x0001, + ImageLockModeWrite = 0x0002, + ImageLockModeUserInputBuf= 0x0004 +}; + +//--------------------------------------------------------------------------- +// Information about image pixel data +//--------------------------------------------------------------------------- + +class BitmapData +{ +public: + UINT Width; + UINT Height; + INT Stride; + PixelFormat PixelFormat; + VOID* Scan0; + UINT_PTR Reserved; +}; + +//--------------------------------------------------------------------------- +// Image flags +//--------------------------------------------------------------------------- + +enum ImageFlags +{ + ImageFlagsNone = 0, + + // Low-word: shared with SINKFLAG_x + + ImageFlagsScalable = 0x0001, + ImageFlagsHasAlpha = 0x0002, + ImageFlagsHasTranslucent = 0x0004, + ImageFlagsPartiallyScalable = 0x0008, + + // Low-word: color space definition + + ImageFlagsColorSpaceRGB = 0x0010, + ImageFlagsColorSpaceCMYK = 0x0020, + ImageFlagsColorSpaceGRAY = 0x0040, + ImageFlagsColorSpaceYCBCR = 0x0080, + ImageFlagsColorSpaceYCCK = 0x0100, + + // Low-word: image size info + + ImageFlagsHasRealDPI = 0x1000, + ImageFlagsHasRealPixelSize = 0x2000, + + // High-word + + ImageFlagsReadOnly = 0x00010000, + ImageFlagsCaching = 0x00020000 +}; + +enum RotateFlipType +{ + RotateNoneFlipNone = 0, + Rotate90FlipNone = 1, + Rotate180FlipNone = 2, + Rotate270FlipNone = 3, + + RotateNoneFlipX = 4, + Rotate90FlipX = 5, + Rotate180FlipX = 6, + Rotate270FlipX = 7, + + RotateNoneFlipY = Rotate180FlipX, + Rotate90FlipY = Rotate270FlipX, + Rotate180FlipY = RotateNoneFlipX, + Rotate270FlipY = Rotate90FlipX, + + RotateNoneFlipXY = Rotate180FlipNone, + Rotate90FlipXY = Rotate270FlipNone, + Rotate180FlipXY = RotateNoneFlipNone, + Rotate270FlipXY = Rotate90FlipNone +}; + +//--------------------------------------------------------------------------- +// Encoder Parameter structure +//--------------------------------------------------------------------------- +class EncoderParameter +{ +public: + GUID Guid; // GUID of the parameter + ULONG NumberOfValues; // Number of the parameter values + ULONG Type; // Value type, like ValueTypeLONG etc. + VOID* Value; // A pointer to the parameter values +}; + +//--------------------------------------------------------------------------- +// Encoder Parameters structure +//--------------------------------------------------------------------------- +class EncoderParameters +{ +public: + UINT Count; // Number of parameters in this structure + EncoderParameter Parameter[1]; // Parameter values +}; + +//--------------------------------------------------------------------------- +// Property Item +//--------------------------------------------------------------------------- +class PropertyItem +{ +public: + PROPID id; // ID of this property + ULONG length; // Length of the property value, in bytes + WORD type; // Type of the value, as one of TAG_TYPE_XXX + // defined above + VOID* value; // property value +}; + +#ifdef DCR_USE_NEW_140857 +//--------------------------------------------------------------------------- +// Image property types +//--------------------------------------------------------------------------- +#define PropertyTagTypeByte 1 +#define PropertyTagTypeASCII 2 +#define PropertyTagTypeShort 3 +#define PropertyTagTypeLong 4 +#define PropertyTagTypeRational 5 +#define PropertyTagTypeUndefined 7 +#define PropertyTagTypeSLONG 9 +#define PropertyTagTypeSRational 10 +#endif + +//--------------------------------------------------------------------------- +// Image property ID tags +//--------------------------------------------------------------------------- + +#define PropertyTagExifIFD 0x8769 +#define PropertyTagGpsIFD 0x8825 + +#define PropertyTagNewSubfileType 0x00FE +#define PropertyTagSubfileType 0x00FF +#define PropertyTagImageWidth 0x0100 +#define PropertyTagImageHeight 0x0101 +#define PropertyTagBitsPerSample 0x0102 +#define PropertyTagCompression 0x0103 +#define PropertyTagPhotometricInterp 0x0106 +#define PropertyTagThreshHolding 0x0107 +#define PropertyTagCellWidth 0x0108 +#define PropertyTagCellHeight 0x0109 +#define PropertyTagFillOrder 0x010A +#define PropertyTagDocumentName 0x010D +#define PropertyTagImageDescription 0x010E +#define PropertyTagEquipMake 0x010F +#define PropertyTagEquipModel 0x0110 +#define PropertyTagStripOffsets 0x0111 +#define PropertyTagOrientation 0x0112 +#define PropertyTagSamplesPerPixel 0x0115 +#define PropertyTagRowsPerStrip 0x0116 +#define PropertyTagStripBytesCount 0x0117 +#define PropertyTagMinSampleValue 0x0118 +#define PropertyTagMaxSampleValue 0x0119 +#define PropertyTagXResolution 0x011A // Image resolution in width direction +#define PropertyTagYResolution 0x011B // Image resolution in height direction +#define PropertyTagPlanarConfig 0x011C // Image data arrangement +#define PropertyTagPageName 0x011D +#define PropertyTagXPosition 0x011E +#define PropertyTagYPosition 0x011F +#define PropertyTagFreeOffset 0x0120 +#define PropertyTagFreeByteCounts 0x0121 +#define PropertyTagGrayResponseUnit 0x0122 +#define PropertyTagGrayResponseCurve 0x0123 +#define PropertyTagT4Option 0x0124 +#define PropertyTagT6Option 0x0125 +#define PropertyTagResolutionUnit 0x0128 // Unit of X and Y resolution +#define PropertyTagPageNumber 0x0129 +#define PropertyTagTransferFuncition 0x012D +#define PropertyTagSoftwareUsed 0x0131 +#define PropertyTagDateTime 0x0132 +#define PropertyTagArtist 0x013B +#define PropertyTagHostComputer 0x013C +#define PropertyTagPredictor 0x013D +#define PropertyTagWhitePoint 0x013E +#define PropertyTagPrimaryChromaticities 0x013F +#define PropertyTagColorMap 0x0140 +#define PropertyTagHalftoneHints 0x0141 +#define PropertyTagTileWidth 0x0142 +#define PropertyTagTileLength 0x0143 +#define PropertyTagTileOffset 0x0144 +#define PropertyTagTileByteCounts 0x0145 +#define PropertyTagInkSet 0x014C +#define PropertyTagInkNames 0x014D +#define PropertyTagNumberOfInks 0x014E +#define PropertyTagDotRange 0x0150 +#define PropertyTagTargetPrinter 0x0151 +#define PropertyTagExtraSamples 0x0152 +#define PropertyTagSampleFormat 0x0153 +#define PropertyTagSMinSampleValue 0x0154 +#define PropertyTagSMaxSampleValue 0x0155 +#define PropertyTagTransferRange 0x0156 + +#define PropertyTagJPEGProc 0x0200 +#define PropertyTagJPEGInterFormat 0x0201 +#define PropertyTagJPEGInterLength 0x0202 +#define PropertyTagJPEGRestartInterval 0x0203 +#define PropertyTagJPEGLosslessPredictors 0x0205 +#define PropertyTagJPEGPointTransforms 0x0206 +#define PropertyTagJPEGQTables 0x0207 +#define PropertyTagJPEGDCTables 0x0208 +#define PropertyTagJPEGACTables 0x0209 + +#define PropertyTagYCbCrCoefficients 0x0211 +#define PropertyTagYCbCrSubsampling 0x0212 +#define PropertyTagYCbCrPositioning 0x0213 +#define PropertyTagREFBlackWhite 0x0214 + +#define PropertyTagICCProfile 0x8773 // This TAG is defined by ICC + // for embedded ICC in TIFF +#define PropertyTagGamma 0x0301 +#define PropertyTagICCProfileDescriptor 0x0302 +#define PropertyTagSRGBRenderingIntent 0x0303 + +#define PropertyTagImageTitle 0x0320 +#define PropertyTagCopyright 0x8298 + +// Extra TAGs (Like Adobe Image Information tags etc.) + +#define PropertyTagResolutionXUnit 0x5001 +#define PropertyTagResolutionYUnit 0x5002 +#define PropertyTagResolutionXLengthUnit 0x5003 +#define PropertyTagResolutionYLengthUnit 0x5004 +#define PropertyTagPrintFlags 0x5005 +#define PropertyTagPrintFlagsVersion 0x5006 +#define PropertyTagPrintFlagsCrop 0x5007 +#define PropertyTagPrintFlagsBleedWidth 0x5008 +#define PropertyTagPrintFlagsBleedWidthScale 0x5009 +#define PropertyTagHalftoneLPI 0x500A +#define PropertyTagHalftoneLPIUnit 0x500B +#define PropertyTagHalftoneDegree 0x500C +#define PropertyTagHalftoneShape 0x500D +#define PropertyTagHalftoneMisc 0x500E +#define PropertyTagHalftoneScreen 0x500F +#define PropertyTagJPEGQuality 0x5010 +#define PropertyTagGridSize 0x5011 +#define PropertyTagThumbnailFormat 0x5012 // 1 = JPEG, 0 = RAW RGB +#define PropertyTagThumbnailWidth 0x5013 +#define PropertyTagThumbnailHeight 0x5014 +#define PropertyTagThumbnailColorDepth 0x5015 +#define PropertyTagThumbnailPlanes 0x5016 +#define PropertyTagThumbnailRawBytes 0x5017 +#define PropertyTagThumbnailSize 0x5018 +#define PropertyTagThumbnailCompressedSize 0x5019 +#define PropertyTagColorTransferFunction 0x501A +#define PropertyTagThumbnailData 0x501B// RAW thumbnail bits in + // JPEG format or RGB format + // depends on + // PropertyTagThumbnailFormat + +// Thumbnail related TAGs + +#define PropertyTagThumbnailImageWidth 0x5020 // Thumbnail width +#define PropertyTagThumbnailImageHeight 0x5021 // Thumbnail height +#define PropertyTagThumbnailBitsPerSample 0x5022 // Number of bits per + // component +#define PropertyTagThumbnailCompression 0x5023 // Compression Scheme +#define PropertyTagThumbnailPhotometricInterp 0x5024 // Pixel composition +#define PropertyTagThumbnailImageDescription 0x5025 // Image Tile +#define PropertyTagThumbnailEquipMake 0x5026 // Manufacturer of Image + // Input equipment +#define PropertyTagThumbnailEquipModel 0x5027 // Model of Image input + // equipment +#define PropertyTagThumbnailStripOffsets 0x5028 // Image data location +#define PropertyTagThumbnailOrientation 0x5029 // Orientation of image +#define PropertyTagThumbnailSamplesPerPixel 0x502A // Number of components +#define PropertyTagThumbnailRowsPerStrip 0x502B // Number of rows per strip +#define PropertyTagThumbnailStripBytesCount 0x502C // Bytes per compressed + // strip +#define PropertyTagThumbnailResolutionX 0x502D // Resolution in width + // direction +#define PropertyTagThumbnailResolutionY 0x502E // Resolution in height + // direction +#define PropertyTagThumbnailPlanarConfig 0x502F // Image data arrangement +#define PropertyTagThumbnailResolutionUnit 0x5030 // Unit of X and Y + // Resolution +#define PropertyTagThumbnailTransferFunction 0x5031 // Transfer function +#define PropertyTagThumbnailSoftwareUsed 0x5032 // Software used +#define PropertyTagThumbnailDateTime 0x5033 // File change date and + // time +#define PropertyTagThumbnailArtist 0x5034 // Person who created the + // image +#define PropertyTagThumbnailWhitePoint 0x5035 // White point chromaticity +#define PropertyTagThumbnailPrimaryChromaticities 0x5036 + // Chromaticities of + // primaries +#define PropertyTagThumbnailYCbCrCoefficients 0x5037 // Color space transforma- + // tion coefficients +#define PropertyTagThumbnailYCbCrSubsampling 0x5038 // Subsampling ratio of Y + // to C +#define PropertyTagThumbnailYCbCrPositioning 0x5039 // Y and C position +#define PropertyTagThumbnailRefBlackWhite 0x503A // Pair of black and white + // reference values +#define PropertyTagThumbnailCopyRight 0x503B // CopyRight holder + +#define PropertyTagLuminanceTable 0x5090 +#define PropertyTagChrominanceTable 0x5091 + +#define PropertyTagFrameDelay 0x5100 +#define PropertyTagLoopCount 0x5101 + +#define PropertyTagPixelUnit 0x5110 // Unit specifier for pixel/unit +#define PropertyTagPixelPerUnitX 0x5111 // Pixels per unit in X +#define PropertyTagPixelPerUnitY 0x5112 // Pixels per unit in Y +#define PropertyTagPaletteHistogram 0x5113 // Palette histogram + +// EXIF specific tag + +#define PropertyTagExifExposureTime 0x829A +#define PropertyTagExifFNumber 0x829D + +#define PropertyTagExifExposureProg 0x8822 +#define PropertyTagExifSpectralSense 0x8824 +#define PropertyTagExifISOSpeed 0x8827 +#define PropertyTagExifOECF 0x8828 + +#define PropertyTagExifVer 0x9000 +#define PropertyTagExifDTOrig 0x9003 // Date & time of original +#define PropertyTagExifDTDigitized 0x9004 // Date & time of digital data generation + +#define PropertyTagExifCompConfig 0x9101 +#define PropertyTagExifCompBPP 0x9102 + +#define PropertyTagExifShutterSpeed 0x9201 +#define PropertyTagExifAperture 0x9202 +#define PropertyTagExifBrightness 0x9203 +#define PropertyTagExifExposureBias 0x9204 +#define PropertyTagExifMaxAperture 0x9205 +#define PropertyTagExifSubjectDist 0x9206 +#define PropertyTagExifMeteringMode 0x9207 +#define PropertyTagExifLightSource 0x9208 +#define PropertyTagExifFlash 0x9209 +#define PropertyTagExifFocalLength 0x920A +#define PropertyTagExifMakerNote 0x927C +#define PropertyTagExifUserComment 0x9286 +#define PropertyTagExifDTSubsec 0x9290 // Date & Time subseconds +#define PropertyTagExifDTOrigSS 0x9291 // Date & Time original subseconds +#define PropertyTagExifDTDigSS 0x9292 // Date & TIme digitized subseconds + +#define PropertyTagExifFPXVer 0xA000 +#define PropertyTagExifColorSpace 0xA001 +#define PropertyTagExifPixXDim 0xA002 +#define PropertyTagExifPixYDim 0xA003 +#define PropertyTagExifRelatedWav 0xA004 // related sound file +#define PropertyTagExifInterop 0xA005 +#define PropertyTagExifFlashEnergy 0xA20B +#define PropertyTagExifSpatialFR 0xA20C // Spatial Frequency Response +#define PropertyTagExifFocalXRes 0xA20E // Focal Plane X Resolution +#define PropertyTagExifFocalYRes 0xA20F // Focal Plane Y Resolution +#define PropertyTagExifFocalResUnit 0xA210 // Focal Plane Resolution Unit +#define PropertyTagExifSubjectLoc 0xA214 +#define PropertyTagExifExposureIndex 0xA215 +#define PropertyTagExifSensingMethod 0xA217 +#define PropertyTagExifFileSource 0xA300 +#define PropertyTagExifSceneType 0xA301 +#define PropertyTagExifCfaPattern 0xA302 + +#define PropertyTagGpsVer 0x0000 +#define PropertyTagGpsLatitudeRef 0x0001 +#define PropertyTagGpsLatitude 0x0002 +#define PropertyTagGpsLongitudeRef 0x0003 +#define PropertyTagGpsLongitude 0x0004 +#define PropertyTagGpsAltitudeRef 0x0005 +#define PropertyTagGpsAltitude 0x0006 +#define PropertyTagGpsGpsTime 0x0007 +#define PropertyTagGpsGpsSatellites 0x0008 +#define PropertyTagGpsGpsStatus 0x0009 +#define PropertyTagGpsGpsMeasureMode 0x00A +#define PropertyTagGpsGpsDop 0x000B // Measurement precision +#define PropertyTagGpsSpeedRef 0x000C +#define PropertyTagGpsSpeed 0x000D +#define PropertyTagGpsTrackRef 0x000E +#define PropertyTagGpsTrack 0x000F +#define PropertyTagGpsImgDirRef 0x0010 +#define PropertyTagGpsImgDir 0x0011 +#define PropertyTagGpsMapDatum 0x0012 +#define PropertyTagGpsDestLatRef 0x0013 +#define PropertyTagGpsDestLat 0x0014 +#define PropertyTagGpsDestLongRef 0x0015 +#define PropertyTagGpsDestLong 0x0016 +#define PropertyTagGpsDestBearRef 0x0017 +#define PropertyTagGpsDestBear 0x0018 +#define PropertyTagGpsDestDistRef 0x0019 +#define PropertyTagGpsDestDist 0x001A + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusLineCaps.h b/core/src/fxge/Microsoft SDK/include/GdiPlusLineCaps.h index e8a2951f43..5ac880f59a 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusLineCaps.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusLineCaps.h @@ -1,253 +1,253 @@ -/**************************************************************************\ -* -* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusLineCaps.h -* -* Abstract: -* -* APIs for Custom Line Caps -* -\**************************************************************************/ - -#ifndef _GDIPLUSLINECAPS_H -#define _GDIPLUSLINECAPS_H - -inline -CustomLineCap::CustomLineCap( - IN const GraphicsPath* fillPath, - IN const GraphicsPath* strokePath, - IN LineCap baseCap, - IN REAL baseInset - ) -{ - nativeCap = NULL; - GpPath* nativeFillPath = NULL; - GpPath* nativeStrokePath = NULL; - - if(fillPath) - nativeFillPath = fillPath->nativePath; - if(strokePath) - nativeStrokePath = strokePath->nativePath; - - lastResult = DllExports::GdipCreateCustomLineCap( - nativeFillPath, nativeStrokePath, - baseCap, baseInset, &nativeCap); -} - -inline -CustomLineCap::CustomLineCap() -{ - // This is used for default constructor for subclasses. - // So don't create a nativeCap. - - nativeCap = NULL; - lastResult = Ok; -} - -inline -CustomLineCap::~CustomLineCap() -{ - DllExports::GdipDeleteCustomLineCap(nativeCap); -} - -inline Status -CustomLineCap::SetStrokeCaps( - IN LineCap startCap, - IN LineCap endCap) -{ - return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap, - startCap, endCap)); -} - -inline Status -CustomLineCap::GetStrokeCaps( - OUT LineCap* startCap, - OUT LineCap* endCap) const -{ - return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap, - startCap, endCap)); -} - -inline Status -CustomLineCap::SetStrokeJoin( - IN LineJoin lineJoin) -{ - return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap, lineJoin)); -} - -inline LineJoin -CustomLineCap::GetStrokeJoin() const -{ - LineJoin lineJoin; - - SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap, &lineJoin)); - - return lineJoin; -} - -inline Status -CustomLineCap::SetBaseCap(IN LineCap baseCap) -{ - return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap, baseCap)); -} - -inline LineCap -CustomLineCap::GetBaseCap() const -{ - LineCap baseCap; - SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap)); - - return baseCap; -} - -inline Status -CustomLineCap::SetBaseInset(IN REAL inset) -{ - return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap, inset)); -} - -inline REAL -CustomLineCap::GetBaseInset() const -{ - REAL inset; - SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset)); - - return inset; -} - - -inline Status -CustomLineCap::SetWidthScale(IN REAL widthScale) -{ - return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap, widthScale)); -} - -inline REAL -CustomLineCap::GetWidthScale() const -{ - REAL widthScale; - SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap, &widthScale)); - - return widthScale; -} - -inline CustomLineCap* -CustomLineCap::Clone() const -{ - GpCustomLineCap *newNativeLineCap = NULL; - - SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap, &newNativeLineCap)); - - if (lastResult == Ok) - { - CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap, lastResult); - if (newLineCap == NULL) - { - SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap)); - } - - return newLineCap; - } - - return NULL; -} - -class AdjustableArrowCap : public CustomLineCap -{ -public: - - AdjustableArrowCap( - IN REAL height, - IN REAL width, - IN BOOL isFilled = TRUE - ) - { - GpAdjustableArrowCap* cap = NULL; - - lastResult = DllExports::GdipCreateAdjustableArrowCap( - height, width, isFilled, &cap); - SetNativeCap(cap); - } - - Status SetHeight(IN REAL height) - { - GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; - return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight( - cap, height)); - } - - REAL GetHeight() const - { - GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; - REAL height; - SetStatus(DllExports::GdipGetAdjustableArrowCapHeight( - cap, &height)); - - return height; - } - - Status SetWidth(IN REAL width) - { - GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; - return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth( - cap, width)); - } - - REAL GetWidth() const - { - GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; - REAL width; - SetStatus(DllExports::GdipGetAdjustableArrowCapWidth( - cap, &width)); - - return width; - } - - Status SetMiddleInset(IN REAL middleInset) - { - GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; - return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset( - cap, middleInset)); - } - - REAL GetMiddleInset() const - { - GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; - REAL middleInset; - SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset( - cap, &middleInset)); - - return middleInset; - } - - Status SetFillState(IN BOOL isFilled) - { - GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; - return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState( - cap, isFilled)); - } - - BOOL IsFilled() const - { - GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; - BOOL isFilled; - SetStatus(DllExports::GdipGetAdjustableArrowCapFillState( - cap, &isFilled)); - - return isFilled; - } - -#ifdef DCR_USE_NEW_250932 - -private: - AdjustableArrowCap(const AdjustableArrowCap &); - AdjustableArrowCap& operator=(const AdjustableArrowCap &); - -#endif - -}; - -#endif +/**************************************************************************\ +* +* Copyright (c) 2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusLineCaps.h +* +* Abstract: +* +* APIs for Custom Line Caps +* +\**************************************************************************/ + +#ifndef _GDIPLUSLINECAPS_H +#define _GDIPLUSLINECAPS_H + +inline +CustomLineCap::CustomLineCap( + IN const GraphicsPath* fillPath, + IN const GraphicsPath* strokePath, + IN LineCap baseCap, + IN REAL baseInset + ) +{ + nativeCap = NULL; + GpPath* nativeFillPath = NULL; + GpPath* nativeStrokePath = NULL; + + if(fillPath) + nativeFillPath = fillPath->nativePath; + if(strokePath) + nativeStrokePath = strokePath->nativePath; + + lastResult = DllExports::GdipCreateCustomLineCap( + nativeFillPath, nativeStrokePath, + baseCap, baseInset, &nativeCap); +} + +inline +CustomLineCap::CustomLineCap() +{ + // This is used for default constructor for subclasses. + // So don't create a nativeCap. + + nativeCap = NULL; + lastResult = Ok; +} + +inline +CustomLineCap::~CustomLineCap() +{ + DllExports::GdipDeleteCustomLineCap(nativeCap); +} + +inline Status +CustomLineCap::SetStrokeCaps( + IN LineCap startCap, + IN LineCap endCap) +{ + return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap, + startCap, endCap)); +} + +inline Status +CustomLineCap::GetStrokeCaps( + OUT LineCap* startCap, + OUT LineCap* endCap) const +{ + return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap, + startCap, endCap)); +} + +inline Status +CustomLineCap::SetStrokeJoin( + IN LineJoin lineJoin) +{ + return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap, lineJoin)); +} + +inline LineJoin +CustomLineCap::GetStrokeJoin() const +{ + LineJoin lineJoin; + + SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap, &lineJoin)); + + return lineJoin; +} + +inline Status +CustomLineCap::SetBaseCap(IN LineCap baseCap) +{ + return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap, baseCap)); +} + +inline LineCap +CustomLineCap::GetBaseCap() const +{ + LineCap baseCap; + SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap)); + + return baseCap; +} + +inline Status +CustomLineCap::SetBaseInset(IN REAL inset) +{ + return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap, inset)); +} + +inline REAL +CustomLineCap::GetBaseInset() const +{ + REAL inset; + SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset)); + + return inset; +} + + +inline Status +CustomLineCap::SetWidthScale(IN REAL widthScale) +{ + return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap, widthScale)); +} + +inline REAL +CustomLineCap::GetWidthScale() const +{ + REAL widthScale; + SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap, &widthScale)); + + return widthScale; +} + +inline CustomLineCap* +CustomLineCap::Clone() const +{ + GpCustomLineCap *newNativeLineCap = NULL; + + SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap, &newNativeLineCap)); + + if (lastResult == Ok) + { + CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap, lastResult); + if (newLineCap == NULL) + { + SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap)); + } + + return newLineCap; + } + + return NULL; +} + +class AdjustableArrowCap : public CustomLineCap +{ +public: + + AdjustableArrowCap( + IN REAL height, + IN REAL width, + IN BOOL isFilled = TRUE + ) + { + GpAdjustableArrowCap* cap = NULL; + + lastResult = DllExports::GdipCreateAdjustableArrowCap( + height, width, isFilled, &cap); + SetNativeCap(cap); + } + + Status SetHeight(IN REAL height) + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight( + cap, height)); + } + + REAL GetHeight() const + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + REAL height; + SetStatus(DllExports::GdipGetAdjustableArrowCapHeight( + cap, &height)); + + return height; + } + + Status SetWidth(IN REAL width) + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth( + cap, width)); + } + + REAL GetWidth() const + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + REAL width; + SetStatus(DllExports::GdipGetAdjustableArrowCapWidth( + cap, &width)); + + return width; + } + + Status SetMiddleInset(IN REAL middleInset) + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset( + cap, middleInset)); + } + + REAL GetMiddleInset() const + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + REAL middleInset; + SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset( + cap, &middleInset)); + + return middleInset; + } + + Status SetFillState(IN BOOL isFilled) + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState( + cap, isFilled)); + } + + BOOL IsFilled() const + { + GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; + BOOL isFilled; + SetStatus(DllExports::GdipGetAdjustableArrowCapFillState( + cap, &isFilled)); + + return isFilled; + } + +#ifdef DCR_USE_NEW_250932 + +private: + AdjustableArrowCap(const AdjustableArrowCap &); + AdjustableArrowCap& operator=(const AdjustableArrowCap &); + +#endif + +}; + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusMatrix.h b/core/src/fxge/Microsoft SDK/include/GdiPlusMatrix.h index 7fa3df8cd1..1338d8c1ac 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusMatrix.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusMatrix.h @@ -1,309 +1,309 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusMatrix.h -* -* Abstract: -* -* GDI+ Matrix class -* -\**************************************************************************/ - -class Matrix : public GdiplusBase -{ -public: - friend class Graphics; - friend class GraphicsPath; - friend class TextureBrush; - friend class LinearGradientBrush; - friend class PathGradientBrush; - friend class Pen; - friend class Region; - - // Default constructor - set to identity matrix - - Matrix() - { - GpMatrix *matrix = NULL; - - lastResult = DllExports::GdipCreateMatrix(&matrix); - - SetNativeMatrix(matrix); - } - - Matrix(IN REAL m11, - IN REAL m12, - IN REAL m21, - IN REAL m22, - IN REAL dx, - IN REAL dy) - { - GpMatrix *matrix = NULL; - - lastResult = DllExports::GdipCreateMatrix2(m11, m12, m21, m22, - dx, dy, &matrix); - - SetNativeMatrix(matrix); - } - - Matrix(IN const RectF& rect, - IN const PointF* dstplg) - { - GpMatrix *matrix = NULL; - - lastResult = DllExports::GdipCreateMatrix3(&rect, - dstplg, - &matrix); - - SetNativeMatrix(matrix); - } - - Matrix(IN const Rect& rect, - IN const Point* dstplg) - { - GpMatrix *matrix = NULL; - - lastResult = DllExports::GdipCreateMatrix3I(&rect, - dstplg, - &matrix); - - SetNativeMatrix(matrix); - } - - ~Matrix() - { - DllExports::GdipDeleteMatrix(nativeMatrix); - } - - Matrix *Clone() const - { - GpMatrix *cloneMatrix = NULL; - - SetStatus(DllExports::GdipCloneMatrix(nativeMatrix, - &cloneMatrix)); - - if (lastResult != Ok) - return NULL; - - return new Matrix(cloneMatrix); - } - - Status GetElements(OUT REAL *m) const - { - return SetStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m)); - } - - Status SetElements(IN REAL m11, - IN REAL m12, - IN REAL m21, - IN REAL m22, - IN REAL dx, - IN REAL dy) - { - return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, - m11, m12, m21, m22, dx, dy)); - } - - REAL OffsetX() const - { - REAL elements[6]; - - if (GetElements(&elements[0]) == Ok) - return elements[4]; - else - return 0.0f; - } - - REAL OffsetY() const - { - REAL elements[6]; - - if (GetElements(&elements[0]) == Ok) - return elements[5]; - else - return 0.0f; - } - - Status Reset() - { - // set identity matrix elements - return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, - 1.0, 0.0, 0.0, 1.0, 0.0, 0.0)); - } - - Status Multiply(IN const Matrix *matrix, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix, - matrix->nativeMatrix, - order)); - } - - Status Translate(IN REAL offsetX, - IN REAL offsetY, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX, offsetY, order)); - } - - Status Scale(IN REAL scaleX, - IN REAL scaleY, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX, scaleY, order)); - } - - Status Rotate(IN REAL angle, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); - } - - Status RotateAt(IN REAL angle, - IN const PointF& center, - IN MatrixOrder order = MatrixOrderPrepend) - { - if(order == MatrixOrderPrepend) - { - SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order)); - SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); - return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, - center.X, - center.Y, order)); - } - else - { - SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, - center.X, - center.Y, order)); - SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); - return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order)); - } - } - - Status Shear(IN REAL shearX, - IN REAL shearY, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX, shearY, order)); - } - - Status Invert() - { - return SetStatus(DllExports::GdipInvertMatrix(nativeMatrix)); - } - - // float version - Status TransformPoints(IN OUT PointF* pts, - IN INT count = 1) const - { - return SetStatus(DllExports::GdipTransformMatrixPoints(nativeMatrix, pts, count)); - } - - Status TransformPoints(IN OUT Point* pts, - IN INT count = 1) const - { - return SetStatus(DllExports::GdipTransformMatrixPointsI(nativeMatrix, - pts, - count)); - } - - Status TransformVectors(IN OUT PointF* pts, - IN INT count = 1) const - { - return SetStatus(DllExports::GdipVectorTransformMatrixPoints(nativeMatrix, pts, count)); - } - - Status TransformVectors(IN OUT Point* pts, - IN INT count = 1) const - { - return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(nativeMatrix, - pts, - count)); - } - - BOOL IsInvertible() const - { - BOOL result = FALSE; - - SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result)); - - return result; - } - - BOOL IsIdentity() const - { - BOOL result = FALSE; - - SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result)); - - return result; - } - - BOOL Equals(IN const Matrix *matrix) const - { - BOOL result = FALSE; - - SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, - matrix->nativeMatrix, &result)); - - return result; - } - - Status GetLastStatus() const - { - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; - } - -protected: - -#ifdef DCR_USE_NEW_250932 - -private: - Matrix(const Matrix &); - Matrix& operator=(const Matrix &); -protected: - -#else - - Matrix(const Matrix& matrix) - { - matrix; - SetStatus(NotImplemented); - SetNativeMatrix(NULL); - } - - Matrix& operator=(const Matrix& matrix) - { - matrix; - SetStatus(NotImplemented); - return *this; - } - -#endif - - Matrix(GpMatrix *nativeMatrix) - { - lastResult = Ok; - SetNativeMatrix(nativeMatrix); - } - - VOID SetNativeMatrix(GpMatrix *nativeMatrix) - { - this->nativeMatrix = nativeMatrix; - } - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - -protected: - GpMatrix *nativeMatrix; - mutable Status lastResult; -}; +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusMatrix.h +* +* Abstract: +* +* GDI+ Matrix class +* +\**************************************************************************/ + +class Matrix : public GdiplusBase +{ +public: + friend class Graphics; + friend class GraphicsPath; + friend class TextureBrush; + friend class LinearGradientBrush; + friend class PathGradientBrush; + friend class Pen; + friend class Region; + + // Default constructor - set to identity matrix + + Matrix() + { + GpMatrix *matrix = NULL; + + lastResult = DllExports::GdipCreateMatrix(&matrix); + + SetNativeMatrix(matrix); + } + + Matrix(IN REAL m11, + IN REAL m12, + IN REAL m21, + IN REAL m22, + IN REAL dx, + IN REAL dy) + { + GpMatrix *matrix = NULL; + + lastResult = DllExports::GdipCreateMatrix2(m11, m12, m21, m22, + dx, dy, &matrix); + + SetNativeMatrix(matrix); + } + + Matrix(IN const RectF& rect, + IN const PointF* dstplg) + { + GpMatrix *matrix = NULL; + + lastResult = DllExports::GdipCreateMatrix3(&rect, + dstplg, + &matrix); + + SetNativeMatrix(matrix); + } + + Matrix(IN const Rect& rect, + IN const Point* dstplg) + { + GpMatrix *matrix = NULL; + + lastResult = DllExports::GdipCreateMatrix3I(&rect, + dstplg, + &matrix); + + SetNativeMatrix(matrix); + } + + ~Matrix() + { + DllExports::GdipDeleteMatrix(nativeMatrix); + } + + Matrix *Clone() const + { + GpMatrix *cloneMatrix = NULL; + + SetStatus(DllExports::GdipCloneMatrix(nativeMatrix, + &cloneMatrix)); + + if (lastResult != Ok) + return NULL; + + return new Matrix(cloneMatrix); + } + + Status GetElements(OUT REAL *m) const + { + return SetStatus(DllExports::GdipGetMatrixElements(nativeMatrix, m)); + } + + Status SetElements(IN REAL m11, + IN REAL m12, + IN REAL m21, + IN REAL m22, + IN REAL dx, + IN REAL dy) + { + return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, + m11, m12, m21, m22, dx, dy)); + } + + REAL OffsetX() const + { + REAL elements[6]; + + if (GetElements(&elements[0]) == Ok) + return elements[4]; + else + return 0.0f; + } + + REAL OffsetY() const + { + REAL elements[6]; + + if (GetElements(&elements[0]) == Ok) + return elements[5]; + else + return 0.0f; + } + + Status Reset() + { + // set identity matrix elements + return SetStatus(DllExports::GdipSetMatrixElements(nativeMatrix, + 1.0, 0.0, 0.0, 1.0, 0.0, 0.0)); + } + + Status Multiply(IN const Matrix *matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyMatrix(nativeMatrix, + matrix->nativeMatrix, + order)); + } + + Status Translate(IN REAL offsetX, + IN REAL offsetY, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, offsetX, offsetY, order)); + } + + Status Scale(IN REAL scaleX, + IN REAL scaleY, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScaleMatrix(nativeMatrix, scaleX, scaleY, order)); + } + + Status Rotate(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); + } + + Status RotateAt(IN REAL angle, + IN const PointF& center, + IN MatrixOrder order = MatrixOrderPrepend) + { + if(order == MatrixOrderPrepend) + { + SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order)); + SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); + return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, - center.X, - center.Y, order)); + } + else + { + SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, - center.X, - center.Y, order)); + SetStatus(DllExports::GdipRotateMatrix(nativeMatrix, angle, order)); + return SetStatus(DllExports::GdipTranslateMatrix(nativeMatrix, center.X, center.Y, order)); + } + } + + Status Shear(IN REAL shearX, + IN REAL shearY, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipShearMatrix(nativeMatrix, shearX, shearY, order)); + } + + Status Invert() + { + return SetStatus(DllExports::GdipInvertMatrix(nativeMatrix)); + } + + // float version + Status TransformPoints(IN OUT PointF* pts, + IN INT count = 1) const + { + return SetStatus(DllExports::GdipTransformMatrixPoints(nativeMatrix, pts, count)); + } + + Status TransformPoints(IN OUT Point* pts, + IN INT count = 1) const + { + return SetStatus(DllExports::GdipTransformMatrixPointsI(nativeMatrix, + pts, + count)); + } + + Status TransformVectors(IN OUT PointF* pts, + IN INT count = 1) const + { + return SetStatus(DllExports::GdipVectorTransformMatrixPoints(nativeMatrix, pts, count)); + } + + Status TransformVectors(IN OUT Point* pts, + IN INT count = 1) const + { + return SetStatus(DllExports::GdipVectorTransformMatrixPointsI(nativeMatrix, + pts, + count)); + } + + BOOL IsInvertible() const + { + BOOL result = FALSE; + + SetStatus(DllExports::GdipIsMatrixInvertible(nativeMatrix, &result)); + + return result; + } + + BOOL IsIdentity() const + { + BOOL result = FALSE; + + SetStatus(DllExports::GdipIsMatrixIdentity(nativeMatrix, &result)); + + return result; + } + + BOOL Equals(IN const Matrix *matrix) const + { + BOOL result = FALSE; + + SetStatus(DllExports::GdipIsMatrixEqual(nativeMatrix, + matrix->nativeMatrix, &result)); + + return result; + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +protected: + +#ifdef DCR_USE_NEW_250932 + +private: + Matrix(const Matrix &); + Matrix& operator=(const Matrix &); +protected: + +#else + + Matrix(const Matrix& matrix) + { + matrix; + SetStatus(NotImplemented); + SetNativeMatrix(NULL); + } + + Matrix& operator=(const Matrix& matrix) + { + matrix; + SetStatus(NotImplemented); + return *this; + } + +#endif + + Matrix(GpMatrix *nativeMatrix) + { + lastResult = Ok; + SetNativeMatrix(nativeMatrix); + } + + VOID SetNativeMatrix(GpMatrix *nativeMatrix) + { + this->nativeMatrix = nativeMatrix; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpMatrix *nativeMatrix; + mutable Status lastResult; +}; diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusMem.h b/core/src/fxge/Microsoft SDK/include/GdiPlusMem.h index 5f92c1e141..a0e0e44f37 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusMem.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusMem.h @@ -1,49 +1,49 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusMem.h -* -* Abstract: -* -* Flat GDI+ Memory Allocators - header file -* -\**************************************************************************/ - -// TODO: this file style needs to be made internally consistent with the way -// it handles breaking the long argument lists across multiple lines - -#ifndef _GDIPLUSMEM_H -#define _GDIPLUSMEM_H - -#define WINGDIPAPI __stdcall - -// currently, only C++ wrapper API's force const. - -#ifdef _GDIPLUS_H -#define GDIPCONST const -#else -#define GDIPCONST -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -//---------------------------------------------------------------------------- -// Memory Allocation APIs -//---------------------------------------------------------------------------- - -void* WINGDIPAPI -GdipAlloc(size_t size); - -void WINGDIPAPI -GdipFree(void* ptr); - -#ifdef __cplusplus -} -#endif - -#endif // !_GDIPLUSMEM_H +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusMem.h +* +* Abstract: +* +* Flat GDI+ Memory Allocators - header file +* +\**************************************************************************/ + +// TODO: this file style needs to be made internally consistent with the way +// it handles breaking the long argument lists across multiple lines + +#ifndef _GDIPLUSMEM_H +#define _GDIPLUSMEM_H + +#define WINGDIPAPI __stdcall + +// currently, only C++ wrapper API's force const. + +#ifdef _GDIPLUS_H +#define GDIPCONST const +#else +#define GDIPCONST +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +//---------------------------------------------------------------------------- +// Memory Allocation APIs +//---------------------------------------------------------------------------- + +void* WINGDIPAPI +GdipAlloc(size_t size); + +void WINGDIPAPI +GdipFree(void* ptr); + +#ifdef __cplusplus +} +#endif + +#endif // !_GDIPLUSMEM_H diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusMetaFile.h b/core/src/fxge/Microsoft SDK/include/GdiPlusMetaFile.h index 3d07dd64d3..f7e0d91aaa 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusMetaFile.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusMetaFile.h @@ -1,374 +1,374 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusMetafile.h -* -* Abstract: -* -* Metafile related declarations -* -\**************************************************************************/ - -#ifndef _GDIPLUSMETAFILE_H -#define _GDIPLUSMETAFILE_H - -class Metafile : public Image -{ -public: - friend class Image; - - // Read a metafile - Metafile() - { - SetNativeImage(NULL); - lastResult = Ok; - } - - // Playback a metafile from a HMETAFILE - // If deleteWmf is TRUE, then when the metafile is deleted, - // the hWmf will also be deleted. Otherwise, it won't be. - Metafile(IN HMETAFILE hWmf, - IN const APMFileHeader * apmFileHeader, - IN BOOL deleteWmf = FALSE) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf, apmFileHeader, &metafile); - - SetNativeImage(metafile); - } - - // Playback a metafile from a HENHMETAFILE - // If deleteEmf is TRUE, then when the metafile is deleted, - // the hEmf will also be deleted. Otherwise, it won't be. - Metafile(IN HENHMETAFILE hEmf, - IN BOOL deleteEmf = FALSE) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipCreateMetafileFromEmf(hEmf, deleteEmf, &metafile); - - SetNativeImage(metafile); - } - - // Playback a metafile from a file - Metafile(IN const WCHAR* filename) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipCreateMetafileFromFile(filename, &metafile); - - SetNativeImage(metafile); - } - - // Playback a WMF metafile from a file - Metafile(IN const WCHAR* filename, - IN const APMFileHeader * apmFileHeader - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipCreateMetafileFromWmfFile(filename, apmFileHeader, &metafile); - - SetNativeImage(metafile); - } - - // Playback a metafile from a stream - Metafile(IN IStream* stream) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipCreateMetafileFromStream(stream, &metafile); - - SetNativeImage(metafile); - } - - // Record a metafile to memory - Metafile( - IN HDC referenceHdc, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafile( - referenceHdc, type, NULL, MetafileFrameUnitGdi, - description, &metafile); - - SetNativeImage(metafile); - } - - // Record a metafile to memory - Metafile( - IN HDC referenceHdc, - IN const RectF & frameRect, - IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafile( - referenceHdc, type, &frameRect, frameUnit, - description, &metafile); - - SetNativeImage(metafile); - } - - // Record a metafile to memory - Metafile( - IN HDC referenceHdc, - IN const Rect & frameRect, - IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafileI( - referenceHdc, type, &frameRect, frameUnit, - description, &metafile); - - SetNativeImage(metafile); - } - - // Record a metafile to a file - Metafile( - IN const WCHAR* fileName, - IN HDC referenceHdc, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafileFileName(fileName, - referenceHdc, type, NULL, MetafileFrameUnitGdi, - description, &metafile); - - SetNativeImage(metafile); - } - - // Record a metafile to a file - Metafile( - IN const WCHAR* fileName, - IN HDC referenceHdc, - IN const RectF & frameRect, - IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafileFileName(fileName, - referenceHdc, type, &frameRect, frameUnit, - description, &metafile); - - SetNativeImage(metafile); - } - - // Record a metafile to a file - Metafile( - IN const WCHAR* fileName, - IN HDC referenceHdc, - IN const Rect & frameRect, - IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafileFileNameI(fileName, - referenceHdc, type, &frameRect, frameUnit, - description, &metafile); - - SetNativeImage(metafile); - } - - // Record a metafile to a stream - Metafile( - IN IStream * stream, - IN HDC referenceHdc, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafileStream(stream, - referenceHdc, type, NULL, MetafileFrameUnitGdi, - description, &metafile); - - SetNativeImage(metafile); - } - - // Record a metafile to a stream - Metafile( - IN IStream * stream, - IN HDC referenceHdc, - IN const RectF & frameRect, - IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafileStream(stream, - referenceHdc, type, &frameRect, frameUnit, - description, &metafile); - - SetNativeImage(metafile); - } - - // Write a metafile to a stream with down-level GDI records - Metafile( - IN IStream * stream, - IN HDC referenceHdc, - IN const Rect & frameRect, - IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, - IN EmfType type = EmfTypeEmfPlusDual, - IN const WCHAR * description = NULL - ) - { - GpMetafile * metafile = NULL; - - lastResult = DllExports::GdipRecordMetafileStreamI(stream, - referenceHdc, type, &frameRect, frameUnit, - description, &metafile); - - SetNativeImage(metafile); - } - - static Status GetMetafileHeader( - IN HMETAFILE hWmf, - IN const APMFileHeader * apmFileHeader, - OUT MetafileHeader * header - ) - { - return DllExports::GdipGetMetafileHeaderFromWmf(hWmf, apmFileHeader, header); - } - - static Status GetMetafileHeader( - IN HENHMETAFILE hEmf, - OUT MetafileHeader * header - ) - { - return DllExports::GdipGetMetafileHeaderFromEmf(hEmf, header); - } - - static Status GetMetafileHeader( - IN const WCHAR* filename, - OUT MetafileHeader * header - ) - { - return DllExports::GdipGetMetafileHeaderFromFile(filename, header); - } - - static Status GetMetafileHeader( - IN IStream * stream, - OUT MetafileHeader * header - ) - { - return DllExports::GdipGetMetafileHeaderFromStream(stream, header); - } - - Status GetMetafileHeader( - OUT MetafileHeader * header - ) const - { - return SetStatus(DllExports::GdipGetMetafileHeaderFromMetafile( - (GpMetafile *)nativeImage, - header)); - } - - // Once this method is called, the Metafile object is in an invalid state - // and can no longer be used. It is the responsiblity of the caller to - // invoke DeleteEnhMetaFile to delete this hEmf. - - HENHMETAFILE GetHENHMETAFILE() - { - HENHMETAFILE hEmf; - - SetStatus(DllExports::GdipGetHemfFromMetafile((GpMetafile *)nativeImage, &hEmf)); - - return hEmf; - } - - // Used in conjuction with Graphics::EnumerateMetafile to play an EMF+ - // The data must be DWORD aligned if it's an EMF or EMF+. It must be - // WORD aligned if it's a WMF. - Status - PlayRecord( - IN EmfPlusRecordType recordType, - IN UINT flags, - IN UINT dataSize, - IN const BYTE * data - ) const - { - return SetStatus(DllExports::GdipPlayMetafileRecord( - (GpMetafile *)nativeImage, - recordType, - flags, - dataSize, - data)); - } - - // If you're using a printer HDC for the metafile, but you want the - // metafile rasterized at screen resolution, then use this API to set - // the rasterization dpi of the metafile to the screen resolution, - // e.g. 96 dpi or 120 dpi. - Status SetDownLevelRasterizationLimit( - IN UINT metafileRasterizationLimitDpi - ) - { - return SetStatus(DllExports::GdipSetMetafileDownLevelRasterizationLimit( - (GpMetafile *)nativeImage, - metafileRasterizationLimitDpi)); - } - - UINT GetDownLevelRasterizationLimit() const - { - UINT metafileRasterizationLimitDpi = 0; - - SetStatus(DllExports::GdipGetMetafileDownLevelRasterizationLimit( - (GpMetafile *)nativeImage, - &metafileRasterizationLimitDpi)); - - return metafileRasterizationLimitDpi; - } - - static UINT Metafile::EmfToWmfBits( - IN HENHMETAFILE hemf, - IN UINT cbData16, - IN LPBYTE pData16, - IN INT iMapMode = MM_ANISOTROPIC, - IN EmfToWmfBitsFlags eFlags = EmfToWmfBitsFlagsDefault - ) - { - return DllExports::GdipEmfToWmfBits( - hemf, - cbData16, - pData16, - iMapMode, - eFlags); - } - -#ifdef DCR_USE_NEW_250932 - -private: - Metafile(const Metafile &); - Metafile& operator=(const Metafile &); - -#endif -}; - -#endif // !_METAFILE_H +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusMetafile.h +* +* Abstract: +* +* Metafile related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSMETAFILE_H +#define _GDIPLUSMETAFILE_H + +class Metafile : public Image +{ +public: + friend class Image; + + // Read a metafile + Metafile() + { + SetNativeImage(NULL); + lastResult = Ok; + } + + // Playback a metafile from a HMETAFILE + // If deleteWmf is TRUE, then when the metafile is deleted, + // the hWmf will also be deleted. Otherwise, it won't be. + Metafile(IN HMETAFILE hWmf, + IN const APMFileHeader * apmFileHeader, + IN BOOL deleteWmf = FALSE) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromWmf(hWmf, deleteWmf, apmFileHeader, &metafile); + + SetNativeImage(metafile); + } + + // Playback a metafile from a HENHMETAFILE + // If deleteEmf is TRUE, then when the metafile is deleted, + // the hEmf will also be deleted. Otherwise, it won't be. + Metafile(IN HENHMETAFILE hEmf, + IN BOOL deleteEmf = FALSE) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromEmf(hEmf, deleteEmf, &metafile); + + SetNativeImage(metafile); + } + + // Playback a metafile from a file + Metafile(IN const WCHAR* filename) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromFile(filename, &metafile); + + SetNativeImage(metafile); + } + + // Playback a WMF metafile from a file + Metafile(IN const WCHAR* filename, + IN const APMFileHeader * apmFileHeader + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromWmfFile(filename, apmFileHeader, &metafile); + + SetNativeImage(metafile); + } + + // Playback a metafile from a stream + Metafile(IN IStream* stream) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipCreateMetafileFromStream(stream, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to memory + Metafile( + IN HDC referenceHdc, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafile( + referenceHdc, type, NULL, MetafileFrameUnitGdi, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to memory + Metafile( + IN HDC referenceHdc, + IN const RectF & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafile( + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to memory + Metafile( + IN HDC referenceHdc, + IN const Rect & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileI( + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a file + Metafile( + IN const WCHAR* fileName, + IN HDC referenceHdc, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileFileName(fileName, + referenceHdc, type, NULL, MetafileFrameUnitGdi, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a file + Metafile( + IN const WCHAR* fileName, + IN HDC referenceHdc, + IN const RectF & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileFileName(fileName, + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a file + Metafile( + IN const WCHAR* fileName, + IN HDC referenceHdc, + IN const Rect & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileFileNameI(fileName, + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a stream + Metafile( + IN IStream * stream, + IN HDC referenceHdc, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileStream(stream, + referenceHdc, type, NULL, MetafileFrameUnitGdi, + description, &metafile); + + SetNativeImage(metafile); + } + + // Record a metafile to a stream + Metafile( + IN IStream * stream, + IN HDC referenceHdc, + IN const RectF & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileStream(stream, + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + // Write a metafile to a stream with down-level GDI records + Metafile( + IN IStream * stream, + IN HDC referenceHdc, + IN const Rect & frameRect, + IN MetafileFrameUnit frameUnit = MetafileFrameUnitGdi, + IN EmfType type = EmfTypeEmfPlusDual, + IN const WCHAR * description = NULL + ) + { + GpMetafile * metafile = NULL; + + lastResult = DllExports::GdipRecordMetafileStreamI(stream, + referenceHdc, type, &frameRect, frameUnit, + description, &metafile); + + SetNativeImage(metafile); + } + + static Status GetMetafileHeader( + IN HMETAFILE hWmf, + IN const APMFileHeader * apmFileHeader, + OUT MetafileHeader * header + ) + { + return DllExports::GdipGetMetafileHeaderFromWmf(hWmf, apmFileHeader, header); + } + + static Status GetMetafileHeader( + IN HENHMETAFILE hEmf, + OUT MetafileHeader * header + ) + { + return DllExports::GdipGetMetafileHeaderFromEmf(hEmf, header); + } + + static Status GetMetafileHeader( + IN const WCHAR* filename, + OUT MetafileHeader * header + ) + { + return DllExports::GdipGetMetafileHeaderFromFile(filename, header); + } + + static Status GetMetafileHeader( + IN IStream * stream, + OUT MetafileHeader * header + ) + { + return DllExports::GdipGetMetafileHeaderFromStream(stream, header); + } + + Status GetMetafileHeader( + OUT MetafileHeader * header + ) const + { + return SetStatus(DllExports::GdipGetMetafileHeaderFromMetafile( + (GpMetafile *)nativeImage, + header)); + } + + // Once this method is called, the Metafile object is in an invalid state + // and can no longer be used. It is the responsiblity of the caller to + // invoke DeleteEnhMetaFile to delete this hEmf. + + HENHMETAFILE GetHENHMETAFILE() + { + HENHMETAFILE hEmf; + + SetStatus(DllExports::GdipGetHemfFromMetafile((GpMetafile *)nativeImage, &hEmf)); + + return hEmf; + } + + // Used in conjuction with Graphics::EnumerateMetafile to play an EMF+ + // The data must be DWORD aligned if it's an EMF or EMF+. It must be + // WORD aligned if it's a WMF. + Status + PlayRecord( + IN EmfPlusRecordType recordType, + IN UINT flags, + IN UINT dataSize, + IN const BYTE * data + ) const + { + return SetStatus(DllExports::GdipPlayMetafileRecord( + (GpMetafile *)nativeImage, + recordType, + flags, + dataSize, + data)); + } + + // If you're using a printer HDC for the metafile, but you want the + // metafile rasterized at screen resolution, then use this API to set + // the rasterization dpi of the metafile to the screen resolution, + // e.g. 96 dpi or 120 dpi. + Status SetDownLevelRasterizationLimit( + IN UINT metafileRasterizationLimitDpi + ) + { + return SetStatus(DllExports::GdipSetMetafileDownLevelRasterizationLimit( + (GpMetafile *)nativeImage, + metafileRasterizationLimitDpi)); + } + + UINT GetDownLevelRasterizationLimit() const + { + UINT metafileRasterizationLimitDpi = 0; + + SetStatus(DllExports::GdipGetMetafileDownLevelRasterizationLimit( + (GpMetafile *)nativeImage, + &metafileRasterizationLimitDpi)); + + return metafileRasterizationLimitDpi; + } + + static UINT Metafile::EmfToWmfBits( + IN HENHMETAFILE hemf, + IN UINT cbData16, + IN LPBYTE pData16, + IN INT iMapMode = MM_ANISOTROPIC, + IN EmfToWmfBitsFlags eFlags = EmfToWmfBitsFlagsDefault + ) + { + return DllExports::GdipEmfToWmfBits( + hemf, + cbData16, + pData16, + iMapMode, + eFlags); + } + +#ifdef DCR_USE_NEW_250932 + +private: + Metafile(const Metafile &); + Metafile& operator=(const Metafile &); + +#endif +}; + +#endif // !_METAFILE_H diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusMetaHeader.h b/core/src/fxge/Microsoft SDK/include/GdiPlusMetaHeader.h index 79b5bc9533..95ee190f04 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusMetaHeader.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusMetaHeader.h @@ -1,213 +1,213 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* Metafile headers -* -* Abstract: -* -* Declarations for various metafile header structures. -* -\**************************************************************************/ - -#ifndef _GDIPLUSMETAHEADER_H -#define _GDIPLUSMETAHEADER_H - -typedef struct -{ - DWORD iType; // Record type EMR_HEADER - DWORD nSize; // Record size in bytes. This may be greater - // than the sizeof(ENHMETAHEADER). - RECTL rclBounds; // Inclusive-inclusive bounds in device units - RECTL rclFrame; // Inclusive-inclusive Picture Frame of metafile in .01 mm units - DWORD dSignature; // Signature. Must be ENHMETA_SIGNATURE. - DWORD nVersion; // Version number - DWORD nBytes; // Size of the metafile in bytes - DWORD nRecords; // Number of records in the metafile - WORD nHandles; // Number of handles in the handle table - // Handle index zero is reserved. - WORD sReserved; // Reserved. Must be zero. - DWORD nDescription; // Number of chars in the unicode description string - // This is 0 if there is no description string - DWORD offDescription; // Offset to the metafile description record. - // This is 0 if there is no description string - DWORD nPalEntries; // Number of entries in the metafile palette. - SIZEL szlDevice; // Size of the reference device in pels - SIZEL szlMillimeters; // Size of the reference device in millimeters -} ENHMETAHEADER3; - -// Aldus Placeable Metafiles - -// Placeable Metafiles were created by Aldus Corporation as a non-standard -// way of specifying how a metafile is mapped and scaled on an output device. -// Placeable metafiles are quite wide-spread, but not directly supported by -// the Windows API. To playback a placeable metafile using the Windows API, -// you will first need to strip the placeable metafile header from the file. -// This is typically performed by copying the metafile to a temporary file -// starting at file offset 22 (0x16). The contents of the temporary file may -// then be used as input to the Windows GetMetaFile(), PlayMetaFile(), -// CopyMetaFile(), etc. GDI functions. - -// Each placeable metafile begins with a 22-byte header, -// followed by a standard metafile: - -#include // set structure packing to 2 - -typedef struct -{ - INT16 Left; - INT16 Top; - INT16 Right; - INT16 Bottom; -} APMRect16; - -typedef struct -{ - UINT32 Key; // GDIP_WMF_ALDUSKEY - INT16 Hmf; // Metafile HANDLE number (always 0) - APMRect16 BoundingBox; // Coordinates in metafile units - INT16 Inch; // Number of metafile units per inch - UINT32 Reserved; // Reserved (always 0) - INT16 Checksum; // Checksum value for previous 10 WORDs -} APMFileHeader; - -#include - -// Key contains a special identification value that indicates the presence -// of a placeable metafile header and is always 0x9AC6CDD7. - -// Handle is used to stored the handle of the metafile in memory. When written -// to disk, this field is not used and will always contains the value 0. - -// Left, Top, Right, and Bottom contain the coordinates of the upper-left -// and lower-right corners of the image on the output device. These are -// measured in twips. - -// A twip (meaning "twentieth of a point") is the logical unit of measurement -// used in Windows Metafiles. A twip is equal to 1/1440 of an inch. Thus 720 -// twips equal 1/2 inch, while 32,768 twips is 22.75 inches. - -// Inch contains the number of twips per inch used to represent the image. -// Normally, there are 1440 twips per inch; however, this number may be -// changed to scale the image. A value of 720 indicates that the image is -// double its normal size, or scaled to a factor of 2:1. A value of 360 -// indicates a scale of 4:1, while a value of 2880 indicates that the image -// is scaled down in size by a factor of two. A value of 1440 indicates -// a 1:1 scale ratio. - -// Reserved is not used and is always set to 0. - -// Checksum contains a checksum value for the previous 10 WORDs in the header. -// This value can be used in an attempt to detect if the metafile has become -// corrupted. The checksum is calculated by XORing each WORD value to an -// initial value of 0. - -// If the metafile was recorded with a reference Hdc that was a display. -#define GDIP_EMFPLUSFLAGS_DISPLAY 0x00000001 - -class MetafileHeader -{ -public: - MetafileType Type; - UINT Size; // Size of the metafile (in bytes) - UINT Version; // EMF+, EMF, or WMF version - UINT EmfPlusFlags; - REAL DpiX; - REAL DpiY; - INT X; // Bounds in device units - INT Y; - INT Width; - INT Height; - union - { - METAHEADER WmfHeader; - ENHMETAHEADER3 EmfHeader; - }; - INT EmfPlusHeaderSize; // size of the EMF+ header in file - INT LogicalDpiX; // Logical Dpi of reference Hdc - INT LogicalDpiY; // usually valid only for EMF+ files - -public: - // Get the metafile type - MetafileType GetType() const { return Type; } - - // Get the size of the metafile in BYTEs - UINT GetMetafileSize() const { return Size; } - - // If IsEmfPlus, this is the EMF+ version; else it is the WMF or EMF version - UINT GetVersion() const { return Version; } - - // Get the EMF+ flags associated with the metafile - UINT GetEmfPlusFlags() const { return EmfPlusFlags; } - - // Get the X Dpi of the metafile - REAL GetDpiX() const { return DpiX; } - - // Get the Y Dpi of the metafile - REAL GetDpiY() const { return DpiY; } - - // Get the bounds of the metafile in device units - VOID GetBounds (OUT Rect *rect) const - { - rect->X = X; - rect->Y = Y; - rect->Width = Width; - rect->Height = Height; - } - - // Is it any type of WMF (standard or Aldus Placeable Metafile)? - BOOL IsWmf() const - { - return ((Type == MetafileTypeWmf) || (Type == MetafileTypeWmfAldus)); - } - - // Is this an Aldus Placeable Metafile? - BOOL IsWmfAldus() const { return (Type == MetafileTypeWmf); } - - // Is this an EMF (not an EMF+)? - BOOL IsEmf() const { return (Type == MetafileTypeEmf); } - - // Is this an EMF or EMF+ file? - BOOL IsEmfOrEmfPlus() const { return (Type >= MetafileTypeEmf); } - - // Is this an EMF+ file? - BOOL IsEmfPlus() const { return (Type >= MetafileTypeEmfPlusOnly); } - - // Is this an EMF+ dual (has dual, down-level records) file? - BOOL IsEmfPlusDual() const { return (Type == MetafileTypeEmfPlusDual); } - - // Is this an EMF+ only (no dual records) file? - BOOL IsEmfPlusOnly() const { return (Type == MetafileTypeEmfPlusOnly); } - - // If it's an EMF+ file, was it recorded against a display Hdc? - BOOL IsDisplay() const - { - return (IsEmfPlus() && - ((EmfPlusFlags & GDIP_EMFPLUSFLAGS_DISPLAY) != 0)); - } - - // Get the WMF header of the metafile (if it is a WMF) - const METAHEADER * GetWmfHeader() const - { - if (IsWmf()) - { - return &WmfHeader; - } - return NULL; - } - - // Get the EMF header of the metafile (if it is an EMF) - const ENHMETAHEADER3 * GetEmfHeader() const - { - if (IsEmfOrEmfPlus()) - { - return &EmfHeader; - } - return NULL; - } -}; - -#endif - +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* Metafile headers +* +* Abstract: +* +* Declarations for various metafile header structures. +* +\**************************************************************************/ + +#ifndef _GDIPLUSMETAHEADER_H +#define _GDIPLUSMETAHEADER_H + +typedef struct +{ + DWORD iType; // Record type EMR_HEADER + DWORD nSize; // Record size in bytes. This may be greater + // than the sizeof(ENHMETAHEADER). + RECTL rclBounds; // Inclusive-inclusive bounds in device units + RECTL rclFrame; // Inclusive-inclusive Picture Frame of metafile in .01 mm units + DWORD dSignature; // Signature. Must be ENHMETA_SIGNATURE. + DWORD nVersion; // Version number + DWORD nBytes; // Size of the metafile in bytes + DWORD nRecords; // Number of records in the metafile + WORD nHandles; // Number of handles in the handle table + // Handle index zero is reserved. + WORD sReserved; // Reserved. Must be zero. + DWORD nDescription; // Number of chars in the unicode description string + // This is 0 if there is no description string + DWORD offDescription; // Offset to the metafile description record. + // This is 0 if there is no description string + DWORD nPalEntries; // Number of entries in the metafile palette. + SIZEL szlDevice; // Size of the reference device in pels + SIZEL szlMillimeters; // Size of the reference device in millimeters +} ENHMETAHEADER3; + +// Aldus Placeable Metafiles + +// Placeable Metafiles were created by Aldus Corporation as a non-standard +// way of specifying how a metafile is mapped and scaled on an output device. +// Placeable metafiles are quite wide-spread, but not directly supported by +// the Windows API. To playback a placeable metafile using the Windows API, +// you will first need to strip the placeable metafile header from the file. +// This is typically performed by copying the metafile to a temporary file +// starting at file offset 22 (0x16). The contents of the temporary file may +// then be used as input to the Windows GetMetaFile(), PlayMetaFile(), +// CopyMetaFile(), etc. GDI functions. + +// Each placeable metafile begins with a 22-byte header, +// followed by a standard metafile: + +#include // set structure packing to 2 + +typedef struct +{ + INT16 Left; + INT16 Top; + INT16 Right; + INT16 Bottom; +} APMRect16; + +typedef struct +{ + UINT32 Key; // GDIP_WMF_ALDUSKEY + INT16 Hmf; // Metafile HANDLE number (always 0) + APMRect16 BoundingBox; // Coordinates in metafile units + INT16 Inch; // Number of metafile units per inch + UINT32 Reserved; // Reserved (always 0) + INT16 Checksum; // Checksum value for previous 10 WORDs +} APMFileHeader; + +#include + +// Key contains a special identification value that indicates the presence +// of a placeable metafile header and is always 0x9AC6CDD7. + +// Handle is used to stored the handle of the metafile in memory. When written +// to disk, this field is not used and will always contains the value 0. + +// Left, Top, Right, and Bottom contain the coordinates of the upper-left +// and lower-right corners of the image on the output device. These are +// measured in twips. + +// A twip (meaning "twentieth of a point") is the logical unit of measurement +// used in Windows Metafiles. A twip is equal to 1/1440 of an inch. Thus 720 +// twips equal 1/2 inch, while 32,768 twips is 22.75 inches. + +// Inch contains the number of twips per inch used to represent the image. +// Normally, there are 1440 twips per inch; however, this number may be +// changed to scale the image. A value of 720 indicates that the image is +// double its normal size, or scaled to a factor of 2:1. A value of 360 +// indicates a scale of 4:1, while a value of 2880 indicates that the image +// is scaled down in size by a factor of two. A value of 1440 indicates +// a 1:1 scale ratio. + +// Reserved is not used and is always set to 0. + +// Checksum contains a checksum value for the previous 10 WORDs in the header. +// This value can be used in an attempt to detect if the metafile has become +// corrupted. The checksum is calculated by XORing each WORD value to an +// initial value of 0. + +// If the metafile was recorded with a reference Hdc that was a display. +#define GDIP_EMFPLUSFLAGS_DISPLAY 0x00000001 + +class MetafileHeader +{ +public: + MetafileType Type; + UINT Size; // Size of the metafile (in bytes) + UINT Version; // EMF+, EMF, or WMF version + UINT EmfPlusFlags; + REAL DpiX; + REAL DpiY; + INT X; // Bounds in device units + INT Y; + INT Width; + INT Height; + union + { + METAHEADER WmfHeader; + ENHMETAHEADER3 EmfHeader; + }; + INT EmfPlusHeaderSize; // size of the EMF+ header in file + INT LogicalDpiX; // Logical Dpi of reference Hdc + INT LogicalDpiY; // usually valid only for EMF+ files + +public: + // Get the metafile type + MetafileType GetType() const { return Type; } + + // Get the size of the metafile in BYTEs + UINT GetMetafileSize() const { return Size; } + + // If IsEmfPlus, this is the EMF+ version; else it is the WMF or EMF version + UINT GetVersion() const { return Version; } + + // Get the EMF+ flags associated with the metafile + UINT GetEmfPlusFlags() const { return EmfPlusFlags; } + + // Get the X Dpi of the metafile + REAL GetDpiX() const { return DpiX; } + + // Get the Y Dpi of the metafile + REAL GetDpiY() const { return DpiY; } + + // Get the bounds of the metafile in device units + VOID GetBounds (OUT Rect *rect) const + { + rect->X = X; + rect->Y = Y; + rect->Width = Width; + rect->Height = Height; + } + + // Is it any type of WMF (standard or Aldus Placeable Metafile)? + BOOL IsWmf() const + { + return ((Type == MetafileTypeWmf) || (Type == MetafileTypeWmfAldus)); + } + + // Is this an Aldus Placeable Metafile? + BOOL IsWmfAldus() const { return (Type == MetafileTypeWmf); } + + // Is this an EMF (not an EMF+)? + BOOL IsEmf() const { return (Type == MetafileTypeEmf); } + + // Is this an EMF or EMF+ file? + BOOL IsEmfOrEmfPlus() const { return (Type >= MetafileTypeEmf); } + + // Is this an EMF+ file? + BOOL IsEmfPlus() const { return (Type >= MetafileTypeEmfPlusOnly); } + + // Is this an EMF+ dual (has dual, down-level records) file? + BOOL IsEmfPlusDual() const { return (Type == MetafileTypeEmfPlusDual); } + + // Is this an EMF+ only (no dual records) file? + BOOL IsEmfPlusOnly() const { return (Type == MetafileTypeEmfPlusOnly); } + + // If it's an EMF+ file, was it recorded against a display Hdc? + BOOL IsDisplay() const + { + return (IsEmfPlus() && + ((EmfPlusFlags & GDIP_EMFPLUSFLAGS_DISPLAY) != 0)); + } + + // Get the WMF header of the metafile (if it is a WMF) + const METAHEADER * GetWmfHeader() const + { + if (IsWmf()) + { + return &WmfHeader; + } + return NULL; + } + + // Get the EMF header of the metafile (if it is an EMF) + const ENHMETAHEADER3 * GetEmfHeader() const + { + if (IsEmfOrEmfPlus()) + { + return &EmfHeader; + } + return NULL; + } +}; + +#endif + diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusPath.h b/core/src/fxge/Microsoft SDK/include/GdiPlusPath.h index cff0e1d9ce..99f8afdda8 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusPath.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusPath.h @@ -1,1686 +1,1686 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusPath.h -* -* Abstract: -* -* Path related declarations -* -\**************************************************************************/ - -#ifndef _GDIPLUSPATH_H -#define _GDIPLUSPATH_H - -class GraphicsPath : public GdiplusBase -{ -public: - friend class Graphics; - friend class Region; - friend class PathGradientBrush; - friend class GraphicsPathIterator; - friend class CustomLineCap; - - // Path constructors - - GraphicsPath(IN FillMode fillMode = FillModeAlternate) - { - nativePath = NULL; - lastResult = DllExports::GdipCreatePath(fillMode, &nativePath); - } - - GraphicsPath(IN const PointF* points, - IN const BYTE* types, - IN INT count, - IN FillMode fillMode = FillModeAlternate) - { - nativePath = NULL; - lastResult = DllExports::GdipCreatePath2(points, - types, - count, - fillMode, - &nativePath); - } - - GraphicsPath(IN const Point* points, - IN const BYTE* types, - IN INT count, - IN FillMode fillMode = FillModeAlternate) - { - nativePath = NULL; - lastResult = DllExports::GdipCreatePath2I(points, - types, - count, - fillMode, - &nativePath); - } - - ~GraphicsPath() - { - DllExports::GdipDeletePath(nativePath); - } - - /** - * Make a copy of the current path object - */ - GraphicsPath* Clone() const - { - GpPath *clonepath = NULL; - - SetStatus(DllExports::GdipClonePath(nativePath, &clonepath)); - - return new GraphicsPath(clonepath); - } - - /** - * Reset the path object to empty (and fill mode to FillModeAlternate) - */ - Status Reset() - { - return SetStatus(DllExports::GdipResetPath(nativePath)); - } - - /** - * Get path fill mode information - */ - FillMode GetFillMode() const - { - FillMode fillmode = FillModeAlternate; - - SetStatus(DllExports::GdipGetPathFillMode(nativePath, &fillmode)); - - return fillmode; - } - - /** - * Set path fill mode information - */ - Status SetFillMode(IN FillMode fillmode) - { - return SetStatus(DllExports::GdipSetPathFillMode(nativePath, fillmode)); - } - - /** - * Set/get path data - */ - Status GetPathData(OUT PathData* pathData) const - { - if (pathData == NULL) - { - return SetStatus(InvalidParameter); - } - - INT count = GetPointCount(); - - if ((count <= 0) || (pathData->Count>0 && pathData->CountCount = 0; - if (pathData->Points) - { - delete pathData->Points; - pathData->Points = NULL; - } - - if (pathData->Types) - { - delete pathData->Types; - pathData->Types = NULL; - } - - if (count <= 0) - { - return lastResult; - } - } - - if (pathData->Count == 0) - { - pathData->Points = new PointF[count]; - if (pathData->Points == NULL) - { - return SetStatus(OutOfMemory); - - } - pathData->Types = new byte[count]; - if (pathData->Types == NULL) - { - delete pathData->Points; - pathData->Points = NULL; - - return SetStatus(OutOfMemory); - } - pathData->Count = count; - } - - return SetStatus(DllExports::GdipGetPathData(nativePath, pathData)); - } - - /** - * Start/end a subpath - */ - Status StartFigure() - { - return SetStatus(DllExports::GdipStartPathFigure(nativePath)); - } - - Status CloseFigure() - { - return SetStatus(DllExports::GdipClosePathFigure(nativePath)); - } - - Status CloseAllFigures() - { - return SetStatus(DllExports::GdipClosePathFigures(nativePath)); - } - - Status SetMarker() - { - return SetStatus(DllExports::GdipSetPathMarker(nativePath)); - } - - Status ClearMarkers() - { - return SetStatus(DllExports::GdipClearPathMarkers(nativePath)); - } - - Status Reverse() - { - return SetStatus(DllExports::GdipReversePath(nativePath)); - } - - Status GetLastPoint(OUT PointF* lastPoint) const - { - return SetStatus(DllExports::GdipGetPathLastPoint(nativePath, lastPoint)); - } - - /** - * Add lines to the path object - */ - // float version - Status AddLine(IN const PointF& pt1, - IN const PointF& pt2) - { - return AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y); - } - - Status AddLine(IN REAL x1, - IN REAL y1, - IN REAL x2, - IN REAL y2) - { - return SetStatus(DllExports::GdipAddPathLine(nativePath, x1, y1, x2, y2)); - } - - Status AddLines(IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathLine2(nativePath, points, count)); - } - - // integer version - Status AddLine(IN const Point& pt1, - IN const Point& pt2) - { - return AddLine(pt1.X, - pt1.Y, - pt2.X, - pt2.Y); - } - - Status AddLine(IN INT x1, - IN INT y1, - IN INT x2, - IN INT y2) - { - return SetStatus(DllExports::GdipAddPathLineI(nativePath, - x1, - y1, - x2, - y2)); - } - - Status AddLines(IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathLine2I(nativePath, - points, - count)); - } - - /** - * Add an arc to the path object - */ - // float version - Status AddArc(IN const RectF& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return AddArc(rect.X, rect.Y, rect.Width, rect.Height, - startAngle, sweepAngle); - } - - Status AddArc(IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipAddPathArc(nativePath, x, y, width, height, - startAngle, sweepAngle)); - } - - // integer version - Status AddArc(IN const Rect& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return AddArc(rect.X, rect.Y, rect.Width, rect.Height, - startAngle, sweepAngle); - } - - Status AddArc(IN INT x, - IN INT y, - IN INT width, - IN INT height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipAddPathArcI(nativePath, - x, - y, - width, - height, - startAngle, - sweepAngle)); - } - - /** - * Add Bezier curves to the path object - */ - // float version - Status AddBezier(IN const PointF& pt1, - IN const PointF& pt2, - IN const PointF& pt3, - IN const PointF& pt4) - { - return AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, - pt4.Y); - } - - Status AddBezier(IN REAL x1, - IN REAL y1, - IN REAL x2, - IN REAL y2, - IN REAL x3, - IN REAL y3, - IN REAL x4, - IN REAL y4) - { - return SetStatus(DllExports::GdipAddPathBezier(nativePath, x1, y1, x2, y2, - x3, y3, x4, y4)); - } - - Status AddBeziers(IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathBeziers(nativePath, points, count)); - } - - // integer version - Status AddBezier(IN const Point& pt1, - IN const Point& pt2, - IN const Point& pt3, - IN const Point& pt4) - { - return AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, - pt4.Y); - } - - Status AddBezier(IN INT x1, - IN INT y1, - IN INT x2, - IN INT y2, - IN INT x3, - IN INT y3, - IN INT x4, - IN INT y4) - { - return SetStatus(DllExports::GdipAddPathBezierI(nativePath, - x1, - y1, - x2, - y2, - x3, - y3, - x4, - y4)); - } - - Status AddBeziers(IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathBeziersI(nativePath, - points, - count)); - } - - // float version - Status AddCurve(IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathCurve(nativePath, - points, - count)); - } - - Status AddCurve(IN const PointF* points, - IN INT count, - IN REAL tension) - { - return SetStatus(DllExports::GdipAddPathCurve2(nativePath, - points, - count, - tension)); - } - - Status AddCurve(IN const PointF* points, - IN INT count, - IN INT offset, - IN INT numberOfSegments, - IN REAL tension) - { - return SetStatus(DllExports::GdipAddPathCurve3(nativePath, - points, - count, - offset, - numberOfSegments, - tension)); - } - - // integer version - Status AddCurve(IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathCurveI(nativePath, - points, - count)); - } - - Status AddCurve(IN const Point* points, - IN INT count, - IN REAL tension) - { - return SetStatus(DllExports::GdipAddPathCurve2I(nativePath, - points, - count, - tension)); - } - - Status AddCurve(IN const Point* points, - IN INT count, - IN INT offset, - IN INT numberOfSegments, - IN REAL tension) - { - return SetStatus(DllExports::GdipAddPathCurve3I(nativePath, - points, - count, - offset, - numberOfSegments, - tension)); - } - - // float version - Status AddClosedCurve(IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathClosedCurve(nativePath, - points, - count)); - } - - Status AddClosedCurve(IN const PointF* points, - IN INT count, - IN REAL tension) - { - return SetStatus(DllExports::GdipAddPathClosedCurve2(nativePath, - points, - count, - tension)); - } - - // integer version - Status AddClosedCurve(IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathClosedCurveI(nativePath, - points, - count)); - } - - - Status AddClosedCurve(IN const Point* points, - IN INT count, - IN REAL tension) - { - return SetStatus(DllExports::GdipAddPathClosedCurve2I(nativePath, - points, - count, - tension)); - } - - - /** - * Add closed shapes to the path object - */ - - // float version - Status AddRectangle(IN const RectF& rect) - { - return SetStatus(DllExports::GdipAddPathRectangle(nativePath, - rect.X, - rect.Y, - rect.Width, - rect.Height)); - } - - Status AddRectangles(IN const RectF* rects, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathRectangles(nativePath, - rects, - count)); - } - - // integer version - Status AddRectangle(IN const Rect& rect) - { - return SetStatus(DllExports::GdipAddPathRectangleI(nativePath, - rect.X, - rect.Y, - rect.Width, - rect.Height)); - } - - Status AddRectangles(IN const Rect* rects, INT count) - { - return SetStatus(DllExports::GdipAddPathRectanglesI(nativePath, - rects, - count)); - } - - // float version - Status AddEllipse(IN const RectF& rect) - { - return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height); - } - - Status AddEllipse(IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height) - { - return SetStatus(DllExports::GdipAddPathEllipse(nativePath, - x, - y, - width, - height)); - } - - // integer version - Status AddEllipse(IN const Rect& rect) - { - return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height); - } - - Status AddEllipse(IN INT x, - IN INT y, - IN INT width, - IN INT height) - { - return SetStatus(DllExports::GdipAddPathEllipseI(nativePath, - x, - y, - width, - height)); - } - - // float version - Status AddPie(IN const RectF& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, - sweepAngle); - } - - Status AddPie(IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipAddPathPie(nativePath, x, y, width, height, - startAngle, sweepAngle)); - } - - // integer version - Status AddPie(IN const Rect& rect, - IN REAL startAngle, - IN REAL sweepAngle) - { - return AddPie(rect.X, - rect.Y, - rect.Width, - rect.Height, - startAngle, - sweepAngle); - } - - Status AddPie(IN INT x, - IN INT y, - IN INT width, - IN INT height, - IN REAL startAngle, - IN REAL sweepAngle) - { - return SetStatus(DllExports::GdipAddPathPieI(nativePath, - x, - y, - width, - height, - startAngle, - sweepAngle)); - } - - // float version - Status AddPolygon(IN const PointF* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathPolygon(nativePath, points, count)); - } - - // integer version - Status AddPolygon(IN const Point* points, - IN INT count) - { - return SetStatus(DllExports::GdipAddPathPolygonI(nativePath, points, count)); - } - - Status AddPath(IN const GraphicsPath* addingPath, - IN BOOL connect) - { - GpPath* nativePath2 = NULL; - if(addingPath) - nativePath2 = addingPath->nativePath; - - return SetStatus(DllExports::GdipAddPathPath(nativePath, nativePath2, connect)); - } - - // AddString point version - - Status AddString( - IN const WCHAR *string, - IN INT length, - IN const FontFamily *family, - IN INT style, - IN REAL emSize, // In world units - IN const PointF &origin, - IN const StringFormat *format - ) - { - RectF rect(origin.X, origin.Y, 0.0f, 0.0f); - - return SetStatus(DllExports::GdipAddPathString( - nativePath, - string, - length, - family ? family->nativeFamily : NULL, - style, - emSize, - &rect, - format ? format->nativeFormat : NULL - )); - } - - // AddString rectangle version - - Status AddString( - IN const WCHAR *string, - IN INT length, - IN const FontFamily *family, - IN INT style, - IN REAL emSize, // In world units - IN const RectF &layoutRect, - IN const StringFormat *format - ) - { - return SetStatus(DllExports::GdipAddPathString( - nativePath, - string, - length, - family ? family->nativeFamily : NULL, - style, - emSize, - &layoutRect, - format ? format->nativeFormat : NULL - )); - } - - Status AddString( - IN const WCHAR *string, - IN INT length, - IN const FontFamily *family, - IN INT style, - IN REAL emSize, // In world units - IN const Point &origin, - IN const StringFormat *format - ) - { - Rect rect(origin.X, origin.Y, 0, 0); - - return SetStatus(DllExports::GdipAddPathStringI( - nativePath, - string, - length, - family ? family->nativeFamily : NULL, - style, - emSize, - &rect, - format ? format->nativeFormat : NULL - )); - } - - // AddString rectangle version - - Status AddString( - IN const WCHAR *string, - IN INT length, - IN const FontFamily *family, - IN INT style, - IN REAL emSize, // In world units - IN const Rect &layoutRect, - IN const StringFormat *format - ) - { - return SetStatus(DllExports::GdipAddPathStringI( - nativePath, - string, - length, - family ? family->nativeFamily : NULL, - style, - emSize, - &layoutRect, - format ? format->nativeFormat : NULL - )); - } - - /** - * Transforms the path object - */ - Status Transform(IN const Matrix* matrix) - { - if(matrix) - return SetStatus(DllExports::GdipTransformPath(nativePath, matrix->nativeMatrix)); - else - return Ok; // No need to transform. - } - - /** - * Get the bounds of the path object with the given transform. - * This is not always the tightest bounds. - * - * Defined in GdiplusGraphics.h. - */ - Status GetBounds(OUT RectF* bounds, - IN const Matrix* matrix = NULL, - IN const Pen* pen = NULL) const; - - // integer version (defined in GdiplusGraphics.h) - Status GetBounds(OUT Rect* bounds, - IN const Matrix* matrix = NULL, - IN const Pen* pen = NULL) const; - - /** - * Flatten the path object - * Once this is called, the resultant path is made of line segments and - * the original path information is lost. - * When matrix = NULL, the identity matrix is assumed. - */ - Status Flatten(IN const Matrix* matrix = NULL, - IN REAL flatness = FlatnessDefault) - { - GpMatrix* nativeMatrix = NULL; - if(matrix) - { - nativeMatrix = matrix->nativeMatrix; - } - - return SetStatus(DllExports::GdipFlattenPath( - nativePath, - nativeMatrix, - flatness - )); - } - -#ifdef DCR_USE_NEW_202903 - - Status Widen( - IN const Pen* pen, - IN const Matrix* matrix = NULL, - IN REAL flatness = FlatnessDefault - ) - { - GpMatrix* nativeMatrix = NULL; - if(matrix) - nativeMatrix = matrix->nativeMatrix; - - return SetStatus(DllExports::GdipWidenPath( - nativePath, - pen->nativePen, - nativeMatrix, - flatness - )); - } - -#else - - /** - * Widen the path object - * When removeSelfIntersects is TRUE, this returns the widened path - * without self intersections. - * When it is FALSE, it returns the widened path with selfintersections. - * The latter is faster and is usually safficient for filling. - */ - Status Widen(IN const Pen* pen, - IN const Matrix* matrix = NULL, - IN BOOL removeSelfIntersects = TRUE) - { - GpMatrix* nativeMatrix = NULL; - if(matrix) - nativeMatrix = matrix->nativeMatrix; - - return SetStatus(DllExports::GdipWidenPathWithMinimumResolutions(nativePath, pen->nativePen, - 0, 0, nativeMatrix, removeSelfIntersects)); - } - - /** - * Widen the path object - * This is equivalent to Widen() method except that - * The widths of the widened path are larger than the given - * minimum resolutions in x and y coordinates after the transform. - * This is usefull when widening a path with the limited device resolutions. - */ - - Status Widen(IN const Pen* pen, - IN REAL minXres, - IN REAL minYres, - IN const Matrix* matrix = NULL, - IN BOOL removeSelfIntersects = TRUE) - { - GpMatrix* nativeMatrix = NULL; - if(matrix) - nativeMatrix = matrix->nativeMatrix; - - return SetStatus(DllExports::GdipWidenPathWithMinimumResolutions(nativePath, pen->nativePen, - minXres, minYres, nativeMatrix, removeSelfIntersects)); - } - -#endif // DCR_USE_NEW_202903 - - Status Outline( - IN const Matrix *matrix = NULL, - IN REAL flatness = FlatnessDefault - ) - { - GpMatrix* nativeMatrix = NULL; - if(matrix) - { - nativeMatrix = matrix->nativeMatrix; - } - - return SetStatus(DllExports::GdipWindingModeOutline( - nativePath, nativeMatrix, flatness - )); - } - - /** - * Warp the path object - * Once this is called, the resultant path is made of line segments and - * the original path information is lost. - * When matrix = NULL, the identity matrix is assumed. - */ - Status Warp(IN const PointF* destPoints, - IN INT count, - IN const RectF& srcRect, - IN const Matrix* matrix = NULL, - IN WarpMode warpMode = WarpModePerspective, - IN REAL flatness = FlatnessDefault) - { - GpMatrix* nativeMatrix = NULL; - if(matrix) - nativeMatrix = matrix->nativeMatrix; - - return SetStatus(DllExports::GdipWarpPath( - nativePath, - nativeMatrix, - destPoints, - count, - srcRect.X, - srcRect.Y, - srcRect.Width, - srcRect.Height, - warpMode, - flatness)); - } - - /** - * Return the number of points in the current path - */ - INT GetPointCount() const - { - INT count = 0; - - SetStatus(DllExports::GdipGetPointCount(nativePath, &count)); - - return count; - } - - /** - * Return the path point type information - */ - Status GetPathTypes(OUT BYTE* types, - IN INT count) const - { - return SetStatus(DllExports::GdipGetPathTypes(nativePath, types, count)); - } - - /** - * Return the path point coordinate information - * @notes Should there be PathData that contains types[] and points[] - * for get & set purposes. - */ - Status GetPathPoints(OUT PointF* points, - IN INT count) const - { - return SetStatus(DllExports::GdipGetPathPoints(nativePath, points, count)); - } - - // integer version - Status GetPathPoints(OUT Point* points, - IN INT count) const - { - return SetStatus(DllExports::GdipGetPathPointsI(nativePath, points, count)); - } - - Status GetLastStatus() const - { - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; - } - - /** - * Hit testing operations - * - * inline implementation is in gdiplusgraphics.h. - */ - - BOOL IsVisible(IN const PointF& point, - IN const Graphics* g = NULL) const - { - return IsVisible(point.X, point.Y, g); - } - - BOOL IsVisible(IN REAL x, - IN REAL y, - IN const Graphics* g = NULL) const; - - BOOL IsVisible(IN const Point& point, - IN const Graphics* g = NULL) const - { - return IsVisible(point.X, point.Y, g); - } - - BOOL IsVisible(IN INT x, - IN INT y, - IN const Graphics* g = NULL) const; - - BOOL IsOutlineVisible(IN const PointF& point, - IN const Pen* pen, - IN const Graphics* g = NULL) const - { - return IsOutlineVisible(point.X, point.Y, pen, g); - } - - BOOL IsOutlineVisible(IN REAL x, - IN REAL y, - IN const Pen* pen, - IN const Graphics* g = NULL) const; - - BOOL IsOutlineVisible(IN const Point& point, - IN const Pen* pen, - IN const Graphics* g = NULL) const - { - return IsOutlineVisible(point.X, point.Y, pen, g); - } - - BOOL IsOutlineVisible(IN INT x, - IN INT y, - IN const Pen* pen, - IN const Graphics* g = NULL) const; - -protected: - - GraphicsPath(const GraphicsPath& path) - { - GpPath *clonepath = NULL; - SetStatus(DllExports::GdipClonePath(path.nativePath, &clonepath)); - SetNativePath(clonepath); - } - -#ifdef DCR_USE_NEW_250932 - -private: - GraphicsPath& operator=(const GraphicsPath &); -protected: - -#else - - GraphicsPath& operator=(const GraphicsPath& path) - { - path; - SetStatus(NotImplemented); - return *this; - } - -#endif - - GraphicsPath(GpPath* nativePath) - { - lastResult = Ok; - SetNativePath(nativePath); - } - - VOID SetNativePath(GpPath *nativePath) - { - this->nativePath = nativePath; - } - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - -protected: - GpPath* nativePath; - mutable Status lastResult; -}; - - -//-------------------------------------------------------------------------- -// GraphisPathIterator class -//-------------------------------------------------------------------------- - -class GraphicsPathIterator : public GdiplusBase -{ -public: - - GraphicsPathIterator(IN const GraphicsPath* path) - { - GpPath* nativePath = NULL; - if(path) - nativePath = path->nativePath; - - GpPathIterator *iter = NULL; - lastResult = DllExports::GdipCreatePathIter(&iter, nativePath); - SetNativeIterator(iter); - } - - ~GraphicsPathIterator() - { - DllExports::GdipDeletePathIter(nativeIterator); - } - - - INT NextSubpath(OUT INT* startIndex, - OUT INT* endIndex, - OUT BOOL* isClosed) - { - INT resultCount; - - SetStatus(DllExports::GdipPathIterNextSubpath(nativeIterator, - &resultCount, startIndex, endIndex, isClosed)); - - return resultCount; - } - - - INT NextSubpath(IN const GraphicsPath* path, - OUT BOOL* isClosed) - { - GpPath* nativePath = NULL; - - INT resultCount; - - if(path) - nativePath= path->nativePath; - - SetStatus(DllExports::GdipPathIterNextSubpathPath(nativeIterator, - &resultCount, nativePath, isClosed)); - - return resultCount; - } - - INT NextPathType(OUT BYTE* pathType, - OUT INT* startIndex, - OUT INT* endIndex) - { - INT resultCount; - - SetStatus(DllExports::GdipPathIterNextPathType(nativeIterator, - &resultCount, pathType, startIndex, endIndex)); - - return resultCount; - } - - INT NextMarker(OUT INT* startIndex, - OUT INT* endIndex) - { - INT resultCount; - - SetStatus(DllExports::GdipPathIterNextMarker(nativeIterator, - &resultCount, startIndex, endIndex)); - - return resultCount; - } - - - INT NextMarker(IN const GraphicsPath* path) - { - GpPath* nativePath = NULL; - - INT resultCount; - - if(path) - nativePath= path->nativePath; - - SetStatus(DllExports::GdipPathIterNextMarkerPath(nativeIterator, - &resultCount, nativePath)); - - return resultCount; - } - - INT GetCount() const - { - INT resultCount; - - SetStatus(DllExports::GdipPathIterGetCount(nativeIterator, &resultCount)); - - return resultCount; - } - - INT GetSubpathCount() const - { - INT resultCount; - - SetStatus(DllExports::GdipPathIterGetSubpathCount(nativeIterator, &resultCount)); - - return resultCount; - } - - BOOL HasCurve() const - { - BOOL hasCurve; - - SetStatus(DllExports::GdipPathIterHasCurve(nativeIterator, &hasCurve)); - - return hasCurve; - } - - VOID Rewind() - { - SetStatus(DllExports::GdipPathIterRewind(nativeIterator)); - } - - INT Enumerate(OUT PointF *points, - OUT BYTE *types, - IN INT count) - { - INT resultCount; - - SetStatus(DllExports::GdipPathIterEnumerate(nativeIterator, - &resultCount, points, types, count)); - - return resultCount; - } - - INT CopyData(OUT PointF* points, - OUT BYTE* types, - IN INT startIndex, - IN INT endIndex) - { - INT resultCount; - - SetStatus(DllExports::GdipPathIterCopyData(nativeIterator, - &resultCount, points, types, startIndex, endIndex)); - - return resultCount; - } - - Status GetLastStatus() const - { - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; - } - -#ifdef DCR_USE_NEW_250932 - -private: - GraphicsPathIterator(const GraphicsPathIterator &); - GraphicsPathIterator& operator=(const GraphicsPathIterator &); - -#endif - -protected: - VOID SetNativeIterator(GpPathIterator *nativeIterator) - { - this->nativeIterator = nativeIterator; - } - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - -protected: - GpPathIterator* nativeIterator; - mutable Status lastResult; -}; - - -//-------------------------------------------------------------------------- -// Represent polygon gradient brush object -//-------------------------------------------------------------------------- - -class PathGradientBrush : public Brush -{ -public: - friend class Pen; - - PathGradientBrush( - IN const PointF* points, - IN INT count, - IN WrapMode wrapMode = WrapModeClamp) - { - GpPathGradient *brush = NULL; - - lastResult = DllExports::GdipCreatePathGradient( - points, count, - wrapMode, &brush); - SetNativeBrush(brush); - } - - PathGradientBrush( - IN const Point* points, - IN INT count, - IN WrapMode wrapMode = WrapModeClamp) - { - GpPathGradient *brush = NULL; - - lastResult = DllExports::GdipCreatePathGradientI( - points, count, - wrapMode, &brush); - - SetNativeBrush(brush); - } - - PathGradientBrush( - IN const GraphicsPath* path - ) - { - GpPathGradient *brush = NULL; - - lastResult = DllExports::GdipCreatePathGradientFromPath( - path->nativePath, &brush); - SetNativeBrush(brush); - } - - // Get/set colors - - Status GetCenterColor(OUT Color* color) const - { - ARGB argb; - - if (color == NULL) - { - return SetStatus(InvalidParameter); - } - - SetStatus(DllExports::GdipGetPathGradientCenterColor( - (GpPathGradient*) nativeBrush, &argb)); - - color->SetValue(argb); - - return lastResult; - } - - Status SetCenterColor(IN const Color& color) - { - SetStatus(DllExports::GdipSetPathGradientCenterColor( - (GpPathGradient*) nativeBrush, - color.GetValue())); - - return lastResult; - } - - INT GetPointCount() const - { - INT count; - - SetStatus(DllExports::GdipGetPathGradientPointCount( - (GpPathGradient*) nativeBrush, &count)); - - return count; - } - - INT GetSurroundColorCount() const - { - INT count; - - SetStatus(DllExports::GdipGetPathGradientSurroundColorCount( - (GpPathGradient*) nativeBrush, &count)); - - return count; - } - - Status GetSurroundColors(OUT Color* colors, - IN OUT INT* count) const - { - if(colors == NULL || count == NULL) - { - return SetStatus(InvalidParameter); - } - - INT count1; - - SetStatus(DllExports::GdipGetPathGradientSurroundColorCount( - (GpPathGradient*) nativeBrush, &count1)); - - if(lastResult != Ok) - return lastResult; - - if((*count < count1) || (count1 <= 0)) - return SetStatus(InsufficientBuffer); - - ARGB* argbs = (ARGB*) new ARGB[count1]; - if(argbs == NULL) - return SetStatus(OutOfMemory); - - SetStatus(DllExports::GdipGetPathGradientSurroundColorsWithCount( - (GpPathGradient*)nativeBrush, argbs, &count1)); - - if(lastResult == Ok) - { - for(INT i = 0; i < count1; i++) - { - colors[i].SetValue(argbs[i]); - } - *count = count1; - } - - delete [] argbs; - return lastResult; - } - - Status SetSurroundColors(IN const Color* colors, - IN OUT INT* count) - { - if(colors == NULL || count == NULL) - { - return SetStatus(InvalidParameter); - } - - INT count1 = GetPointCount(); - - if((*count > count1) || (count1 <= 0)) - return SetStatus(InvalidParameter); - - count1 = *count; - - ARGB* argbs = (ARGB*) new ARGB[count1]; - if(argbs == NULL) - return SetStatus(OutOfMemory); - - for(INT i = 0; i < count1; i++) - { - argbs[i] = colors[i].GetValue(); - } - - SetStatus(DllExports::GdipSetPathGradientSurroundColorsWithCount( - (GpPathGradient*)nativeBrush, argbs, &count1)); - - if(lastResult == Ok) - *count = count1; - - delete [] argbs; - - return lastResult; - } - - Status GetGraphicsPath(OUT GraphicsPath* path) const - { - if(path == NULL) - return SetStatus(InvalidParameter); - - return SetStatus(DllExports::GdipGetPathGradientPath( - (GpPathGradient*)nativeBrush, path->nativePath)); - } - - Status SetGraphicsPath(IN const GraphicsPath* path) - { - if(path == NULL) - return SetStatus(InvalidParameter); - - return SetStatus(DllExports::GdipSetPathGradientPath( - (GpPathGradient*)nativeBrush, path->nativePath)); - } - - Status GetCenterPoint(OUT PointF* point) const - { - return SetStatus(DllExports::GdipGetPathGradientCenterPoint( - (GpPathGradient*)nativeBrush, - point)); - } - - - Status GetCenterPoint(OUT Point* point) const - { - return SetStatus(DllExports::GdipGetPathGradientCenterPointI( - (GpPathGradient*)nativeBrush, - point)); - } - - Status SetCenterPoint(IN const PointF& point) - { - return SetStatus(DllExports::GdipSetPathGradientCenterPoint( - (GpPathGradient*)nativeBrush, - &point)); - } - - Status SetCenterPoint(IN const Point& point) - { - return SetStatus(DllExports::GdipSetPathGradientCenterPointI( - (GpPathGradient*)nativeBrush, - &point)); - } - - Status GetRectangle(OUT RectF* rect) const - { - return SetStatus(DllExports::GdipGetPathGradientRect( - (GpPathGradient*)nativeBrush, rect)); - } - - Status GetRectangle(OUT Rect* rect) const - { - return SetStatus(DllExports::GdipGetPathGradientRectI( - (GpPathGradient*)nativeBrush, rect)); - } - - // Gamma correction. - - Status SetGammaCorrection(IN BOOL useGammaCorrection) - { - return SetStatus(DllExports::GdipSetPathGradientGammaCorrection( - (GpPathGradient*)nativeBrush, useGammaCorrection)); - } - - BOOL GetGammaCorrection() const - { - BOOL useGammaCorrection; - - SetStatus(DllExports::GdipGetPathGradientGammaCorrection( - (GpPathGradient*)nativeBrush, &useGammaCorrection)); - - return useGammaCorrection; - } - - INT GetBlendCount() const - { - INT count = 0; - - SetStatus(DllExports::GdipGetPathGradientBlendCount( - (GpPathGradient*) nativeBrush, &count)); - - return count; - } - - Status GetBlend(OUT REAL* blendFactors, - OUT REAL* blendPositions, - IN INT count) const - { - return SetStatus(DllExports::GdipGetPathGradientBlend( - (GpPathGradient*)nativeBrush, - blendFactors, blendPositions, count)); - } - - Status SetBlend(IN const REAL* blendFactors, - IN const REAL* blendPositions, - IN INT count) - { - return SetStatus(DllExports::GdipSetPathGradientBlend( - (GpPathGradient*)nativeBrush, - blendFactors, blendPositions, count)); - } - - INT GetInterpolationColorCount() const - { - INT count = 0; - - SetStatus(DllExports::GdipGetPathGradientPresetBlendCount( - (GpPathGradient*) nativeBrush, &count)); - - return count; - } - - Status SetInterpolationColors(IN const Color* presetColors, - IN const REAL* blendPositions, - IN INT count) - { - if ((count <= 0) || !presetColors) - { - return SetStatus(InvalidParameter); - } - - ARGB* argbs = (ARGB*) new ARGB[count]; - if(argbs) - { - for(INT i = 0; i < count; i++) - { - argbs[i] = presetColors[i].GetValue(); - } - - Status status = SetStatus(DllExports::GdipSetPathGradientPresetBlend( - (GpPathGradient*) nativeBrush, - argbs, - blendPositions, - count)); - delete[] argbs; - return status; - } - else - { - return SetStatus(OutOfMemory); - } - } - - Status GetInterpolationColors(OUT Color* presetColors, - OUT REAL* blendPositions, - IN INT count) const - { - if ((count <= 0) || !presetColors) - { - return SetStatus(InvalidParameter); - } - - ARGB* argbs = (ARGB*) new ARGB[count]; - - if (!argbs) - { - return SetStatus(OutOfMemory); - } - - GpStatus status = SetStatus(DllExports::GdipGetPathGradientPresetBlend( - (GpPathGradient*)nativeBrush, - argbs, - blendPositions, - count)); - - for(INT i = 0; i < count; i++) - { - presetColors[i] = Color(argbs[i]); - } - delete [] argbs; - - return status; - } - - Status SetBlendBellShape(IN REAL focus, - IN REAL scale = 1.0) - { - return SetStatus(DllExports::GdipSetPathGradientSigmaBlend( - (GpPathGradient*)nativeBrush, focus, scale)); - } - - #ifdef DCR_USE_NEW_145135 - Status SetBlendTriangularShape( - IN REAL focus, - IN REAL scale = 1.0 - ) - #else - Status SetBlendTrianglarShape(IN REAL focus, - IN REAL scale = 1.0) - #endif - { - return SetStatus(DllExports::GdipSetPathGradientLinearBlend( - (GpPathGradient*)nativeBrush, focus, scale)); - } - - /** - * Get/set brush transform - */ - Status GetTransform(OUT Matrix *matrix) const - { - return SetStatus(DllExports::GdipGetPathGradientTransform( - (GpPathGradient*) nativeBrush, matrix->nativeMatrix)); - } - - Status SetTransform(IN const Matrix* matrix) - { - return SetStatus(DllExports::GdipSetPathGradientTransform( - (GpPathGradient*) nativeBrush, matrix->nativeMatrix)); - } - - Status ResetTransform() - { - return SetStatus(DllExports::GdipResetPathGradientTransform((GpPathGradient*)nativeBrush)); - } - - Status MultiplyTransform(IN const Matrix* matrix, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipMultiplyPathGradientTransform((GpPathGradient*)nativeBrush, - matrix->nativeMatrix, - order)); - } - - Status TranslateTransform(IN REAL dx, - IN REAL dy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipTranslatePathGradientTransform((GpPathGradient*)nativeBrush, - dx, dy, order)); - } - - Status ScaleTransform(IN REAL sx, - IN REAL sy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipScalePathGradientTransform((GpPathGradient*)nativeBrush, - sx, sy, order)); - } - - Status RotateTransform(IN REAL angle, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipRotatePathGradientTransform((GpPathGradient*)nativeBrush, - angle, order)); - } - - /** - * Get/set brush focus scales - */ - Status GetFocusScales(OUT REAL* xScale, - OUT REAL* yScale) const - { - return SetStatus(DllExports::GdipGetPathGradientFocusScales( - (GpPathGradient*) nativeBrush, xScale, yScale)); - } - - Status SetFocusScales(IN REAL xScale, - IN REAL yScale) - { - return SetStatus(DllExports::GdipSetPathGradientFocusScales( - (GpPathGradient*) nativeBrush, xScale, yScale)); - } - - /** - * Get/set brush wrapping mode - */ - WrapMode GetWrapMode() const - { - WrapMode wrapMode; - - SetStatus(DllExports::GdipGetPathGradientWrapMode( - (GpPathGradient*) nativeBrush, &wrapMode)); - - return wrapMode; - } - - Status SetWrapMode(IN WrapMode wrapMode) - { - return SetStatus(DllExports::GdipSetPathGradientWrapMode( - (GpPathGradient*) nativeBrush, wrapMode)); - } - -#ifdef DCR_USE_NEW_250932 - -private: - PathGradientBrush(const PathGradientBrush &); - PathGradientBrush& operator=(const PathGradientBrush &); - -#endif - -protected: - - PathGradientBrush() - { - } -}; - - -#endif // !_GRAPHICSPATH_HPP +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusPath.h +* +* Abstract: +* +* Path related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSPATH_H +#define _GDIPLUSPATH_H + +class GraphicsPath : public GdiplusBase +{ +public: + friend class Graphics; + friend class Region; + friend class PathGradientBrush; + friend class GraphicsPathIterator; + friend class CustomLineCap; + + // Path constructors + + GraphicsPath(IN FillMode fillMode = FillModeAlternate) + { + nativePath = NULL; + lastResult = DllExports::GdipCreatePath(fillMode, &nativePath); + } + + GraphicsPath(IN const PointF* points, + IN const BYTE* types, + IN INT count, + IN FillMode fillMode = FillModeAlternate) + { + nativePath = NULL; + lastResult = DllExports::GdipCreatePath2(points, + types, + count, + fillMode, + &nativePath); + } + + GraphicsPath(IN const Point* points, + IN const BYTE* types, + IN INT count, + IN FillMode fillMode = FillModeAlternate) + { + nativePath = NULL; + lastResult = DllExports::GdipCreatePath2I(points, + types, + count, + fillMode, + &nativePath); + } + + ~GraphicsPath() + { + DllExports::GdipDeletePath(nativePath); + } + + /** + * Make a copy of the current path object + */ + GraphicsPath* Clone() const + { + GpPath *clonepath = NULL; + + SetStatus(DllExports::GdipClonePath(nativePath, &clonepath)); + + return new GraphicsPath(clonepath); + } + + /** + * Reset the path object to empty (and fill mode to FillModeAlternate) + */ + Status Reset() + { + return SetStatus(DllExports::GdipResetPath(nativePath)); + } + + /** + * Get path fill mode information + */ + FillMode GetFillMode() const + { + FillMode fillmode = FillModeAlternate; + + SetStatus(DllExports::GdipGetPathFillMode(nativePath, &fillmode)); + + return fillmode; + } + + /** + * Set path fill mode information + */ + Status SetFillMode(IN FillMode fillmode) + { + return SetStatus(DllExports::GdipSetPathFillMode(nativePath, fillmode)); + } + + /** + * Set/get path data + */ + Status GetPathData(OUT PathData* pathData) const + { + if (pathData == NULL) + { + return SetStatus(InvalidParameter); + } + + INT count = GetPointCount(); + + if ((count <= 0) || (pathData->Count>0 && pathData->CountCount = 0; + if (pathData->Points) + { + delete pathData->Points; + pathData->Points = NULL; + } + + if (pathData->Types) + { + delete pathData->Types; + pathData->Types = NULL; + } + + if (count <= 0) + { + return lastResult; + } + } + + if (pathData->Count == 0) + { + pathData->Points = new PointF[count]; + if (pathData->Points == NULL) + { + return SetStatus(OutOfMemory); + + } + pathData->Types = new byte[count]; + if (pathData->Types == NULL) + { + delete pathData->Points; + pathData->Points = NULL; + + return SetStatus(OutOfMemory); + } + pathData->Count = count; + } + + return SetStatus(DllExports::GdipGetPathData(nativePath, pathData)); + } + + /** + * Start/end a subpath + */ + Status StartFigure() + { + return SetStatus(DllExports::GdipStartPathFigure(nativePath)); + } + + Status CloseFigure() + { + return SetStatus(DllExports::GdipClosePathFigure(nativePath)); + } + + Status CloseAllFigures() + { + return SetStatus(DllExports::GdipClosePathFigures(nativePath)); + } + + Status SetMarker() + { + return SetStatus(DllExports::GdipSetPathMarker(nativePath)); + } + + Status ClearMarkers() + { + return SetStatus(DllExports::GdipClearPathMarkers(nativePath)); + } + + Status Reverse() + { + return SetStatus(DllExports::GdipReversePath(nativePath)); + } + + Status GetLastPoint(OUT PointF* lastPoint) const + { + return SetStatus(DllExports::GdipGetPathLastPoint(nativePath, lastPoint)); + } + + /** + * Add lines to the path object + */ + // float version + Status AddLine(IN const PointF& pt1, + IN const PointF& pt2) + { + return AddLine(pt1.X, pt1.Y, pt2.X, pt2.Y); + } + + Status AddLine(IN REAL x1, + IN REAL y1, + IN REAL x2, + IN REAL y2) + { + return SetStatus(DllExports::GdipAddPathLine(nativePath, x1, y1, x2, y2)); + } + + Status AddLines(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathLine2(nativePath, points, count)); + } + + // integer version + Status AddLine(IN const Point& pt1, + IN const Point& pt2) + { + return AddLine(pt1.X, + pt1.Y, + pt2.X, + pt2.Y); + } + + Status AddLine(IN INT x1, + IN INT y1, + IN INT x2, + IN INT y2) + { + return SetStatus(DllExports::GdipAddPathLineI(nativePath, + x1, + y1, + x2, + y2)); + } + + Status AddLines(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathLine2I(nativePath, + points, + count)); + } + + /** + * Add an arc to the path object + */ + // float version + Status AddArc(IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return AddArc(rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + Status AddArc(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipAddPathArc(nativePath, x, y, width, height, + startAngle, sweepAngle)); + } + + // integer version + Status AddArc(IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return AddArc(rect.X, rect.Y, rect.Width, rect.Height, + startAngle, sweepAngle); + } + + Status AddArc(IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipAddPathArcI(nativePath, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + /** + * Add Bezier curves to the path object + */ + // float version + Status AddBezier(IN const PointF& pt1, + IN const PointF& pt2, + IN const PointF& pt3, + IN const PointF& pt4) + { + return AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, + pt4.Y); + } + + Status AddBezier(IN REAL x1, + IN REAL y1, + IN REAL x2, + IN REAL y2, + IN REAL x3, + IN REAL y3, + IN REAL x4, + IN REAL y4) + { + return SetStatus(DllExports::GdipAddPathBezier(nativePath, x1, y1, x2, y2, + x3, y3, x4, y4)); + } + + Status AddBeziers(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathBeziers(nativePath, points, count)); + } + + // integer version + Status AddBezier(IN const Point& pt1, + IN const Point& pt2, + IN const Point& pt3, + IN const Point& pt4) + { + return AddBezier(pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, + pt4.Y); + } + + Status AddBezier(IN INT x1, + IN INT y1, + IN INT x2, + IN INT y2, + IN INT x3, + IN INT y3, + IN INT x4, + IN INT y4) + { + return SetStatus(DllExports::GdipAddPathBezierI(nativePath, + x1, + y1, + x2, + y2, + x3, + y3, + x4, + y4)); + } + + Status AddBeziers(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathBeziersI(nativePath, + points, + count)); + } + + // float version + Status AddCurve(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathCurve(nativePath, + points, + count)); + } + + Status AddCurve(IN const PointF* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathCurve2(nativePath, + points, + count, + tension)); + } + + Status AddCurve(IN const PointF* points, + IN INT count, + IN INT offset, + IN INT numberOfSegments, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathCurve3(nativePath, + points, + count, + offset, + numberOfSegments, + tension)); + } + + // integer version + Status AddCurve(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathCurveI(nativePath, + points, + count)); + } + + Status AddCurve(IN const Point* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathCurve2I(nativePath, + points, + count, + tension)); + } + + Status AddCurve(IN const Point* points, + IN INT count, + IN INT offset, + IN INT numberOfSegments, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathCurve3I(nativePath, + points, + count, + offset, + numberOfSegments, + tension)); + } + + // float version + Status AddClosedCurve(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathClosedCurve(nativePath, + points, + count)); + } + + Status AddClosedCurve(IN const PointF* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathClosedCurve2(nativePath, + points, + count, + tension)); + } + + // integer version + Status AddClosedCurve(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathClosedCurveI(nativePath, + points, + count)); + } + + + Status AddClosedCurve(IN const Point* points, + IN INT count, + IN REAL tension) + { + return SetStatus(DllExports::GdipAddPathClosedCurve2I(nativePath, + points, + count, + tension)); + } + + + /** + * Add closed shapes to the path object + */ + + // float version + Status AddRectangle(IN const RectF& rect) + { + return SetStatus(DllExports::GdipAddPathRectangle(nativePath, + rect.X, + rect.Y, + rect.Width, + rect.Height)); + } + + Status AddRectangles(IN const RectF* rects, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathRectangles(nativePath, + rects, + count)); + } + + // integer version + Status AddRectangle(IN const Rect& rect) + { + return SetStatus(DllExports::GdipAddPathRectangleI(nativePath, + rect.X, + rect.Y, + rect.Width, + rect.Height)); + } + + Status AddRectangles(IN const Rect* rects, INT count) + { + return SetStatus(DllExports::GdipAddPathRectanglesI(nativePath, + rects, + count)); + } + + // float version + Status AddEllipse(IN const RectF& rect) + { + return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height); + } + + Status AddEllipse(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + return SetStatus(DllExports::GdipAddPathEllipse(nativePath, + x, + y, + width, + height)); + } + + // integer version + Status AddEllipse(IN const Rect& rect) + { + return AddEllipse(rect.X, rect.Y, rect.Width, rect.Height); + } + + Status AddEllipse(IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + return SetStatus(DllExports::GdipAddPathEllipseI(nativePath, + x, + y, + width, + height)); + } + + // float version + Status AddPie(IN const RectF& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return AddPie(rect.X, rect.Y, rect.Width, rect.Height, startAngle, + sweepAngle); + } + + Status AddPie(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipAddPathPie(nativePath, x, y, width, height, + startAngle, sweepAngle)); + } + + // integer version + Status AddPie(IN const Rect& rect, + IN REAL startAngle, + IN REAL sweepAngle) + { + return AddPie(rect.X, + rect.Y, + rect.Width, + rect.Height, + startAngle, + sweepAngle); + } + + Status AddPie(IN INT x, + IN INT y, + IN INT width, + IN INT height, + IN REAL startAngle, + IN REAL sweepAngle) + { + return SetStatus(DllExports::GdipAddPathPieI(nativePath, + x, + y, + width, + height, + startAngle, + sweepAngle)); + } + + // float version + Status AddPolygon(IN const PointF* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathPolygon(nativePath, points, count)); + } + + // integer version + Status AddPolygon(IN const Point* points, + IN INT count) + { + return SetStatus(DllExports::GdipAddPathPolygonI(nativePath, points, count)); + } + + Status AddPath(IN const GraphicsPath* addingPath, + IN BOOL connect) + { + GpPath* nativePath2 = NULL; + if(addingPath) + nativePath2 = addingPath->nativePath; + + return SetStatus(DllExports::GdipAddPathPath(nativePath, nativePath2, connect)); + } + + // AddString point version + + Status AddString( + IN const WCHAR *string, + IN INT length, + IN const FontFamily *family, + IN INT style, + IN REAL emSize, // In world units + IN const PointF &origin, + IN const StringFormat *format + ) + { + RectF rect(origin.X, origin.Y, 0.0f, 0.0f); + + return SetStatus(DllExports::GdipAddPathString( + nativePath, + string, + length, + family ? family->nativeFamily : NULL, + style, + emSize, + &rect, + format ? format->nativeFormat : NULL + )); + } + + // AddString rectangle version + + Status AddString( + IN const WCHAR *string, + IN INT length, + IN const FontFamily *family, + IN INT style, + IN REAL emSize, // In world units + IN const RectF &layoutRect, + IN const StringFormat *format + ) + { + return SetStatus(DllExports::GdipAddPathString( + nativePath, + string, + length, + family ? family->nativeFamily : NULL, + style, + emSize, + &layoutRect, + format ? format->nativeFormat : NULL + )); + } + + Status AddString( + IN const WCHAR *string, + IN INT length, + IN const FontFamily *family, + IN INT style, + IN REAL emSize, // In world units + IN const Point &origin, + IN const StringFormat *format + ) + { + Rect rect(origin.X, origin.Y, 0, 0); + + return SetStatus(DllExports::GdipAddPathStringI( + nativePath, + string, + length, + family ? family->nativeFamily : NULL, + style, + emSize, + &rect, + format ? format->nativeFormat : NULL + )); + } + + // AddString rectangle version + + Status AddString( + IN const WCHAR *string, + IN INT length, + IN const FontFamily *family, + IN INT style, + IN REAL emSize, // In world units + IN const Rect &layoutRect, + IN const StringFormat *format + ) + { + return SetStatus(DllExports::GdipAddPathStringI( + nativePath, + string, + length, + family ? family->nativeFamily : NULL, + style, + emSize, + &layoutRect, + format ? format->nativeFormat : NULL + )); + } + + /** + * Transforms the path object + */ + Status Transform(IN const Matrix* matrix) + { + if(matrix) + return SetStatus(DllExports::GdipTransformPath(nativePath, matrix->nativeMatrix)); + else + return Ok; // No need to transform. + } + + /** + * Get the bounds of the path object with the given transform. + * This is not always the tightest bounds. + * + * Defined in GdiplusGraphics.h. + */ + Status GetBounds(OUT RectF* bounds, + IN const Matrix* matrix = NULL, + IN const Pen* pen = NULL) const; + + // integer version (defined in GdiplusGraphics.h) + Status GetBounds(OUT Rect* bounds, + IN const Matrix* matrix = NULL, + IN const Pen* pen = NULL) const; + + /** + * Flatten the path object + * Once this is called, the resultant path is made of line segments and + * the original path information is lost. + * When matrix = NULL, the identity matrix is assumed. + */ + Status Flatten(IN const Matrix* matrix = NULL, + IN REAL flatness = FlatnessDefault) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + { + nativeMatrix = matrix->nativeMatrix; + } + + return SetStatus(DllExports::GdipFlattenPath( + nativePath, + nativeMatrix, + flatness + )); + } + +#ifdef DCR_USE_NEW_202903 + + Status Widen( + IN const Pen* pen, + IN const Matrix* matrix = NULL, + IN REAL flatness = FlatnessDefault + ) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + nativeMatrix = matrix->nativeMatrix; + + return SetStatus(DllExports::GdipWidenPath( + nativePath, + pen->nativePen, + nativeMatrix, + flatness + )); + } + +#else + + /** + * Widen the path object + * When removeSelfIntersects is TRUE, this returns the widened path + * without self intersections. + * When it is FALSE, it returns the widened path with selfintersections. + * The latter is faster and is usually safficient for filling. + */ + Status Widen(IN const Pen* pen, + IN const Matrix* matrix = NULL, + IN BOOL removeSelfIntersects = TRUE) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + nativeMatrix = matrix->nativeMatrix; + + return SetStatus(DllExports::GdipWidenPathWithMinimumResolutions(nativePath, pen->nativePen, + 0, 0, nativeMatrix, removeSelfIntersects)); + } + + /** + * Widen the path object + * This is equivalent to Widen() method except that + * The widths of the widened path are larger than the given + * minimum resolutions in x and y coordinates after the transform. + * This is usefull when widening a path with the limited device resolutions. + */ + + Status Widen(IN const Pen* pen, + IN REAL minXres, + IN REAL minYres, + IN const Matrix* matrix = NULL, + IN BOOL removeSelfIntersects = TRUE) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + nativeMatrix = matrix->nativeMatrix; + + return SetStatus(DllExports::GdipWidenPathWithMinimumResolutions(nativePath, pen->nativePen, + minXres, minYres, nativeMatrix, removeSelfIntersects)); + } + +#endif // DCR_USE_NEW_202903 + + Status Outline( + IN const Matrix *matrix = NULL, + IN REAL flatness = FlatnessDefault + ) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + { + nativeMatrix = matrix->nativeMatrix; + } + + return SetStatus(DllExports::GdipWindingModeOutline( + nativePath, nativeMatrix, flatness + )); + } + + /** + * Warp the path object + * Once this is called, the resultant path is made of line segments and + * the original path information is lost. + * When matrix = NULL, the identity matrix is assumed. + */ + Status Warp(IN const PointF* destPoints, + IN INT count, + IN const RectF& srcRect, + IN const Matrix* matrix = NULL, + IN WarpMode warpMode = WarpModePerspective, + IN REAL flatness = FlatnessDefault) + { + GpMatrix* nativeMatrix = NULL; + if(matrix) + nativeMatrix = matrix->nativeMatrix; + + return SetStatus(DllExports::GdipWarpPath( + nativePath, + nativeMatrix, + destPoints, + count, + srcRect.X, + srcRect.Y, + srcRect.Width, + srcRect.Height, + warpMode, + flatness)); + } + + /** + * Return the number of points in the current path + */ + INT GetPointCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPointCount(nativePath, &count)); + + return count; + } + + /** + * Return the path point type information + */ + Status GetPathTypes(OUT BYTE* types, + IN INT count) const + { + return SetStatus(DllExports::GdipGetPathTypes(nativePath, types, count)); + } + + /** + * Return the path point coordinate information + * @notes Should there be PathData that contains types[] and points[] + * for get & set purposes. + */ + Status GetPathPoints(OUT PointF* points, + IN INT count) const + { + return SetStatus(DllExports::GdipGetPathPoints(nativePath, points, count)); + } + + // integer version + Status GetPathPoints(OUT Point* points, + IN INT count) const + { + return SetStatus(DllExports::GdipGetPathPointsI(nativePath, points, count)); + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + + /** + * Hit testing operations + * + * inline implementation is in gdiplusgraphics.h. + */ + + BOOL IsVisible(IN const PointF& point, + IN const Graphics* g = NULL) const + { + return IsVisible(point.X, point.Y, g); + } + + BOOL IsVisible(IN REAL x, + IN REAL y, + IN const Graphics* g = NULL) const; + + BOOL IsVisible(IN const Point& point, + IN const Graphics* g = NULL) const + { + return IsVisible(point.X, point.Y, g); + } + + BOOL IsVisible(IN INT x, + IN INT y, + IN const Graphics* g = NULL) const; + + BOOL IsOutlineVisible(IN const PointF& point, + IN const Pen* pen, + IN const Graphics* g = NULL) const + { + return IsOutlineVisible(point.X, point.Y, pen, g); + } + + BOOL IsOutlineVisible(IN REAL x, + IN REAL y, + IN const Pen* pen, + IN const Graphics* g = NULL) const; + + BOOL IsOutlineVisible(IN const Point& point, + IN const Pen* pen, + IN const Graphics* g = NULL) const + { + return IsOutlineVisible(point.X, point.Y, pen, g); + } + + BOOL IsOutlineVisible(IN INT x, + IN INT y, + IN const Pen* pen, + IN const Graphics* g = NULL) const; + +protected: + + GraphicsPath(const GraphicsPath& path) + { + GpPath *clonepath = NULL; + SetStatus(DllExports::GdipClonePath(path.nativePath, &clonepath)); + SetNativePath(clonepath); + } + +#ifdef DCR_USE_NEW_250932 + +private: + GraphicsPath& operator=(const GraphicsPath &); +protected: + +#else + + GraphicsPath& operator=(const GraphicsPath& path) + { + path; + SetStatus(NotImplemented); + return *this; + } + +#endif + + GraphicsPath(GpPath* nativePath) + { + lastResult = Ok; + SetNativePath(nativePath); + } + + VOID SetNativePath(GpPath *nativePath) + { + this->nativePath = nativePath; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpPath* nativePath; + mutable Status lastResult; +}; + + +//-------------------------------------------------------------------------- +// GraphisPathIterator class +//-------------------------------------------------------------------------- + +class GraphicsPathIterator : public GdiplusBase +{ +public: + + GraphicsPathIterator(IN const GraphicsPath* path) + { + GpPath* nativePath = NULL; + if(path) + nativePath = path->nativePath; + + GpPathIterator *iter = NULL; + lastResult = DllExports::GdipCreatePathIter(&iter, nativePath); + SetNativeIterator(iter); + } + + ~GraphicsPathIterator() + { + DllExports::GdipDeletePathIter(nativeIterator); + } + + + INT NextSubpath(OUT INT* startIndex, + OUT INT* endIndex, + OUT BOOL* isClosed) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterNextSubpath(nativeIterator, + &resultCount, startIndex, endIndex, isClosed)); + + return resultCount; + } + + + INT NextSubpath(IN const GraphicsPath* path, + OUT BOOL* isClosed) + { + GpPath* nativePath = NULL; + + INT resultCount; + + if(path) + nativePath= path->nativePath; + + SetStatus(DllExports::GdipPathIterNextSubpathPath(nativeIterator, + &resultCount, nativePath, isClosed)); + + return resultCount; + } + + INT NextPathType(OUT BYTE* pathType, + OUT INT* startIndex, + OUT INT* endIndex) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterNextPathType(nativeIterator, + &resultCount, pathType, startIndex, endIndex)); + + return resultCount; + } + + INT NextMarker(OUT INT* startIndex, + OUT INT* endIndex) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterNextMarker(nativeIterator, + &resultCount, startIndex, endIndex)); + + return resultCount; + } + + + INT NextMarker(IN const GraphicsPath* path) + { + GpPath* nativePath = NULL; + + INT resultCount; + + if(path) + nativePath= path->nativePath; + + SetStatus(DllExports::GdipPathIterNextMarkerPath(nativeIterator, + &resultCount, nativePath)); + + return resultCount; + } + + INT GetCount() const + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterGetCount(nativeIterator, &resultCount)); + + return resultCount; + } + + INT GetSubpathCount() const + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterGetSubpathCount(nativeIterator, &resultCount)); + + return resultCount; + } + + BOOL HasCurve() const + { + BOOL hasCurve; + + SetStatus(DllExports::GdipPathIterHasCurve(nativeIterator, &hasCurve)); + + return hasCurve; + } + + VOID Rewind() + { + SetStatus(DllExports::GdipPathIterRewind(nativeIterator)); + } + + INT Enumerate(OUT PointF *points, + OUT BYTE *types, + IN INT count) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterEnumerate(nativeIterator, + &resultCount, points, types, count)); + + return resultCount; + } + + INT CopyData(OUT PointF* points, + OUT BYTE* types, + IN INT startIndex, + IN INT endIndex) + { + INT resultCount; + + SetStatus(DllExports::GdipPathIterCopyData(nativeIterator, + &resultCount, points, types, startIndex, endIndex)); + + return resultCount; + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +#ifdef DCR_USE_NEW_250932 + +private: + GraphicsPathIterator(const GraphicsPathIterator &); + GraphicsPathIterator& operator=(const GraphicsPathIterator &); + +#endif + +protected: + VOID SetNativeIterator(GpPathIterator *nativeIterator) + { + this->nativeIterator = nativeIterator; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpPathIterator* nativeIterator; + mutable Status lastResult; +}; + + +//-------------------------------------------------------------------------- +// Represent polygon gradient brush object +//-------------------------------------------------------------------------- + +class PathGradientBrush : public Brush +{ +public: + friend class Pen; + + PathGradientBrush( + IN const PointF* points, + IN INT count, + IN WrapMode wrapMode = WrapModeClamp) + { + GpPathGradient *brush = NULL; + + lastResult = DllExports::GdipCreatePathGradient( + points, count, + wrapMode, &brush); + SetNativeBrush(brush); + } + + PathGradientBrush( + IN const Point* points, + IN INT count, + IN WrapMode wrapMode = WrapModeClamp) + { + GpPathGradient *brush = NULL; + + lastResult = DllExports::GdipCreatePathGradientI( + points, count, + wrapMode, &brush); + + SetNativeBrush(brush); + } + + PathGradientBrush( + IN const GraphicsPath* path + ) + { + GpPathGradient *brush = NULL; + + lastResult = DllExports::GdipCreatePathGradientFromPath( + path->nativePath, &brush); + SetNativeBrush(brush); + } + + // Get/set colors + + Status GetCenterColor(OUT Color* color) const + { + ARGB argb; + + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + SetStatus(DllExports::GdipGetPathGradientCenterColor( + (GpPathGradient*) nativeBrush, &argb)); + + color->SetValue(argb); + + return lastResult; + } + + Status SetCenterColor(IN const Color& color) + { + SetStatus(DllExports::GdipSetPathGradientCenterColor( + (GpPathGradient*) nativeBrush, + color.GetValue())); + + return lastResult; + } + + INT GetPointCount() const + { + INT count; + + SetStatus(DllExports::GdipGetPathGradientPointCount( + (GpPathGradient*) nativeBrush, &count)); + + return count; + } + + INT GetSurroundColorCount() const + { + INT count; + + SetStatus(DllExports::GdipGetPathGradientSurroundColorCount( + (GpPathGradient*) nativeBrush, &count)); + + return count; + } + + Status GetSurroundColors(OUT Color* colors, + IN OUT INT* count) const + { + if(colors == NULL || count == NULL) + { + return SetStatus(InvalidParameter); + } + + INT count1; + + SetStatus(DllExports::GdipGetPathGradientSurroundColorCount( + (GpPathGradient*) nativeBrush, &count1)); + + if(lastResult != Ok) + return lastResult; + + if((*count < count1) || (count1 <= 0)) + return SetStatus(InsufficientBuffer); + + ARGB* argbs = (ARGB*) new ARGB[count1]; + if(argbs == NULL) + return SetStatus(OutOfMemory); + + SetStatus(DllExports::GdipGetPathGradientSurroundColorsWithCount( + (GpPathGradient*)nativeBrush, argbs, &count1)); + + if(lastResult == Ok) + { + for(INT i = 0; i < count1; i++) + { + colors[i].SetValue(argbs[i]); + } + *count = count1; + } + + delete [] argbs; + return lastResult; + } + + Status SetSurroundColors(IN const Color* colors, + IN OUT INT* count) + { + if(colors == NULL || count == NULL) + { + return SetStatus(InvalidParameter); + } + + INT count1 = GetPointCount(); + + if((*count > count1) || (count1 <= 0)) + return SetStatus(InvalidParameter); + + count1 = *count; + + ARGB* argbs = (ARGB*) new ARGB[count1]; + if(argbs == NULL) + return SetStatus(OutOfMemory); + + for(INT i = 0; i < count1; i++) + { + argbs[i] = colors[i].GetValue(); + } + + SetStatus(DllExports::GdipSetPathGradientSurroundColorsWithCount( + (GpPathGradient*)nativeBrush, argbs, &count1)); + + if(lastResult == Ok) + *count = count1; + + delete [] argbs; + + return lastResult; + } + + Status GetGraphicsPath(OUT GraphicsPath* path) const + { + if(path == NULL) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPathGradientPath( + (GpPathGradient*)nativeBrush, path->nativePath)); + } + + Status SetGraphicsPath(IN const GraphicsPath* path) + { + if(path == NULL) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipSetPathGradientPath( + (GpPathGradient*)nativeBrush, path->nativePath)); + } + + Status GetCenterPoint(OUT PointF* point) const + { + return SetStatus(DllExports::GdipGetPathGradientCenterPoint( + (GpPathGradient*)nativeBrush, + point)); + } + + + Status GetCenterPoint(OUT Point* point) const + { + return SetStatus(DllExports::GdipGetPathGradientCenterPointI( + (GpPathGradient*)nativeBrush, + point)); + } + + Status SetCenterPoint(IN const PointF& point) + { + return SetStatus(DllExports::GdipSetPathGradientCenterPoint( + (GpPathGradient*)nativeBrush, + &point)); + } + + Status SetCenterPoint(IN const Point& point) + { + return SetStatus(DllExports::GdipSetPathGradientCenterPointI( + (GpPathGradient*)nativeBrush, + &point)); + } + + Status GetRectangle(OUT RectF* rect) const + { + return SetStatus(DllExports::GdipGetPathGradientRect( + (GpPathGradient*)nativeBrush, rect)); + } + + Status GetRectangle(OUT Rect* rect) const + { + return SetStatus(DllExports::GdipGetPathGradientRectI( + (GpPathGradient*)nativeBrush, rect)); + } + + // Gamma correction. + + Status SetGammaCorrection(IN BOOL useGammaCorrection) + { + return SetStatus(DllExports::GdipSetPathGradientGammaCorrection( + (GpPathGradient*)nativeBrush, useGammaCorrection)); + } + + BOOL GetGammaCorrection() const + { + BOOL useGammaCorrection; + + SetStatus(DllExports::GdipGetPathGradientGammaCorrection( + (GpPathGradient*)nativeBrush, &useGammaCorrection)); + + return useGammaCorrection; + } + + INT GetBlendCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPathGradientBlendCount( + (GpPathGradient*) nativeBrush, &count)); + + return count; + } + + Status GetBlend(OUT REAL* blendFactors, + OUT REAL* blendPositions, + IN INT count) const + { + return SetStatus(DllExports::GdipGetPathGradientBlend( + (GpPathGradient*)nativeBrush, + blendFactors, blendPositions, count)); + } + + Status SetBlend(IN const REAL* blendFactors, + IN const REAL* blendPositions, + IN INT count) + { + return SetStatus(DllExports::GdipSetPathGradientBlend( + (GpPathGradient*)nativeBrush, + blendFactors, blendPositions, count)); + } + + INT GetInterpolationColorCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPathGradientPresetBlendCount( + (GpPathGradient*) nativeBrush, &count)); + + return count; + } + + Status SetInterpolationColors(IN const Color* presetColors, + IN const REAL* blendPositions, + IN INT count) + { + if ((count <= 0) || !presetColors) + { + return SetStatus(InvalidParameter); + } + + ARGB* argbs = (ARGB*) new ARGB[count]; + if(argbs) + { + for(INT i = 0; i < count; i++) + { + argbs[i] = presetColors[i].GetValue(); + } + + Status status = SetStatus(DllExports::GdipSetPathGradientPresetBlend( + (GpPathGradient*) nativeBrush, + argbs, + blendPositions, + count)); + delete[] argbs; + return status; + } + else + { + return SetStatus(OutOfMemory); + } + } + + Status GetInterpolationColors(OUT Color* presetColors, + OUT REAL* blendPositions, + IN INT count) const + { + if ((count <= 0) || !presetColors) + { + return SetStatus(InvalidParameter); + } + + ARGB* argbs = (ARGB*) new ARGB[count]; + + if (!argbs) + { + return SetStatus(OutOfMemory); + } + + GpStatus status = SetStatus(DllExports::GdipGetPathGradientPresetBlend( + (GpPathGradient*)nativeBrush, + argbs, + blendPositions, + count)); + + for(INT i = 0; i < count; i++) + { + presetColors[i] = Color(argbs[i]); + } + delete [] argbs; + + return status; + } + + Status SetBlendBellShape(IN REAL focus, + IN REAL scale = 1.0) + { + return SetStatus(DllExports::GdipSetPathGradientSigmaBlend( + (GpPathGradient*)nativeBrush, focus, scale)); + } + + #ifdef DCR_USE_NEW_145135 + Status SetBlendTriangularShape( + IN REAL focus, + IN REAL scale = 1.0 + ) + #else + Status SetBlendTrianglarShape(IN REAL focus, + IN REAL scale = 1.0) + #endif + { + return SetStatus(DllExports::GdipSetPathGradientLinearBlend( + (GpPathGradient*)nativeBrush, focus, scale)); + } + + /** + * Get/set brush transform + */ + Status GetTransform(OUT Matrix *matrix) const + { + return SetStatus(DllExports::GdipGetPathGradientTransform( + (GpPathGradient*) nativeBrush, matrix->nativeMatrix)); + } + + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetPathGradientTransform( + (GpPathGradient*) nativeBrush, matrix->nativeMatrix)); + } + + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetPathGradientTransform((GpPathGradient*)nativeBrush)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyPathGradientTransform((GpPathGradient*)nativeBrush, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslatePathGradientTransform((GpPathGradient*)nativeBrush, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScalePathGradientTransform((GpPathGradient*)nativeBrush, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotatePathGradientTransform((GpPathGradient*)nativeBrush, + angle, order)); + } + + /** + * Get/set brush focus scales + */ + Status GetFocusScales(OUT REAL* xScale, + OUT REAL* yScale) const + { + return SetStatus(DllExports::GdipGetPathGradientFocusScales( + (GpPathGradient*) nativeBrush, xScale, yScale)); + } + + Status SetFocusScales(IN REAL xScale, + IN REAL yScale) + { + return SetStatus(DllExports::GdipSetPathGradientFocusScales( + (GpPathGradient*) nativeBrush, xScale, yScale)); + } + + /** + * Get/set brush wrapping mode + */ + WrapMode GetWrapMode() const + { + WrapMode wrapMode; + + SetStatus(DllExports::GdipGetPathGradientWrapMode( + (GpPathGradient*) nativeBrush, &wrapMode)); + + return wrapMode; + } + + Status SetWrapMode(IN WrapMode wrapMode) + { + return SetStatus(DllExports::GdipSetPathGradientWrapMode( + (GpPathGradient*) nativeBrush, wrapMode)); + } + +#ifdef DCR_USE_NEW_250932 + +private: + PathGradientBrush(const PathGradientBrush &); + PathGradientBrush& operator=(const PathGradientBrush &); + +#endif + +protected: + + PathGradientBrush() + { + } +}; + + +#endif // !_GRAPHICSPATH_HPP diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusPen.h b/core/src/fxge/Microsoft SDK/include/GdiPlusPen.h index 20653db36e..c5776ab639 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusPen.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusPen.h @@ -1,519 +1,519 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusPen.h -* -* Abstract: -* -* Pen API related declarations -* -\**************************************************************************/ -#ifndef _GDIPLUSPEN_H -#define _GDIPLUSPEN_H - -//-------------------------------------------------------------------------- -// class for various pen types -//-------------------------------------------------------------------------- - -class Pen : public GdiplusBase -{ -public: - friend class GraphicsPath; - friend class Graphics; - - // abstract Clone() can't be implemented here because it can't - // new an object with pure virtual functions - - // Constructors - - Pen(IN const Color& color, - IN REAL width = 1.0f) - { - Unit unit = UnitWorld; - nativePen = NULL; - lastResult = DllExports::GdipCreatePen1(color.GetValue(), - width, unit, &nativePen); - } - - Pen(IN const Brush* brush, - IN REAL width = 1.0f) - { - Unit unit = UnitWorld; - nativePen = NULL; - lastResult = DllExports::GdipCreatePen2(brush->nativeBrush, - width, unit, &nativePen); - } - - ~Pen() - { - DllExports::GdipDeletePen(nativePen); - } - - Pen* Clone() const - { - GpPen *clonePen = NULL; - - lastResult = DllExports::GdipClonePen(nativePen, &clonePen); - - return new Pen(clonePen, lastResult); - } - - Status SetWidth(IN REAL width) - { - return SetStatus(DllExports::GdipSetPenWidth(nativePen, width)); - } - - REAL GetWidth() const - { - REAL width; - - SetStatus(DllExports::GdipGetPenWidth(nativePen, &width)); - - return width; - } - - // Set/get line caps: start, end, and dash - - // Line cap and join APIs by using LineCap and LineJoin enums. - - #ifdef DCR_USE_NEW_197819 - Status SetLineCap(IN LineCap startCap, - IN LineCap endCap, - IN DashCap dashCap) - { - return SetStatus(DllExports::GdipSetPenLineCap197819(nativePen, - startCap, endCap, dashCap)); - } - #else - Status SetLineCap(IN LineCap startCap, - IN LineCap endCap, - IN LineCap dashCap) - { - return SetStatus(DllExports::GdipSetPenLineCap(nativePen, - startCap, endCap, dashCap)); - } - #endif // DCR_USE_NEW_197819 - - Status SetStartCap(IN LineCap startCap) - { - return SetStatus(DllExports::GdipSetPenStartCap(nativePen, startCap)); - } - - Status SetEndCap(IN LineCap endCap) - { - return SetStatus(DllExports::GdipSetPenEndCap(nativePen, endCap)); - } - - #ifdef DCR_USE_NEW_197819 - Status SetDashCap(IN DashCap dashCap) - { - return SetStatus(DllExports::GdipSetPenDashCap197819(nativePen, - dashCap)); - } - #else - Status SetDashCap(IN LineCap dashCap) - { - return SetStatus(DllExports::GdipSetPenDashCap(nativePen, dashCap)); - } - #endif // DCR_USE_NEW_197819 - - LineCap GetStartCap() const - { - LineCap startCap; - - SetStatus(DllExports::GdipGetPenStartCap(nativePen, &startCap)); - - return startCap; - } - - LineCap GetEndCap() const - { - LineCap endCap; - - SetStatus(DllExports::GdipGetPenEndCap(nativePen, &endCap)); - - return endCap; - } - - #ifdef DCR_USE_NEW_197819 - DashCap GetDashCap() const - { - DashCap dashCap; - - SetStatus(DllExports::GdipGetPenDashCap197819(nativePen, - &dashCap)); - - return dashCap; - } - #else - LineCap GetDashCap() const - { - LineCap dashCap; - - SetStatus(DllExports::GdipGetPenDashCap(nativePen, &dashCap)); - - return dashCap; - } - #endif // DCR_USE_NEW_197819 - - - // Set/get line join - - Status SetLineJoin(IN LineJoin lineJoin) - { - return SetStatus(DllExports::GdipSetPenLineJoin(nativePen, lineJoin)); - } - - LineJoin GetLineJoin() const - { - LineJoin lineJoin; - - SetStatus(DllExports::GdipGetPenLineJoin(nativePen, &lineJoin)); - - return lineJoin; - } - - Status SetCustomStartCap(IN const CustomLineCap* customCap) - { - GpCustomLineCap* nativeCap = NULL; - if(customCap) - nativeCap = customCap->nativeCap; - - return SetStatus(DllExports::GdipSetPenCustomStartCap(nativePen, nativeCap)); - } - - Status GetCustomStartCap(OUT CustomLineCap* customCap) const - { - if(!customCap) - return SetStatus(InvalidParameter); - - return SetStatus(DllExports::GdipGetPenCustomStartCap(nativePen, &(customCap->nativeCap))); - } - - Status SetCustomEndCap(IN const CustomLineCap* customCap) - { - GpCustomLineCap* nativeCap = NULL; - if(customCap) - nativeCap = customCap->nativeCap; - - return SetStatus(DllExports::GdipSetPenCustomEndCap(nativePen, nativeCap)); - } - - Status GetCustomEndCap(OUT CustomLineCap* customCap) const - { - if(!customCap) - return SetStatus(InvalidParameter); - - return SetStatus(DllExports::GdipGetPenCustomEndCap(nativePen, &(customCap->nativeCap))); - } - - Status SetMiterLimit(IN REAL miterLimit) - { - return SetStatus(DllExports::GdipSetPenMiterLimit(nativePen, miterLimit)); - } - - REAL GetMiterLimit() const - { - REAL miterLimit; - - SetStatus(DllExports::GdipGetPenMiterLimit(nativePen, &miterLimit)); - - return miterLimit; - } - - // Set/get pen mode - Status SetAlignment(IN PenAlignment penAlignment) - { - return SetStatus(DllExports::GdipSetPenMode(nativePen, penAlignment)); - } - - PenAlignment GetAlignment() const - { - PenAlignment penAlignment; - - SetStatus(DllExports::GdipGetPenMode(nativePen, &penAlignment)); - - return penAlignment; - } - - // Set/get pen transform - Status SetTransform(IN const Matrix* matrix) - { - return SetStatus(DllExports::GdipSetPenTransform(nativePen, - matrix->nativeMatrix)); - } - - Status GetTransform(OUT Matrix* matrix) const - { - return SetStatus(DllExports::GdipGetPenTransform(nativePen, matrix->nativeMatrix)); - } - - Status ResetTransform() - { - return SetStatus(DllExports::GdipResetPenTransform(nativePen)); - } - - Status MultiplyTransform(IN const Matrix* matrix, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipMultiplyPenTransform(nativePen, - matrix->nativeMatrix, - order)); - } - - Status TranslateTransform(IN REAL dx, - IN REAL dy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipTranslatePenTransform(nativePen, - dx, dy, order)); - } - - Status ScaleTransform(IN REAL sx, - IN REAL sy, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipScalePenTransform(nativePen, - sx, sy, order)); - } - - Status RotateTransform(IN REAL angle, - IN MatrixOrder order = MatrixOrderPrepend) - { - return SetStatus(DllExports::GdipRotatePenTransform(nativePen, - angle, order)); - } - - PenType GetPenType() const - { - PenType type; - SetStatus(DllExports::GdipGetPenFillType(nativePen, &type)); - - return type; - } - - Status SetColor(IN const Color& color) - { - return SetStatus(DllExports::GdipSetPenColor(nativePen, - color.GetValue())); - } - - Status SetBrush(IN const Brush* brush) - { - return SetStatus(DllExports::GdipSetPenBrushFill(nativePen, - brush->nativeBrush)); - } - - Status GetColor(OUT Color* color) const - { - if (color == NULL) - { - return SetStatus(InvalidParameter); - } - - PenType type = GetPenType(); - - if (type != PenTypeSolidColor) - { - return WrongState; - } - - ARGB argb; - - SetStatus(DllExports::GdipGetPenColor(nativePen, - &argb)); - if (lastResult == Ok) - { - color->SetValue(argb); - } - - return lastResult; - } - - Brush* GetBrush() const - { - PenType type = GetPenType(); - - Brush* brush = NULL; - - switch(type) - { - case PenTypeSolidColor: - brush = new SolidBrush(); - break; - - case PenTypeHatchFill: - brush = new HatchBrush(); - break; - - case PenTypeTextureFill: - brush = new TextureBrush(); - break; - - case PenTypePathGradient: - brush = new Brush(); - break; - - case PenTypeLinearGradient: - brush = new LinearGradientBrush(); - break; - - default: - break; - } - - if(brush) - { - GpBrush* nativeBrush; - - SetStatus(DllExports::GdipGetPenBrushFill(nativePen, &nativeBrush)); - brush->SetNativeBrush(nativeBrush); - } - - return brush; - } - - DashStyle GetDashStyle() const - { - DashStyle dashStyle; - - SetStatus(DllExports::GdipGetPenDashStyle(nativePen, &dashStyle)); - - return dashStyle; - } - - Status SetDashStyle(IN DashStyle dashStyle) - { - return SetStatus(DllExports::GdipSetPenDashStyle(nativePen, dashStyle)); - } - - REAL GetDashOffset() const - { - REAL dashOffset; - - SetStatus(DllExports::GdipGetPenDashOffset(nativePen, &dashOffset)); - - return dashOffset; - } - - Status SetDashOffset(IN REAL dashOffset) - { - return SetStatus(DllExports::GdipSetPenDashOffset(nativePen, dashOffset)); - } - - Status SetDashPattern(IN const REAL* dashArray, IN INT count) - { - return SetStatus(DllExports::GdipSetPenDashArray(nativePen, dashArray, - count)); - } - - INT GetDashPatternCount() const - { - INT count = 0; - - SetStatus(DllExports::GdipGetPenDashCount(nativePen, &count)); - - return count; - } - - Status GetDashPattern(OUT REAL* dashArray, - IN INT count) const - { - if (dashArray == NULL || count <= 0) - return SetStatus(InvalidParameter); - - return SetStatus(DllExports::GdipGetPenDashArray(nativePen, - dashArray, - count)); - } - - Status SetCompoundArray(IN const REAL* compoundArray, - IN INT count) - { - return SetStatus(DllExports::GdipSetPenCompoundArray(nativePen, compoundArray, - count)); - } - - INT GetCompoundArrayCount() const - { - INT count = 0; - - SetStatus(DllExports::GdipGetPenCompoundCount(nativePen, &count)); - - return count; - } - - Status GetCompoundArray(OUT REAL* compoundArray, - IN INT count) const - { - if (compoundArray == NULL || count <= 0) - return SetStatus(InvalidParameter); - - return SetStatus(DllExports::GdipGetPenCompoundArray(nativePen, - compoundArray, - count)); - } - - Status GetLastStatus() const - { - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; - } - -protected: - -#ifdef DCR_USE_NEW_250932 - -private: - Pen(const Pen &); - Pen& operator=(const Pen &); -protected: - -#else - - Pen(const Pen& pen) - { - pen; - SetStatus(NotImplemented); - SetNativePen(NULL); - } - - Pen& operator=(const Pen& pen) - { - pen; - SetStatus(NotImplemented); - return *this; - } - -#endif - - Pen(GpPen* nativePen, Status status) - { - lastResult = status; - SetNativePen(nativePen); - } - - VOID SetNativePen(GpPen* nativePen) - { - this->nativePen = nativePen; - } - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - -protected: - GpPen* nativePen; - mutable Status lastResult; -}; - -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusPen.h +* +* Abstract: +* +* Pen API related declarations +* +\**************************************************************************/ +#ifndef _GDIPLUSPEN_H +#define _GDIPLUSPEN_H + +//-------------------------------------------------------------------------- +// class for various pen types +//-------------------------------------------------------------------------- + +class Pen : public GdiplusBase +{ +public: + friend class GraphicsPath; + friend class Graphics; + + // abstract Clone() can't be implemented here because it can't + // new an object with pure virtual functions + + // Constructors + + Pen(IN const Color& color, + IN REAL width = 1.0f) + { + Unit unit = UnitWorld; + nativePen = NULL; + lastResult = DllExports::GdipCreatePen1(color.GetValue(), + width, unit, &nativePen); + } + + Pen(IN const Brush* brush, + IN REAL width = 1.0f) + { + Unit unit = UnitWorld; + nativePen = NULL; + lastResult = DllExports::GdipCreatePen2(brush->nativeBrush, + width, unit, &nativePen); + } + + ~Pen() + { + DllExports::GdipDeletePen(nativePen); + } + + Pen* Clone() const + { + GpPen *clonePen = NULL; + + lastResult = DllExports::GdipClonePen(nativePen, &clonePen); + + return new Pen(clonePen, lastResult); + } + + Status SetWidth(IN REAL width) + { + return SetStatus(DllExports::GdipSetPenWidth(nativePen, width)); + } + + REAL GetWidth() const + { + REAL width; + + SetStatus(DllExports::GdipGetPenWidth(nativePen, &width)); + + return width; + } + + // Set/get line caps: start, end, and dash + + // Line cap and join APIs by using LineCap and LineJoin enums. + + #ifdef DCR_USE_NEW_197819 + Status SetLineCap(IN LineCap startCap, + IN LineCap endCap, + IN DashCap dashCap) + { + return SetStatus(DllExports::GdipSetPenLineCap197819(nativePen, + startCap, endCap, dashCap)); + } + #else + Status SetLineCap(IN LineCap startCap, + IN LineCap endCap, + IN LineCap dashCap) + { + return SetStatus(DllExports::GdipSetPenLineCap(nativePen, + startCap, endCap, dashCap)); + } + #endif // DCR_USE_NEW_197819 + + Status SetStartCap(IN LineCap startCap) + { + return SetStatus(DllExports::GdipSetPenStartCap(nativePen, startCap)); + } + + Status SetEndCap(IN LineCap endCap) + { + return SetStatus(DllExports::GdipSetPenEndCap(nativePen, endCap)); + } + + #ifdef DCR_USE_NEW_197819 + Status SetDashCap(IN DashCap dashCap) + { + return SetStatus(DllExports::GdipSetPenDashCap197819(nativePen, + dashCap)); + } + #else + Status SetDashCap(IN LineCap dashCap) + { + return SetStatus(DllExports::GdipSetPenDashCap(nativePen, dashCap)); + } + #endif // DCR_USE_NEW_197819 + + LineCap GetStartCap() const + { + LineCap startCap; + + SetStatus(DllExports::GdipGetPenStartCap(nativePen, &startCap)); + + return startCap; + } + + LineCap GetEndCap() const + { + LineCap endCap; + + SetStatus(DllExports::GdipGetPenEndCap(nativePen, &endCap)); + + return endCap; + } + + #ifdef DCR_USE_NEW_197819 + DashCap GetDashCap() const + { + DashCap dashCap; + + SetStatus(DllExports::GdipGetPenDashCap197819(nativePen, + &dashCap)); + + return dashCap; + } + #else + LineCap GetDashCap() const + { + LineCap dashCap; + + SetStatus(DllExports::GdipGetPenDashCap(nativePen, &dashCap)); + + return dashCap; + } + #endif // DCR_USE_NEW_197819 + + + // Set/get line join + + Status SetLineJoin(IN LineJoin lineJoin) + { + return SetStatus(DllExports::GdipSetPenLineJoin(nativePen, lineJoin)); + } + + LineJoin GetLineJoin() const + { + LineJoin lineJoin; + + SetStatus(DllExports::GdipGetPenLineJoin(nativePen, &lineJoin)); + + return lineJoin; + } + + Status SetCustomStartCap(IN const CustomLineCap* customCap) + { + GpCustomLineCap* nativeCap = NULL; + if(customCap) + nativeCap = customCap->nativeCap; + + return SetStatus(DllExports::GdipSetPenCustomStartCap(nativePen, nativeCap)); + } + + Status GetCustomStartCap(OUT CustomLineCap* customCap) const + { + if(!customCap) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPenCustomStartCap(nativePen, &(customCap->nativeCap))); + } + + Status SetCustomEndCap(IN const CustomLineCap* customCap) + { + GpCustomLineCap* nativeCap = NULL; + if(customCap) + nativeCap = customCap->nativeCap; + + return SetStatus(DllExports::GdipSetPenCustomEndCap(nativePen, nativeCap)); + } + + Status GetCustomEndCap(OUT CustomLineCap* customCap) const + { + if(!customCap) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPenCustomEndCap(nativePen, &(customCap->nativeCap))); + } + + Status SetMiterLimit(IN REAL miterLimit) + { + return SetStatus(DllExports::GdipSetPenMiterLimit(nativePen, miterLimit)); + } + + REAL GetMiterLimit() const + { + REAL miterLimit; + + SetStatus(DllExports::GdipGetPenMiterLimit(nativePen, &miterLimit)); + + return miterLimit; + } + + // Set/get pen mode + Status SetAlignment(IN PenAlignment penAlignment) + { + return SetStatus(DllExports::GdipSetPenMode(nativePen, penAlignment)); + } + + PenAlignment GetAlignment() const + { + PenAlignment penAlignment; + + SetStatus(DllExports::GdipGetPenMode(nativePen, &penAlignment)); + + return penAlignment; + } + + // Set/get pen transform + Status SetTransform(IN const Matrix* matrix) + { + return SetStatus(DllExports::GdipSetPenTransform(nativePen, + matrix->nativeMatrix)); + } + + Status GetTransform(OUT Matrix* matrix) const + { + return SetStatus(DllExports::GdipGetPenTransform(nativePen, matrix->nativeMatrix)); + } + + Status ResetTransform() + { + return SetStatus(DllExports::GdipResetPenTransform(nativePen)); + } + + Status MultiplyTransform(IN const Matrix* matrix, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipMultiplyPenTransform(nativePen, + matrix->nativeMatrix, + order)); + } + + Status TranslateTransform(IN REAL dx, + IN REAL dy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipTranslatePenTransform(nativePen, + dx, dy, order)); + } + + Status ScaleTransform(IN REAL sx, + IN REAL sy, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipScalePenTransform(nativePen, + sx, sy, order)); + } + + Status RotateTransform(IN REAL angle, + IN MatrixOrder order = MatrixOrderPrepend) + { + return SetStatus(DllExports::GdipRotatePenTransform(nativePen, + angle, order)); + } + + PenType GetPenType() const + { + PenType type; + SetStatus(DllExports::GdipGetPenFillType(nativePen, &type)); + + return type; + } + + Status SetColor(IN const Color& color) + { + return SetStatus(DllExports::GdipSetPenColor(nativePen, + color.GetValue())); + } + + Status SetBrush(IN const Brush* brush) + { + return SetStatus(DllExports::GdipSetPenBrushFill(nativePen, + brush->nativeBrush)); + } + + Status GetColor(OUT Color* color) const + { + if (color == NULL) + { + return SetStatus(InvalidParameter); + } + + PenType type = GetPenType(); + + if (type != PenTypeSolidColor) + { + return WrongState; + } + + ARGB argb; + + SetStatus(DllExports::GdipGetPenColor(nativePen, + &argb)); + if (lastResult == Ok) + { + color->SetValue(argb); + } + + return lastResult; + } + + Brush* GetBrush() const + { + PenType type = GetPenType(); + + Brush* brush = NULL; + + switch(type) + { + case PenTypeSolidColor: + brush = new SolidBrush(); + break; + + case PenTypeHatchFill: + brush = new HatchBrush(); + break; + + case PenTypeTextureFill: + brush = new TextureBrush(); + break; + + case PenTypePathGradient: + brush = new Brush(); + break; + + case PenTypeLinearGradient: + brush = new LinearGradientBrush(); + break; + + default: + break; + } + + if(brush) + { + GpBrush* nativeBrush; + + SetStatus(DllExports::GdipGetPenBrushFill(nativePen, &nativeBrush)); + brush->SetNativeBrush(nativeBrush); + } + + return brush; + } + + DashStyle GetDashStyle() const + { + DashStyle dashStyle; + + SetStatus(DllExports::GdipGetPenDashStyle(nativePen, &dashStyle)); + + return dashStyle; + } + + Status SetDashStyle(IN DashStyle dashStyle) + { + return SetStatus(DllExports::GdipSetPenDashStyle(nativePen, dashStyle)); + } + + REAL GetDashOffset() const + { + REAL dashOffset; + + SetStatus(DllExports::GdipGetPenDashOffset(nativePen, &dashOffset)); + + return dashOffset; + } + + Status SetDashOffset(IN REAL dashOffset) + { + return SetStatus(DllExports::GdipSetPenDashOffset(nativePen, dashOffset)); + } + + Status SetDashPattern(IN const REAL* dashArray, IN INT count) + { + return SetStatus(DllExports::GdipSetPenDashArray(nativePen, dashArray, + count)); + } + + INT GetDashPatternCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPenDashCount(nativePen, &count)); + + return count; + } + + Status GetDashPattern(OUT REAL* dashArray, + IN INT count) const + { + if (dashArray == NULL || count <= 0) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPenDashArray(nativePen, + dashArray, + count)); + } + + Status SetCompoundArray(IN const REAL* compoundArray, + IN INT count) + { + return SetStatus(DllExports::GdipSetPenCompoundArray(nativePen, compoundArray, + count)); + } + + INT GetCompoundArrayCount() const + { + INT count = 0; + + SetStatus(DllExports::GdipGetPenCompoundCount(nativePen, &count)); + + return count; + } + + Status GetCompoundArray(OUT REAL* compoundArray, + IN INT count) const + { + if (compoundArray == NULL || count <= 0) + return SetStatus(InvalidParameter); + + return SetStatus(DllExports::GdipGetPenCompoundArray(nativePen, + compoundArray, + count)); + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +protected: + +#ifdef DCR_USE_NEW_250932 + +private: + Pen(const Pen &); + Pen& operator=(const Pen &); +protected: + +#else + + Pen(const Pen& pen) + { + pen; + SetStatus(NotImplemented); + SetNativePen(NULL); + } + + Pen& operator=(const Pen& pen) + { + pen; + SetStatus(NotImplemented); + return *this; + } + +#endif + + Pen(GpPen* nativePen, Status status) + { + lastResult = status; + SetNativePen(nativePen); + } + + VOID SetNativePen(GpPen* nativePen) + { + this->nativePen = nativePen; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpPen* nativePen; + mutable Status lastResult; +}; + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusPixelFormats.h b/core/src/fxge/Microsoft SDK/include/GdiPlusPixelFormats.h index f9dc5991d4..68b7084074 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusPixelFormats.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusPixelFormats.h @@ -1,201 +1,201 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* Gdiplus pixel formats -* -* Abstract: -* -* Definitions for color types, palettes, pixel format IDs. -* -\**************************************************************************/ - -#ifndef _GDIPLUSPIXELFORMATS_H -#define _GDIPLUSPIXELFORMATS_H - -/* - * 32-bit and 64-bit ARGB pixel value - */ - -typedef DWORD ARGB; -typedef DWORDLONG ARGB64; - -#define ALPHA_SHIFT 24 -#define RED_SHIFT 16 -#define GREEN_SHIFT 8 -#define BLUE_SHIFT 0 -#define ALPHA_MASK ((ARGB) 0xff << ALPHA_SHIFT) - -/* - * In-memory pixel data formats: - * bits 0-7 = format index - * bits 8-15 = pixel size (in bits) - * bits 16-23 = flags - * bits 24-31 = reserved - */ - -#ifndef DCR_USE_NEW_105760 - -enum PixelFormat -{ - PixelFormatIndexed = 0x00010000, // Indexes into a palette - PixelFormatGDI = 0x00020000, // Is a GDI-supported format - PixelFormatAlpha = 0x00040000, // Has an alpha component - PixelFormatPAlpha = 0x00080000, // Uses pre-multiplied alpha - PixelFormatExtended = 0x00100000, // Uses extended color (16 bits per channel) - PixelFormatCanonical = 0x00200000, // ? - - PixelFormatUndefined = 0, - PixelFormatDontCare = 0, - - PixelFormat1bppIndexed = 1 | ( 1 << 8) | PixelFormatIndexed - | PixelFormatGDI, - PixelFormat4bppIndexed = 2 | ( 4 << 8) | PixelFormatIndexed - | PixelFormatGDI, - PixelFormat8bppIndexed = 3 | ( 8 << 8) | PixelFormatIndexed - | PixelFormatGDI, - PixelFormat16bppGrayScale = 4 | (16 << 8) | PixelFormatExtended, - PixelFormat16bppRGB555 = 5 | (16 << 8) | PixelFormatGDI, - PixelFormat16bppRGB565 = 6 | (16 << 8) | PixelFormatGDI, - PixelFormat16bppARGB1555 = 7 | (16 << 8) | PixelFormatAlpha - | PixelFormatGDI, - PixelFormat24bppRGB = 8 | (24 << 8) | PixelFormatGDI, - PixelFormat32bppRGB = 9 | (32 << 8) | PixelFormatGDI, - PixelFormat32bppARGB = 10 | (32 << 8) | PixelFormatAlpha - | PixelFormatGDI - | PixelFormatCanonical, - PixelFormat32bppPARGB = 11 | (32 << 8) | PixelFormatAlpha - | PixelFormatPAlpha - | PixelFormatGDI, - PixelFormat48bppRGB = 12 | (48 << 8) | PixelFormatExtended, - PixelFormat64bppARGB = 13 | (64 << 8) | PixelFormatAlpha - | PixelFormatCanonical - | PixelFormatExtended, - PixelFormat64bppPARGB = 14 | (64 << 8) | PixelFormatAlpha - | PixelFormatPAlpha - | PixelFormatExtended, - PixelFormat24bppBGR = 15 | (24 << 8) | PixelFormatGDI, - PixelFormatMax = 16 -}; - -#else - -typedef INT PixelFormat; - -#define PixelFormatIndexed 0x00010000 // Indexes into a palette -#define PixelFormatGDI 0x00020000 // Is a GDI-supported format -#define PixelFormatAlpha 0x00040000 // Has an alpha component -#define PixelFormatPAlpha 0x00080000 // Uses pre-multiplied alpha -#define PixelFormatExtended 0x00100000 // Uses extended color (16 bits per channel) -#define PixelFormatCanonical 0x00200000 // ? - -#define PixelFormatUndefined 0 -#define PixelFormatDontCare 0 - -#define PixelFormat1bppIndexed (1 | ( 1 << 8) | PixelFormatIndexed | PixelFormatGDI) -#define PixelFormat4bppIndexed (2 | ( 4 << 8) | PixelFormatIndexed | PixelFormatGDI) -#define PixelFormat8bppIndexed (3 | ( 8 << 8) | PixelFormatIndexed | PixelFormatGDI) -#define PixelFormat16bppGrayScale (4 | (16 << 8) | PixelFormatExtended) -#define PixelFormat16bppRGB555 (5 | (16 << 8) | PixelFormatGDI) -#define PixelFormat16bppRGB565 (6 | (16 << 8) | PixelFormatGDI) -#define PixelFormat16bppARGB1555 (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI) -#define PixelFormat24bppRGB (8 | (24 << 8) | PixelFormatGDI) -#define PixelFormat32bppRGB (9 | (32 << 8) | PixelFormatGDI) -#define PixelFormat32bppARGB (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical) -#define PixelFormat32bppPARGB (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI) -#define PixelFormat48bppRGB (12 | (48 << 8) | PixelFormatExtended) -#define PixelFormat64bppARGB (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended) -#define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended) -#define PixelFormatMax 15 - -#endif - - -/* - * Return the pixel size for the specified format (in bits) - */ - -inline UINT -GetPixelFormatSize( - PixelFormat pixfmt - ) -{ - return (pixfmt >> 8) & 0xff; -} - -/* - * Determine if the specified pixel format is an indexed color format - */ - -inline BOOL -IsIndexedPixelFormat( - PixelFormat pixfmt - ) -{ - return (pixfmt & PixelFormatIndexed) != 0; -} - -/* - * Determine if the pixel format can have alpha channel - */ - -inline BOOL -IsAlphaPixelFormat( - PixelFormat pixfmt -) -{ - return (pixfmt & PixelFormatAlpha) != 0; -} - -/* - * Determine if the pixel format is an extended format, - * i.e. supports 16-bit per channel - */ - -inline BOOL -IsExtendedPixelFormat( - PixelFormat pixfmt - ) -{ - return (pixfmt & PixelFormatExtended) != 0; -} - -/* - * Determine if the pixel format is canonical format: - * PixelFormat32bppARGB - * PixelFormat32bppPARGB - * PixelFormat64bppARGB - * PixelFormat64bppPARGB - */ - -inline BOOL -IsCanonicalPixelFormat( - PixelFormat pixfmt - ) -{ - return (pixfmt & PixelFormatCanonical) != 0; -} - -/* - * Color palette - * palette entries are limited to 32bpp ARGB pixel format - */ - -enum PaletteFlags -{ - PaletteFlagsHasAlpha = 0x0001, - PaletteFlagsGrayScale = 0x0002, - PaletteFlagsHalftone = 0x0004 -}; - -struct ColorPalette -{ -public: - UINT Flags; // palette flags - UINT Count; // number of color entries - ARGB Entries[1]; // palette color entries -}; - -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* Gdiplus pixel formats +* +* Abstract: +* +* Definitions for color types, palettes, pixel format IDs. +* +\**************************************************************************/ + +#ifndef _GDIPLUSPIXELFORMATS_H +#define _GDIPLUSPIXELFORMATS_H + +/* + * 32-bit and 64-bit ARGB pixel value + */ + +typedef DWORD ARGB; +typedef DWORDLONG ARGB64; + +#define ALPHA_SHIFT 24 +#define RED_SHIFT 16 +#define GREEN_SHIFT 8 +#define BLUE_SHIFT 0 +#define ALPHA_MASK ((ARGB) 0xff << ALPHA_SHIFT) + +/* + * In-memory pixel data formats: + * bits 0-7 = format index + * bits 8-15 = pixel size (in bits) + * bits 16-23 = flags + * bits 24-31 = reserved + */ + +#ifndef DCR_USE_NEW_105760 + +enum PixelFormat +{ + PixelFormatIndexed = 0x00010000, // Indexes into a palette + PixelFormatGDI = 0x00020000, // Is a GDI-supported format + PixelFormatAlpha = 0x00040000, // Has an alpha component + PixelFormatPAlpha = 0x00080000, // Uses pre-multiplied alpha + PixelFormatExtended = 0x00100000, // Uses extended color (16 bits per channel) + PixelFormatCanonical = 0x00200000, // ? + + PixelFormatUndefined = 0, + PixelFormatDontCare = 0, + + PixelFormat1bppIndexed = 1 | ( 1 << 8) | PixelFormatIndexed + | PixelFormatGDI, + PixelFormat4bppIndexed = 2 | ( 4 << 8) | PixelFormatIndexed + | PixelFormatGDI, + PixelFormat8bppIndexed = 3 | ( 8 << 8) | PixelFormatIndexed + | PixelFormatGDI, + PixelFormat16bppGrayScale = 4 | (16 << 8) | PixelFormatExtended, + PixelFormat16bppRGB555 = 5 | (16 << 8) | PixelFormatGDI, + PixelFormat16bppRGB565 = 6 | (16 << 8) | PixelFormatGDI, + PixelFormat16bppARGB1555 = 7 | (16 << 8) | PixelFormatAlpha + | PixelFormatGDI, + PixelFormat24bppRGB = 8 | (24 << 8) | PixelFormatGDI, + PixelFormat32bppRGB = 9 | (32 << 8) | PixelFormatGDI, + PixelFormat32bppARGB = 10 | (32 << 8) | PixelFormatAlpha + | PixelFormatGDI + | PixelFormatCanonical, + PixelFormat32bppPARGB = 11 | (32 << 8) | PixelFormatAlpha + | PixelFormatPAlpha + | PixelFormatGDI, + PixelFormat48bppRGB = 12 | (48 << 8) | PixelFormatExtended, + PixelFormat64bppARGB = 13 | (64 << 8) | PixelFormatAlpha + | PixelFormatCanonical + | PixelFormatExtended, + PixelFormat64bppPARGB = 14 | (64 << 8) | PixelFormatAlpha + | PixelFormatPAlpha + | PixelFormatExtended, + PixelFormat24bppBGR = 15 | (24 << 8) | PixelFormatGDI, + PixelFormatMax = 16 +}; + +#else + +typedef INT PixelFormat; + +#define PixelFormatIndexed 0x00010000 // Indexes into a palette +#define PixelFormatGDI 0x00020000 // Is a GDI-supported format +#define PixelFormatAlpha 0x00040000 // Has an alpha component +#define PixelFormatPAlpha 0x00080000 // Uses pre-multiplied alpha +#define PixelFormatExtended 0x00100000 // Uses extended color (16 bits per channel) +#define PixelFormatCanonical 0x00200000 // ? + +#define PixelFormatUndefined 0 +#define PixelFormatDontCare 0 + +#define PixelFormat1bppIndexed (1 | ( 1 << 8) | PixelFormatIndexed | PixelFormatGDI) +#define PixelFormat4bppIndexed (2 | ( 4 << 8) | PixelFormatIndexed | PixelFormatGDI) +#define PixelFormat8bppIndexed (3 | ( 8 << 8) | PixelFormatIndexed | PixelFormatGDI) +#define PixelFormat16bppGrayScale (4 | (16 << 8) | PixelFormatExtended) +#define PixelFormat16bppRGB555 (5 | (16 << 8) | PixelFormatGDI) +#define PixelFormat16bppRGB565 (6 | (16 << 8) | PixelFormatGDI) +#define PixelFormat16bppARGB1555 (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI) +#define PixelFormat24bppRGB (8 | (24 << 8) | PixelFormatGDI) +#define PixelFormat32bppRGB (9 | (32 << 8) | PixelFormatGDI) +#define PixelFormat32bppARGB (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical) +#define PixelFormat32bppPARGB (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI) +#define PixelFormat48bppRGB (12 | (48 << 8) | PixelFormatExtended) +#define PixelFormat64bppARGB (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended) +#define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended) +#define PixelFormatMax 15 + +#endif + + +/* + * Return the pixel size for the specified format (in bits) + */ + +inline UINT +GetPixelFormatSize( + PixelFormat pixfmt + ) +{ + return (pixfmt >> 8) & 0xff; +} + +/* + * Determine if the specified pixel format is an indexed color format + */ + +inline BOOL +IsIndexedPixelFormat( + PixelFormat pixfmt + ) +{ + return (pixfmt & PixelFormatIndexed) != 0; +} + +/* + * Determine if the pixel format can have alpha channel + */ + +inline BOOL +IsAlphaPixelFormat( + PixelFormat pixfmt +) +{ + return (pixfmt & PixelFormatAlpha) != 0; +} + +/* + * Determine if the pixel format is an extended format, + * i.e. supports 16-bit per channel + */ + +inline BOOL +IsExtendedPixelFormat( + PixelFormat pixfmt + ) +{ + return (pixfmt & PixelFormatExtended) != 0; +} + +/* + * Determine if the pixel format is canonical format: + * PixelFormat32bppARGB + * PixelFormat32bppPARGB + * PixelFormat64bppARGB + * PixelFormat64bppPARGB + */ + +inline BOOL +IsCanonicalPixelFormat( + PixelFormat pixfmt + ) +{ + return (pixfmt & PixelFormatCanonical) != 0; +} + +/* + * Color palette + * palette entries are limited to 32bpp ARGB pixel format + */ + +enum PaletteFlags +{ + PaletteFlagsHasAlpha = 0x0001, + PaletteFlagsGrayScale = 0x0002, + PaletteFlagsHalftone = 0x0004 +}; + +struct ColorPalette +{ +public: + UINT Flags; // palette flags + UINT Count; // number of color entries + ARGB Entries[1]; // palette color entries +}; + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusRegion.h b/core/src/fxge/Microsoft SDK/include/GdiPlusRegion.h index dd1d20e273..cfb40a17dc 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusRegion.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusRegion.h @@ -1,498 +1,498 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusRegion.h -* -* Abstract: -* -* Region API related declarations -* -\**************************************************************************/ - -#ifndef _GDIPLUSREGION_H -#define _GDIPLUSREGION_H - -/** - * Construct a new region object - */ - -inline -Region::Region() -{ - GpRegion *region = NULL; - - lastResult = DllExports::GdipCreateRegion(®ion); - - SetNativeRegion(region); -} - -inline -Region::Region(IN const RectF& rect) -{ - GpRegion *region = NULL; - - lastResult = DllExports::GdipCreateRegionRect(&rect, ®ion); - - SetNativeRegion(region); -} - -inline -Region::Region(IN const Rect& rect) -{ - GpRegion *region = NULL; - - lastResult = DllExports::GdipCreateRegionRectI(&rect, ®ion); - - SetNativeRegion(region); -} - -inline -Region::Region(IN const GraphicsPath* path) -{ - GpRegion *region = NULL; - - lastResult = DllExports::GdipCreateRegionPath(path->nativePath, ®ion); - - SetNativeRegion(region); -} - -inline -Region::Region(IN const BYTE* regionData, IN INT size) -{ - GpRegion *region = NULL; - - lastResult = DllExports::GdipCreateRegionRgnData(regionData, size, ®ion); - - SetNativeRegion(region); -} - -inline -Region::Region(IN HRGN hRgn) -{ - GpRegion *region = NULL; - - lastResult = DllExports::GdipCreateRegionHrgn(hRgn, ®ion); - - SetNativeRegion(region); -} - -inline -Region* Region::FromHRGN(IN HRGN hRgn) -{ - GpRegion *region = NULL; - - if (DllExports::GdipCreateRegionHrgn(hRgn, ®ion) == Ok) - { - Region* newRegion = new Region(region); - - if (newRegion == NULL) - { - DllExports::GdipDeleteRegion(region); - } - - return newRegion; - } - else - return NULL; -} - -inline -Region::~Region() -{ - DllExports::GdipDeleteRegion(nativeRegion); -} - -/** - * Make a copy of the region object - */ -inline Region* -Region::Clone() const -{ - GpRegion *region = NULL; - - SetStatus(DllExports::GdipCloneRegion(nativeRegion, ®ion)); - - return new Region(region); -} - -inline Status -Region::MakeInfinite() -{ - return SetStatus(DllExports::GdipSetInfinite(nativeRegion)); -} - -inline Status -Region::MakeEmpty() -{ - return SetStatus(DllExports::GdipSetEmpty(nativeRegion)); -} - -/** - * Region operations - */ -inline Status -Region::Intersect(IN const RectF& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeIntersect)); -} - -inline Status -Region::Intersect(IN const Rect& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeIntersect)); -} - -inline Status -Region::Intersect(IN const GraphicsPath* path) -{ - return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeIntersect)); -} - -inline Status -Region::Intersect(IN const Region* region) -{ - return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeIntersect)); -} - -inline Status -Region::Union(IN const RectF& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeUnion)); -} - -inline Status -Region::Union(IN const Rect& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeUnion)); -} - -inline Status -Region::Union(IN const GraphicsPath* path) -{ - return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeUnion)); -} - -inline Status -Region::Union(IN const Region* region) -{ - return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeUnion)); -} - -inline Status -Region::Xor(IN const RectF& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeXor)); -} - -inline Status -Region::Xor(IN const Rect& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeXor)); -} - -inline Status -Region::Xor(IN const GraphicsPath* path) -{ - return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeXor)); -} - -inline Status -Region::Xor(IN const Region* region) -{ - return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeXor)); -} - -inline Status -Region::Exclude(IN const RectF& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeExclude)); -} - -inline Status -Region::Exclude(IN const Rect& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeExclude)); -} - -inline Status -Region::Exclude(IN const GraphicsPath* path) -{ - return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeExclude)); -} - -inline Status -Region::Exclude(IN const Region* region) -{ - return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, - region->nativeRegion, CombineModeExclude)); -} - -inline Status -Region::Complement(IN const RectF& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeComplement)); -} - -inline Status -Region::Complement(IN const Rect& rect) -{ - return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeComplement)); -} - -inline Status -Region::Complement(IN const GraphicsPath* path) -{ - return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, - path->nativePath, CombineModeComplement)); -} - -inline Status -Region::Complement(IN const Region* region) -{ - return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, - region->nativeRegion, CombineModeComplement)); -} - -/** - * Transform operations - */ -inline Status -Region::Translate(IN REAL dx, - IN REAL dy) -{ - return SetStatus(DllExports::GdipTranslateRegion(nativeRegion, dx, dy)); -} - -inline Status -Region::Translate(IN INT dx, - IN INT dy) -{ - return SetStatus(DllExports::GdipTranslateRegionI(nativeRegion, dx, dy)); -} - -inline Status -Region::Transform(IN const Matrix* matrix) -{ - return SetStatus(DllExports::GdipTransformRegion(nativeRegion, matrix->nativeMatrix)); -} - -/** - * Get region attributes - */ -inline Status -Region::GetBounds(OUT RectF* rect, - IN const Graphics* g) const -{ - return SetStatus(DllExports::GdipGetRegionBounds(nativeRegion, - g->nativeGraphics, - rect)); -} - -inline Status -Region::GetBounds(OUT Rect* rect, - IN const Graphics* g) const -{ - return SetStatus(DllExports::GdipGetRegionBoundsI(nativeRegion, - g->nativeGraphics, - rect)); -} - -inline HRGN -Region::GetHRGN(IN const Graphics* g) const -{ - HRGN hrgn; - - SetStatus(DllExports::GdipGetRegionHRgn(nativeRegion, - g->nativeGraphics, - &hrgn)); - - return hrgn; -} - -inline BOOL -Region::IsEmpty(IN const Graphics *g) const -{ - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsEmptyRegion(nativeRegion, - g->nativeGraphics, - &booln)); - - return booln; -} - -inline BOOL -Region::IsInfinite(IN const Graphics *g) const -{ - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsInfiniteRegion(nativeRegion, - g->nativeGraphics, - &booln)); - - return booln; -} - -inline BOOL -Region::Equals(IN const Region* region, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsEqualRegion(nativeRegion, - region->nativeRegion, - g->nativeGraphics, - &booln)); - return booln; -} - -// Get the size of the buffer needed for the GetData method -inline UINT -Region::GetDataSize() const -{ - UINT bufferSize = 0; - - SetStatus(DllExports::GdipGetRegionDataSize(nativeRegion, &bufferSize)); - - return bufferSize; -} - -// 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. -inline Status -Region::GetData(OUT BYTE* buffer, - IN UINT bufferSize, - OUT UINT* sizeFilled) const -{ - return SetStatus(DllExports::GdipGetRegionData(nativeRegion, buffer, bufferSize, sizeFilled)); -} - -/** - * Hit testing operations - */ -inline BOOL -Region::IsVisible(IN const PointF& point, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsVisibleRegionPoint(nativeRegion, - point.X, point.Y, - (g == NULL) ? NULL : g->nativeGraphics, - &booln)); - return booln; -} - -inline BOOL -Region::IsVisible(IN const RectF& rect, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsVisibleRegionRect(nativeRegion, rect.X, - rect.Y, rect.Width, - rect.Height, - (g == NULL) ? NULL : g->nativeGraphics, - &booln)); - return booln; -} - -inline BOOL -Region::IsVisible(IN const Point& point, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - - SetStatus(DllExports::GdipIsVisibleRegionPointI(nativeRegion, - point.X, - point.Y, - (g == NULL) ? NULL : g->nativeGraphics, - &booln)); - return booln; -} - -inline BOOL -Region::IsVisible(IN const Rect& rect, - IN const Graphics* g) const -{ - BOOL booln = FALSE; - - SetStatus(DllExports::GdipIsVisibleRegionRectI(nativeRegion, - rect.X, - rect.Y, - rect.Width, - rect.Height, - (g == NULL) ? NULL : g->nativeGraphics, - &booln)); - return booln; -} - -inline UINT -Region::GetRegionScansCount(IN const Matrix* matrix) const -{ - UINT count = 0; - - SetStatus(DllExports::GdipGetRegionScansCount(nativeRegion, - &count, - matrix->nativeMatrix)); - return count; -} - -inline Status -Region::GetRegionScans( - IN const Matrix* matrix, - OUT RectF* rects, - IN OUT INT* count) const -{ - return SetStatus(DllExports::GdipGetRegionScans(nativeRegion, - rects, - count, - matrix->nativeMatrix)); -} - -// If rects is NULL, return the count of rects in the region. -// Otherwise, assume rects is big enough to hold all the region rects -// and fill them in and return the number of rects filled in. -// The rects are returned in the units specified by the matrix -// (which is typically a world-to-device transform). -// Note that the number of rects returned can vary, depending on the -// matrix that is used. -inline Status -Region::GetRegionScans( - IN const Matrix* matrix, - OUT Rect* rects, // NULL to just get the count - IN OUT INT* count) const -{ - return SetStatus(DllExports::GdipGetRegionScansI(nativeRegion, - rects, - count, - matrix->nativeMatrix)); -} - -// protected method -inline Region::Region(GpRegion* nativeRegion) -{ - SetNativeRegion(nativeRegion); -} - -// protected method -inline VOID Region::SetNativeRegion(GpRegion* nativeRegion) -{ - this->nativeRegion = nativeRegion; -} - -inline Status Region::GetLastStatus() const -{ - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; -} - -#endif // !_GDIPLUSREGION_H +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusRegion.h +* +* Abstract: +* +* Region API related declarations +* +\**************************************************************************/ + +#ifndef _GDIPLUSREGION_H +#define _GDIPLUSREGION_H + +/** + * Construct a new region object + */ + +inline +Region::Region() +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegion(®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN const RectF& rect) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionRect(&rect, ®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN const Rect& rect) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionRectI(&rect, ®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN const GraphicsPath* path) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionPath(path->nativePath, ®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN const BYTE* regionData, IN INT size) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionRgnData(regionData, size, ®ion); + + SetNativeRegion(region); +} + +inline +Region::Region(IN HRGN hRgn) +{ + GpRegion *region = NULL; + + lastResult = DllExports::GdipCreateRegionHrgn(hRgn, ®ion); + + SetNativeRegion(region); +} + +inline +Region* Region::FromHRGN(IN HRGN hRgn) +{ + GpRegion *region = NULL; + + if (DllExports::GdipCreateRegionHrgn(hRgn, ®ion) == Ok) + { + Region* newRegion = new Region(region); + + if (newRegion == NULL) + { + DllExports::GdipDeleteRegion(region); + } + + return newRegion; + } + else + return NULL; +} + +inline +Region::~Region() +{ + DllExports::GdipDeleteRegion(nativeRegion); +} + +/** + * Make a copy of the region object + */ +inline Region* +Region::Clone() const +{ + GpRegion *region = NULL; + + SetStatus(DllExports::GdipCloneRegion(nativeRegion, ®ion)); + + return new Region(region); +} + +inline Status +Region::MakeInfinite() +{ + return SetStatus(DllExports::GdipSetInfinite(nativeRegion)); +} + +inline Status +Region::MakeEmpty() +{ + return SetStatus(DllExports::GdipSetEmpty(nativeRegion)); +} + +/** + * Region operations + */ +inline Status +Region::Intersect(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeIntersect)); +} + +inline Status +Region::Intersect(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeIntersect)); +} + +inline Status +Region::Intersect(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeIntersect)); +} + +inline Status +Region::Intersect(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeIntersect)); +} + +inline Status +Region::Union(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeUnion)); +} + +inline Status +Region::Union(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeUnion)); +} + +inline Status +Region::Union(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeUnion)); +} + +inline Status +Region::Union(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeUnion)); +} + +inline Status +Region::Xor(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeXor)); +} + +inline Status +Region::Xor(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeXor)); +} + +inline Status +Region::Xor(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeXor)); +} + +inline Status +Region::Xor(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, region->nativeRegion, CombineModeXor)); +} + +inline Status +Region::Exclude(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeExclude)); +} + +inline Status +Region::Exclude(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeExclude)); +} + +inline Status +Region::Exclude(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, path->nativePath, CombineModeExclude)); +} + +inline Status +Region::Exclude(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, + region->nativeRegion, CombineModeExclude)); +} + +inline Status +Region::Complement(IN const RectF& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRect(nativeRegion, &rect, CombineModeComplement)); +} + +inline Status +Region::Complement(IN const Rect& rect) +{ + return SetStatus(DllExports::GdipCombineRegionRectI(nativeRegion, &rect, CombineModeComplement)); +} + +inline Status +Region::Complement(IN const GraphicsPath* path) +{ + return SetStatus(DllExports::GdipCombineRegionPath(nativeRegion, + path->nativePath, CombineModeComplement)); +} + +inline Status +Region::Complement(IN const Region* region) +{ + return SetStatus(DllExports::GdipCombineRegionRegion(nativeRegion, + region->nativeRegion, CombineModeComplement)); +} + +/** + * Transform operations + */ +inline Status +Region::Translate(IN REAL dx, + IN REAL dy) +{ + return SetStatus(DllExports::GdipTranslateRegion(nativeRegion, dx, dy)); +} + +inline Status +Region::Translate(IN INT dx, + IN INT dy) +{ + return SetStatus(DllExports::GdipTranslateRegionI(nativeRegion, dx, dy)); +} + +inline Status +Region::Transform(IN const Matrix* matrix) +{ + return SetStatus(DllExports::GdipTransformRegion(nativeRegion, matrix->nativeMatrix)); +} + +/** + * Get region attributes + */ +inline Status +Region::GetBounds(OUT RectF* rect, + IN const Graphics* g) const +{ + return SetStatus(DllExports::GdipGetRegionBounds(nativeRegion, + g->nativeGraphics, + rect)); +} + +inline Status +Region::GetBounds(OUT Rect* rect, + IN const Graphics* g) const +{ + return SetStatus(DllExports::GdipGetRegionBoundsI(nativeRegion, + g->nativeGraphics, + rect)); +} + +inline HRGN +Region::GetHRGN(IN const Graphics* g) const +{ + HRGN hrgn; + + SetStatus(DllExports::GdipGetRegionHRgn(nativeRegion, + g->nativeGraphics, + &hrgn)); + + return hrgn; +} + +inline BOOL +Region::IsEmpty(IN const Graphics *g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsEmptyRegion(nativeRegion, + g->nativeGraphics, + &booln)); + + return booln; +} + +inline BOOL +Region::IsInfinite(IN const Graphics *g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsInfiniteRegion(nativeRegion, + g->nativeGraphics, + &booln)); + + return booln; +} + +inline BOOL +Region::Equals(IN const Region* region, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsEqualRegion(nativeRegion, + region->nativeRegion, + g->nativeGraphics, + &booln)); + return booln; +} + +// Get the size of the buffer needed for the GetData method +inline UINT +Region::GetDataSize() const +{ + UINT bufferSize = 0; + + SetStatus(DllExports::GdipGetRegionDataSize(nativeRegion, &bufferSize)); + + return bufferSize; +} + +// 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. +inline Status +Region::GetData(OUT BYTE* buffer, + IN UINT bufferSize, + OUT UINT* sizeFilled) const +{ + return SetStatus(DllExports::GdipGetRegionData(nativeRegion, buffer, bufferSize, sizeFilled)); +} + +/** + * Hit testing operations + */ +inline BOOL +Region::IsVisible(IN const PointF& point, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisibleRegionPoint(nativeRegion, + point.X, point.Y, + (g == NULL) ? NULL : g->nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +Region::IsVisible(IN const RectF& rect, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisibleRegionRect(nativeRegion, rect.X, + rect.Y, rect.Width, + rect.Height, + (g == NULL) ? NULL : g->nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +Region::IsVisible(IN const Point& point, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + + SetStatus(DllExports::GdipIsVisibleRegionPointI(nativeRegion, + point.X, + point.Y, + (g == NULL) ? NULL : g->nativeGraphics, + &booln)); + return booln; +} + +inline BOOL +Region::IsVisible(IN const Rect& rect, + IN const Graphics* g) const +{ + BOOL booln = FALSE; + + SetStatus(DllExports::GdipIsVisibleRegionRectI(nativeRegion, + rect.X, + rect.Y, + rect.Width, + rect.Height, + (g == NULL) ? NULL : g->nativeGraphics, + &booln)); + return booln; +} + +inline UINT +Region::GetRegionScansCount(IN const Matrix* matrix) const +{ + UINT count = 0; + + SetStatus(DllExports::GdipGetRegionScansCount(nativeRegion, + &count, + matrix->nativeMatrix)); + return count; +} + +inline Status +Region::GetRegionScans( + IN const Matrix* matrix, + OUT RectF* rects, + IN OUT INT* count) const +{ + return SetStatus(DllExports::GdipGetRegionScans(nativeRegion, + rects, + count, + matrix->nativeMatrix)); +} + +// If rects is NULL, return the count of rects in the region. +// Otherwise, assume rects is big enough to hold all the region rects +// and fill them in and return the number of rects filled in. +// The rects are returned in the units specified by the matrix +// (which is typically a world-to-device transform). +// Note that the number of rects returned can vary, depending on the +// matrix that is used. +inline Status +Region::GetRegionScans( + IN const Matrix* matrix, + OUT Rect* rects, // NULL to just get the count + IN OUT INT* count) const +{ + return SetStatus(DllExports::GdipGetRegionScansI(nativeRegion, + rects, + count, + matrix->nativeMatrix)); +} + +// protected method +inline Region::Region(GpRegion* nativeRegion) +{ + SetNativeRegion(nativeRegion); +} + +// protected method +inline VOID Region::SetNativeRegion(GpRegion* nativeRegion) +{ + this->nativeRegion = nativeRegion; +} + +inline Status Region::GetLastStatus() const +{ + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; +} + +#endif // !_GDIPLUSREGION_H diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusStringFormat.h b/core/src/fxge/Microsoft SDK/include/GdiPlusStringFormat.h index 1c9ddb50ec..b4ed431a06 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusStringFormat.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusStringFormat.h @@ -1,381 +1,381 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusStringFormat.h -* -* Abstract: -* -* String format specification for DrawString and text APIs -* -\**************************************************************************/ - -#ifndef _GDIPLUSSTRINGFORMAT_H -#define _GDIPLUSSTRINGFORMAT_H - - -class StringFormat : public GdiplusBase -{ -public: - friend class Graphics; - friend class GraphicsPath; - - - StringFormat( - IN INT formatFlags = 0, - IN LANGID language = LANG_NEUTRAL - ) - { - nativeFormat = NULL; - lastError = DllExports::GdipCreateStringFormat( - formatFlags, - language, - &nativeFormat - ); - } - - static const StringFormat *GenericDefault(); - static const StringFormat *GenericTypographic(); - - // Constructor based on existing string format - - StringFormat( - IN const StringFormat *format - ) - { - nativeFormat = NULL; - lastError = DllExports::GdipCloneStringFormat( - format ? format->nativeFormat : NULL, - &nativeFormat - ); - } - - StringFormat *Clone() const - { - GpStringFormat *clonedStringFormat = NULL; - - lastError = DllExports::GdipCloneStringFormat( - nativeFormat, - &clonedStringFormat - ); - - if (lastError == Ok) - return new StringFormat(clonedStringFormat, lastError); - else - return NULL; - } - - ~StringFormat() - { - DllExports::GdipDeleteStringFormat(nativeFormat); - } - - Status SetFormatFlags(IN INT flags) - { - return SetStatus(DllExports::GdipSetStringFormatFlags( - nativeFormat, - flags - )); - } - - INT GetFormatFlags() const - { - INT flags; - SetStatus(DllExports::GdipGetStringFormatFlags(nativeFormat, &flags)); - return flags; - } - -#ifndef DCR_USE_NEW_152154 - Status SetLineSpacing( - IN REAL amount = 1.0f, - IN LineSpacing method = LineSpacingRecommended - ) - { - return SetStatus(DllExports::GdipSetStringFormatLineSpacing( - nativeFormat, - amount, - method - )); - } -#endif - - Status SetAlignment(IN StringAlignment align) - { - return SetStatus(DllExports::GdipSetStringFormatAlign( - nativeFormat, - align - )); - } - - StringAlignment GetAlignment() const - { - StringAlignment alignment; - SetStatus(DllExports::GdipGetStringFormatAlign( - nativeFormat, - &alignment - )); - return alignment; - } - - Status SetLineAlignment(IN StringAlignment align) - { - return SetStatus(DllExports::GdipSetStringFormatLineAlign( - nativeFormat, - align - )); - } - - StringAlignment GetLineAlignment() const - { - StringAlignment alignment; - SetStatus(DllExports::GdipGetStringFormatLineAlign( - nativeFormat, - &alignment - )); - return alignment; - } - - Status SetHotkeyPrefix(IN HotkeyPrefix hotkeyPrefix) - { - return SetStatus(DllExports::GdipSetStringFormatHotkeyPrefix( - nativeFormat, - (INT)hotkeyPrefix - )); - } - - HotkeyPrefix GetHotkeyPrefix() const - { - HotkeyPrefix hotkeyPrefix; - SetStatus(DllExports::GdipGetStringFormatHotkeyPrefix( - nativeFormat, - (INT*)&hotkeyPrefix - )); - return hotkeyPrefix; - } - - Status SetTabStops( - IN REAL firstTabOffset, - IN INT count, - IN const REAL *tabStops - ) - { - return SetStatus(DllExports::GdipSetStringFormatTabStops( - nativeFormat, - firstTabOffset, - count, - tabStops - )); - } - - INT GetTabStopCount() const - { - INT count; - SetStatus(DllExports::GdipGetStringFormatTabStopCount(nativeFormat, &count)); - return count; - } - - Status GetTabStops( - IN INT count, - OUT REAL *firstTabOffset, - OUT REAL *tabStops - ) const - { - return SetStatus(DllExports::GdipGetStringFormatTabStops( - nativeFormat, - count, - firstTabOffset, - tabStops - )); - } - -#ifdef DCR_USE_NEW_146933 - Status SetDigitSubstitution( - IN LANGID language, - IN StringDigitSubstitute substitute - ) - { - return SetStatus(DllExports::GdipSetStringFormatDigitSubstitution( - nativeFormat, - language, - substitute - )); - } - - LANGID GetDigitSubstitutionLanguage( - ) const - { - LANGID language; - SetStatus(DllExports::GdipGetStringFormatDigitSubstitution( - nativeFormat, - &language, - NULL - )); - return language; - } - - StringDigitSubstitute GetDigitSubstitutionMethod( - ) const - { - StringDigitSubstitute substitute; - SetStatus(DllExports::GdipGetStringFormatDigitSubstitution( - nativeFormat, - NULL, - &substitute - )); - return substitute; - } -#endif // DCR_USE_NEW_146933 - - // String trimming. How to handle more text than can be displayed - // in the limits available. - - Status SetTrimming(IN StringTrimming trimming) - { - return SetStatus(DllExports::GdipSetStringFormatTrimming( - nativeFormat, - trimming - )); - } - - StringTrimming StringFormat::GetTrimming() const - { - StringTrimming trimming; - SetStatus(DllExports::GdipGetStringFormatTrimming( - nativeFormat, - &trimming - )); - return trimming; - } - -#ifdef DCR_USE_NEW_174340 - Status SetMeasurableCharacterRanges( - IN INT rangeCount, - IN const CharacterRange *ranges - ) - { - return SetStatus(DllExports::GdipSetStringFormatMeasurableCharacterRanges( - nativeFormat, - rangeCount, - ranges - )); - } - - INT GetMeasurableCharacterRangeCount() - { - INT count; - SetStatus(DllExports::GdipGetStringFormatMeasurableCharacterRangeCount( - nativeFormat, - &count - )); - return count; - } -#endif - - // GetLastStatus - return last error code and clear error code - - Status GetLastStatus() const - { - Status lastStatus = lastError; - lastError = Ok; - - return lastStatus; - } - -protected: - - Status SetStatus(GpStatus newStatus) const - { - if (newStatus == Ok) - { - return Ok; - } - else - { - return lastError = newStatus; - } - } - - -// Not allowed and move to private - StringFormat(const StringFormat &source) - { - nativeFormat = NULL; - lastError = DllExports::GdipCloneStringFormat( - source.nativeFormat, - &nativeFormat - ); - } - - StringFormat& operator=(const StringFormat &source) - { - DllExports::GdipDeleteStringFormat(nativeFormat); - lastError = DllExports::GdipCloneStringFormat( - source.nativeFormat, - &nativeFormat - ); - return *this; - } - - - // private constructor for copy - StringFormat(GpStringFormat * clonedStringFormat, Status status) - { - lastError = status; - nativeFormat = clonedStringFormat; - - } - - GpStringFormat *nativeFormat; - mutable Status lastError; -}; - -// Generic constant string formats. - -static BYTE GenericTypographicStringFormatBuffer[sizeof(StringFormat)] = {0}; -static BYTE GenericDefaultStringFormatBuffer[sizeof(StringFormat)] = {0}; - -static StringFormat *GenericTypographicStringFormat = NULL; -static StringFormat *GenericDefaultStringFormat = NULL; - -// Define the generic string formats - - -inline const StringFormat *StringFormat::GenericDefault() -{ - if (GenericDefaultStringFormat != NULL) - { - return GenericDefaultStringFormat; - } - - GenericDefaultStringFormat = - (StringFormat*)GenericDefaultStringFormatBuffer; - - GenericDefaultStringFormat->lastError = - DllExports::GdipStringFormatGetGenericDefault( - &(GenericDefaultStringFormat->nativeFormat) - ); - - return GenericDefaultStringFormat; -} - -inline const StringFormat *StringFormat::GenericTypographic() -{ - if (GenericTypographicStringFormat != NULL) - { - return GenericTypographicStringFormat; - } - - GenericTypographicStringFormat = - (StringFormat*)GenericTypographicStringFormatBuffer; - - GenericTypographicStringFormat->lastError = - DllExports::GdipStringFormatGetGenericTypographic( - &GenericTypographicStringFormat->nativeFormat - ); - - return GenericTypographicStringFormat; -} - -#endif // !_GDIPLUSSTRINGFORMAT_H +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusStringFormat.h +* +* Abstract: +* +* String format specification for DrawString and text APIs +* +\**************************************************************************/ + +#ifndef _GDIPLUSSTRINGFORMAT_H +#define _GDIPLUSSTRINGFORMAT_H + + +class StringFormat : public GdiplusBase +{ +public: + friend class Graphics; + friend class GraphicsPath; + + + StringFormat( + IN INT formatFlags = 0, + IN LANGID language = LANG_NEUTRAL + ) + { + nativeFormat = NULL; + lastError = DllExports::GdipCreateStringFormat( + formatFlags, + language, + &nativeFormat + ); + } + + static const StringFormat *GenericDefault(); + static const StringFormat *GenericTypographic(); + + // Constructor based on existing string format + + StringFormat( + IN const StringFormat *format + ) + { + nativeFormat = NULL; + lastError = DllExports::GdipCloneStringFormat( + format ? format->nativeFormat : NULL, + &nativeFormat + ); + } + + StringFormat *Clone() const + { + GpStringFormat *clonedStringFormat = NULL; + + lastError = DllExports::GdipCloneStringFormat( + nativeFormat, + &clonedStringFormat + ); + + if (lastError == Ok) + return new StringFormat(clonedStringFormat, lastError); + else + return NULL; + } + + ~StringFormat() + { + DllExports::GdipDeleteStringFormat(nativeFormat); + } + + Status SetFormatFlags(IN INT flags) + { + return SetStatus(DllExports::GdipSetStringFormatFlags( + nativeFormat, + flags + )); + } + + INT GetFormatFlags() const + { + INT flags; + SetStatus(DllExports::GdipGetStringFormatFlags(nativeFormat, &flags)); + return flags; + } + +#ifndef DCR_USE_NEW_152154 + Status SetLineSpacing( + IN REAL amount = 1.0f, + IN LineSpacing method = LineSpacingRecommended + ) + { + return SetStatus(DllExports::GdipSetStringFormatLineSpacing( + nativeFormat, + amount, + method + )); + } +#endif + + Status SetAlignment(IN StringAlignment align) + { + return SetStatus(DllExports::GdipSetStringFormatAlign( + nativeFormat, + align + )); + } + + StringAlignment GetAlignment() const + { + StringAlignment alignment; + SetStatus(DllExports::GdipGetStringFormatAlign( + nativeFormat, + &alignment + )); + return alignment; + } + + Status SetLineAlignment(IN StringAlignment align) + { + return SetStatus(DllExports::GdipSetStringFormatLineAlign( + nativeFormat, + align + )); + } + + StringAlignment GetLineAlignment() const + { + StringAlignment alignment; + SetStatus(DllExports::GdipGetStringFormatLineAlign( + nativeFormat, + &alignment + )); + return alignment; + } + + Status SetHotkeyPrefix(IN HotkeyPrefix hotkeyPrefix) + { + return SetStatus(DllExports::GdipSetStringFormatHotkeyPrefix( + nativeFormat, + (INT)hotkeyPrefix + )); + } + + HotkeyPrefix GetHotkeyPrefix() const + { + HotkeyPrefix hotkeyPrefix; + SetStatus(DllExports::GdipGetStringFormatHotkeyPrefix( + nativeFormat, + (INT*)&hotkeyPrefix + )); + return hotkeyPrefix; + } + + Status SetTabStops( + IN REAL firstTabOffset, + IN INT count, + IN const REAL *tabStops + ) + { + return SetStatus(DllExports::GdipSetStringFormatTabStops( + nativeFormat, + firstTabOffset, + count, + tabStops + )); + } + + INT GetTabStopCount() const + { + INT count; + SetStatus(DllExports::GdipGetStringFormatTabStopCount(nativeFormat, &count)); + return count; + } + + Status GetTabStops( + IN INT count, + OUT REAL *firstTabOffset, + OUT REAL *tabStops + ) const + { + return SetStatus(DllExports::GdipGetStringFormatTabStops( + nativeFormat, + count, + firstTabOffset, + tabStops + )); + } + +#ifdef DCR_USE_NEW_146933 + Status SetDigitSubstitution( + IN LANGID language, + IN StringDigitSubstitute substitute + ) + { + return SetStatus(DllExports::GdipSetStringFormatDigitSubstitution( + nativeFormat, + language, + substitute + )); + } + + LANGID GetDigitSubstitutionLanguage( + ) const + { + LANGID language; + SetStatus(DllExports::GdipGetStringFormatDigitSubstitution( + nativeFormat, + &language, + NULL + )); + return language; + } + + StringDigitSubstitute GetDigitSubstitutionMethod( + ) const + { + StringDigitSubstitute substitute; + SetStatus(DllExports::GdipGetStringFormatDigitSubstitution( + nativeFormat, + NULL, + &substitute + )); + return substitute; + } +#endif // DCR_USE_NEW_146933 + + // String trimming. How to handle more text than can be displayed + // in the limits available. + + Status SetTrimming(IN StringTrimming trimming) + { + return SetStatus(DllExports::GdipSetStringFormatTrimming( + nativeFormat, + trimming + )); + } + + StringTrimming StringFormat::GetTrimming() const + { + StringTrimming trimming; + SetStatus(DllExports::GdipGetStringFormatTrimming( + nativeFormat, + &trimming + )); + return trimming; + } + +#ifdef DCR_USE_NEW_174340 + Status SetMeasurableCharacterRanges( + IN INT rangeCount, + IN const CharacterRange *ranges + ) + { + return SetStatus(DllExports::GdipSetStringFormatMeasurableCharacterRanges( + nativeFormat, + rangeCount, + ranges + )); + } + + INT GetMeasurableCharacterRangeCount() + { + INT count; + SetStatus(DllExports::GdipGetStringFormatMeasurableCharacterRangeCount( + nativeFormat, + &count + )); + return count; + } +#endif + + // GetLastStatus - return last error code and clear error code + + Status GetLastStatus() const + { + Status lastStatus = lastError; + lastError = Ok; + + return lastStatus; + } + +protected: + + Status SetStatus(GpStatus newStatus) const + { + if (newStatus == Ok) + { + return Ok; + } + else + { + return lastError = newStatus; + } + } + + +// Not allowed and move to private + StringFormat(const StringFormat &source) + { + nativeFormat = NULL; + lastError = DllExports::GdipCloneStringFormat( + source.nativeFormat, + &nativeFormat + ); + } + + StringFormat& operator=(const StringFormat &source) + { + DllExports::GdipDeleteStringFormat(nativeFormat); + lastError = DllExports::GdipCloneStringFormat( + source.nativeFormat, + &nativeFormat + ); + return *this; + } + + + // private constructor for copy + StringFormat(GpStringFormat * clonedStringFormat, Status status) + { + lastError = status; + nativeFormat = clonedStringFormat; + + } + + GpStringFormat *nativeFormat; + mutable Status lastError; +}; + +// Generic constant string formats. + +static BYTE GenericTypographicStringFormatBuffer[sizeof(StringFormat)] = {0}; +static BYTE GenericDefaultStringFormatBuffer[sizeof(StringFormat)] = {0}; + +static StringFormat *GenericTypographicStringFormat = NULL; +static StringFormat *GenericDefaultStringFormat = NULL; + +// Define the generic string formats + + +inline const StringFormat *StringFormat::GenericDefault() +{ + if (GenericDefaultStringFormat != NULL) + { + return GenericDefaultStringFormat; + } + + GenericDefaultStringFormat = + (StringFormat*)GenericDefaultStringFormatBuffer; + + GenericDefaultStringFormat->lastError = + DllExports::GdipStringFormatGetGenericDefault( + &(GenericDefaultStringFormat->nativeFormat) + ); + + return GenericDefaultStringFormat; +} + +inline const StringFormat *StringFormat::GenericTypographic() +{ + if (GenericTypographicStringFormat != NULL) + { + return GenericTypographicStringFormat; + } + + GenericTypographicStringFormat = + (StringFormat*)GenericTypographicStringFormatBuffer; + + GenericTypographicStringFormat->lastError = + DllExports::GdipStringFormatGetGenericTypographic( + &GenericTypographicStringFormat->nativeFormat + ); + + return GenericTypographicStringFormat; +} + +#endif // !_GDIPLUSSTRINGFORMAT_H diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusTypes.h b/core/src/fxge/Microsoft SDK/include/GdiPlusTypes.h index 58c584dc1d..d5c03a265e 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusTypes.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusTypes.h @@ -1,826 +1,826 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* GdiplusTypes.h -* -* Abstract: -* -* Basic types used by GDI+ -* -\**************************************************************************/ - -#ifndef _GDIPLUSTYPES_H -#define _GDIPLUSTYPES_H - -#ifndef DCR_USE_NEW_175866 - -//-------------------------------------------------------------------------- -// LIB version initialization functions -//-------------------------------------------------------------------------- - -typedef VOID (__cdecl *DEBUGEVENTFUNCTION)(INT level, CHAR *message); - -extern "C" BOOL __stdcall InitializeGdiplus(DEBUGEVENTFUNCTION); -extern "C" VOID __stdcall UninitializeGdiplus(); - -#endif - -//-------------------------------------------------------------------------- -// Callback functions -//-------------------------------------------------------------------------- - -extern "C" { -typedef BOOL (CALLBACK * ImageAbort)(VOID *); -typedef ImageAbort DrawImageAbort; -typedef ImageAbort GetThumbnailImageAbort; -} - -// Callback for EnumerateMetafile methods. The parameters are: - -// recordType WMF, EMF, or EMF+ record type -// flags (always 0 for WMF/EMF records) -// dataSize size of the record data (in bytes), or 0 if no data -// data pointer to the record data, or NULL if no data -// callbackData pointer to callbackData, if any - -// This method can then call Metafile::PlayRecord to play the -// record that was just enumerated. If this method returns -// FALSE, the enumeration process is aborted. Otherwise, it continues. - -extern "C" { -typedef BOOL (CALLBACK * EnumerateMetafileProc)(EmfPlusRecordType,UINT,UINT,const BYTE*,VOID*); -} - -//-------------------------------------------------------------------------- -// Primitive data types -// -// NOTE: -// Types already defined in standard header files: -// INT8 -// UINT8 -// INT16 -// UINT16 -// INT32 -// UINT32 -// INT64 -// UINT64 -// -// Avoid using the following types: -// LONG - use INT -// ULONG - use UINT -// DWORD - use UINT32 -//-------------------------------------------------------------------------- - -typedef float REAL; - -#define REAL_MAX FLT_MAX -#define REAL_MIN FLT_MIN -#define REAL_TOLERANCE (FLT_MIN * 100) -#define REAL_EPSILON 1.192092896e-07F /* FLT_EPSILON */ - -//-------------------------------------------------------------------------- -// Forward declarations of various internal classes -//-------------------------------------------------------------------------- - -class Size; -class SizeF; -class Point; -class PointF; -class Rect; -class RectF; -class CharacterRange; - -//-------------------------------------------------------------------------- -// Return values from any GDI+ API -//-------------------------------------------------------------------------- - -enum Status -{ - Ok = 0, - GenericError = 1, - InvalidParameter = 2, - OutOfMemory = 3, - ObjectBusy = 4, - InsufficientBuffer = 5, - NotImplemented = 6, - Win32Error = 7, - WrongState = 8, - Aborted = 9, -#ifdef DCR_USE_NEW_135429 - FileNotFound = 10, - ValueOverflow = 11, - AccessDenied = 12, - UnknownImageFormat = 13, - FontFamilyNotFound = 14, - FontStyleNotFound = 15, - NotTrueTypeFont = 16, -#else - NotFound = 10, - ValueOverflow = 11, -#endif - UnsupportedGdiplusVersion = 17, - GdiplusNotInitialized - -}; - -//-------------------------------------------------------------------------- -// Represents a dimension in a 2D coordinate system -// (floating-point coordinates) -//-------------------------------------------------------------------------- - -class SizeF -{ -public: - - // Default constructor - SizeF() - { - Width = Height = 0.0f; - } - - SizeF(IN const SizeF& size) - { - Width = size.Width; - Height = size.Height; - } - - SizeF(IN REAL width, - IN REAL height) - { - Width = width; - Height = height; - } - - SizeF operator+(IN const SizeF& sz) const - { - return SizeF(Width + sz.Width, - Height + sz.Height); - } - - SizeF operator-(IN const SizeF& sz) const - { - return SizeF(Width - sz.Width, - Height - sz.Height); - } - - BOOL Equals(IN const SizeF& sz) const - { - return (Width == sz.Width) && (Height == sz.Height); - } - - BOOL Empty() const - { - return (Width == 0.0f && Height == 0.0f); - } - -public: - - REAL Width; - REAL Height; -}; - -//-------------------------------------------------------------------------- -// Represents a dimension in a 2D coordinate system -// (integer coordinates) -//-------------------------------------------------------------------------- - -class Size -{ -public: - - // Default constructor - Size() - { - Width = Height = 0; - } - - Size(IN const Size& size) - { - Width = size.Width; - Height = size.Height; - } - - Size(IN INT width, - IN INT height) - { - Width = width; - Height = height; - } - - Size operator+(IN const Size& sz) const - { - return Size(Width + sz.Width, - Height + sz.Height); - } - - Size operator-(IN const Size& sz) const - { - return Size(Width - sz.Width, - Height - sz.Height); - } - - BOOL Equals(IN const Size& sz) const - { - return (Width == sz.Width) && (Height == sz.Height); - } - - BOOL Empty() const - { - return (Width == 0 && Height == 0); - } - -public: - - INT Width; - INT Height; -}; - -//-------------------------------------------------------------------------- -// Represents a location in a 2D coordinate system -// (floating-point coordinates) -//-------------------------------------------------------------------------- - -class PointF -{ -public: - PointF() - { - X = Y = 0.0f; - } - - PointF(IN const PointF &point) - { - X = point.X; - Y = point.Y; - } - - PointF(IN const SizeF &size) - { - X = size.Width; - Y = size.Height; - } - - PointF(IN REAL x, - IN REAL y) - { - X = x; - Y = y; - } - - PointF operator+(IN const PointF& point) const - { - return PointF(X + point.X, - Y + point.Y); - } - - PointF operator-(IN const PointF& point) const - { - return PointF(X - point.X, - Y - point.Y); - } - - BOOL Equals(IN const PointF& point) - { - return (X == point.X) && (Y == point.Y); - } - -public: - - REAL X; - REAL Y; -}; - -//-------------------------------------------------------------------------- -// Represents a location in a 2D coordinate system -// (integer coordinates) -//-------------------------------------------------------------------------- - -class Point -{ -public: - Point() - { - X = Y = 0; - } - - Point(IN const Point &point) - { - X = point.X; - Y = point.Y; - } - - Point(IN const Size &size) - { - X = size.Width; - Y = size.Height; - } - - Point(IN INT x, - IN INT y) - { - X = x; - Y = y; - } - - Point operator+(IN const Point& point) const - { - return Point(X + point.X, - Y + point.Y); - } - - Point operator-(IN const Point& point) const - { - return Point(X - point.X, - Y - point.Y); - } - - BOOL Equals(IN const Point& point) - { - return (X == point.X) && (Y == point.Y); - } - -public: - - INT X; - INT Y; -}; - -//-------------------------------------------------------------------------- -// Represents a rectangle in a 2D coordinate system -// (floating-point coordinates) -//-------------------------------------------------------------------------- - -class RectF -{ -public: - - // Default constructor - - RectF() - { - X = Y = Width = Height = 0.0f; - } - - RectF(IN REAL x, - IN REAL y, - IN REAL width, - IN REAL height) - { - X = x; - Y = y; - Width = width; - Height = height; - } - - RectF(IN const PointF& location, - IN const SizeF& size) - { - X = location.X; - Y = location.Y; - Width = size.Width; - Height = size.Height; - } - - RectF* Clone() const - { - return new RectF(X, Y, Width, Height); - } - - VOID GetLocation(OUT PointF* point) const - { - point->X = X; - point->Y = Y; - } - - VOID GetSize(OUT SizeF* size) const - { - size->Width = Width; - size->Height = Height; - } - - VOID GetBounds(OUT RectF* rect) const - { - rect->X = X; - rect->Y = Y; - rect->Width = Width; - rect->Height = Height; - } - - // Return the left, top, right, and bottom - // coordinates of the rectangle - - REAL GetLeft() const - { - return X; - } - - REAL GetTop() const - { - return Y; - } - - REAL GetRight() const - { - return X+Width; - } - - REAL GetBottom() const - { - return Y+Height; - } - - // Determine if the rectangle is empty - BOOL IsEmptyArea() const - { - return (Width <= REAL_EPSILON) || (Height <= REAL_EPSILON); - } - - BOOL Equals(IN const RectF & rect) const - { - return X == rect.X && - Y == rect.Y && - Width == rect.Width && - Height == rect.Height; - } - - BOOL Contains(IN REAL x, - IN REAL y) const - { - return x >= X && x < X+Width && - y >= Y && y < Y+Height; - } - - BOOL Contains(IN const PointF& pt) const - { - return Contains(pt.X, pt.Y); - } - - BOOL Contains(IN const RectF& rect) const - { - return (X <= rect.X) && (rect.GetRight() <= GetRight()) && - (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()); - } - - VOID Inflate(IN REAL dx, - IN REAL dy) - { - X -= dx; - Y -= dy; - Width += 2*dx; - Height += 2*dy; - } - - VOID Inflate(IN const PointF& point) - { - Inflate(point.X, point.Y); - } - - // Intersect the current rect with the specified object - - BOOL Intersect(IN const RectF& rect) - { - return Intersect(*this, *this, rect); - } - - // Intersect rect a and b and save the result into c - // Notice that c may be the same object as a or b. - - static BOOL Intersect(OUT RectF& c, - IN const RectF& a, - IN const RectF& b) - { - REAL right = min(a.GetRight(), b.GetRight()); - REAL bottom = min(a.GetBottom(), b.GetBottom()); - REAL left = max(a.GetLeft(), b.GetLeft()); - REAL top = max(a.GetTop(), b.GetTop()); - - c.X = left; - c.Y = top; - c.Width = right - left; - c.Height = bottom - top; - return !c.IsEmptyArea(); - } - - // Determine if the specified rect intersects with the - // current rect object. - - BOOL IntersectsWith(IN const RectF& rect) const - { - return (GetLeft() < rect.GetRight() && - GetTop() < rect.GetTop() && - GetRight() > rect.GetLeft() && - GetBottom() > rect.GetTop()); - } - - static BOOL Union(OUT RectF& c, - IN const RectF& a, - IN const RectF& b) - { - REAL right = max(a.GetRight(), b.GetRight()); - REAL bottom = max(a.GetBottom(), b.GetBottom()); - REAL left = min(a.GetLeft(), b.GetLeft()); - REAL top = min(a.GetTop(), b.GetTop()); - - c.X = left; - c.Y = top; - c.Width = right - left; - c.Height = bottom - top; - return !c.IsEmptyArea(); - } - - VOID Offset(IN const PointF& point) - { - Offset(point.X, point.Y); - } - - VOID Offset(IN REAL dx, - IN REAL dy) - { - X += dx; - Y += dy; - } - -public: - - REAL X; - REAL Y; - REAL Width; - REAL Height; -}; - -//-------------------------------------------------------------------------- -// Represents a rectangle in a 2D coordinate system -// (integer coordinates) -//-------------------------------------------------------------------------- - -class Rect -{ -public: - - // Default constructor - - Rect() - { - X = Y = Width = Height = 0; - } - - Rect(IN INT x, - IN INT y, - IN INT width, - IN INT height) - { - X = x; - Y = y; - Width = width; - Height = height; - } - - Rect(IN const Point& location, - IN const Size& size) - { - X = location.X; - Y = location.Y; - Width = size.Width; - Height = size.Height; - } - - Rect* Clone() const - { - return new Rect(X, Y, Width, Height); - } - - VOID GetLocation(OUT Point* point) const - { - point->X = X; - point->Y = Y; - } - - VOID GetSize(OUT Size* size) const - { - size->Width = Width; - size->Height = Height; - } - - VOID GetBounds(OUT Rect* rect) const - { - rect->X = X; - rect->Y = Y; - rect->Width = Width; - rect->Height = Height; - } - - // Return the left, top, right, and bottom - // coordinates of the rectangle - - INT GetLeft() const - { - return X; - } - - INT GetTop() const - { - return Y; - } - - INT GetRight() const - { - return X+Width; - } - - INT GetBottom() const - { - return Y+Height; - } - - // Determine if the rectangle is empty - BOOL IsEmptyArea() const - { - return (Width <= 0) || (Height <= 0); - } - - BOOL Equals(IN const Rect & rect) const - { - return X == rect.X && - Y == rect.Y && - Width == rect.Width && - Height == rect.Height; - } - - BOOL Contains(IN INT x, - IN INT y) const - { - return x >= X && x < X+Width && - y >= Y && y < Y+Height; - } - - BOOL Contains(IN const Point& pt) const - { - return Contains(pt.X, pt.Y); - } - - BOOL Contains(IN Rect& rect) const - { - return (X <= rect.X) && (rect.GetRight() <= GetRight()) && - (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()); - } - - VOID Inflate(IN INT dx, - IN INT dy) - { - X -= dx; - Y -= dy; - Width += 2*dx; - Height += 2*dy; - } - - VOID Inflate(IN const Point& point) - { - Inflate(point.X, point.Y); - } - - // Intersect the current rect with the specified object - - BOOL Intersect(IN const Rect& rect) - { - return Intersect(*this, *this, rect); - } - - // Intersect rect a and b and save the result into c - // Notice that c may be the same object as a or b. - - static BOOL Intersect(OUT Rect& c, - IN const Rect& a, - IN const Rect& b) - { - INT right = min(a.GetRight(), b.GetRight()); - INT bottom = min(a.GetBottom(), b.GetBottom()); - INT left = max(a.GetLeft(), b.GetLeft()); - INT top = max(a.GetTop(), b.GetTop()); - - c.X = left; - c.Y = top; - c.Width = right - left; - c.Height = bottom - top; - return !c.IsEmptyArea(); - } - - // Determine if the specified rect intersects with the - // current rect object. - - BOOL IntersectsWith(IN const Rect& rect) const - { - return (GetLeft() < rect.GetRight() && - GetTop() < rect.GetTop() && - GetRight() > rect.GetLeft() && - GetBottom() > rect.GetTop()); - } - - static BOOL Union(OUT Rect& c, - IN const Rect& a, - IN const Rect& b) - { - INT right = max(a.GetRight(), b.GetRight()); - INT bottom = max(a.GetBottom(), b.GetBottom()); - INT left = min(a.GetLeft(), b.GetLeft()); - INT top = min(a.GetTop(), b.GetTop()); - - c.X = left; - c.Y = top; - c.Width = right - left; - c.Height = bottom - top; - return !c.IsEmptyArea(); - } - - VOID Offset(IN const Point& point) - { - Offset(point.X, point.Y); - } - - VOID Offset(IN INT dx, - IN INT dy) - { - X += dx; - Y += dy; - } - -public: - - INT X; - INT Y; - INT Width; - INT Height; -}; - -// A user must mange memory for PathData. - -class PathData -{ -public: - PathData() - { - Count = 0; - Points = NULL; - Types = NULL; - } - - ~PathData() - { - if (Points != NULL) - { - delete Points; - } - - if (Types != NULL) - { - delete Types; - } - } - -#ifdef DCR_USE_NEW_250932 - -private: - PathData(const PathData &); - PathData& operator=(const PathData &); - -#endif - -public: - INT Count; - PointF* Points; - BYTE* Types; -}; - - -//----------------------------- -// text character range -//----------------------------- - -class CharacterRange -{ -public: - CharacterRange( - INT first, - INT length - ) : - First (first), - Length (length) - {} - - CharacterRange() : First(0), Length(0) - {} - - CharacterRange & operator = (const CharacterRange &rhs) - { - First = rhs.First; - Length = rhs.Length; - return *this; - } - - INT First; - INT Length; -}; - -#endif // !_GDIPLUSTYPES_HPP +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* GdiplusTypes.h +* +* Abstract: +* +* Basic types used by GDI+ +* +\**************************************************************************/ + +#ifndef _GDIPLUSTYPES_H +#define _GDIPLUSTYPES_H + +#ifndef DCR_USE_NEW_175866 + +//-------------------------------------------------------------------------- +// LIB version initialization functions +//-------------------------------------------------------------------------- + +typedef VOID (__cdecl *DEBUGEVENTFUNCTION)(INT level, CHAR *message); + +extern "C" BOOL __stdcall InitializeGdiplus(DEBUGEVENTFUNCTION); +extern "C" VOID __stdcall UninitializeGdiplus(); + +#endif + +//-------------------------------------------------------------------------- +// Callback functions +//-------------------------------------------------------------------------- + +extern "C" { +typedef BOOL (CALLBACK * ImageAbort)(VOID *); +typedef ImageAbort DrawImageAbort; +typedef ImageAbort GetThumbnailImageAbort; +} + +// Callback for EnumerateMetafile methods. The parameters are: + +// recordType WMF, EMF, or EMF+ record type +// flags (always 0 for WMF/EMF records) +// dataSize size of the record data (in bytes), or 0 if no data +// data pointer to the record data, or NULL if no data +// callbackData pointer to callbackData, if any + +// This method can then call Metafile::PlayRecord to play the +// record that was just enumerated. If this method returns +// FALSE, the enumeration process is aborted. Otherwise, it continues. + +extern "C" { +typedef BOOL (CALLBACK * EnumerateMetafileProc)(EmfPlusRecordType,UINT,UINT,const BYTE*,VOID*); +} + +//-------------------------------------------------------------------------- +// Primitive data types +// +// NOTE: +// Types already defined in standard header files: +// INT8 +// UINT8 +// INT16 +// UINT16 +// INT32 +// UINT32 +// INT64 +// UINT64 +// +// Avoid using the following types: +// LONG - use INT +// ULONG - use UINT +// DWORD - use UINT32 +//-------------------------------------------------------------------------- + +typedef float REAL; + +#define REAL_MAX FLT_MAX +#define REAL_MIN FLT_MIN +#define REAL_TOLERANCE (FLT_MIN * 100) +#define REAL_EPSILON 1.192092896e-07F /* FLT_EPSILON */ + +//-------------------------------------------------------------------------- +// Forward declarations of various internal classes +//-------------------------------------------------------------------------- + +class Size; +class SizeF; +class Point; +class PointF; +class Rect; +class RectF; +class CharacterRange; + +//-------------------------------------------------------------------------- +// Return values from any GDI+ API +//-------------------------------------------------------------------------- + +enum Status +{ + Ok = 0, + GenericError = 1, + InvalidParameter = 2, + OutOfMemory = 3, + ObjectBusy = 4, + InsufficientBuffer = 5, + NotImplemented = 6, + Win32Error = 7, + WrongState = 8, + Aborted = 9, +#ifdef DCR_USE_NEW_135429 + FileNotFound = 10, + ValueOverflow = 11, + AccessDenied = 12, + UnknownImageFormat = 13, + FontFamilyNotFound = 14, + FontStyleNotFound = 15, + NotTrueTypeFont = 16, +#else + NotFound = 10, + ValueOverflow = 11, +#endif + UnsupportedGdiplusVersion = 17, + GdiplusNotInitialized + +}; + +//-------------------------------------------------------------------------- +// Represents a dimension in a 2D coordinate system +// (floating-point coordinates) +//-------------------------------------------------------------------------- + +class SizeF +{ +public: + + // Default constructor + SizeF() + { + Width = Height = 0.0f; + } + + SizeF(IN const SizeF& size) + { + Width = size.Width; + Height = size.Height; + } + + SizeF(IN REAL width, + IN REAL height) + { + Width = width; + Height = height; + } + + SizeF operator+(IN const SizeF& sz) const + { + return SizeF(Width + sz.Width, + Height + sz.Height); + } + + SizeF operator-(IN const SizeF& sz) const + { + return SizeF(Width - sz.Width, + Height - sz.Height); + } + + BOOL Equals(IN const SizeF& sz) const + { + return (Width == sz.Width) && (Height == sz.Height); + } + + BOOL Empty() const + { + return (Width == 0.0f && Height == 0.0f); + } + +public: + + REAL Width; + REAL Height; +}; + +//-------------------------------------------------------------------------- +// Represents a dimension in a 2D coordinate system +// (integer coordinates) +//-------------------------------------------------------------------------- + +class Size +{ +public: + + // Default constructor + Size() + { + Width = Height = 0; + } + + Size(IN const Size& size) + { + Width = size.Width; + Height = size.Height; + } + + Size(IN INT width, + IN INT height) + { + Width = width; + Height = height; + } + + Size operator+(IN const Size& sz) const + { + return Size(Width + sz.Width, + Height + sz.Height); + } + + Size operator-(IN const Size& sz) const + { + return Size(Width - sz.Width, + Height - sz.Height); + } + + BOOL Equals(IN const Size& sz) const + { + return (Width == sz.Width) && (Height == sz.Height); + } + + BOOL Empty() const + { + return (Width == 0 && Height == 0); + } + +public: + + INT Width; + INT Height; +}; + +//-------------------------------------------------------------------------- +// Represents a location in a 2D coordinate system +// (floating-point coordinates) +//-------------------------------------------------------------------------- + +class PointF +{ +public: + PointF() + { + X = Y = 0.0f; + } + + PointF(IN const PointF &point) + { + X = point.X; + Y = point.Y; + } + + PointF(IN const SizeF &size) + { + X = size.Width; + Y = size.Height; + } + + PointF(IN REAL x, + IN REAL y) + { + X = x; + Y = y; + } + + PointF operator+(IN const PointF& point) const + { + return PointF(X + point.X, + Y + point.Y); + } + + PointF operator-(IN const PointF& point) const + { + return PointF(X - point.X, + Y - point.Y); + } + + BOOL Equals(IN const PointF& point) + { + return (X == point.X) && (Y == point.Y); + } + +public: + + REAL X; + REAL Y; +}; + +//-------------------------------------------------------------------------- +// Represents a location in a 2D coordinate system +// (integer coordinates) +//-------------------------------------------------------------------------- + +class Point +{ +public: + Point() + { + X = Y = 0; + } + + Point(IN const Point &point) + { + X = point.X; + Y = point.Y; + } + + Point(IN const Size &size) + { + X = size.Width; + Y = size.Height; + } + + Point(IN INT x, + IN INT y) + { + X = x; + Y = y; + } + + Point operator+(IN const Point& point) const + { + return Point(X + point.X, + Y + point.Y); + } + + Point operator-(IN const Point& point) const + { + return Point(X - point.X, + Y - point.Y); + } + + BOOL Equals(IN const Point& point) + { + return (X == point.X) && (Y == point.Y); + } + +public: + + INT X; + INT Y; +}; + +//-------------------------------------------------------------------------- +// Represents a rectangle in a 2D coordinate system +// (floating-point coordinates) +//-------------------------------------------------------------------------- + +class RectF +{ +public: + + // Default constructor + + RectF() + { + X = Y = Width = Height = 0.0f; + } + + RectF(IN REAL x, + IN REAL y, + IN REAL width, + IN REAL height) + { + X = x; + Y = y; + Width = width; + Height = height; + } + + RectF(IN const PointF& location, + IN const SizeF& size) + { + X = location.X; + Y = location.Y; + Width = size.Width; + Height = size.Height; + } + + RectF* Clone() const + { + return new RectF(X, Y, Width, Height); + } + + VOID GetLocation(OUT PointF* point) const + { + point->X = X; + point->Y = Y; + } + + VOID GetSize(OUT SizeF* size) const + { + size->Width = Width; + size->Height = Height; + } + + VOID GetBounds(OUT RectF* rect) const + { + rect->X = X; + rect->Y = Y; + rect->Width = Width; + rect->Height = Height; + } + + // Return the left, top, right, and bottom + // coordinates of the rectangle + + REAL GetLeft() const + { + return X; + } + + REAL GetTop() const + { + return Y; + } + + REAL GetRight() const + { + return X+Width; + } + + REAL GetBottom() const + { + return Y+Height; + } + + // Determine if the rectangle is empty + BOOL IsEmptyArea() const + { + return (Width <= REAL_EPSILON) || (Height <= REAL_EPSILON); + } + + BOOL Equals(IN const RectF & rect) const + { + return X == rect.X && + Y == rect.Y && + Width == rect.Width && + Height == rect.Height; + } + + BOOL Contains(IN REAL x, + IN REAL y) const + { + return x >= X && x < X+Width && + y >= Y && y < Y+Height; + } + + BOOL Contains(IN const PointF& pt) const + { + return Contains(pt.X, pt.Y); + } + + BOOL Contains(IN const RectF& rect) const + { + return (X <= rect.X) && (rect.GetRight() <= GetRight()) && + (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()); + } + + VOID Inflate(IN REAL dx, + IN REAL dy) + { + X -= dx; + Y -= dy; + Width += 2*dx; + Height += 2*dy; + } + + VOID Inflate(IN const PointF& point) + { + Inflate(point.X, point.Y); + } + + // Intersect the current rect with the specified object + + BOOL Intersect(IN const RectF& rect) + { + return Intersect(*this, *this, rect); + } + + // Intersect rect a and b and save the result into c + // Notice that c may be the same object as a or b. + + static BOOL Intersect(OUT RectF& c, + IN const RectF& a, + IN const RectF& b) + { + REAL right = min(a.GetRight(), b.GetRight()); + REAL bottom = min(a.GetBottom(), b.GetBottom()); + REAL left = max(a.GetLeft(), b.GetLeft()); + REAL top = max(a.GetTop(), b.GetTop()); + + c.X = left; + c.Y = top; + c.Width = right - left; + c.Height = bottom - top; + return !c.IsEmptyArea(); + } + + // Determine if the specified rect intersects with the + // current rect object. + + BOOL IntersectsWith(IN const RectF& rect) const + { + return (GetLeft() < rect.GetRight() && + GetTop() < rect.GetTop() && + GetRight() > rect.GetLeft() && + GetBottom() > rect.GetTop()); + } + + static BOOL Union(OUT RectF& c, + IN const RectF& a, + IN const RectF& b) + { + REAL right = max(a.GetRight(), b.GetRight()); + REAL bottom = max(a.GetBottom(), b.GetBottom()); + REAL left = min(a.GetLeft(), b.GetLeft()); + REAL top = min(a.GetTop(), b.GetTop()); + + c.X = left; + c.Y = top; + c.Width = right - left; + c.Height = bottom - top; + return !c.IsEmptyArea(); + } + + VOID Offset(IN const PointF& point) + { + Offset(point.X, point.Y); + } + + VOID Offset(IN REAL dx, + IN REAL dy) + { + X += dx; + Y += dy; + } + +public: + + REAL X; + REAL Y; + REAL Width; + REAL Height; +}; + +//-------------------------------------------------------------------------- +// Represents a rectangle in a 2D coordinate system +// (integer coordinates) +//-------------------------------------------------------------------------- + +class Rect +{ +public: + + // Default constructor + + Rect() + { + X = Y = Width = Height = 0; + } + + Rect(IN INT x, + IN INT y, + IN INT width, + IN INT height) + { + X = x; + Y = y; + Width = width; + Height = height; + } + + Rect(IN const Point& location, + IN const Size& size) + { + X = location.X; + Y = location.Y; + Width = size.Width; + Height = size.Height; + } + + Rect* Clone() const + { + return new Rect(X, Y, Width, Height); + } + + VOID GetLocation(OUT Point* point) const + { + point->X = X; + point->Y = Y; + } + + VOID GetSize(OUT Size* size) const + { + size->Width = Width; + size->Height = Height; + } + + VOID GetBounds(OUT Rect* rect) const + { + rect->X = X; + rect->Y = Y; + rect->Width = Width; + rect->Height = Height; + } + + // Return the left, top, right, and bottom + // coordinates of the rectangle + + INT GetLeft() const + { + return X; + } + + INT GetTop() const + { + return Y; + } + + INT GetRight() const + { + return X+Width; + } + + INT GetBottom() const + { + return Y+Height; + } + + // Determine if the rectangle is empty + BOOL IsEmptyArea() const + { + return (Width <= 0) || (Height <= 0); + } + + BOOL Equals(IN const Rect & rect) const + { + return X == rect.X && + Y == rect.Y && + Width == rect.Width && + Height == rect.Height; + } + + BOOL Contains(IN INT x, + IN INT y) const + { + return x >= X && x < X+Width && + y >= Y && y < Y+Height; + } + + BOOL Contains(IN const Point& pt) const + { + return Contains(pt.X, pt.Y); + } + + BOOL Contains(IN Rect& rect) const + { + return (X <= rect.X) && (rect.GetRight() <= GetRight()) && + (Y <= rect.Y) && (rect.GetBottom() <= GetBottom()); + } + + VOID Inflate(IN INT dx, + IN INT dy) + { + X -= dx; + Y -= dy; + Width += 2*dx; + Height += 2*dy; + } + + VOID Inflate(IN const Point& point) + { + Inflate(point.X, point.Y); + } + + // Intersect the current rect with the specified object + + BOOL Intersect(IN const Rect& rect) + { + return Intersect(*this, *this, rect); + } + + // Intersect rect a and b and save the result into c + // Notice that c may be the same object as a or b. + + static BOOL Intersect(OUT Rect& c, + IN const Rect& a, + IN const Rect& b) + { + INT right = min(a.GetRight(), b.GetRight()); + INT bottom = min(a.GetBottom(), b.GetBottom()); + INT left = max(a.GetLeft(), b.GetLeft()); + INT top = max(a.GetTop(), b.GetTop()); + + c.X = left; + c.Y = top; + c.Width = right - left; + c.Height = bottom - top; + return !c.IsEmptyArea(); + } + + // Determine if the specified rect intersects with the + // current rect object. + + BOOL IntersectsWith(IN const Rect& rect) const + { + return (GetLeft() < rect.GetRight() && + GetTop() < rect.GetTop() && + GetRight() > rect.GetLeft() && + GetBottom() > rect.GetTop()); + } + + static BOOL Union(OUT Rect& c, + IN const Rect& a, + IN const Rect& b) + { + INT right = max(a.GetRight(), b.GetRight()); + INT bottom = max(a.GetBottom(), b.GetBottom()); + INT left = min(a.GetLeft(), b.GetLeft()); + INT top = min(a.GetTop(), b.GetTop()); + + c.X = left; + c.Y = top; + c.Width = right - left; + c.Height = bottom - top; + return !c.IsEmptyArea(); + } + + VOID Offset(IN const Point& point) + { + Offset(point.X, point.Y); + } + + VOID Offset(IN INT dx, + IN INT dy) + { + X += dx; + Y += dy; + } + +public: + + INT X; + INT Y; + INT Width; + INT Height; +}; + +// A user must mange memory for PathData. + +class PathData +{ +public: + PathData() + { + Count = 0; + Points = NULL; + Types = NULL; + } + + ~PathData() + { + if (Points != NULL) + { + delete Points; + } + + if (Types != NULL) + { + delete Types; + } + } + +#ifdef DCR_USE_NEW_250932 + +private: + PathData(const PathData &); + PathData& operator=(const PathData &); + +#endif + +public: + INT Count; + PointF* Points; + BYTE* Types; +}; + + +//----------------------------- +// text character range +//----------------------------- + +class CharacterRange +{ +public: + CharacterRange( + INT first, + INT length + ) : + First (first), + Length (length) + {} + + CharacterRange() : First(0), Length(0) + {} + + CharacterRange & operator = (const CharacterRange &rhs) + { + First = rhs.First; + Length = rhs.Length; + return *this; + } + + INT First; + INT Length; +}; + +#endif // !_GDIPLUSTYPES_HPP diff --git a/core/src/fxge/Microsoft SDK/include/GdiPlusimageAttributes.h b/core/src/fxge/Microsoft SDK/include/GdiPlusimageAttributes.h index 0a514772bc..26da28c756 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiPlusimageAttributes.h +++ b/core/src/fxge/Microsoft SDK/include/GdiPlusimageAttributes.h @@ -1,397 +1,397 @@ -/**************************************************************************\ -* -* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. -* -* Module Name: -* -* Image Attributes -* -* Abstract: -* -* Class for color adjustment object passed to Graphics.DrawImage -* -\**************************************************************************/ - -#ifndef _GDIPLUSIMAGEATTRIBUTES_H -#define _GDIPLUSIMAGEATTRIBUTES_H - -class GpImageAttributes; - -// There are 5 possible sets of color adjustments: -// ColorAdjustDefault, -// ColorAdjustBitmap, -// ColorAdjustBrush, -// ColorAdjustPen, -// ColorAdjustText, - -// Bitmaps, Brushes, Pens, and Text will all use any color adjustments -// that have been set into the default ImageAttributes until their own -// color adjustments have been set. So as soon as any "Set" method is -// called for Bitmaps, Brushes, Pens, or Text, then they start from -// scratch with only the color adjustments that have been set for them. -// Calling Reset removes any individual color adjustments for a type -// and makes it revert back to using all the default color adjustments -// (if any). The SetToIdentity method is a way to force a type to -// have no color adjustments at all, regardless of what previous adjustments -// have been set for the defaults or for that type. - -class ImageAttributes : public GdiplusBase -{ - friend class Graphics; - friend class TextureBrush; - -public: - - ImageAttributes() - { - nativeImageAttr = NULL; - lastResult = DllExports::GdipCreateImageAttributes(&nativeImageAttr); - } - - ~ImageAttributes() - { - DllExports::GdipDisposeImageAttributes(nativeImageAttr); - } - - ImageAttributes* Clone() const - { - GpImageAttributes* clone; - - SetStatus(DllExports::GdipCloneImageAttributes( - nativeImageAttr, - &clone)); - - return new ImageAttributes(clone, lastResult); - } - - // Set to identity, regardless of what the default color adjustment is. - Status - SetToIdentity( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesToIdentity( - nativeImageAttr, - type)); - } - - // Remove any individual color adjustments, and go back to using the default - Status - Reset( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipResetImageAttributes( - nativeImageAttr, - type)); - } - - Status - SetColorMatrix( - IN const ColorMatrix *colorMatrix, - IN ColorMatrixFlags mode = ColorMatrixFlagsDefault, - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( - nativeImageAttr, - type, - TRUE, - colorMatrix, - NULL, - mode)); - } - - Status ClearColorMatrix( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( - nativeImageAttr, - type, - FALSE, - NULL, - NULL, - ColorMatrixFlagsDefault)); - } - - Status - SetColorMatrices( - IN const ColorMatrix *colorMatrix, - IN const ColorMatrix *grayMatrix, - IN ColorMatrixFlags mode = ColorMatrixFlagsDefault, - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( - nativeImageAttr, - type, - TRUE, - colorMatrix, - grayMatrix, - mode)); - } - - Status ClearColorMatrices( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( - nativeImageAttr, - type, - FALSE, - NULL, - NULL, - ColorMatrixFlagsDefault)); - } - - Status SetThreshold( - IN REAL threshold, - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesThreshold( - nativeImageAttr, - type, - TRUE, - threshold)); - } - - Status ClearThreshold( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesThreshold( - nativeImageAttr, - type, - FALSE, - 0.0)); - } - - Status SetGamma( - IN REAL gamma, - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesGamma( - nativeImageAttr, - type, - TRUE, - gamma)); - } - - Status ClearGamma( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesGamma( - nativeImageAttr, - type, - FALSE, - 0.0)); - } - - Status SetNoOp( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesNoOp( - nativeImageAttr, - type, - TRUE)); - } - - Status ClearNoOp( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesNoOp( - nativeImageAttr, - type, - FALSE)); - } - - Status SetColorKey( - IN const Color& colorLow, - IN const Color& colorHigh, - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesColorKeys( - nativeImageAttr, - type, - TRUE, - colorLow.GetValue(), - colorHigh.GetValue())); - } - - Status ClearColorKey( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesColorKeys( - nativeImageAttr, - type, - FALSE, - NULL, - NULL)); - } - - Status SetOutputChannel( - IN ColorChannelFlags channelFlags, - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesOutputChannel( - nativeImageAttr, - type, - TRUE, - channelFlags)); - } - - Status ClearOutputChannel( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesOutputChannel( - nativeImageAttr, - type, - FALSE, - ColorChannelFlagsLast)); - } - - Status SetOutputChannelColorProfile( - IN const WCHAR *colorProfileFilename, - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile( - nativeImageAttr, - type, - TRUE, - colorProfileFilename)); - } - - Status ClearOutputChannelColorProfile( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile( - nativeImageAttr, - type, - FALSE, - NULL)); - } - - Status SetRemapTable( - IN UINT mapSize, - IN const ColorMap *map, - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesRemapTable( - nativeImageAttr, - type, - TRUE, - mapSize, - map)); - } - - Status ClearRemapTable( - IN ColorAdjustType type = ColorAdjustTypeDefault - ) - { - return SetStatus(DllExports::GdipSetImageAttributesRemapTable( - nativeImageAttr, - type, - FALSE, - 0, - NULL)); - } - - Status SetBrushRemapTable(IN UINT mapSize, - IN const ColorMap *map) - { - return this->SetRemapTable(mapSize, map, ColorAdjustTypeBrush); - } - - Status ClearBrushRemapTable() - { - return this->ClearRemapTable(ColorAdjustTypeBrush); - } - - Status SetWrapMode(IN WrapMode wrap, - IN const Color& color = Color(), - IN BOOL clamp = FALSE) - { - ARGB argb = color.GetValue(); - - return SetStatus(DllExports::GdipSetImageAttributesWrapMode( - nativeImageAttr, wrap, argb, clamp)); - } - - #ifndef DCR_USE_NEW_145139 - Status SetICMMode(IN BOOL on) - { - on; - // This is not implemented. - // The supported method for doing ICM conversion from the embedded - // ICC profile is to use the Bitmap constructor from a file or stream - // and specify TRUE for the useIcm parameter. This will cause the - // image to be ICM converted when it's loaded from the file/stream - // if the profile exists. - return SetStatus(NotImplemented); -// DllExports::GdipSetImageAttributesICMMode(nativeImageAttr, on) - } - #endif - - // The flags of the palette are ignored. - Status GetAdjustedPalette(IN OUT ColorPalette* colorPalette, - IN ColorAdjustType colorAdjustType) const - { - return SetStatus(DllExports::GdipGetImageAttributesAdjustedPalette( - nativeImageAttr, colorPalette, colorAdjustType)); - } - - Status GetLastStatus() const - { - Status lastStatus = lastResult; - lastResult = Ok; - - return lastStatus; - } - -#ifdef DCR_USE_NEW_250932 - -private: - ImageAttributes(const ImageAttributes &); - ImageAttributes& operator=(const ImageAttributes &); - -#endif - -protected: - ImageAttributes(GpImageAttributes* imageAttr, Status status) - { - SetNativeImageAttr(imageAttr); - lastResult = status; - } - - VOID SetNativeImageAttr(GpImageAttributes* nativeImageAttr) - { - this->nativeImageAttr = nativeImageAttr; - } - - Status SetStatus(Status status) const - { - if (status != Ok) - return (lastResult = status); - else - return status; - } - -protected: - GpImageAttributes* nativeImageAttr; - mutable Status lastResult; -}; - -#endif +/**************************************************************************\ +* +* Copyright (c) 1998-2000, Microsoft Corp. All Rights Reserved. +* +* Module Name: +* +* Image Attributes +* +* Abstract: +* +* Class for color adjustment object passed to Graphics.DrawImage +* +\**************************************************************************/ + +#ifndef _GDIPLUSIMAGEATTRIBUTES_H +#define _GDIPLUSIMAGEATTRIBUTES_H + +class GpImageAttributes; + +// There are 5 possible sets of color adjustments: +// ColorAdjustDefault, +// ColorAdjustBitmap, +// ColorAdjustBrush, +// ColorAdjustPen, +// ColorAdjustText, + +// Bitmaps, Brushes, Pens, and Text will all use any color adjustments +// that have been set into the default ImageAttributes until their own +// color adjustments have been set. So as soon as any "Set" method is +// called for Bitmaps, Brushes, Pens, or Text, then they start from +// scratch with only the color adjustments that have been set for them. +// Calling Reset removes any individual color adjustments for a type +// and makes it revert back to using all the default color adjustments +// (if any). The SetToIdentity method is a way to force a type to +// have no color adjustments at all, regardless of what previous adjustments +// have been set for the defaults or for that type. + +class ImageAttributes : public GdiplusBase +{ + friend class Graphics; + friend class TextureBrush; + +public: + + ImageAttributes() + { + nativeImageAttr = NULL; + lastResult = DllExports::GdipCreateImageAttributes(&nativeImageAttr); + } + + ~ImageAttributes() + { + DllExports::GdipDisposeImageAttributes(nativeImageAttr); + } + + ImageAttributes* Clone() const + { + GpImageAttributes* clone; + + SetStatus(DllExports::GdipCloneImageAttributes( + nativeImageAttr, + &clone)); + + return new ImageAttributes(clone, lastResult); + } + + // Set to identity, regardless of what the default color adjustment is. + Status + SetToIdentity( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesToIdentity( + nativeImageAttr, + type)); + } + + // Remove any individual color adjustments, and go back to using the default + Status + Reset( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipResetImageAttributes( + nativeImageAttr, + type)); + } + + Status + SetColorMatrix( + IN const ColorMatrix *colorMatrix, + IN ColorMatrixFlags mode = ColorMatrixFlagsDefault, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, + type, + TRUE, + colorMatrix, + NULL, + mode)); + } + + Status ClearColorMatrix( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, + type, + FALSE, + NULL, + NULL, + ColorMatrixFlagsDefault)); + } + + Status + SetColorMatrices( + IN const ColorMatrix *colorMatrix, + IN const ColorMatrix *grayMatrix, + IN ColorMatrixFlags mode = ColorMatrixFlagsDefault, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, + type, + TRUE, + colorMatrix, + grayMatrix, + mode)); + } + + Status ClearColorMatrices( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorMatrix( + nativeImageAttr, + type, + FALSE, + NULL, + NULL, + ColorMatrixFlagsDefault)); + } + + Status SetThreshold( + IN REAL threshold, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesThreshold( + nativeImageAttr, + type, + TRUE, + threshold)); + } + + Status ClearThreshold( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesThreshold( + nativeImageAttr, + type, + FALSE, + 0.0)); + } + + Status SetGamma( + IN REAL gamma, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesGamma( + nativeImageAttr, + type, + TRUE, + gamma)); + } + + Status ClearGamma( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesGamma( + nativeImageAttr, + type, + FALSE, + 0.0)); + } + + Status SetNoOp( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesNoOp( + nativeImageAttr, + type, + TRUE)); + } + + Status ClearNoOp( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesNoOp( + nativeImageAttr, + type, + FALSE)); + } + + Status SetColorKey( + IN const Color& colorLow, + IN const Color& colorHigh, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorKeys( + nativeImageAttr, + type, + TRUE, + colorLow.GetValue(), + colorHigh.GetValue())); + } + + Status ClearColorKey( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesColorKeys( + nativeImageAttr, + type, + FALSE, + NULL, + NULL)); + } + + Status SetOutputChannel( + IN ColorChannelFlags channelFlags, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesOutputChannel( + nativeImageAttr, + type, + TRUE, + channelFlags)); + } + + Status ClearOutputChannel( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesOutputChannel( + nativeImageAttr, + type, + FALSE, + ColorChannelFlagsLast)); + } + + Status SetOutputChannelColorProfile( + IN const WCHAR *colorProfileFilename, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile( + nativeImageAttr, + type, + TRUE, + colorProfileFilename)); + } + + Status ClearOutputChannelColorProfile( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesOutputChannelColorProfile( + nativeImageAttr, + type, + FALSE, + NULL)); + } + + Status SetRemapTable( + IN UINT mapSize, + IN const ColorMap *map, + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesRemapTable( + nativeImageAttr, + type, + TRUE, + mapSize, + map)); + } + + Status ClearRemapTable( + IN ColorAdjustType type = ColorAdjustTypeDefault + ) + { + return SetStatus(DllExports::GdipSetImageAttributesRemapTable( + nativeImageAttr, + type, + FALSE, + 0, + NULL)); + } + + Status SetBrushRemapTable(IN UINT mapSize, + IN const ColorMap *map) + { + return this->SetRemapTable(mapSize, map, ColorAdjustTypeBrush); + } + + Status ClearBrushRemapTable() + { + return this->ClearRemapTable(ColorAdjustTypeBrush); + } + + Status SetWrapMode(IN WrapMode wrap, + IN const Color& color = Color(), + IN BOOL clamp = FALSE) + { + ARGB argb = color.GetValue(); + + return SetStatus(DllExports::GdipSetImageAttributesWrapMode( + nativeImageAttr, wrap, argb, clamp)); + } + + #ifndef DCR_USE_NEW_145139 + Status SetICMMode(IN BOOL on) + { + on; + // This is not implemented. + // The supported method for doing ICM conversion from the embedded + // ICC profile is to use the Bitmap constructor from a file or stream + // and specify TRUE for the useIcm parameter. This will cause the + // image to be ICM converted when it's loaded from the file/stream + // if the profile exists. + return SetStatus(NotImplemented); +// DllExports::GdipSetImageAttributesICMMode(nativeImageAttr, on) + } + #endif + + // The flags of the palette are ignored. + Status GetAdjustedPalette(IN OUT ColorPalette* colorPalette, + IN ColorAdjustType colorAdjustType) const + { + return SetStatus(DllExports::GdipGetImageAttributesAdjustedPalette( + nativeImageAttr, colorPalette, colorAdjustType)); + } + + Status GetLastStatus() const + { + Status lastStatus = lastResult; + lastResult = Ok; + + return lastStatus; + } + +#ifdef DCR_USE_NEW_250932 + +private: + ImageAttributes(const ImageAttributes &); + ImageAttributes& operator=(const ImageAttributes &); + +#endif + +protected: + ImageAttributes(GpImageAttributes* imageAttr, Status status) + { + SetNativeImageAttr(imageAttr); + lastResult = status; + } + + VOID SetNativeImageAttr(GpImageAttributes* nativeImageAttr) + { + this->nativeImageAttr = nativeImageAttr; + } + + Status SetStatus(Status status) const + { + if (status != Ok) + return (lastResult = status); + else + return status; + } + +protected: + GpImageAttributes* nativeImageAttr; + mutable Status lastResult; +}; + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/GdiplusInit.h b/core/src/fxge/Microsoft SDK/include/GdiplusInit.h index 3320fa4b7e..48516d63d5 100644 --- a/core/src/fxge/Microsoft SDK/include/GdiplusInit.h +++ b/core/src/fxge/Microsoft SDK/include/GdiplusInit.h @@ -1,104 +1,104 @@ -/************************************************************************** -* -* Copyright (c) 2000 Microsoft Corporation -* -* Module Name: -* -* Gdiplus init -* -* Abstract: -* -* GDI+ startup/shutdown API's -* -* Created: -* -* 09/02/2000 agodfrey -* Created it. -* -**************************************************************************/ - -#ifndef _GDIPLUSINIT_H -#define _GDIPLUSINIT_H -//************************************************************************ -#if _FX_COMPILER_ == _FX_VC6_ -typedef unsigned long ULONG_PTR, *PULONG_PTR; //johnson add here. -#endif -//************************************************************************ - -// Used for debug event notification (debug builds only) - -enum DebugEventLevel -{ - DebugEventLevelFatal, - DebugEventLevelWarning -}; - -// Callback function that GDI+ can call, on debug builds, for assertions -// and warnings. - -typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message); - -// Notification functions which the user must call appropriately if -// "SuppressBackgroundThread" (below) is set. - -typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token); -typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token); - -// Input structure for GdiplusStartup() - -struct GdiplusStartupInput -{ - UINT32 GdiplusVersion; // Must be 1 - DebugEventProc DebugEventCallback; // Ignored on free builds - BOOL SuppressBackgroundThread; // FALSE unless you're prepared to call - // the hook/unhook functions properly - BOOL SuppressExternalCodecs; // FALSE unless you want GDI+ only to use - // its internal image codecs. - - GdiplusStartupInput( - DebugEventProc debugEventCallback = NULL, - BOOL suppressBackgroundThread = FALSE, - BOOL suppressExternalCodecs = FALSE) - { - GdiplusVersion = 1; - DebugEventCallback = debugEventCallback; - SuppressBackgroundThread = suppressBackgroundThread; - SuppressExternalCodecs = suppressExternalCodecs; - } -}; - -// Output structure for GdiplusStartup() - -struct GdiplusStartupOutput -{ - // The following 2 fields are NULL if SuppressBackgroundThread is FALSE. - // Otherwise, they are functions which must be called appropriately to - // replace the background thread. - // - // These should be called on the application's main message loop - i.e. - // a message loop which is active for the lifetime of GDI+. - // "NotificationHook" should be called before starting the loop, - // and "NotificationUnhook" should be called after the loop ends. - - NotificationHookProc NotificationHook; - NotificationUnhookProc NotificationUnhook; -}; - -// GDI+ initialization. Must be called before GDI+ API's are used. -// -// token - may not be NULL - accepts a token to be passed in the corresponding -// GdiplusShutdown call. -// input - may not be NULL -// output - may be NULL only if input->SuppressBackgroundThread is FALSE. - -extern "C" Status WINAPI GdiplusStartup( - OUT ULONG_PTR *token, - const GdiplusStartupInput *input, - OUT GdiplusStartupOutput *output); - -// GDI+ termination. Must be called before GDI+ is unloaded. GDI+ API's may not -// be called after this. - -extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token); - -#endif +/************************************************************************** +* +* Copyright (c) 2000 Microsoft Corporation +* +* Module Name: +* +* Gdiplus init +* +* Abstract: +* +* GDI+ startup/shutdown API's +* +* Created: +* +* 09/02/2000 agodfrey +* Created it. +* +**************************************************************************/ + +#ifndef _GDIPLUSINIT_H +#define _GDIPLUSINIT_H +//************************************************************************ +#if _FX_COMPILER_ == _FX_VC6_ +typedef unsigned long ULONG_PTR, *PULONG_PTR; //johnson add here. +#endif +//************************************************************************ + +// Used for debug event notification (debug builds only) + +enum DebugEventLevel +{ + DebugEventLevelFatal, + DebugEventLevelWarning +}; + +// Callback function that GDI+ can call, on debug builds, for assertions +// and warnings. + +typedef VOID (WINAPI *DebugEventProc)(DebugEventLevel level, CHAR *message); + +// Notification functions which the user must call appropriately if +// "SuppressBackgroundThread" (below) is set. + +typedef Status (WINAPI *NotificationHookProc)(OUT ULONG_PTR *token); +typedef VOID (WINAPI *NotificationUnhookProc)(ULONG_PTR token); + +// Input structure for GdiplusStartup() + +struct GdiplusStartupInput +{ + UINT32 GdiplusVersion; // Must be 1 + DebugEventProc DebugEventCallback; // Ignored on free builds + BOOL SuppressBackgroundThread; // FALSE unless you're prepared to call + // the hook/unhook functions properly + BOOL SuppressExternalCodecs; // FALSE unless you want GDI+ only to use + // its internal image codecs. + + GdiplusStartupInput( + DebugEventProc debugEventCallback = NULL, + BOOL suppressBackgroundThread = FALSE, + BOOL suppressExternalCodecs = FALSE) + { + GdiplusVersion = 1; + DebugEventCallback = debugEventCallback; + SuppressBackgroundThread = suppressBackgroundThread; + SuppressExternalCodecs = suppressExternalCodecs; + } +}; + +// Output structure for GdiplusStartup() + +struct GdiplusStartupOutput +{ + // The following 2 fields are NULL if SuppressBackgroundThread is FALSE. + // Otherwise, they are functions which must be called appropriately to + // replace the background thread. + // + // These should be called on the application's main message loop - i.e. + // a message loop which is active for the lifetime of GDI+. + // "NotificationHook" should be called before starting the loop, + // and "NotificationUnhook" should be called after the loop ends. + + NotificationHookProc NotificationHook; + NotificationUnhookProc NotificationUnhook; +}; + +// GDI+ initialization. Must be called before GDI+ API's are used. +// +// token - may not be NULL - accepts a token to be passed in the corresponding +// GdiplusShutdown call. +// input - may not be NULL +// output - may be NULL only if input->SuppressBackgroundThread is FALSE. + +extern "C" Status WINAPI GdiplusStartup( + OUT ULONG_PTR *token, + const GdiplusStartupInput *input, + OUT GdiplusStartupOutput *output); + +// GDI+ termination. Must be called before GDI+ is unloaded. GDI+ API's may not +// be called after this. + +extern "C" VOID WINAPI GdiplusShutdown(ULONG_PTR token); + +#endif diff --git a/core/src/fxge/Microsoft SDK/include/sal.h b/core/src/fxge/Microsoft SDK/include/sal.h index 136996974a..07234950cd 100644 --- a/core/src/fxge/Microsoft SDK/include/sal.h +++ b/core/src/fxge/Microsoft SDK/include/sal.h @@ -1,729 +1,729 @@ -/*** -*sal.h - markers for documenting the semantics of APIs -* -* Copyright (c) Microsoft Corporation. All rights reserved. -* -*Purpose: -* sal.h provides a set of annotations to describe how a function uses its -* parameters - the assumptions it makes about them, and the guarantees it makes -* upon finishing. -* -* [Public] -* -****/ - -/* - ------------------------------------------------------------------------------- - Introduction - - sal.h provides a set of annotations to describe how a function uses its - parameters - the assumptions it makes about them, and the guarantees it makes - upon finishing. - - Annotations may be placed before either a function parameter's type or its return - type, and describe the function's behavior regarding the parameter or return value. - There are two classes of annotations: buffer annotations and advanced annotations. - Buffer annotations describe how functions use their pointer parameters, and - advanced annotations either describe complex/unusual buffer behavior, or provide - additional information about a parameter that is not otherwise expressible. - - ------------------------------------------------------------------------------- - Buffer Annotations - - The most important annotations in sal.h provide a consistent way to annotate - buffer parameters or return values for a function. Each of these annotations describes - a single buffer (which could be a string, a fixed-length or variable-length array, - or just a pointer) that the function interacts with: where it is, how large it is, - how much is initialized, and what the function does with it. - - The appropriate macro for a given buffer can be constructed using the table below. - Just pick the appropriate values from each category, and combine them together - with a leading underscore. Some combinations of values do not make sense as buffer - annotations. Only meaningful annotations can be added to your code; for a list of - these, see the buffer annotation definitions section. - - Only a single buffer annotation should be used for each parameter. - - |------------|------------|---------|--------|----------|----------|---------------| - | Level | Usage | Size | Output | NullTerm | Optional | Parameters | - |------------|------------|---------|--------|----------|----------|---------------| - | <> | <> | <> | <> | _z | <> | <> | - | _deref | _in | _ecount | _full | _nz | _opt | (size) | - | _deref_opt | _out | _bcount | _part | | | (size,length) | - | | _inout | | | | | | - | | | | | | | | - |------------|------------|---------|--------|----------|----------|---------------| - - Level: Describes the buffer pointer's level of indirection from the parameter or - return value 'p'. - - <> : p is the buffer pointer. - _deref : *p is the buffer pointer. p must not be NULL. - _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the rest of - the annotation is ignored. - - Usage: Describes how the function uses the buffer. - - <> : The buffer is not accessed. If used on the return value or with _deref, the - function will provide the buffer, and it will be uninitialized at exit. - Otherwise, the caller must provide the buffer. This should only be used - for alloc and free functions. - _in : The function will only read from the buffer. The caller must provide the - buffer and initialize it. Cannot be used with _deref. - _out : The function will only write to the buffer. If used on the return value or - with _deref, the function will provide the buffer and initialize it. - Otherwise, the caller must provide the buffer, and the function will - initialize it. - _inout : The function may freely read from and write to the buffer. The caller must - provide the buffer and initialize it. If used with _deref, the buffer may - be reallocated by the function. - - Size: Describes the total size of the buffer. This may be less than the space actually - allocated for the buffer, in which case it describes the accessible amount. - - <> : No buffer size is given. If the type specifies the buffer size (such as - with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is one - element long. Must be used with _in, _out, or _inout. - _ecount : The buffer size is an explicit element count. - _bcount : The buffer size is an explicit byte count. - - Output: Describes how much of the buffer will be initialized by the function. For - _inout buffers, this also describes how much is initialized at entry. Omit this - category for _in buffers; they must be fully initialized by the caller. - - <> : The type specifies how much is initialized. For instance, a function initializing - an LPWSTR must NULL-terminate the string. - _full : The function initializes the entire buffer. - _part : The function initializes part of the buffer, and explicitly indicates how much. - - NullTerm: States if the present of a '\0' marks the end of valid elements in the buffer. - _z : A '\0' indicated the end of the buffer - _nz : The buffer may not be null terminated and a '\0' does not indicate the end of the - buffer. - Optional: Describes if the buffer itself is optional. - - <> : The pointer to the buffer must not be NULL. - _opt : The pointer to the buffer might be NULL. It will be checked before being dereferenced. - - Parameters: Gives explicit counts for the size and length of the buffer. - - <> : There is no explicit count. Use when neither _ecount nor _bcount is used. - (size) : Only the buffer's total size is given. Use with _ecount or _bcount but not _part. - (size,length) : The buffer's total size and initialized length are given. Use with _ecount_part - and _bcount_part. - - ------------------------------------------------------------------------------- - Buffer Annotation Examples - - LWSTDAPI_(BOOL) StrToIntExA( - LPCSTR pszString, -- No annotation required, const implies __in. - DWORD dwFlags, - __out int *piRet -- A pointer whose dereference will be filled in. - ); - - void MyPaintingFunction( - __in HWND hwndControl, -- An initialized read-only parameter. - __in_opt HDC hdcOptional, -- An initialized read-only parameter that might be NULL. - __inout IPropertyStore *ppsStore -- An initialized parameter that may be freely used - -- and modified. - ); - - LWSTDAPI_(BOOL) PathCompactPathExA( - __out_ecount(cchMax) LPSTR pszOut, -- A string buffer with cch elements that will - -- be NULL terminated on exit. - LPCSTR pszSrc, -- No annotation required, const implies __in. - UINT cchMax, - DWORD dwFlags - ); - - HRESULT SHLocalAllocBytes( - size_t cb, - __deref_bcount(cb) T **ppv -- A pointer whose dereference will be set to an - -- uninitialized buffer with cb bytes. - ); - - __inout_bcount_full(cb) : A buffer with cb elements that is fully initialized at - entry and exit, and may be written to by this function. - - __out_ecount_part(count, *countOut) : A buffer with count elements that will be - partially initialized by this function. The function indicates how much it - initialized by setting *countOut. - - ------------------------------------------------------------------------------- - Advanced Annotations - - Advanced annotations describe behavior that is not expressible with the regular - buffer macros. These may be used either to annotate buffer parameters that involve - complex or conditional behavior, or to enrich existing annotations with additional - information. - - __success(expr) f : - indicates whether function f succeeded or not. If is true at exit, - all the function's guarantees (as given by other annotations) must hold. If - is false at exit, the caller should not expect any of the function's guarantees - to hold. If not used, the function must always satisfy its guarantees. Added - automatically to functions that indicate success in standard ways, such as by - returning an HRESULT. - - __nullterminated p : - Pointer p is a buffer that may be read or written up to and including the first - NULL character or pointer. May be used on typedefs, which marks valid (properly - initialized) instances of that type as being NULL-terminated. - - __nullnullterminated p : - Pointer p is a buffer that may be read or written up to and including the first - sequence of two NULL characters or pointers. May be used on typedefs, which marks - valid instances of that type as being double-NULL terminated. - - __reserved v : - Value v must be 0/NULL, reserved for future use. - - __checkReturn v : - Return value v must not be ignored by callers of this function. - - __typefix(ctype) v : - Value v should be treated as an instance of ctype, rather than its declared type. - - __override f : - Specify C#-style 'override' behaviour for overriding virtual methods. - - __callback f : - Function f can be used as a function pointer. - - __format_string p : - Pointer p is a string that contains % markers in the style of printf. - - __blocksOn(resource) f : - Function f blocks on the resource 'resource'. - - __fallthrough : - Annotates switch statement labels where fall-through is desired, to distinguish - from forgotten break statements. - - ------------------------------------------------------------------------------- - Advanced Annotation Examples - - __success(return == TRUE) LWSTDAPI_(BOOL) - PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) : - pszBuf is only guaranteed to be NULL-terminated when TRUE is returned. - - typedef __nullterminated WCHAR* LPWSTR : Initialized LPWSTRs are NULL-terminated strings. - - __out_ecount(cch) __typefix(LPWSTR) void *psz : psz is a buffer parameter which will be - a NULL-terminated WCHAR string at exit, and which initially contains cch WCHARs. - - ------------------------------------------------------------------------------- -*/ - -#pragma once - -#define __specstrings - -#ifdef __cplusplus -#ifndef __nothrow -# define __nothrow __declspec(nothrow) -#endif -extern "C" { -#else -#ifndef __nothrow -# define __nothrow -#endif -#endif /* #ifdef __cplusplus */ - -/* - ------------------------------------------------------------------------------- - Helper Macro Definitions - - These express behavior common to many of the high-level annotations. - DO NOT USE THESE IN YOUR CODE. - ------------------------------------------------------------------------------- -*/ - -/* -The helper annotations are only understood by the compiler version used by various -defect detection tools. When the regular compiler is running, they are defined into -nothing, and do not affect the compiled code. -*/ - -#if !defined(__midl) && defined(_PREFAST_) - - /* - In the primitive __declspec("SAL_*") annotations "SAL" stands for Standard - Annotation Language. These __declspec("SAL_*") annotations are the - primitives the compiler understands and all high-level SpecString MACROs - will decompose into these primivates. - */ - - #define SPECSTRINGIZE( x ) #x - - /* - __null p - __notnull p - __maybenull p - - Annotates a pointer p. States that pointer p is null. Commonly used - in the negated form __notnull or the possibly null form __maybenull. - */ - - #define __null __declspec("SAL_null") - #define __notnull __declspec("SAL_notnull") - #define __maybenull __declspec("SAL_maybenull") - - /* - __readonly l - __notreadonly l - __mabyereadonly l - - Annotates a location l. States that location l is not modified after - this point. If the annotation is placed on the precondition state of - a function, the restriction only applies until the postcondition state - of the function. __maybereadonly states that the annotated location - may be modified, whereas __notreadonly states that a location must be - modified. - */ - - #define __readonly __declspec("SAL_readonly") - #define __notreadonly __declspec("SAL_notreadonly") - #define __maybereadonly __declspec("SAL_maybereadonly") - - /* - __valid v - __notvalid v - __maybevalid v - - Annotates any value v. States that the value satisfies all properties of - valid values of its type. For example, for a string buffer, valid means - that the buffer pointer is either NULL or points to a NULL-terminated string. - */ - - #define __valid __declspec("SAL_valid") - #define __notvalid __declspec("SAL_notvalid") - #define __maybevalid __declspec("SAL_maybevalid") - - /* - __readableTo(extent) p - - Annotates a buffer pointer p. If the buffer can be read, extent describes - how much of the buffer is readable. For a reader of the buffer, this is - an explicit permission to read up to that amount, rather than a restriction to - read only up to it. - */ - - #define __readableTo(extent) __declspec("SAL_readableTo("SPECSTRINGIZE(extent)")") - - /* - - __elem_readableTo(size) - - Annotates a buffer pointer p as being readable to size elements. - */ - - #define __elem_readableTo(size) __declspec("SAL_readableTo(elementCount("SPECSTRINGIZE(size)"))") - - /* - __byte_readableTo(size) - - Annotates a buffer pointer p as being readable to size bytes. - */ - #define __byte_readableTo(size) __declspec("SAL_readableTo(byteCount("SPECSTRINGIZE(size)"))") - - /* - __writableTo(extent) p - - Annotates a buffer pointer p. If the buffer can be modified, extent - describes how much of the buffer is writable (usually the allocation - size). For a writer of the buffer, this is an explicit permission to - write up to that amount, rather than a restriction to write only up to it. - */ - #define __writableTo(size) __declspec("SAL_writableTo("SPECSTRINGIZE(size)")") - - /* - __elem_writableTo(size) - - Annotates a buffer pointer p as being writable to size elements. - */ - #define __elem_writableTo(size) __declspec("SAL_writableTo(elementCount("SPECSTRINGIZE(size)"))") - - /* - __byte_writableTo(size) - - Annotates a buffer pointer p as being writable to size bytes. - */ - #define __byte_writableTo(size) __declspec("SAL_writableTo(byteCount("SPECSTRINGIZE(size)"))") - - /* - __deref p - - Annotates a pointer p. The next annotation applies one dereference down - in the type. If readableTo(p, size) then the next annotation applies to - all elements *(p+i) for which i satisfies the size. If p is a pointer - to a struct, the next annotation applies to all fields of the struct. - */ - #define __deref __declspec("SAL_deref") - - /* - __pre __next_annotation - - The next annotation applies in the precondition state - */ - #define __pre __declspec("SAL_pre") - - /* - __post __next_annotation - - The next annotation applies in the postcondition state - */ - #define __post __declspec("SAL_post") - - /* - __precond() - - When is true, the next annotation applies in the precondition state - (currently not enabled) - */ - #define __precond(expr) __pre - - /* - __postcond() - - When is true, the next annotation applies in the postcondition state - (currently not enabled) - */ - #define __postcond(expr) __post - - /* - __exceptthat - - Given a set of annotations Q containing __exceptthat maybeP, the effect of - the except clause is to erase any P or notP annotations (explicit or - implied) within Q at the same level of dereferencing that the except - clause appears, and to replace it with maybeP. - - Example 1: __valid __exceptthat __maybenull on a pointer p means that the - pointer may be null, and is otherwise valid, thus overriding - the implicit notnull annotation implied by __valid on - pointers. - - Example 2: __valid __deref __exceptthat __maybenull on an int **p means - that p is not null (implied by valid), but the elements - pointed to by p could be null, and are otherwise valid. - */ - #define __exceptthat __declspec("SAL_except") - #define __execeptthat __exceptthat - - /* - _refparam - - Added to all out parameter macros to indicate that they are all reference - parameters. - */ - #define __refparam __deref __notreadonly - - /* - __inner_* - - Helper macros that directly correspond to certain high-level annotations. - - */ - - /* - Macros to classify the entrypoints and indicate their category. - - Pre-defined control point categories include: RPC, LPC, DeviceDriver, UserToKernel, ISAPI, COM. - - */ - #define __inner_control_entrypoint(category) __declspec("SAL_entrypoint(controlEntry, "SPECSTRINGIZE(category)")") - - /* - Pre-defined data entry point categories include: Registry, File, Network. - */ - #define __inner_data_entrypoint(category) __declspec("SAL_entrypoint(dataEntry, "SPECSTRINGIZE(category)")") - - #define __inner_success(expr) __declspec("SAL_success("SPECSTRINGIZE(expr)")") - #define __inner_checkReturn __declspec("SAL_checkReturn") - #define __inner_typefix(ctype) __declspec("SAL_typefix("SPECSTRINGIZE(ctype)")") - #define __inner_override __declspec("__override") - #define __inner_callback __declspec("__callback") - #define __inner_blocksOn(resource) __declspec("SAL_blocksOn("SPECSTRINGIZE(resource)")") - #define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {} - #define __inner_fallthrough __FallThrough(); - -#else - #define __null - #define __notnull - #define __maybenull - #define __readonly - #define __notreadonly - #define __maybereadonly - #define __valid - #define __notvalid - #define __maybevalid - #define __readableTo(extent) - #define __elem_readableTo(size) - #define __byte_readableTo(size) - #define __writableTo(size) - #define __elem_writableTo(size) - #define __byte_writableTo(size) - #define __deref - #define __pre - #define __post - #define __precond(expr) - #define __postcond(expr) - #define __exceptthat - #define __execeptthat - #define __inner_success(expr) - #define __inner_checkReturn - #define __inner_typefix(ctype) - #define __inner_override - #define __inner_callback - #define __inner_blocksOn(resource) - #define __inner_fallthrough_dec - #define __inner_fallthrough - #define __refparam - #define __inner_control_entrypoint(category) - #define __inner_data_entrypoint(category) -#endif /* #if !defined(__midl) && defined(_PREFAST_) */ - -/* -------------------------------------------------------------------------------- -Buffer Annotation Definitions - -Any of these may be used to directly annotate functions, but only one should -be used for each parameter. To determine which annotation to use for a given -buffer, use the table in the buffer annotations section. -------------------------------------------------------------------------------- -*/ - -#define __ecount(size) __notnull __elem_writableTo(size) -#define __bcount(size) __notnull __byte_writableTo(size) -#define __in __pre __valid __pre __deref __readonly -#define __in_ecount(size) __in __pre __elem_readableTo(size) -#define __in_bcount(size) __in __pre __byte_readableTo(size) -#define __in_z __in __pre __nullterminated -#define __in_ecount_z(size) __in_ecount(size) __pre __nullterminated -#define __in_bcount_z(size) __in_bcount(size) __pre __nullterminated -#define __in_nz __in -#define __in_ecount_nz(size) __in_ecount(size) -#define __in_bcount_nz(size) __in_bcount(size) -#define __out __ecount(1) __post __valid __refparam -#define __out_ecount(size) __ecount(size) __post __valid __refparam -#define __out_bcount(size) __bcount(size) __post __valid __refparam -#define __out_ecount_part(size,length) __out_ecount(size) __post __elem_readableTo(length) -#define __out_bcount_part(size,length) __out_bcount(size) __post __byte_readableTo(length) -#define __out_ecount_full(size) __out_ecount_part(size,size) -#define __out_bcount_full(size) __out_bcount_part(size,size) -#define __out_z __post __valid __refparam __post __nullterminated -#define __out_z_opt __post __valid __refparam __post __nullterminated __exceptthat __maybenull -#define __out_ecount_z(size) __ecount(size) __post __valid __refparam __post __nullterminated -#define __out_bcount_z(size) __bcount(size) __post __valid __refparam __post __nullterminated -#define __out_ecount_part_z(size,length) __out_ecount_part(size,length) __post __nullterminated -#define __out_bcount_part_z(size,length) __out_bcount_part(size,length) __post __nullterminated -#define __out_ecount_full_z(size) __out_ecount_full(size) __post __nullterminated -#define __out_bcount_full_z(size) __out_bcount_full(size) __post __nullterminated -#define __out_nz __post __valid __refparam __post -#define __out_nz_opt __post __valid __refparam __post __exceptthat __maybenull -#define __out_ecount_nz(size) __ecount(size) __post __valid __refparam -#define __out_bcount_nz(size) __bcount(size) __post __valid __refparam -#define __inout __pre __valid __post __valid __refparam -#define __inout_ecount(size) __out_ecount(size) __pre __valid -#define __inout_bcount(size) __out_bcount(size) __pre __valid -#define __inout_ecount_part(size,length) __out_ecount_part(size,length) __pre __valid __pre __elem_readableTo(length) -#define __inout_bcount_part(size,length) __out_bcount_part(size,length) __pre __valid __pre __byte_readableTo(length) -#define __inout_ecount_full(size) __inout_ecount_part(size,size) -#define __inout_bcount_full(size) __inout_bcount_part(size,size) -#define __inout_z __inout __pre __nullterminated __post __nullterminated -#define __inout_ecount_z(size) __inout_ecount(size) __pre __nullterminated __post __nullterminated -#define __inout_bcount_z(size) __inout_bcount(size) __pre __nullterminated __post __nullterminated -#define __inout_nz __inout -#define __inout_ecount_nz(size) __inout_ecount(size) -#define __inout_bcount_nz(size) __inout_bcount(size) -#define __ecount_opt(size) __ecount(size) __exceptthat __maybenull -#define __bcount_opt(size) __bcount(size) __exceptthat __maybenull -#define __in_opt __in __exceptthat __maybenull -#define __in_ecount_opt(size) __in_ecount(size) __exceptthat __maybenull -#define __in_bcount_opt(size) __in_bcount(size) __exceptthat __maybenull -#define __in_z_opt __in_opt __pre __nullterminated -#define __in_ecount_z_opt(size) __in_ecount_opt(size) __pre __nullterminated -#define __in_bcount_z_opt(size) __in_bcount_opt(size) __pre __nullterminated -#define __in_nz_opt __in_opt -#define __in_ecount_nz_opt(size) __in_ecount_opt(size) -#define __in_bcount_nz_opt(size) __in_bcount_opt(size) -#define __out_opt __out __exceptthat __maybenull -#define __out_ecount_opt(size) __out_ecount(size) __exceptthat __maybenull -#define __out_bcount_opt(size) __out_bcount(size) __exceptthat __maybenull -#define __out_ecount_part_opt(size,length) __out_ecount_part(size,length) __exceptthat __maybenull -#define __out_bcount_part_opt(size,length) __out_bcount_part(size,length) __exceptthat __maybenull -#define __out_ecount_full_opt(size) __out_ecount_full(size) __exceptthat __maybenull -#define __out_bcount_full_opt(size) __out_bcount_full(size) __exceptthat __maybenull -#define __out_ecount_z_opt(size) __out_ecount_opt(size) __post __nullterminated -#define __out_bcount_z_opt(size) __out_bcount_opt(size) __post __nullterminated -#define __out_ecount_part_z_opt(size,length) __out_ecount_part_opt(size,length) __post __nullterminated -#define __out_bcount_part_z_opt(size,length) __out_bcount_part_opt(size,length) __post __nullterminated -#define __out_ecount_full_z_opt(size) __out_ecount_full_opt(size) __post __nullterminated -#define __out_bcount_full_z_opt(size) __out_bcount_full_opt(size) __post __nullterminated -#define __out_ecount_nz_opt(size) __out_ecount_opt(size) __post __nullterminated -#define __out_bcount_nz_opt(size) __out_bcount_opt(size) __post __nullterminated -#define __inout_opt __inout __exceptthat __maybenull -#define __inout_ecount_opt(size) __inout_ecount(size) __exceptthat __maybenull -#define __inout_bcount_opt(size) __inout_bcount(size) __exceptthat __maybenull -#define __inout_ecount_part_opt(size,length) __inout_ecount_part(size,length) __exceptthat __maybenull -#define __inout_bcount_part_opt(size,length) __inout_bcount_part(size,length) __exceptthat __maybenull -#define __inout_ecount_full_opt(size) __inout_ecount_full(size) __exceptthat __maybenull -#define __inout_bcount_full_opt(size) __inout_bcount_full(size) __exceptthat __maybenull -#define __inout_z_opt __inout_opt __pre __nullterminated __post __nullterminated -#define __inout_ecount_z_opt(size) __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated -#define __inout_ecount_z_opt(size) __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated -#define __inout_bcount_z_opt(size) __inout_bcount_opt(size) -#define __inout_nz_opt __inout_opt -#define __inout_ecount_nz_opt(size) __inout_ecount_opt(size) -#define __inout_bcount_nz_opt(size) __inout_bcount_opt(size) -#define __deref_ecount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __elem_writableTo(size) -#define __deref_bcount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __byte_writableTo(size) -#define __deref_out __deref_ecount(1) __post __deref __valid __refparam -#define __deref_out_ecount(size) __deref_ecount(size) __post __deref __valid __refparam -#define __deref_out_bcount(size) __deref_bcount(size) __post __deref __valid __refparam -#define __deref_out_ecount_part(size,length) __deref_out_ecount(size) __post __deref __elem_readableTo(length) -#define __deref_out_bcount_part(size,length) __deref_out_bcount(size) __post __deref __byte_readableTo(length) -#define __deref_out_ecount_full(size) __deref_out_ecount_part(size,size) -#define __deref_out_bcount_full(size) __deref_out_bcount_part(size,size) -#define __deref_out_z __post __deref __valid __refparam __post __deref __nullterminated -#define __deref_out_ecount_z(size) __deref_out_ecount(size) __post __deref __nullterminated -#define __deref_out_bcount_z(size) __deref_out_ecount(size) __post __deref __nullterminated -#define __deref_out_nz __deref_out -#define __deref_out_ecount_nz(size) __deref_out_ecount(size) -#define __deref_out_bcount_nz(size) __deref_out_ecount(size) -#define __deref_inout __notnull __elem_readableTo(1) __pre __deref __valid __post __deref __valid __refparam -#define __deref_inout_z __deref_inout __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_inout_ecount(size) __deref_inout __pre __deref __elem_writableTo(size) __post __deref __elem_writableTo(size) -#define __deref_inout_bcount(size) __deref_inout __pre __deref __byte_writableTo(size) __post __deref __byte_writableTo(size) -#define __deref_inout_ecount_part(size,length) __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length) -#define __deref_inout_bcount_part(size,length) __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length) -#define __deref_inout_ecount_full(size) __deref_inout_ecount_part(size,size) -#define __deref_inout_bcount_full(size) __deref_inout_bcount_part(size,size) -#define __deref_inout_z __deref_inout __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_inout_ecount_z(size) __deref_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_inout_bcount_z(size) __deref_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_inout_nz __deref_inout -#define __deref_inout_ecount_nz(size) __deref_inout_ecount(size) -#define __deref_inout_bcount_nz(size) __deref_inout_ecount(size) -#define __deref_ecount_opt(size) __deref_ecount(size) __post __deref __exceptthat __maybenull -#define __deref_bcount_opt(size) __deref_bcount(size) __post __deref __exceptthat __maybenull -#define __deref_out_opt __deref_out __post __deref __exceptthat __maybenull -#define __deref_out_ecount_opt(size) __deref_out_ecount(size) __post __deref __exceptthat __maybenull -#define __deref_out_bcount_opt(size) __deref_out_bcount(size) __post __deref __exceptthat __maybenull -#define __deref_out_ecount_part_opt(size,length) __deref_out_ecount_part(size,length) __post __deref __exceptthat __maybenull -#define __deref_out_bcount_part_opt(size,length) __deref_out_bcount_part(size,length) __post __deref __exceptthat __maybenull -#define __deref_out_ecount_full_opt(size) __deref_out_ecount_full(size) __post __deref __exceptthat __maybenull -#define __deref_out_bcount_full_opt(size) __deref_out_bcount_full(size) __post __deref __exceptthat __maybenull -#define __deref_out_z_opt __post __deref __valid __refparam __execeptthat __maybenull __post __deref __nullterminated -#define __deref_out_ecount_z_opt(size) __deref_out_ecount_opt(size) __post __deref __nullterminated -#define __deref_out_bcount_z_opt(size) __deref_out_bcount_opt(size) __post __deref __nullterminated -#define __deref_out_nz_opt __deref_out_opt -#define __deref_out_ecount_nz_opt(size) __deref_out_ecount_opt(size) -#define __deref_out_bcount_nz_opt(size) __deref_out_bcount_opt(size) -#define __deref_inout_opt __deref_inout __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#define __deref_inout_ecount_opt(size) __deref_inout_ecount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#define __deref_inout_bcount_opt(size) __deref_inout_bcount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#define __deref_inout_ecount_part_opt(size,length) __deref_inout_ecount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#define __deref_inout_bcount_part_opt(size,length) __deref_inout_bcount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#define __deref_inout_ecount_full_opt(size) __deref_inout_ecount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#define __deref_inout_bcount_full_opt(size) __deref_inout_bcount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#define __deref_inout_z_opt __deref_inout_opt __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_inout_ecount_z_opt(size) __deref_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_inout_bcount_z_opt(size) __deref_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_inout_nz_opt __deref_inout_opt -#define __deref_inout_ecount_nz_opt(size) __deref_inout_ecount_opt(size) -#define __deref_inout_bcount_nz_opt(size) __deref_inout_bcount_opt(size) -#define __deref_opt_ecount(size) __deref_ecount(size) __exceptthat __maybenull -#define __deref_opt_bcount(size) __deref_bcount(size) __exceptthat __maybenull -#define __deref_opt_out __deref_out __exceptthat __maybenull -#define __deref_opt_out_z __deref_opt_out __post __deref __nullterminated -#define __deref_opt_out_ecount(size) __deref_out_ecount(size) __exceptthat __maybenull -#define __deref_opt_out_bcount(size) __deref_out_bcount(size) __exceptthat __maybenull -#define __deref_opt_out_ecount_part(size,length) __deref_out_ecount_part(size,length) __exceptthat __maybenull -#define __deref_opt_out_bcount_part(size,length) __deref_out_bcount_part(size,length) __exceptthat __maybenull -#define __deref_opt_out_ecount_full(size) __deref_out_ecount_full(size) __exceptthat __maybenull -#define __deref_opt_out_bcount_full(size) __deref_out_bcount_full(size) __exceptthat __maybenull -#define __deref_opt_inout __deref_inout __exceptthat __maybenull -#define __deref_opt_inout_ecount(size) __deref_inout_ecount(size) __exceptthat __maybenull -#define __deref_opt_inout_bcount(size) __deref_inout_bcount(size) __exceptthat __maybenull -#define __deref_opt_inout_ecount_part(size,length) __deref_inout_ecount_part(size,length) __exceptthat __maybenull -#define __deref_opt_inout_bcount_part(size,length) __deref_inout_bcount_part(size,length) __exceptthat __maybenull -#define __deref_opt_inout_ecount_full(size) __deref_inout_ecount_full(size) __exceptthat __maybenull -#define __deref_opt_inout_bcount_full(size) __deref_inout_bcount_full(size) __exceptthat __maybenull -#define __deref_opt_inout_z __deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_opt_inout_ecount_z(size) __deref_opt_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_opt_inout_bcount_z(size) __deref_opt_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_opt_inout_nz __deref_opt_inout -#define __deref_opt_inout_ecount_nz(size) __deref_opt_inout_ecount(size) -#define __deref_opt_inout_bcount_nz(size) __deref_opt_inout_bcount(size) -#define __deref_opt_ecount_opt(size) __deref_ecount_opt(size) __exceptthat __maybenull -#define __deref_opt_bcount_opt(size) __deref_bcount_opt(size) __exceptthat __maybenull -#define __deref_opt_out_opt __deref_out_opt __exceptthat __maybenull -#define __deref_opt_out_ecount_opt(size) __deref_out_ecount_opt(size) __exceptthat __maybenull -#define __deref_opt_out_bcount_opt(size) __deref_out_bcount_opt(size) __exceptthat __maybenull -#define __deref_opt_out_ecount_part_opt(size,length) __deref_out_ecount_part_opt(size,length) __exceptthat __maybenull -#define __deref_opt_out_bcount_part_opt(size,length) __deref_out_bcount_part_opt(size,length) __exceptthat __maybenull -#define __deref_opt_out_ecount_full_opt(size) __deref_out_ecount_full_opt(size) __exceptthat __maybenull -#define __deref_opt_out_bcount_full_opt(size) __deref_out_bcount_full_opt(size) __exceptthat __maybenull -#define __deref_opt_out_z_opt __post __deref __valid __refparam __exceptthat __maybenull __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull __post __deref __nullterminated -#define __deref_opt_out_ecount_z_opt(size) __deref_opt_out_ecount_opt(size) __post __deref __nullterminated -#define __deref_opt_out_bcount_z_opt(size) __deref_opt_out_bcount_opt(size) __post __deref __nullterminated -#define __deref_opt_out_nz_opt __deref_opt_out_opt -#define __deref_opt_out_ecount_nz_opt(size) __deref_opt_out_ecount_opt(size) -#define __deref_opt_out_bcount_nz_opt(size) __deref_opt_out_bcount_opt(size) -#define __deref_opt_inout_opt __deref_inout_opt __exceptthat __maybenull -#define __deref_opt_inout_ecount_opt(size) __deref_inout_ecount_opt(size) __exceptthat __maybenull -#define __deref_opt_inout_bcount_opt(size) __deref_inout_bcount_opt(size) __exceptthat __maybenull -#define __deref_opt_inout_ecount_part_opt(size,length) __deref_inout_ecount_part_opt(size,length) __exceptthat __maybenull -#define __deref_opt_inout_bcount_part_opt(size,length) __deref_inout_bcount_part_opt(size,length) __exceptthat __maybenull -#define __deref_opt_inout_ecount_full_opt(size) __deref_inout_ecount_full_opt(size) __exceptthat __maybenull -#define __deref_opt_inout_bcount_full_opt(size) __deref_inout_bcount_full_opt(size) __exceptthat __maybenull -#define __deref_opt_inout_z_opt __deref_opt_inout_opt __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_opt_inout_ecount_z_opt(size) __deref_opt_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_opt_inout_bcount_z_opt(size) __deref_opt_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated -#define __deref_opt_inout_nz_opt __deref_opt_inout_opt -#define __deref_opt_inout_ecount_nz_opt(size) __deref_opt_inout_ecount_opt(size) -#define __deref_opt_inout_bcount_nz_opt(size) __deref_opt_inout_bcount_opt(size) - -/* -------------------------------------------------------------------------------- -Advanced Annotation Definitions - -Any of these may be used to directly annotate functions, and may be used in -combination with each other or with regular buffer macros. For an explanation -of each annotation, see the advanced annotations section. -------------------------------------------------------------------------------- -*/ - -#define __success(expr) __inner_success(expr) -#define __nullterminated __readableTo(sentinel(0)) -#define __nullnullterminated -#define __reserved __pre __null -#define __checkReturn __inner_checkReturn -#define __typefix(ctype) __inner_typefix(ctype) -#define __override __inner_override -#define __callback __inner_callback -#define __format_string -#define __blocksOn(resource) __inner_blocksOn(resource) -#define __control_entrypoint(category) __inner_control_entrypoint(category) -#define __data_entrypoint(category) __inner_data_entrypoint(category) - -#ifndef __fallthrough - __inner_fallthrough_dec - #define __fallthrough __inner_fallthrough -#endif - -#ifndef __analysis_assume -#ifdef _PREFAST_ -#define __analysis_assume(expr) __assume(expr) -#else -#define __analysis_assume(expr) -#endif -#endif - -#ifdef __cplusplus -} -#endif - - +/*** +*sal.h - markers for documenting the semantics of APIs +* +* Copyright (c) Microsoft Corporation. All rights reserved. +* +*Purpose: +* sal.h provides a set of annotations to describe how a function uses its +* parameters - the assumptions it makes about them, and the guarantees it makes +* upon finishing. +* +* [Public] +* +****/ + +/* + ------------------------------------------------------------------------------- + Introduction + + sal.h provides a set of annotations to describe how a function uses its + parameters - the assumptions it makes about them, and the guarantees it makes + upon finishing. + + Annotations may be placed before either a function parameter's type or its return + type, and describe the function's behavior regarding the parameter or return value. + There are two classes of annotations: buffer annotations and advanced annotations. + Buffer annotations describe how functions use their pointer parameters, and + advanced annotations either describe complex/unusual buffer behavior, or provide + additional information about a parameter that is not otherwise expressible. + + ------------------------------------------------------------------------------- + Buffer Annotations + + The most important annotations in sal.h provide a consistent way to annotate + buffer parameters or return values for a function. Each of these annotations describes + a single buffer (which could be a string, a fixed-length or variable-length array, + or just a pointer) that the function interacts with: where it is, how large it is, + how much is initialized, and what the function does with it. + + The appropriate macro for a given buffer can be constructed using the table below. + Just pick the appropriate values from each category, and combine them together + with a leading underscore. Some combinations of values do not make sense as buffer + annotations. Only meaningful annotations can be added to your code; for a list of + these, see the buffer annotation definitions section. + + Only a single buffer annotation should be used for each parameter. + + |------------|------------|---------|--------|----------|----------|---------------| + | Level | Usage | Size | Output | NullTerm | Optional | Parameters | + |------------|------------|---------|--------|----------|----------|---------------| + | <> | <> | <> | <> | _z | <> | <> | + | _deref | _in | _ecount | _full | _nz | _opt | (size) | + | _deref_opt | _out | _bcount | _part | | | (size,length) | + | | _inout | | | | | | + | | | | | | | | + |------------|------------|---------|--------|----------|----------|---------------| + + Level: Describes the buffer pointer's level of indirection from the parameter or + return value 'p'. + + <> : p is the buffer pointer. + _deref : *p is the buffer pointer. p must not be NULL. + _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the rest of + the annotation is ignored. + + Usage: Describes how the function uses the buffer. + + <> : The buffer is not accessed. If used on the return value or with _deref, the + function will provide the buffer, and it will be uninitialized at exit. + Otherwise, the caller must provide the buffer. This should only be used + for alloc and free functions. + _in : The function will only read from the buffer. The caller must provide the + buffer and initialize it. Cannot be used with _deref. + _out : The function will only write to the buffer. If used on the return value or + with _deref, the function will provide the buffer and initialize it. + Otherwise, the caller must provide the buffer, and the function will + initialize it. + _inout : The function may freely read from and write to the buffer. The caller must + provide the buffer and initialize it. If used with _deref, the buffer may + be reallocated by the function. + + Size: Describes the total size of the buffer. This may be less than the space actually + allocated for the buffer, in which case it describes the accessible amount. + + <> : No buffer size is given. If the type specifies the buffer size (such as + with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is one + element long. Must be used with _in, _out, or _inout. + _ecount : The buffer size is an explicit element count. + _bcount : The buffer size is an explicit byte count. + + Output: Describes how much of the buffer will be initialized by the function. For + _inout buffers, this also describes how much is initialized at entry. Omit this + category for _in buffers; they must be fully initialized by the caller. + + <> : The type specifies how much is initialized. For instance, a function initializing + an LPWSTR must NULL-terminate the string. + _full : The function initializes the entire buffer. + _part : The function initializes part of the buffer, and explicitly indicates how much. + + NullTerm: States if the present of a '\0' marks the end of valid elements in the buffer. + _z : A '\0' indicated the end of the buffer + _nz : The buffer may not be null terminated and a '\0' does not indicate the end of the + buffer. + Optional: Describes if the buffer itself is optional. + + <> : The pointer to the buffer must not be NULL. + _opt : The pointer to the buffer might be NULL. It will be checked before being dereferenced. + + Parameters: Gives explicit counts for the size and length of the buffer. + + <> : There is no explicit count. Use when neither _ecount nor _bcount is used. + (size) : Only the buffer's total size is given. Use with _ecount or _bcount but not _part. + (size,length) : The buffer's total size and initialized length are given. Use with _ecount_part + and _bcount_part. + + ------------------------------------------------------------------------------- + Buffer Annotation Examples + + LWSTDAPI_(BOOL) StrToIntExA( + LPCSTR pszString, -- No annotation required, const implies __in. + DWORD dwFlags, + __out int *piRet -- A pointer whose dereference will be filled in. + ); + + void MyPaintingFunction( + __in HWND hwndControl, -- An initialized read-only parameter. + __in_opt HDC hdcOptional, -- An initialized read-only parameter that might be NULL. + __inout IPropertyStore *ppsStore -- An initialized parameter that may be freely used + -- and modified. + ); + + LWSTDAPI_(BOOL) PathCompactPathExA( + __out_ecount(cchMax) LPSTR pszOut, -- A string buffer with cch elements that will + -- be NULL terminated on exit. + LPCSTR pszSrc, -- No annotation required, const implies __in. + UINT cchMax, + DWORD dwFlags + ); + + HRESULT SHLocalAllocBytes( + size_t cb, + __deref_bcount(cb) T **ppv -- A pointer whose dereference will be set to an + -- uninitialized buffer with cb bytes. + ); + + __inout_bcount_full(cb) : A buffer with cb elements that is fully initialized at + entry and exit, and may be written to by this function. + + __out_ecount_part(count, *countOut) : A buffer with count elements that will be + partially initialized by this function. The function indicates how much it + initialized by setting *countOut. + + ------------------------------------------------------------------------------- + Advanced Annotations + + Advanced annotations describe behavior that is not expressible with the regular + buffer macros. These may be used either to annotate buffer parameters that involve + complex or conditional behavior, or to enrich existing annotations with additional + information. + + __success(expr) f : + indicates whether function f succeeded or not. If is true at exit, + all the function's guarantees (as given by other annotations) must hold. If + is false at exit, the caller should not expect any of the function's guarantees + to hold. If not used, the function must always satisfy its guarantees. Added + automatically to functions that indicate success in standard ways, such as by + returning an HRESULT. + + __nullterminated p : + Pointer p is a buffer that may be read or written up to and including the first + NULL character or pointer. May be used on typedefs, which marks valid (properly + initialized) instances of that type as being NULL-terminated. + + __nullnullterminated p : + Pointer p is a buffer that may be read or written up to and including the first + sequence of two NULL characters or pointers. May be used on typedefs, which marks + valid instances of that type as being double-NULL terminated. + + __reserved v : + Value v must be 0/NULL, reserved for future use. + + __checkReturn v : + Return value v must not be ignored by callers of this function. + + __typefix(ctype) v : + Value v should be treated as an instance of ctype, rather than its declared type. + + __override f : + Specify C#-style 'override' behaviour for overriding virtual methods. + + __callback f : + Function f can be used as a function pointer. + + __format_string p : + Pointer p is a string that contains % markers in the style of printf. + + __blocksOn(resource) f : + Function f blocks on the resource 'resource'. + + __fallthrough : + Annotates switch statement labels where fall-through is desired, to distinguish + from forgotten break statements. + + ------------------------------------------------------------------------------- + Advanced Annotation Examples + + __success(return == TRUE) LWSTDAPI_(BOOL) + PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) : + pszBuf is only guaranteed to be NULL-terminated when TRUE is returned. + + typedef __nullterminated WCHAR* LPWSTR : Initialized LPWSTRs are NULL-terminated strings. + + __out_ecount(cch) __typefix(LPWSTR) void *psz : psz is a buffer parameter which will be + a NULL-terminated WCHAR string at exit, and which initially contains cch WCHARs. + + ------------------------------------------------------------------------------- +*/ + +#pragma once + +#define __specstrings + +#ifdef __cplusplus +#ifndef __nothrow +# define __nothrow __declspec(nothrow) +#endif +extern "C" { +#else +#ifndef __nothrow +# define __nothrow +#endif +#endif /* #ifdef __cplusplus */ + +/* + ------------------------------------------------------------------------------- + Helper Macro Definitions + + These express behavior common to many of the high-level annotations. + DO NOT USE THESE IN YOUR CODE. + ------------------------------------------------------------------------------- +*/ + +/* +The helper annotations are only understood by the compiler version used by various +defect detection tools. When the regular compiler is running, they are defined into +nothing, and do not affect the compiled code. +*/ + +#if !defined(__midl) && defined(_PREFAST_) + + /* + In the primitive __declspec("SAL_*") annotations "SAL" stands for Standard + Annotation Language. These __declspec("SAL_*") annotations are the + primitives the compiler understands and all high-level SpecString MACROs + will decompose into these primivates. + */ + + #define SPECSTRINGIZE( x ) #x + + /* + __null p + __notnull p + __maybenull p + + Annotates a pointer p. States that pointer p is null. Commonly used + in the negated form __notnull or the possibly null form __maybenull. + */ + + #define __null __declspec("SAL_null") + #define __notnull __declspec("SAL_notnull") + #define __maybenull __declspec("SAL_maybenull") + + /* + __readonly l + __notreadonly l + __mabyereadonly l + + Annotates a location l. States that location l is not modified after + this point. If the annotation is placed on the precondition state of + a function, the restriction only applies until the postcondition state + of the function. __maybereadonly states that the annotated location + may be modified, whereas __notreadonly states that a location must be + modified. + */ + + #define __readonly __declspec("SAL_readonly") + #define __notreadonly __declspec("SAL_notreadonly") + #define __maybereadonly __declspec("SAL_maybereadonly") + + /* + __valid v + __notvalid v + __maybevalid v + + Annotates any value v. States that the value satisfies all properties of + valid values of its type. For example, for a string buffer, valid means + that the buffer pointer is either NULL or points to a NULL-terminated string. + */ + + #define __valid __declspec("SAL_valid") + #define __notvalid __declspec("SAL_notvalid") + #define __maybevalid __declspec("SAL_maybevalid") + + /* + __readableTo(extent) p + + Annotates a buffer pointer p. If the buffer can be read, extent describes + how much of the buffer is readable. For a reader of the buffer, this is + an explicit permission to read up to that amount, rather than a restriction to + read only up to it. + */ + + #define __readableTo(extent) __declspec("SAL_readableTo("SPECSTRINGIZE(extent)")") + + /* + + __elem_readableTo(size) + + Annotates a buffer pointer p as being readable to size elements. + */ + + #define __elem_readableTo(size) __declspec("SAL_readableTo(elementCount("SPECSTRINGIZE(size)"))") + + /* + __byte_readableTo(size) + + Annotates a buffer pointer p as being readable to size bytes. + */ + #define __byte_readableTo(size) __declspec("SAL_readableTo(byteCount("SPECSTRINGIZE(size)"))") + + /* + __writableTo(extent) p + + Annotates a buffer pointer p. If the buffer can be modified, extent + describes how much of the buffer is writable (usually the allocation + size). For a writer of the buffer, this is an explicit permission to + write up to that amount, rather than a restriction to write only up to it. + */ + #define __writableTo(size) __declspec("SAL_writableTo("SPECSTRINGIZE(size)")") + + /* + __elem_writableTo(size) + + Annotates a buffer pointer p as being writable to size elements. + */ + #define __elem_writableTo(size) __declspec("SAL_writableTo(elementCount("SPECSTRINGIZE(size)"))") + + /* + __byte_writableTo(size) + + Annotates a buffer pointer p as being writable to size bytes. + */ + #define __byte_writableTo(size) __declspec("SAL_writableTo(byteCount("SPECSTRINGIZE(size)"))") + + /* + __deref p + + Annotates a pointer p. The next annotation applies one dereference down + in the type. If readableTo(p, size) then the next annotation applies to + all elements *(p+i) for which i satisfies the size. If p is a pointer + to a struct, the next annotation applies to all fields of the struct. + */ + #define __deref __declspec("SAL_deref") + + /* + __pre __next_annotation + + The next annotation applies in the precondition state + */ + #define __pre __declspec("SAL_pre") + + /* + __post __next_annotation + + The next annotation applies in the postcondition state + */ + #define __post __declspec("SAL_post") + + /* + __precond() + + When is true, the next annotation applies in the precondition state + (currently not enabled) + */ + #define __precond(expr) __pre + + /* + __postcond() + + When is true, the next annotation applies in the postcondition state + (currently not enabled) + */ + #define __postcond(expr) __post + + /* + __exceptthat + + Given a set of annotations Q containing __exceptthat maybeP, the effect of + the except clause is to erase any P or notP annotations (explicit or + implied) within Q at the same level of dereferencing that the except + clause appears, and to replace it with maybeP. + + Example 1: __valid __exceptthat __maybenull on a pointer p means that the + pointer may be null, and is otherwise valid, thus overriding + the implicit notnull annotation implied by __valid on + pointers. + + Example 2: __valid __deref __exceptthat __maybenull on an int **p means + that p is not null (implied by valid), but the elements + pointed to by p could be null, and are otherwise valid. + */ + #define __exceptthat __declspec("SAL_except") + #define __execeptthat __exceptthat + + /* + _refparam + + Added to all out parameter macros to indicate that they are all reference + parameters. + */ + #define __refparam __deref __notreadonly + + /* + __inner_* + + Helper macros that directly correspond to certain high-level annotations. + + */ + + /* + Macros to classify the entrypoints and indicate their category. + + Pre-defined control point categories include: RPC, LPC, DeviceDriver, UserToKernel, ISAPI, COM. + + */ + #define __inner_control_entrypoint(category) __declspec("SAL_entrypoint(controlEntry, "SPECSTRINGIZE(category)")") + + /* + Pre-defined data entry point categories include: Registry, File, Network. + */ + #define __inner_data_entrypoint(category) __declspec("SAL_entrypoint(dataEntry, "SPECSTRINGIZE(category)")") + + #define __inner_success(expr) __declspec("SAL_success("SPECSTRINGIZE(expr)")") + #define __inner_checkReturn __declspec("SAL_checkReturn") + #define __inner_typefix(ctype) __declspec("SAL_typefix("SPECSTRINGIZE(ctype)")") + #define __inner_override __declspec("__override") + #define __inner_callback __declspec("__callback") + #define __inner_blocksOn(resource) __declspec("SAL_blocksOn("SPECSTRINGIZE(resource)")") + #define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {} + #define __inner_fallthrough __FallThrough(); + +#else + #define __null + #define __notnull + #define __maybenull + #define __readonly + #define __notreadonly + #define __maybereadonly + #define __valid + #define __notvalid + #define __maybevalid + #define __readableTo(extent) + #define __elem_readableTo(size) + #define __byte_readableTo(size) + #define __writableTo(size) + #define __elem_writableTo(size) + #define __byte_writableTo(size) + #define __deref + #define __pre + #define __post + #define __precond(expr) + #define __postcond(expr) + #define __exceptthat + #define __execeptthat + #define __inner_success(expr) + #define __inner_checkReturn + #define __inner_typefix(ctype) + #define __inner_override + #define __inner_callback + #define __inner_blocksOn(resource) + #define __inner_fallthrough_dec + #define __inner_fallthrough + #define __refparam + #define __inner_control_entrypoint(category) + #define __inner_data_entrypoint(category) +#endif /* #if !defined(__midl) && defined(_PREFAST_) */ + +/* +------------------------------------------------------------------------------- +Buffer Annotation Definitions + +Any of these may be used to directly annotate functions, but only one should +be used for each parameter. To determine which annotation to use for a given +buffer, use the table in the buffer annotations section. +------------------------------------------------------------------------------- +*/ + +#define __ecount(size) __notnull __elem_writableTo(size) +#define __bcount(size) __notnull __byte_writableTo(size) +#define __in __pre __valid __pre __deref __readonly +#define __in_ecount(size) __in __pre __elem_readableTo(size) +#define __in_bcount(size) __in __pre __byte_readableTo(size) +#define __in_z __in __pre __nullterminated +#define __in_ecount_z(size) __in_ecount(size) __pre __nullterminated +#define __in_bcount_z(size) __in_bcount(size) __pre __nullterminated +#define __in_nz __in +#define __in_ecount_nz(size) __in_ecount(size) +#define __in_bcount_nz(size) __in_bcount(size) +#define __out __ecount(1) __post __valid __refparam +#define __out_ecount(size) __ecount(size) __post __valid __refparam +#define __out_bcount(size) __bcount(size) __post __valid __refparam +#define __out_ecount_part(size,length) __out_ecount(size) __post __elem_readableTo(length) +#define __out_bcount_part(size,length) __out_bcount(size) __post __byte_readableTo(length) +#define __out_ecount_full(size) __out_ecount_part(size,size) +#define __out_bcount_full(size) __out_bcount_part(size,size) +#define __out_z __post __valid __refparam __post __nullterminated +#define __out_z_opt __post __valid __refparam __post __nullterminated __exceptthat __maybenull +#define __out_ecount_z(size) __ecount(size) __post __valid __refparam __post __nullterminated +#define __out_bcount_z(size) __bcount(size) __post __valid __refparam __post __nullterminated +#define __out_ecount_part_z(size,length) __out_ecount_part(size,length) __post __nullterminated +#define __out_bcount_part_z(size,length) __out_bcount_part(size,length) __post __nullterminated +#define __out_ecount_full_z(size) __out_ecount_full(size) __post __nullterminated +#define __out_bcount_full_z(size) __out_bcount_full(size) __post __nullterminated +#define __out_nz __post __valid __refparam __post +#define __out_nz_opt __post __valid __refparam __post __exceptthat __maybenull +#define __out_ecount_nz(size) __ecount(size) __post __valid __refparam +#define __out_bcount_nz(size) __bcount(size) __post __valid __refparam +#define __inout __pre __valid __post __valid __refparam +#define __inout_ecount(size) __out_ecount(size) __pre __valid +#define __inout_bcount(size) __out_bcount(size) __pre __valid +#define __inout_ecount_part(size,length) __out_ecount_part(size,length) __pre __valid __pre __elem_readableTo(length) +#define __inout_bcount_part(size,length) __out_bcount_part(size,length) __pre __valid __pre __byte_readableTo(length) +#define __inout_ecount_full(size) __inout_ecount_part(size,size) +#define __inout_bcount_full(size) __inout_bcount_part(size,size) +#define __inout_z __inout __pre __nullterminated __post __nullterminated +#define __inout_ecount_z(size) __inout_ecount(size) __pre __nullterminated __post __nullterminated +#define __inout_bcount_z(size) __inout_bcount(size) __pre __nullterminated __post __nullterminated +#define __inout_nz __inout +#define __inout_ecount_nz(size) __inout_ecount(size) +#define __inout_bcount_nz(size) __inout_bcount(size) +#define __ecount_opt(size) __ecount(size) __exceptthat __maybenull +#define __bcount_opt(size) __bcount(size) __exceptthat __maybenull +#define __in_opt __in __exceptthat __maybenull +#define __in_ecount_opt(size) __in_ecount(size) __exceptthat __maybenull +#define __in_bcount_opt(size) __in_bcount(size) __exceptthat __maybenull +#define __in_z_opt __in_opt __pre __nullterminated +#define __in_ecount_z_opt(size) __in_ecount_opt(size) __pre __nullterminated +#define __in_bcount_z_opt(size) __in_bcount_opt(size) __pre __nullterminated +#define __in_nz_opt __in_opt +#define __in_ecount_nz_opt(size) __in_ecount_opt(size) +#define __in_bcount_nz_opt(size) __in_bcount_opt(size) +#define __out_opt __out __exceptthat __maybenull +#define __out_ecount_opt(size) __out_ecount(size) __exceptthat __maybenull +#define __out_bcount_opt(size) __out_bcount(size) __exceptthat __maybenull +#define __out_ecount_part_opt(size,length) __out_ecount_part(size,length) __exceptthat __maybenull +#define __out_bcount_part_opt(size,length) __out_bcount_part(size,length) __exceptthat __maybenull +#define __out_ecount_full_opt(size) __out_ecount_full(size) __exceptthat __maybenull +#define __out_bcount_full_opt(size) __out_bcount_full(size) __exceptthat __maybenull +#define __out_ecount_z_opt(size) __out_ecount_opt(size) __post __nullterminated +#define __out_bcount_z_opt(size) __out_bcount_opt(size) __post __nullterminated +#define __out_ecount_part_z_opt(size,length) __out_ecount_part_opt(size,length) __post __nullterminated +#define __out_bcount_part_z_opt(size,length) __out_bcount_part_opt(size,length) __post __nullterminated +#define __out_ecount_full_z_opt(size) __out_ecount_full_opt(size) __post __nullterminated +#define __out_bcount_full_z_opt(size) __out_bcount_full_opt(size) __post __nullterminated +#define __out_ecount_nz_opt(size) __out_ecount_opt(size) __post __nullterminated +#define __out_bcount_nz_opt(size) __out_bcount_opt(size) __post __nullterminated +#define __inout_opt __inout __exceptthat __maybenull +#define __inout_ecount_opt(size) __inout_ecount(size) __exceptthat __maybenull +#define __inout_bcount_opt(size) __inout_bcount(size) __exceptthat __maybenull +#define __inout_ecount_part_opt(size,length) __inout_ecount_part(size,length) __exceptthat __maybenull +#define __inout_bcount_part_opt(size,length) __inout_bcount_part(size,length) __exceptthat __maybenull +#define __inout_ecount_full_opt(size) __inout_ecount_full(size) __exceptthat __maybenull +#define __inout_bcount_full_opt(size) __inout_bcount_full(size) __exceptthat __maybenull +#define __inout_z_opt __inout_opt __pre __nullterminated __post __nullterminated +#define __inout_ecount_z_opt(size) __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated +#define __inout_ecount_z_opt(size) __inout_ecount_opt(size) __pre __nullterminated __post __nullterminated +#define __inout_bcount_z_opt(size) __inout_bcount_opt(size) +#define __inout_nz_opt __inout_opt +#define __inout_ecount_nz_opt(size) __inout_ecount_opt(size) +#define __inout_bcount_nz_opt(size) __inout_bcount_opt(size) +#define __deref_ecount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __elem_writableTo(size) +#define __deref_bcount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __byte_writableTo(size) +#define __deref_out __deref_ecount(1) __post __deref __valid __refparam +#define __deref_out_ecount(size) __deref_ecount(size) __post __deref __valid __refparam +#define __deref_out_bcount(size) __deref_bcount(size) __post __deref __valid __refparam +#define __deref_out_ecount_part(size,length) __deref_out_ecount(size) __post __deref __elem_readableTo(length) +#define __deref_out_bcount_part(size,length) __deref_out_bcount(size) __post __deref __byte_readableTo(length) +#define __deref_out_ecount_full(size) __deref_out_ecount_part(size,size) +#define __deref_out_bcount_full(size) __deref_out_bcount_part(size,size) +#define __deref_out_z __post __deref __valid __refparam __post __deref __nullterminated +#define __deref_out_ecount_z(size) __deref_out_ecount(size) __post __deref __nullterminated +#define __deref_out_bcount_z(size) __deref_out_ecount(size) __post __deref __nullterminated +#define __deref_out_nz __deref_out +#define __deref_out_ecount_nz(size) __deref_out_ecount(size) +#define __deref_out_bcount_nz(size) __deref_out_ecount(size) +#define __deref_inout __notnull __elem_readableTo(1) __pre __deref __valid __post __deref __valid __refparam +#define __deref_inout_z __deref_inout __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_inout_ecount(size) __deref_inout __pre __deref __elem_writableTo(size) __post __deref __elem_writableTo(size) +#define __deref_inout_bcount(size) __deref_inout __pre __deref __byte_writableTo(size) __post __deref __byte_writableTo(size) +#define __deref_inout_ecount_part(size,length) __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length) +#define __deref_inout_bcount_part(size,length) __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length) +#define __deref_inout_ecount_full(size) __deref_inout_ecount_part(size,size) +#define __deref_inout_bcount_full(size) __deref_inout_bcount_part(size,size) +#define __deref_inout_z __deref_inout __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_inout_ecount_z(size) __deref_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_inout_bcount_z(size) __deref_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_inout_nz __deref_inout +#define __deref_inout_ecount_nz(size) __deref_inout_ecount(size) +#define __deref_inout_bcount_nz(size) __deref_inout_ecount(size) +#define __deref_ecount_opt(size) __deref_ecount(size) __post __deref __exceptthat __maybenull +#define __deref_bcount_opt(size) __deref_bcount(size) __post __deref __exceptthat __maybenull +#define __deref_out_opt __deref_out __post __deref __exceptthat __maybenull +#define __deref_out_ecount_opt(size) __deref_out_ecount(size) __post __deref __exceptthat __maybenull +#define __deref_out_bcount_opt(size) __deref_out_bcount(size) __post __deref __exceptthat __maybenull +#define __deref_out_ecount_part_opt(size,length) __deref_out_ecount_part(size,length) __post __deref __exceptthat __maybenull +#define __deref_out_bcount_part_opt(size,length) __deref_out_bcount_part(size,length) __post __deref __exceptthat __maybenull +#define __deref_out_ecount_full_opt(size) __deref_out_ecount_full(size) __post __deref __exceptthat __maybenull +#define __deref_out_bcount_full_opt(size) __deref_out_bcount_full(size) __post __deref __exceptthat __maybenull +#define __deref_out_z_opt __post __deref __valid __refparam __execeptthat __maybenull __post __deref __nullterminated +#define __deref_out_ecount_z_opt(size) __deref_out_ecount_opt(size) __post __deref __nullterminated +#define __deref_out_bcount_z_opt(size) __deref_out_bcount_opt(size) __post __deref __nullterminated +#define __deref_out_nz_opt __deref_out_opt +#define __deref_out_ecount_nz_opt(size) __deref_out_ecount_opt(size) +#define __deref_out_bcount_nz_opt(size) __deref_out_bcount_opt(size) +#define __deref_inout_opt __deref_inout __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#define __deref_inout_ecount_opt(size) __deref_inout_ecount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#define __deref_inout_bcount_opt(size) __deref_inout_bcount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#define __deref_inout_ecount_part_opt(size,length) __deref_inout_ecount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#define __deref_inout_bcount_part_opt(size,length) __deref_inout_bcount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#define __deref_inout_ecount_full_opt(size) __deref_inout_ecount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#define __deref_inout_bcount_full_opt(size) __deref_inout_bcount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#define __deref_inout_z_opt __deref_inout_opt __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_inout_ecount_z_opt(size) __deref_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_inout_bcount_z_opt(size) __deref_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_inout_nz_opt __deref_inout_opt +#define __deref_inout_ecount_nz_opt(size) __deref_inout_ecount_opt(size) +#define __deref_inout_bcount_nz_opt(size) __deref_inout_bcount_opt(size) +#define __deref_opt_ecount(size) __deref_ecount(size) __exceptthat __maybenull +#define __deref_opt_bcount(size) __deref_bcount(size) __exceptthat __maybenull +#define __deref_opt_out __deref_out __exceptthat __maybenull +#define __deref_opt_out_z __deref_opt_out __post __deref __nullterminated +#define __deref_opt_out_ecount(size) __deref_out_ecount(size) __exceptthat __maybenull +#define __deref_opt_out_bcount(size) __deref_out_bcount(size) __exceptthat __maybenull +#define __deref_opt_out_ecount_part(size,length) __deref_out_ecount_part(size,length) __exceptthat __maybenull +#define __deref_opt_out_bcount_part(size,length) __deref_out_bcount_part(size,length) __exceptthat __maybenull +#define __deref_opt_out_ecount_full(size) __deref_out_ecount_full(size) __exceptthat __maybenull +#define __deref_opt_out_bcount_full(size) __deref_out_bcount_full(size) __exceptthat __maybenull +#define __deref_opt_inout __deref_inout __exceptthat __maybenull +#define __deref_opt_inout_ecount(size) __deref_inout_ecount(size) __exceptthat __maybenull +#define __deref_opt_inout_bcount(size) __deref_inout_bcount(size) __exceptthat __maybenull +#define __deref_opt_inout_ecount_part(size,length) __deref_inout_ecount_part(size,length) __exceptthat __maybenull +#define __deref_opt_inout_bcount_part(size,length) __deref_inout_bcount_part(size,length) __exceptthat __maybenull +#define __deref_opt_inout_ecount_full(size) __deref_inout_ecount_full(size) __exceptthat __maybenull +#define __deref_opt_inout_bcount_full(size) __deref_inout_bcount_full(size) __exceptthat __maybenull +#define __deref_opt_inout_z __deref_opt_inout __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_opt_inout_ecount_z(size) __deref_opt_inout_ecount(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_opt_inout_bcount_z(size) __deref_opt_inout_bcount(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_opt_inout_nz __deref_opt_inout +#define __deref_opt_inout_ecount_nz(size) __deref_opt_inout_ecount(size) +#define __deref_opt_inout_bcount_nz(size) __deref_opt_inout_bcount(size) +#define __deref_opt_ecount_opt(size) __deref_ecount_opt(size) __exceptthat __maybenull +#define __deref_opt_bcount_opt(size) __deref_bcount_opt(size) __exceptthat __maybenull +#define __deref_opt_out_opt __deref_out_opt __exceptthat __maybenull +#define __deref_opt_out_ecount_opt(size) __deref_out_ecount_opt(size) __exceptthat __maybenull +#define __deref_opt_out_bcount_opt(size) __deref_out_bcount_opt(size) __exceptthat __maybenull +#define __deref_opt_out_ecount_part_opt(size,length) __deref_out_ecount_part_opt(size,length) __exceptthat __maybenull +#define __deref_opt_out_bcount_part_opt(size,length) __deref_out_bcount_part_opt(size,length) __exceptthat __maybenull +#define __deref_opt_out_ecount_full_opt(size) __deref_out_ecount_full_opt(size) __exceptthat __maybenull +#define __deref_opt_out_bcount_full_opt(size) __deref_out_bcount_full_opt(size) __exceptthat __maybenull +#define __deref_opt_out_z_opt __post __deref __valid __refparam __exceptthat __maybenull __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull __post __deref __nullterminated +#define __deref_opt_out_ecount_z_opt(size) __deref_opt_out_ecount_opt(size) __post __deref __nullterminated +#define __deref_opt_out_bcount_z_opt(size) __deref_opt_out_bcount_opt(size) __post __deref __nullterminated +#define __deref_opt_out_nz_opt __deref_opt_out_opt +#define __deref_opt_out_ecount_nz_opt(size) __deref_opt_out_ecount_opt(size) +#define __deref_opt_out_bcount_nz_opt(size) __deref_opt_out_bcount_opt(size) +#define __deref_opt_inout_opt __deref_inout_opt __exceptthat __maybenull +#define __deref_opt_inout_ecount_opt(size) __deref_inout_ecount_opt(size) __exceptthat __maybenull +#define __deref_opt_inout_bcount_opt(size) __deref_inout_bcount_opt(size) __exceptthat __maybenull +#define __deref_opt_inout_ecount_part_opt(size,length) __deref_inout_ecount_part_opt(size,length) __exceptthat __maybenull +#define __deref_opt_inout_bcount_part_opt(size,length) __deref_inout_bcount_part_opt(size,length) __exceptthat __maybenull +#define __deref_opt_inout_ecount_full_opt(size) __deref_inout_ecount_full_opt(size) __exceptthat __maybenull +#define __deref_opt_inout_bcount_full_opt(size) __deref_inout_bcount_full_opt(size) __exceptthat __maybenull +#define __deref_opt_inout_z_opt __deref_opt_inout_opt __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_opt_inout_ecount_z_opt(size) __deref_opt_inout_ecount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_opt_inout_bcount_z_opt(size) __deref_opt_inout_bcount_opt(size) __pre __deref __nullterminated __post __deref __nullterminated +#define __deref_opt_inout_nz_opt __deref_opt_inout_opt +#define __deref_opt_inout_ecount_nz_opt(size) __deref_opt_inout_ecount_opt(size) +#define __deref_opt_inout_bcount_nz_opt(size) __deref_opt_inout_bcount_opt(size) + +/* +------------------------------------------------------------------------------- +Advanced Annotation Definitions + +Any of these may be used to directly annotate functions, and may be used in +combination with each other or with regular buffer macros. For an explanation +of each annotation, see the advanced annotations section. +------------------------------------------------------------------------------- +*/ + +#define __success(expr) __inner_success(expr) +#define __nullterminated __readableTo(sentinel(0)) +#define __nullnullterminated +#define __reserved __pre __null +#define __checkReturn __inner_checkReturn +#define __typefix(ctype) __inner_typefix(ctype) +#define __override __inner_override +#define __callback __inner_callback +#define __format_string +#define __blocksOn(resource) __inner_blocksOn(resource) +#define __control_entrypoint(category) __inner_control_entrypoint(category) +#define __data_entrypoint(category) __inner_data_entrypoint(category) + +#ifndef __fallthrough + __inner_fallthrough_dec + #define __fallthrough __inner_fallthrough +#endif + +#ifndef __analysis_assume +#ifdef _PREFAST_ +#define __analysis_assume(expr) __assume(expr) +#else +#define __analysis_assume(expr) +#endif +#endif + +#ifdef __cplusplus +} +#endif + + diff --git a/core/src/fxge/Microsoft SDK/include/specstrings.h b/core/src/fxge/Microsoft SDK/include/specstrings.h index 00cdd332ec..27a589a985 100644 --- a/core/src/fxge/Microsoft SDK/include/specstrings.h +++ b/core/src/fxge/Microsoft SDK/include/specstrings.h @@ -1,978 +1,978 @@ -/***************************************************************\ -* * -* SpecStrings.h - markers for documenting the semantics of APIs * -* * -* Version 1.0 * -* * -* Copyright (c) Microsoft Corporation. All rights reserved. * -* * -\***************************************************************/ - -// @@BEGIN_DDKSPLIT - -// ------------------------------------------------------------------------------- -// Introduction -// -// SpecStrings.h provides a set of annotations to describe how a function uses its -// parameters - the assumptions it makes about them, and the guarantees it makes -// upon finishing. -// -// Annotations may be placed before either a function parameter's type or its return -// type, and describe the function's behavior regarding the parameter or return value. -// There are two classes of annotations: buffer annotations and advanced annotations. -// Buffer annotations describe how functions use their pointer parameters, and -// advanced annotations either describe complex/unusual buffer behavior, or provide -// additional information about a parameter that is not otherwise expressible. -// -// ------------------------------------------------------------------------------- -// Buffer Annotations -// -// The most important annotations in SpecStrings.h provide a consistent way to annotate -// buffer parameters or return values for a function. Each of these annotations describes -// a single buffer (which could be a string, a fixed-length or variable-length array, -// or just a pointer) that the function interacts with: where it is, how large it is, -// how much is initialized, and what the function does with it. -// -// The appropriate macro for a given buffer can be constructed using the table below. -// Just pick the appropriate values from each category, and combine them together -// with a leading underscore. Some combinations of values do not make sense as buffer -// annotations. Only meaningful annotations can be added to your code; for a list of -// these, see the buffer annotation definitions section. -// -// Only a single buffer annotation should be used for each parameter. -// -// |------------|------------|---------|--------|----------|---------------| -// | Level | Usage | Size | Output | Optional | Parameters | -// |------------|------------|---------|--------|----------|---------------| -// | <> | <> | <> | <> | <> | <> | -// | _deref | _in | _ecount | _full | _opt | (size) | -// | _deref_opt | _out | _bcount | _part | | (size,length) | -// | | _inout | | | | | -// | | | | | | | -// |------------|------------|---------|--------|----------|---------------| -// -// Level: Describes the buffer pointer's level of indirection from the parameter or -// return value 'p'. -// -// <> : p is the buffer pointer. -// _deref : *p is the buffer pointer. p must not be NULL. -// _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the rest of -// the annotation is ignored. -// -// Usage: Describes how the function uses the buffer. -// -// <> : The buffer is not accessed. If used on the return value or with _deref, the -// function will provide the buffer, and it will be uninitialized at exit. -// Otherwise, the caller must provide the buffer. This should only be used -// for alloc and free functions. -// _in : The function will only read from the buffer. The caller must provide the -// buffer and initialize it. -// _out : The function will only write to the buffer. If used on the return value or -// with _deref, the function will provide the buffer and initialize it. -// Otherwise, the caller must provide the buffer, and the function will -// initialize it. -// _inout : The function may freely read from and write to the buffer. The caller must -// provide the buffer and initialize it. If used with _deref, the buffer may -// be reallocated by the function. -// -// Size: Describes the total size of the buffer. This may be less than the space actually -// allocated for the buffer, in which case it describes the accessible amount. -// -// <> : No buffer size is given. If the type specifies the buffer size (such as -// with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is one -// element long. Must be used with _in, _out, or _inout. -// _ecount : The buffer size is an explicit element count. -// _bcount : The buffer size is an explicit byte count. -// -// Output: Describes how much of the buffer will be initialized by the function. For -// _inout buffers, this also describes how much is initialized at entry. Omit this -// category for _in buffers; they must be fully initialized by the caller. -// -// <> : The type specifies how much is initialized. For instance, a function initializing -// an LPWSTR must NULL-terminate the string. -// _full : The function initializes the entire buffer. -// _part : The function initializes part of the buffer, and explicitly indicates how much. -// -// Optional: Describes if the buffer itself is optional. -// -// <> : The pointer to the buffer must not be NULL. -// _opt : The pointer to the buffer might be NULL. It will be checked before being dereferenced. -// -// Parameters: Gives explicit counts for the size and length of the buffer. -// -// <> : There is no explicit count. Use when neither _ecount nor _bcount is used. -// (size) : Only the buffer's total size is given. Use with _ecount or _bcount but not _part. -// (size,length) : The buffer's total size and initialized length are given. Use with _ecount_part -// and _bcount_part. -// -// ------------------------------------------------------------------------------- -// Buffer Annotation Examples -// -// LWSTDAPI_(BOOL) StrToIntExA( -// LPCSTR pszString, // No annotation required, const implies __in. -// DWORD dwFlags, -// __out int *piRet // A pointer whose dereference will be filled in. -// ); -// -// void MyPaintingFunction( -// __in HWND hwndControl, // An initialized read-only parameter. -// __in_opt HDC hdcOptional, // An initialized read-only parameter that might be NULL. -// __inout IPropertyStore *ppsStore // An initialized parameter that may be freely used -// // and modified. -// ); -// -// LWSTDAPI_(BOOL) PathCompactPathExA( -// __out_ecount(cchMax) LPSTR pszOut, // A string buffer with cch elements that will -// // be NULL terminated on exit. -// LPCSTR pszSrc, // No annotation required, const implies __in. -// UINT cchMax, -// DWORD dwFlags -// ); -// -// HRESULT SHLocalAllocBytes( -// size_t cb, -// __deref_bcount(cb) T **ppv // A pointer whose dereference will be set to an -// // uninitialized buffer with cb bytes. -// ); -// -// __inout_bcount_full(cb) : A buffer with cb elements that is fully initialized at -// entry and exit, and may be written to by this function. -// -// __out_ecount_part(count, *countOut) : A buffer with count elements that will be -// partially initialized by this function. The function indicates how much it -// initialized by setting *countOut. -// -// ------------------------------------------------------------------------------- -// Advanced Annotations -// -// Advanced annotations describe behavior that is not expressible with the regular -// buffer macros. These may be used either to annotate buffer parameters that involve -// complex or conditional behavior, or to enrich existing annotations with additional -// information. -// -// __success(expr) f : -// indicates whether function f succeeded or not. If is true at exit, -// all the function's guarantees (as given by other annotations) must hold. If -// is false at exit, the caller should not expect any of the function's guarantees -// to hold. If not used, the function must always satisfy its guarantees. Added -// automatically to functions that indicate success in standard ways, such as by -// returning an HRESULT. -// -// __out_awcount(expr, size) p : -// Pointer p is a buffer whose size may be given in either bytes or elements. If -// is true, this acts like __out_bcount. If is false, this acts -// like __out_ecount. This should only be used to annotate old APIs. -// -// __in_awcount(expr, size) p : -// Pointer p is a buffer whose size may be given in either bytes or elements. If -// is true, this acts like __in_bcount. If is false, this acts -// like __in_ecount. This should only be used to annotate old APIs. -// -// __nullterminated p : -// Pointer p is a buffer that may be read or written up to and including the first -// NULL character or pointer. May be used on typedefs, which marks valid (properly -// initialized) instances of that type as being NULL-terminated. -// -// __nullnullterminated p : -// Pointer p is a buffer that may be read or written up to and including the first -// sequence of two NULL characters or pointers. May be used on typedefs, which marks -// valid instances of that type as being double-NULL terminated. -// -// __reserved v : -// Value v must be 0/NULL, reserved for future use. -// -// __checkReturn v : -// Return value v must not be ignored by callers of this function. -// -// __typefix(ctype) v : -// Value v should be treated as an instance of ctype, rather than its declared type. -// -// __override f : -// Specify C#-style 'override' behaviour for overriding virtual methods. -// -// __callback f : -// Function f can be used as a function pointer. -// -// __format_string p : -// Pointer p is a string that contains % markers in the style of printf. -// -// __blocksOn(resource) f : -// Function f blocks on the resource 'resource'. -// -// __fallthrough : -// Annotates switch statement labels where fall-through is desired, to distinguish -// from forgotten break statements. -// -// ------------------------------------------------------------------------------- -// Advanced Annotation Examples -// -// __success(return == TRUE) LWSTDAPI_(BOOL) -// PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) : -// pszBuf is only guaranteed to be NULL-terminated when TRUE is returned. -// -// typedef __nullterminated WCHAR* LPWSTR : Initialized LPWSTRs are NULL-terminated strings. -// -// __out_ecount(cch) __typefix(LPWSTR) void *psz : psz is a buffer parameter which will be -// a NULL-terminated WCHAR string at exit, and which initially contains cch WCHARs. -// -// ------------------------------------------------------------------------------- - -// @@END_DDKSPLIT - -#if _MSC_VER > 1000 -#pragma once -#endif // #if _MSC_VER > 1000 - -#define __specstrings - -#ifdef __cplusplus -#ifndef __nothrow -# define __nothrow __declspec(nothrow) -#endif -extern "C" { -#else -#ifndef __nothrow -# define __nothrow -#endif -#endif // #ifdef __cplusplus - -// @@BEGIN_DDKSPLIT - -// ------------------------------------------------------------------------------- -// Helper Macro Definitions -// -// These express behavior common to many of the high-level annotations. -// DO NOT USE THESE IN YOUR CODE. -// ------------------------------------------------------------------------------- - -// The helper annotations are only understood by the compiler version used by various -// defect detection tools. When the regular compiler is running, they are defined into -// nothing, and do not affect the compiled code. -#if (_MSC_VER >= 1000) && !defined(MIDL_PASS) && defined(_PREFAST_) - - // In the primitive __declspec("SAL_*") annotations "SAL" stands for Standard - // Annotation Language. These __declspec("SAL_*") annotations are the - // primitives the compiler understands and all high-level SpecString MACROs - // will decompose into these primivates. - - #define SPECSTRINGIZE( x ) #x - - // - // __null p - // __notnull p - // __maybenull p - // - // Annotates a pointer p. States that pointer p is null. Commonly used - // in the negated form __notnull or the possibly null form __maybenull. - // - #define __null __declspec("SAL_null") - #define __notnull __declspec("SAL_notnull") - #define __maybenull __declspec("SAL_maybenull") - - // - // __readonly l - // __notreadonly l - // __mabyereadonly l - // - // Annotates a location l. States that location l is not modified after - // this point. If the annotation is placed on the precondition state of - // a function, the restriction only applies until the postcondition state - // of the function. __maybereadonly states that the annotated location - // may be modified, whereas __notreadonly states that a location must be - // modified. - // - #define __readonly __declspec("SAL_readonly") - #define __notreadonly __declspec("SAL_notreadonly") - #define __maybereadonly __declspec("SAL_maybereadonly") - - // - // __valid v - // __notvalid v - // __maybevalid v - // - // Annotates any value v. States that the value satisfies all properties of - // valid values of its type. For example, for a string buffer, valid means - // that the buffer pointer is either NULL or points to a NULL-terminated string. - // - #define __valid __declspec("SAL_valid") - #define __notvalid __declspec("SAL_notvalid") - #define __maybevalid __declspec("SAL_maybevalid") - - // - // __readableTo(extent) p - // - // Annotates a buffer pointer p. If the buffer can be read, extent describes - // how much of the buffer is readable. For a reader of the buffer, this is - // an explicit permission to read up to that amount, rather than a restriction to - // read only up to it. - // - #define __readableTo(extent) __declspec("SAL_readableTo("SPECSTRINGIZE(extent)")") - - // - // __elem_readableTo(size) - // - // Annotates a buffer pointer p as being readable to size elements. - // - #define __elem_readableTo(size) __declspec("SAL_readableTo(elementCount("SPECSTRINGIZE(size)"))") - - // - // __byte_readableTo(size) - // - // Annotates a buffer pointer p as being readable to size bytes. - // - #define __byte_readableTo(size) __declspec("SAL_readableTo(byteCount("SPECSTRINGIZE(size)"))") - - // - // __writableTo(extent) p - // - // Annotates a buffer pointer p. If the buffer can be modified, extent - // describes how much of the buffer is writable (usually the allocation - // size). For a writer of the buffer, this is an explicit permission to - // write up to that amount, rather than a restriction to write only up to it. - // - #define __writableTo(size) __declspec("SAL_writableTo("SPECSTRINGIZE(size)")") - - // - // __elem_writableTo(size) - // - // Annotates a buffer pointer p as being writable to size elements. - // - #define __elem_writableTo(size) __declspec("SAL_writableTo(elementCount("SPECSTRINGIZE(size)"))") - - // - // __byte_writableTo(size) - // - // Annotates a buffer pointer p as being writable to size bytes. - // - #define __byte_writableTo(size) __declspec("SAL_writableTo(byteCount("SPECSTRINGIZE(size)"))") - - // - // __deref p - // - // Annotates a pointer p. The next annotation applies one dereference down - // in the type. If readableTo(p, size) then the next annotation applies to - // all elements *(p+i) for which i satisfies the size. If p is a pointer - // to a struct, the next annotation applies to all fields of the struct. - // - #define __deref __declspec("SAL_deref") - - // - // __pre __next_annotation - // - // The next annotation applies in the precondition state - // - #define __pre __declspec("SAL_pre") - - // - // __post __next_annotation - // - // The next annotation applies in the postcondition state - // - #define __post __declspec("SAL_post") - - // - // __precond() - // - // When is true, the next annotation applies in the precondition state - // (currently not enabled) - // - #define __precond(expr) __pre - - // - // __postcond() - // - // When is true, the next annotation applies in the postcondition state - // (currently not enabled) - // - #define __postcond(expr) __post - - // - // __exceptthat - // - // Given a set of annotations Q containing __exceptthat maybeP, the effect of - // the except clause is to erase any P or notP annotations (explicit or - // implied) within Q at the same level of dereferencing that the except - // clause appears, and to replace it with maybeP. - // - // Example 1: __valid __exceptthat __maybenull on a pointer p means that the - // pointer may be null, and is otherwise valid, thus overriding - // the implicit notnull annotation implied by __valid on - // pointers. - // - // Example 2: __valid __deref __exceptthat __maybenull on an int **p means - // that p is not null (implied by valid), but the elements - // pointed to by p could be null, and are otherwise valid. - // - #define __exceptthat __declspec("SAL_except") - - // - // _refparam - // - // Added to all out parameter macros to indicate that they are all reference - // parameters. - // - #define __refparam __deref __notreadonly - - // - // __inner_* - // - // Helper macros that directly correspond to certain high-level annotations. - // - // - - // Macros to classify the entrypoints and indicate their category. - // - // - // Pre-defined control point categories include: RPC, LPC, DeviceDriver, UserToKernel, ISAPI, COM. - // - #define __inner_control_entrypoint(category) __declspec("SAL_entrypoint(controlEntry, "SPECSTRINGIZE(category)")") - - // - // Pre-defined data entry point categories include: Registry, File, Network. - // - #define __inner_data_entrypoint(category) __declspec("SAL_entrypoint(dataEntry, "SPECSTRINGIZE(category)")") - - #define __inner_success(expr) __declspec("SAL_success("SPECSTRINGIZE(expr)")") - #define __inner_checkReturn __declspec("SAL_checkReturn") - #define __inner_typefix(ctype) __declspec("SAL_typefix("SPECSTRINGIZE(ctype)")") - #define __inner_override __declspec("__override") - #define __inner_callback __declspec("__callback") - #define __inner_blocksOn(resource) __declspec("SAL_blocksOn("SPECSTRINGIZE(resource)")") - #define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {} - #define __inner_fallthrough __FallThrough(); - -#else - -// @@END_DDKSPLIT - -#ifndef __null - #define __null -#endif -#ifndef __notnull - #define __notnull -#endif -#ifndef __maybenull - #define __maybenull -#endif -#ifndef __readonly - #define __readonly -#endif -#ifndef __notreadonly - #define __notreadonly -#endif -#ifndef __maybereadonly - #define __maybereadonly -#endif -#ifndef __valid - #define __valid -#endif -#ifndef __notvalid - #define __notvalid -#endif -#ifndef __maybevalid - #define __maybevalid -#endif -#ifndef __readableTo - #define __readableTo(extent) -#endif -#ifndef __elem_readableTo - #define __elem_readableTo(size) -#endif -#ifndef __byte_readableTo - #define __byte_readableTo(size) -#endif -#ifndef __writableTo - #define __writableTo(size) -#endif -#ifndef __elem_writableTo - #define __elem_writableTo(size) -#endif -#ifndef __byte_writableTo - #define __byte_writableTo(size) -#endif -#ifndef __deref - #define __deref -#endif -#ifndef __pre - #define __pre -#endif -#ifndef __post - #define __post -#endif -#ifndef __precond - #define __precond(expr) -#endif -#ifndef __postcond - #define __postcond(expr) -#endif -#ifndef __exceptthat - #define __exceptthat -#endif -#ifndef __inner_success - #define __inner_success(expr) -#endif -#ifndef __inner_checkReturn - #define __inner_checkReturn -#endif -#ifndef __inner_typefix - #define __inner_typefix(ctype) -#endif -#ifndef __inner_override - #define __inner_override -#endif -#ifndef __inner_callback - #define __inner_callback -#endif -#ifndef __inner_blocksOn - #define __inner_blocksOn(resource) -#endif -#ifndef __inner_fallthrough_dec - #define __inner_fallthrough_dec -#endif -#ifndef __inner_fallthrough - #define __inner_fallthrough -#endif -#ifndef __refparam - #define __refparam -#endif -#ifndef __inner_control_entrypoint - #define __inner_control_entrypoint(category) -#endif -#ifndef __inner_data_entrypoint - #define __inner_data_entrypoint(category) -#endif -// @@BEGIN_DDKSPLIT -#endif // #if (_MSC_VER >= 1000) && !defined(MIDL_PASS) && defined(_PREFAST_) -// ------------------------------------------------------------------------------- -// Buffer Annotation Definitions -// -// Any of these may be used to directly annotate functions, but only one should -// be used for each parameter. To determine which annotation to use for a given -// buffer, use the table in the buffer annotations section. -// ------------------------------------------------------------------------------- -// @@END_DDKSPLIT - -#ifndef __ecount -#define __ecount(size) __notnull __elem_writableTo(size) -#endif -#ifndef __bcount -#define __bcount(size) __notnull __byte_writableTo(size) -#endif -#ifndef __in -#define __in __pre __valid __pre __deref __readonly -#endif -#ifndef __in_ecount -#define __in_ecount(size) __in __pre __elem_readableTo(size) -#endif -#ifndef __in_bcount -#define __in_bcount(size) __in __pre __byte_readableTo(size) -#endif -#ifndef __out -#define __out __ecount(1) __post __valid __refparam -#endif -#ifndef __out_ecount -#define __out_ecount(size) __ecount(size) __post __valid __refparam -#endif -#ifndef __out_bcount -#define __out_bcount(size) __bcount(size) __post __valid __refparam -#endif -#ifndef __out_ecount_part -#define __out_ecount_part(size,length) __out_ecount(size) __post __elem_readableTo(length) -#endif -#ifndef __out_bcount_part -#define __out_bcount_part(size,length) __out_bcount(size) __post __byte_readableTo(length) -#endif -#ifndef __out_ecount_full -#define __out_ecount_full(size) __out_ecount_part(size,size) -#endif -#ifndef __out_bcount_full -#define __out_bcount_full(size) __out_bcount_part(size,size) -#endif -#ifndef __inout -#define __inout __pre __valid __post __valid __refparam -#endif -#ifndef __inout_ecount -#define __inout_ecount(size) __out_ecount(size) __pre __valid -#endif -#ifndef __inout_bcount -#define __inout_bcount(size) __out_bcount(size) __pre __valid -#endif -#ifndef __inout_ecount_part -#define __inout_ecount_part(size,length) __out_ecount_part(size,length) __pre __valid __pre __elem_readableTo(length) -#endif -#ifndef __inout_bcount_part -#define __inout_bcount_part(size,length) __out_bcount_part(size,length) __pre __valid __pre __byte_readableTo(length) -#endif -#ifndef __inout_ecount_full -#define __inout_ecount_full(size) __inout_ecount_part(size,size) -#endif -#ifndef __inout_bcount_full -#define __inout_bcount_full(size) __inout_bcount_part(size,size) -#endif - -#ifndef __ecount_opt -#define __ecount_opt(size) __ecount(size) __exceptthat __maybenull -#endif -#ifndef __bcount_opt -#define __bcount_opt(size) __bcount(size) __exceptthat __maybenull -#endif -#ifndef __in_opt -#define __in_opt __in __exceptthat __maybenull -#endif -#ifndef __in_ecount_opt -#define __in_ecount_opt(size) __in_ecount(size) __exceptthat __maybenull -#endif -#ifndef __in_bcount_opt -#define __in_bcount_opt(size) __in_bcount(size) __exceptthat __maybenull -#endif -#ifndef __out_opt -#define __out_opt __out __exceptthat __maybenull -#endif -#ifndef __out_ecount_opt -#define __out_ecount_opt(size) __out_ecount(size) __exceptthat __maybenull -#endif -#ifndef __out_bcount_opt -#define __out_bcount_opt(size) __out_bcount(size) __exceptthat __maybenull -#endif -#ifndef __out_ecount_part_opt -#define __out_ecount_part_opt(size,length) __out_ecount_part(size,length) __exceptthat __maybenull -#endif -#ifndef __out_bcount_part_opt -#define __out_bcount_part_opt(size,length) __out_bcount_part(size,length) __exceptthat __maybenull -#endif -#ifndef __out_ecount_full_opt -#define __out_ecount_full_opt(size) __out_ecount_full(size) __exceptthat __maybenull -#endif -#ifndef __out_bcount_full_opt -#define __out_bcount_full_opt(size) __out_bcount_full(size) __exceptthat __maybenull -#endif -#ifndef __inout_opt -#define __inout_opt __inout __exceptthat __maybenull -#endif -#ifndef __inout_ecount_opt -#define __inout_ecount_opt(size) __inout_ecount(size) __exceptthat __maybenull -#endif -#ifndef __inout_bcount_opt -#define __inout_bcount_opt(size) __inout_bcount(size) __exceptthat __maybenull -#endif -#ifndef __inout_ecount_part_opt -#define __inout_ecount_part_opt(size,length) __inout_ecount_part(size,length) __exceptthat __maybenull -#endif -#ifndef __inout_bcount_part_opt -#define __inout_bcount_part_opt(size,length) __inout_bcount_part(size,length) __exceptthat __maybenull -#endif -#ifndef __inout_ecount_full_opt -#define __inout_ecount_full_opt(size) __inout_ecount_full(size) __exceptthat __maybenull -#endif -#ifndef __inout_bcount_full_opt -#define __inout_bcount_full_opt(size) __inout_bcount_full(size) __exceptthat __maybenull -#endif - -#ifndef __deref_ecount -#define __deref_ecount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __elem_writableTo(size) -#endif -#ifndef __deref_bcount -#define __deref_bcount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __byte_writableTo(size) -#endif -#ifndef __deref_in -#define __deref_in __in __pre __deref __deref __readonly -#endif -#ifndef __deref_in_ecount -#define __deref_in_ecount(size) __deref_in __pre __deref __elem_readableTo(size) -#endif -#ifndef __deref_in_bcount -#define __deref_in_bcount(size) __deref_in __pre __deref __byte_readableTo(size) -#endif -#ifndef __deref_out -#define __deref_out __deref_ecount(1) __post __deref __valid __refparam -#endif -#ifndef __deref_out_ecount -#define __deref_out_ecount(size) __deref_ecount(size) __post __deref __valid __refparam -#endif -#ifndef __deref_out_bcount -#define __deref_out_bcount(size) __deref_bcount(size) __post __deref __valid __refparam -#endif -#ifndef __deref_out_ecount_part -#define __deref_out_ecount_part(size,length) __deref_out_ecount(size) __post __deref __elem_readableTo(length) -#endif -#ifndef __deref_out_bcount_part -#define __deref_out_bcount_part(size,length) __deref_out_bcount(size) __post __deref __byte_readableTo(length) -#endif -#ifndef __deref_out_ecount_full -#define __deref_out_ecount_full(size) __deref_out_ecount_part(size,size) -#endif -#ifndef __deref_out_bcount_full -#define __deref_out_bcount_full(size) __deref_out_bcount_part(size,size) -#endif -#ifndef __deref_inout -#define __deref_inout __notnull __elem_readableTo(1) __pre __deref __valid __post __deref __valid __refparam -#endif -#ifndef __deref_inout_ecount -#define __deref_inout_ecount(size) __deref_inout __pre __deref __elem_writableTo(size) __post __deref __elem_writableTo(size) -#endif -#ifndef __deref_inout_bcount -#define __deref_inout_bcount(size) __deref_inout __pre __deref __byte_writableTo(size) __post __deref __byte_writableTo(size) -#endif -#ifndef __deref_inout_ecount_part -#define __deref_inout_ecount_part(size,length) __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length) -#endif -#ifndef __deref_inout_bcount_part -#define __deref_inout_bcount_part(size,length) __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length) -#endif -#ifndef __deref_inout_ecount_full -#define __deref_inout_ecount_full(size) __deref_inout_ecount_part(size,size) -#endif -#ifndef __deref_inout_bcount_full -#define __deref_inout_bcount_full(size) __deref_inout_bcount_part(size,size) -#endif - -#ifndef __deref_ecount_opt -#define __deref_ecount_opt(size) __deref_ecount(size) __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_bcount_opt -#define __deref_bcount_opt(size) __deref_bcount(size) __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_in_opt -#define __deref_in_opt __deref_in __pre __deref __exceptthat __maybenull -#endif -#ifndef __deref_in_ecount_opt -#define __deref_in_ecount_opt(size) __deref_in_ecount(size) __pre __deref __exceptthat __maybenull -#endif -#ifndef __deref_in_bcount_opt -#define __deref_in_bcount_opt(size) __deref_in_bcount(size) __pre __deref __exceptthat __maybenull -#endif -#ifndef __deref_out_opt -#define __deref_out_opt __deref_out __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_out_ecount_opt -#define __deref_out_ecount_opt(size) __deref_out_ecount(size) __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_out_bcount_opt -#define __deref_out_bcount_opt(size) __deref_out_bcount(size) __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_out_ecount_part_opt -#define __deref_out_ecount_part_opt(size,length) __deref_out_ecount_part(size,length) __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_out_bcount_part_opt -#define __deref_out_bcount_part_opt(size,length) __deref_out_bcount_part(size,length) __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_out_ecount_full_opt -#define __deref_out_ecount_full_opt(size) __deref_out_ecount_full(size) __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_out_bcount_full_opt -#define __deref_out_bcount_full_opt(size) __deref_out_bcount_full(size) __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_inout_opt -#define __deref_inout_opt __deref_inout __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_inout_ecount_opt -#define __deref_inout_ecount_opt(size) __deref_inout_ecount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_inout_bcount_opt -#define __deref_inout_bcount_opt(size) __deref_inout_bcount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_inout_ecount_part_opt -#define __deref_inout_ecount_part_opt(size,length) __deref_inout_ecount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_inout_bcount_part_opt -#define __deref_inout_bcount_part_opt(size,length) __deref_inout_bcount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_inout_ecount_full_opt -#define __deref_inout_ecount_full_opt(size) __deref_inout_ecount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#endif -#ifndef __deref_inout_bcount_full_opt -#define __deref_inout_bcount_full_opt(size) __deref_inout_bcount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull -#endif - -#ifndef __deref_opt_ecount -#define __deref_opt_ecount(size) __deref_ecount(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_bcount -#define __deref_opt_bcount(size) __deref_bcount(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_in -#define __deref_opt_in __deref_in __exceptthat __maybenull -#endif -#ifndef __deref_opt_in_ecount -#define __deref_opt_in_ecount(size) __deref_in_ecount(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_in_bcount -#define __deref_opt_in_bcount(size) __deref_in_bcount(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out -#define __deref_opt_out __deref_out __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_ecount -#define __deref_opt_out_ecount(size) __deref_out_ecount(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_bcount -#define __deref_opt_out_bcount(size) __deref_out_bcount(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_ecount_part -#define __deref_opt_out_ecount_part(size,length) __deref_out_ecount_part(size,length) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_bcount_part -#define __deref_opt_out_bcount_part(size,length) __deref_out_bcount_part(size,length) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_ecount_full -#define __deref_opt_out_ecount_full(size) __deref_out_ecount_full(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_bcount_full -#define __deref_opt_out_bcount_full(size) __deref_out_bcount_full(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout -#define __deref_opt_inout __deref_inout __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_ecount -#define __deref_opt_inout_ecount(size) __deref_inout_ecount(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_bcount -#define __deref_opt_inout_bcount(size) __deref_inout_bcount(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_ecount_part -#define __deref_opt_inout_ecount_part(size,length) __deref_inout_ecount_part(size,length) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_bcount_part -#define __deref_opt_inout_bcount_part(size,length) __deref_inout_bcount_part(size,length) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_ecount_full -#define __deref_opt_inout_ecount_full(size) __deref_inout_ecount_full(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_bcount_full -#define __deref_opt_inout_bcount_full(size) __deref_inout_bcount_full(size) __exceptthat __maybenull -#endif - -#ifndef __deref_opt_ecount_opt -#define __deref_opt_ecount_opt(size) __deref_ecount_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_bcount_opt -#define __deref_opt_bcount_opt(size) __deref_bcount_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_in_opt -#define __deref_opt_in_opt __deref_in_opt __exceptthat __maybenull -#endif -#ifndef __deref_opt_in_ecount_opt -#define __deref_opt_in_ecount_opt(size) __deref_in_ecount_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_in_bcount_opt -#define __deref_opt_in_bcount_opt(size) __deref_in_bcount_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_opt -#define __deref_opt_out_opt __deref_out_opt __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_ecount_opt -#define __deref_opt_out_ecount_opt(size) __deref_out_ecount_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_bcount_opt -#define __deref_opt_out_bcount_opt(size) __deref_out_bcount_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_ecount_part_opt -#define __deref_opt_out_ecount_part_opt(size,length) __deref_out_ecount_part_opt(size,length) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_bcount_part_opt -#define __deref_opt_out_bcount_part_opt(size,length) __deref_out_bcount_part_opt(size,length) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_ecount_full_opt -#define __deref_opt_out_ecount_full_opt(size) __deref_out_ecount_full_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_out_bcount_full_opt -#define __deref_opt_out_bcount_full_opt(size) __deref_out_bcount_full_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_opt -#define __deref_opt_inout_opt __deref_inout_opt __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_ecount_opt -#define __deref_opt_inout_ecount_opt(size) __deref_inout_ecount_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_bcount_opt -#define __deref_opt_inout_bcount_opt(size) __deref_inout_bcount_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_ecount_part_opt -#define __deref_opt_inout_ecount_part_opt(size,length) __deref_inout_ecount_part_opt(size,length) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_bcount_part_opt -#define __deref_opt_inout_bcount_part_opt(size,length) __deref_inout_bcount_part_opt(size,length) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_ecount_full_opt -#define __deref_opt_inout_ecount_full_opt(size) __deref_inout_ecount_full_opt(size) __exceptthat __maybenull -#endif -#ifndef __deref_opt_inout_bcount_full_opt -#define __deref_opt_inout_bcount_full_opt(size) __deref_inout_bcount_full_opt(size) __exceptthat __maybenull -#endif - -// @@BEGIN_DDKSPLIT -// ------------------------------------------------------------------------------- -// Advanced Annotation Definitions -// -// Any of these may be used to directly annotate functions, and may be used in -// combination with each other or with regular buffer macros. For an explanation -// of each annotation, see the advanced annotations section. -// ------------------------------------------------------------------------------- -// @@END_DDKSPLIT - -#ifndef __out_awcount -#define __out_awcount(expr,size) __pre __notnull \ - __precond(expr) __byte_writableTo(size) \ - __precond(!(expr)) __byte_writableTo((size)*2) \ - __post __valid __refparam -#endif -#ifndef __in_awcount -#define __in_awcount(expr,size) __pre __valid \ - __pre __deref __readonly \ - __precond(expr) __byte_readableTo(size) \ - __precond(!(expr)) __elem_readableTo(size) -#endif -#ifndef __success -#define __success(expr) __inner_success(expr) -#endif -#ifndef __nullterminated -#define __nullterminated __readableTo(sentinel(0)) -#endif -#ifndef __nullnullterminated -#define __nullnullterminated -#endif -#ifndef __reserved -#define __reserved __pre __null -#endif -#ifndef __checkReturn -#define __checkReturn __inner_checkReturn -#endif -#ifndef __typefix -#define __typefix(ctype) __inner_typefix(ctype) -#endif -#ifndef __override -#define __override __inner_override -#endif -#ifndef __callback -#define __callback __inner_callback -#endif -#ifndef __format_string -#define __format_string -#endif -#ifndef __blocksOn -#define __blocksOn(resource) __inner_blocksOn(resource) -#endif -#ifndef __control_entrypoint -#define __control_entrypoint(category) __inner_control_entrypoint(category) -#endif -#ifndef __data_entrypoint -#define __data_entrypoint(category) __inner_data_entrypoint(category) -#endif - -#ifndef __fallthrough - __inner_fallthrough_dec - #define __fallthrough __inner_fallthrough -#endif - -// ------------------------------------------------------------------------------- -// Deprecated Annotation Definitions -// -// These should be removed from existing code. -// ------------------------------------------------------------------------------- - -// #define __opt __exceptthat __maybenull - -#ifdef __cplusplus -} -#endif - +/***************************************************************\ +* * +* SpecStrings.h - markers for documenting the semantics of APIs * +* * +* Version 1.0 * +* * +* Copyright (c) Microsoft Corporation. All rights reserved. * +* * +\***************************************************************/ + +// @@BEGIN_DDKSPLIT + +// ------------------------------------------------------------------------------- +// Introduction +// +// SpecStrings.h provides a set of annotations to describe how a function uses its +// parameters - the assumptions it makes about them, and the guarantees it makes +// upon finishing. +// +// Annotations may be placed before either a function parameter's type or its return +// type, and describe the function's behavior regarding the parameter or return value. +// There are two classes of annotations: buffer annotations and advanced annotations. +// Buffer annotations describe how functions use their pointer parameters, and +// advanced annotations either describe complex/unusual buffer behavior, or provide +// additional information about a parameter that is not otherwise expressible. +// +// ------------------------------------------------------------------------------- +// Buffer Annotations +// +// The most important annotations in SpecStrings.h provide a consistent way to annotate +// buffer parameters or return values for a function. Each of these annotations describes +// a single buffer (which could be a string, a fixed-length or variable-length array, +// or just a pointer) that the function interacts with: where it is, how large it is, +// how much is initialized, and what the function does with it. +// +// The appropriate macro for a given buffer can be constructed using the table below. +// Just pick the appropriate values from each category, and combine them together +// with a leading underscore. Some combinations of values do not make sense as buffer +// annotations. Only meaningful annotations can be added to your code; for a list of +// these, see the buffer annotation definitions section. +// +// Only a single buffer annotation should be used for each parameter. +// +// |------------|------------|---------|--------|----------|---------------| +// | Level | Usage | Size | Output | Optional | Parameters | +// |------------|------------|---------|--------|----------|---------------| +// | <> | <> | <> | <> | <> | <> | +// | _deref | _in | _ecount | _full | _opt | (size) | +// | _deref_opt | _out | _bcount | _part | | (size,length) | +// | | _inout | | | | | +// | | | | | | | +// |------------|------------|---------|--------|----------|---------------| +// +// Level: Describes the buffer pointer's level of indirection from the parameter or +// return value 'p'. +// +// <> : p is the buffer pointer. +// _deref : *p is the buffer pointer. p must not be NULL. +// _deref_opt : *p may be the buffer pointer. p may be NULL, in which case the rest of +// the annotation is ignored. +// +// Usage: Describes how the function uses the buffer. +// +// <> : The buffer is not accessed. If used on the return value or with _deref, the +// function will provide the buffer, and it will be uninitialized at exit. +// Otherwise, the caller must provide the buffer. This should only be used +// for alloc and free functions. +// _in : The function will only read from the buffer. The caller must provide the +// buffer and initialize it. +// _out : The function will only write to the buffer. If used on the return value or +// with _deref, the function will provide the buffer and initialize it. +// Otherwise, the caller must provide the buffer, and the function will +// initialize it. +// _inout : The function may freely read from and write to the buffer. The caller must +// provide the buffer and initialize it. If used with _deref, the buffer may +// be reallocated by the function. +// +// Size: Describes the total size of the buffer. This may be less than the space actually +// allocated for the buffer, in which case it describes the accessible amount. +// +// <> : No buffer size is given. If the type specifies the buffer size (such as +// with LPSTR and LPWSTR), that amount is used. Otherwise, the buffer is one +// element long. Must be used with _in, _out, or _inout. +// _ecount : The buffer size is an explicit element count. +// _bcount : The buffer size is an explicit byte count. +// +// Output: Describes how much of the buffer will be initialized by the function. For +// _inout buffers, this also describes how much is initialized at entry. Omit this +// category for _in buffers; they must be fully initialized by the caller. +// +// <> : The type specifies how much is initialized. For instance, a function initializing +// an LPWSTR must NULL-terminate the string. +// _full : The function initializes the entire buffer. +// _part : The function initializes part of the buffer, and explicitly indicates how much. +// +// Optional: Describes if the buffer itself is optional. +// +// <> : The pointer to the buffer must not be NULL. +// _opt : The pointer to the buffer might be NULL. It will be checked before being dereferenced. +// +// Parameters: Gives explicit counts for the size and length of the buffer. +// +// <> : There is no explicit count. Use when neither _ecount nor _bcount is used. +// (size) : Only the buffer's total size is given. Use with _ecount or _bcount but not _part. +// (size,length) : The buffer's total size and initialized length are given. Use with _ecount_part +// and _bcount_part. +// +// ------------------------------------------------------------------------------- +// Buffer Annotation Examples +// +// LWSTDAPI_(BOOL) StrToIntExA( +// LPCSTR pszString, // No annotation required, const implies __in. +// DWORD dwFlags, +// __out int *piRet // A pointer whose dereference will be filled in. +// ); +// +// void MyPaintingFunction( +// __in HWND hwndControl, // An initialized read-only parameter. +// __in_opt HDC hdcOptional, // An initialized read-only parameter that might be NULL. +// __inout IPropertyStore *ppsStore // An initialized parameter that may be freely used +// // and modified. +// ); +// +// LWSTDAPI_(BOOL) PathCompactPathExA( +// __out_ecount(cchMax) LPSTR pszOut, // A string buffer with cch elements that will +// // be NULL terminated on exit. +// LPCSTR pszSrc, // No annotation required, const implies __in. +// UINT cchMax, +// DWORD dwFlags +// ); +// +// HRESULT SHLocalAllocBytes( +// size_t cb, +// __deref_bcount(cb) T **ppv // A pointer whose dereference will be set to an +// // uninitialized buffer with cb bytes. +// ); +// +// __inout_bcount_full(cb) : A buffer with cb elements that is fully initialized at +// entry and exit, and may be written to by this function. +// +// __out_ecount_part(count, *countOut) : A buffer with count elements that will be +// partially initialized by this function. The function indicates how much it +// initialized by setting *countOut. +// +// ------------------------------------------------------------------------------- +// Advanced Annotations +// +// Advanced annotations describe behavior that is not expressible with the regular +// buffer macros. These may be used either to annotate buffer parameters that involve +// complex or conditional behavior, or to enrich existing annotations with additional +// information. +// +// __success(expr) f : +// indicates whether function f succeeded or not. If is true at exit, +// all the function's guarantees (as given by other annotations) must hold. If +// is false at exit, the caller should not expect any of the function's guarantees +// to hold. If not used, the function must always satisfy its guarantees. Added +// automatically to functions that indicate success in standard ways, such as by +// returning an HRESULT. +// +// __out_awcount(expr, size) p : +// Pointer p is a buffer whose size may be given in either bytes or elements. If +// is true, this acts like __out_bcount. If is false, this acts +// like __out_ecount. This should only be used to annotate old APIs. +// +// __in_awcount(expr, size) p : +// Pointer p is a buffer whose size may be given in either bytes or elements. If +// is true, this acts like __in_bcount. If is false, this acts +// like __in_ecount. This should only be used to annotate old APIs. +// +// __nullterminated p : +// Pointer p is a buffer that may be read or written up to and including the first +// NULL character or pointer. May be used on typedefs, which marks valid (properly +// initialized) instances of that type as being NULL-terminated. +// +// __nullnullterminated p : +// Pointer p is a buffer that may be read or written up to and including the first +// sequence of two NULL characters or pointers. May be used on typedefs, which marks +// valid instances of that type as being double-NULL terminated. +// +// __reserved v : +// Value v must be 0/NULL, reserved for future use. +// +// __checkReturn v : +// Return value v must not be ignored by callers of this function. +// +// __typefix(ctype) v : +// Value v should be treated as an instance of ctype, rather than its declared type. +// +// __override f : +// Specify C#-style 'override' behaviour for overriding virtual methods. +// +// __callback f : +// Function f can be used as a function pointer. +// +// __format_string p : +// Pointer p is a string that contains % markers in the style of printf. +// +// __blocksOn(resource) f : +// Function f blocks on the resource 'resource'. +// +// __fallthrough : +// Annotates switch statement labels where fall-through is desired, to distinguish +// from forgotten break statements. +// +// ------------------------------------------------------------------------------- +// Advanced Annotation Examples +// +// __success(return == TRUE) LWSTDAPI_(BOOL) +// PathCanonicalizeA(__out_ecount(MAX_PATH) LPSTR pszBuf, LPCSTR pszPath) : +// pszBuf is only guaranteed to be NULL-terminated when TRUE is returned. +// +// typedef __nullterminated WCHAR* LPWSTR : Initialized LPWSTRs are NULL-terminated strings. +// +// __out_ecount(cch) __typefix(LPWSTR) void *psz : psz is a buffer parameter which will be +// a NULL-terminated WCHAR string at exit, and which initially contains cch WCHARs. +// +// ------------------------------------------------------------------------------- + +// @@END_DDKSPLIT + +#if _MSC_VER > 1000 +#pragma once +#endif // #if _MSC_VER > 1000 + +#define __specstrings + +#ifdef __cplusplus +#ifndef __nothrow +# define __nothrow __declspec(nothrow) +#endif +extern "C" { +#else +#ifndef __nothrow +# define __nothrow +#endif +#endif // #ifdef __cplusplus + +// @@BEGIN_DDKSPLIT + +// ------------------------------------------------------------------------------- +// Helper Macro Definitions +// +// These express behavior common to many of the high-level annotations. +// DO NOT USE THESE IN YOUR CODE. +// ------------------------------------------------------------------------------- + +// The helper annotations are only understood by the compiler version used by various +// defect detection tools. When the regular compiler is running, they are defined into +// nothing, and do not affect the compiled code. +#if (_MSC_VER >= 1000) && !defined(MIDL_PASS) && defined(_PREFAST_) + + // In the primitive __declspec("SAL_*") annotations "SAL" stands for Standard + // Annotation Language. These __declspec("SAL_*") annotations are the + // primitives the compiler understands and all high-level SpecString MACROs + // will decompose into these primivates. + + #define SPECSTRINGIZE( x ) #x + + // + // __null p + // __notnull p + // __maybenull p + // + // Annotates a pointer p. States that pointer p is null. Commonly used + // in the negated form __notnull or the possibly null form __maybenull. + // + #define __null __declspec("SAL_null") + #define __notnull __declspec("SAL_notnull") + #define __maybenull __declspec("SAL_maybenull") + + // + // __readonly l + // __notreadonly l + // __mabyereadonly l + // + // Annotates a location l. States that location l is not modified after + // this point. If the annotation is placed on the precondition state of + // a function, the restriction only applies until the postcondition state + // of the function. __maybereadonly states that the annotated location + // may be modified, whereas __notreadonly states that a location must be + // modified. + // + #define __readonly __declspec("SAL_readonly") + #define __notreadonly __declspec("SAL_notreadonly") + #define __maybereadonly __declspec("SAL_maybereadonly") + + // + // __valid v + // __notvalid v + // __maybevalid v + // + // Annotates any value v. States that the value satisfies all properties of + // valid values of its type. For example, for a string buffer, valid means + // that the buffer pointer is either NULL or points to a NULL-terminated string. + // + #define __valid __declspec("SAL_valid") + #define __notvalid __declspec("SAL_notvalid") + #define __maybevalid __declspec("SAL_maybevalid") + + // + // __readableTo(extent) p + // + // Annotates a buffer pointer p. If the buffer can be read, extent describes + // how much of the buffer is readable. For a reader of the buffer, this is + // an explicit permission to read up to that amount, rather than a restriction to + // read only up to it. + // + #define __readableTo(extent) __declspec("SAL_readableTo("SPECSTRINGIZE(extent)")") + + // + // __elem_readableTo(size) + // + // Annotates a buffer pointer p as being readable to size elements. + // + #define __elem_readableTo(size) __declspec("SAL_readableTo(elementCount("SPECSTRINGIZE(size)"))") + + // + // __byte_readableTo(size) + // + // Annotates a buffer pointer p as being readable to size bytes. + // + #define __byte_readableTo(size) __declspec("SAL_readableTo(byteCount("SPECSTRINGIZE(size)"))") + + // + // __writableTo(extent) p + // + // Annotates a buffer pointer p. If the buffer can be modified, extent + // describes how much of the buffer is writable (usually the allocation + // size). For a writer of the buffer, this is an explicit permission to + // write up to that amount, rather than a restriction to write only up to it. + // + #define __writableTo(size) __declspec("SAL_writableTo("SPECSTRINGIZE(size)")") + + // + // __elem_writableTo(size) + // + // Annotates a buffer pointer p as being writable to size elements. + // + #define __elem_writableTo(size) __declspec("SAL_writableTo(elementCount("SPECSTRINGIZE(size)"))") + + // + // __byte_writableTo(size) + // + // Annotates a buffer pointer p as being writable to size bytes. + // + #define __byte_writableTo(size) __declspec("SAL_writableTo(byteCount("SPECSTRINGIZE(size)"))") + + // + // __deref p + // + // Annotates a pointer p. The next annotation applies one dereference down + // in the type. If readableTo(p, size) then the next annotation applies to + // all elements *(p+i) for which i satisfies the size. If p is a pointer + // to a struct, the next annotation applies to all fields of the struct. + // + #define __deref __declspec("SAL_deref") + + // + // __pre __next_annotation + // + // The next annotation applies in the precondition state + // + #define __pre __declspec("SAL_pre") + + // + // __post __next_annotation + // + // The next annotation applies in the postcondition state + // + #define __post __declspec("SAL_post") + + // + // __precond() + // + // When is true, the next annotation applies in the precondition state + // (currently not enabled) + // + #define __precond(expr) __pre + + // + // __postcond() + // + // When is true, the next annotation applies in the postcondition state + // (currently not enabled) + // + #define __postcond(expr) __post + + // + // __exceptthat + // + // Given a set of annotations Q containing __exceptthat maybeP, the effect of + // the except clause is to erase any P or notP annotations (explicit or + // implied) within Q at the same level of dereferencing that the except + // clause appears, and to replace it with maybeP. + // + // Example 1: __valid __exceptthat __maybenull on a pointer p means that the + // pointer may be null, and is otherwise valid, thus overriding + // the implicit notnull annotation implied by __valid on + // pointers. + // + // Example 2: __valid __deref __exceptthat __maybenull on an int **p means + // that p is not null (implied by valid), but the elements + // pointed to by p could be null, and are otherwise valid. + // + #define __exceptthat __declspec("SAL_except") + + // + // _refparam + // + // Added to all out parameter macros to indicate that they are all reference + // parameters. + // + #define __refparam __deref __notreadonly + + // + // __inner_* + // + // Helper macros that directly correspond to certain high-level annotations. + // + // + + // Macros to classify the entrypoints and indicate their category. + // + // + // Pre-defined control point categories include: RPC, LPC, DeviceDriver, UserToKernel, ISAPI, COM. + // + #define __inner_control_entrypoint(category) __declspec("SAL_entrypoint(controlEntry, "SPECSTRINGIZE(category)")") + + // + // Pre-defined data entry point categories include: Registry, File, Network. + // + #define __inner_data_entrypoint(category) __declspec("SAL_entrypoint(dataEntry, "SPECSTRINGIZE(category)")") + + #define __inner_success(expr) __declspec("SAL_success("SPECSTRINGIZE(expr)")") + #define __inner_checkReturn __declspec("SAL_checkReturn") + #define __inner_typefix(ctype) __declspec("SAL_typefix("SPECSTRINGIZE(ctype)")") + #define __inner_override __declspec("__override") + #define __inner_callback __declspec("__callback") + #define __inner_blocksOn(resource) __declspec("SAL_blocksOn("SPECSTRINGIZE(resource)")") + #define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {} + #define __inner_fallthrough __FallThrough(); + +#else + +// @@END_DDKSPLIT + +#ifndef __null + #define __null +#endif +#ifndef __notnull + #define __notnull +#endif +#ifndef __maybenull + #define __maybenull +#endif +#ifndef __readonly + #define __readonly +#endif +#ifndef __notreadonly + #define __notreadonly +#endif +#ifndef __maybereadonly + #define __maybereadonly +#endif +#ifndef __valid + #define __valid +#endif +#ifndef __notvalid + #define __notvalid +#endif +#ifndef __maybevalid + #define __maybevalid +#endif +#ifndef __readableTo + #define __readableTo(extent) +#endif +#ifndef __elem_readableTo + #define __elem_readableTo(size) +#endif +#ifndef __byte_readableTo + #define __byte_readableTo(size) +#endif +#ifndef __writableTo + #define __writableTo(size) +#endif +#ifndef __elem_writableTo + #define __elem_writableTo(size) +#endif +#ifndef __byte_writableTo + #define __byte_writableTo(size) +#endif +#ifndef __deref + #define __deref +#endif +#ifndef __pre + #define __pre +#endif +#ifndef __post + #define __post +#endif +#ifndef __precond + #define __precond(expr) +#endif +#ifndef __postcond + #define __postcond(expr) +#endif +#ifndef __exceptthat + #define __exceptthat +#endif +#ifndef __inner_success + #define __inner_success(expr) +#endif +#ifndef __inner_checkReturn + #define __inner_checkReturn +#endif +#ifndef __inner_typefix + #define __inner_typefix(ctype) +#endif +#ifndef __inner_override + #define __inner_override +#endif +#ifndef __inner_callback + #define __inner_callback +#endif +#ifndef __inner_blocksOn + #define __inner_blocksOn(resource) +#endif +#ifndef __inner_fallthrough_dec + #define __inner_fallthrough_dec +#endif +#ifndef __inner_fallthrough + #define __inner_fallthrough +#endif +#ifndef __refparam + #define __refparam +#endif +#ifndef __inner_control_entrypoint + #define __inner_control_entrypoint(category) +#endif +#ifndef __inner_data_entrypoint + #define __inner_data_entrypoint(category) +#endif +// @@BEGIN_DDKSPLIT +#endif // #if (_MSC_VER >= 1000) && !defined(MIDL_PASS) && defined(_PREFAST_) +// ------------------------------------------------------------------------------- +// Buffer Annotation Definitions +// +// Any of these may be used to directly annotate functions, but only one should +// be used for each parameter. To determine which annotation to use for a given +// buffer, use the table in the buffer annotations section. +// ------------------------------------------------------------------------------- +// @@END_DDKSPLIT + +#ifndef __ecount +#define __ecount(size) __notnull __elem_writableTo(size) +#endif +#ifndef __bcount +#define __bcount(size) __notnull __byte_writableTo(size) +#endif +#ifndef __in +#define __in __pre __valid __pre __deref __readonly +#endif +#ifndef __in_ecount +#define __in_ecount(size) __in __pre __elem_readableTo(size) +#endif +#ifndef __in_bcount +#define __in_bcount(size) __in __pre __byte_readableTo(size) +#endif +#ifndef __out +#define __out __ecount(1) __post __valid __refparam +#endif +#ifndef __out_ecount +#define __out_ecount(size) __ecount(size) __post __valid __refparam +#endif +#ifndef __out_bcount +#define __out_bcount(size) __bcount(size) __post __valid __refparam +#endif +#ifndef __out_ecount_part +#define __out_ecount_part(size,length) __out_ecount(size) __post __elem_readableTo(length) +#endif +#ifndef __out_bcount_part +#define __out_bcount_part(size,length) __out_bcount(size) __post __byte_readableTo(length) +#endif +#ifndef __out_ecount_full +#define __out_ecount_full(size) __out_ecount_part(size,size) +#endif +#ifndef __out_bcount_full +#define __out_bcount_full(size) __out_bcount_part(size,size) +#endif +#ifndef __inout +#define __inout __pre __valid __post __valid __refparam +#endif +#ifndef __inout_ecount +#define __inout_ecount(size) __out_ecount(size) __pre __valid +#endif +#ifndef __inout_bcount +#define __inout_bcount(size) __out_bcount(size) __pre __valid +#endif +#ifndef __inout_ecount_part +#define __inout_ecount_part(size,length) __out_ecount_part(size,length) __pre __valid __pre __elem_readableTo(length) +#endif +#ifndef __inout_bcount_part +#define __inout_bcount_part(size,length) __out_bcount_part(size,length) __pre __valid __pre __byte_readableTo(length) +#endif +#ifndef __inout_ecount_full +#define __inout_ecount_full(size) __inout_ecount_part(size,size) +#endif +#ifndef __inout_bcount_full +#define __inout_bcount_full(size) __inout_bcount_part(size,size) +#endif + +#ifndef __ecount_opt +#define __ecount_opt(size) __ecount(size) __exceptthat __maybenull +#endif +#ifndef __bcount_opt +#define __bcount_opt(size) __bcount(size) __exceptthat __maybenull +#endif +#ifndef __in_opt +#define __in_opt __in __exceptthat __maybenull +#endif +#ifndef __in_ecount_opt +#define __in_ecount_opt(size) __in_ecount(size) __exceptthat __maybenull +#endif +#ifndef __in_bcount_opt +#define __in_bcount_opt(size) __in_bcount(size) __exceptthat __maybenull +#endif +#ifndef __out_opt +#define __out_opt __out __exceptthat __maybenull +#endif +#ifndef __out_ecount_opt +#define __out_ecount_opt(size) __out_ecount(size) __exceptthat __maybenull +#endif +#ifndef __out_bcount_opt +#define __out_bcount_opt(size) __out_bcount(size) __exceptthat __maybenull +#endif +#ifndef __out_ecount_part_opt +#define __out_ecount_part_opt(size,length) __out_ecount_part(size,length) __exceptthat __maybenull +#endif +#ifndef __out_bcount_part_opt +#define __out_bcount_part_opt(size,length) __out_bcount_part(size,length) __exceptthat __maybenull +#endif +#ifndef __out_ecount_full_opt +#define __out_ecount_full_opt(size) __out_ecount_full(size) __exceptthat __maybenull +#endif +#ifndef __out_bcount_full_opt +#define __out_bcount_full_opt(size) __out_bcount_full(size) __exceptthat __maybenull +#endif +#ifndef __inout_opt +#define __inout_opt __inout __exceptthat __maybenull +#endif +#ifndef __inout_ecount_opt +#define __inout_ecount_opt(size) __inout_ecount(size) __exceptthat __maybenull +#endif +#ifndef __inout_bcount_opt +#define __inout_bcount_opt(size) __inout_bcount(size) __exceptthat __maybenull +#endif +#ifndef __inout_ecount_part_opt +#define __inout_ecount_part_opt(size,length) __inout_ecount_part(size,length) __exceptthat __maybenull +#endif +#ifndef __inout_bcount_part_opt +#define __inout_bcount_part_opt(size,length) __inout_bcount_part(size,length) __exceptthat __maybenull +#endif +#ifndef __inout_ecount_full_opt +#define __inout_ecount_full_opt(size) __inout_ecount_full(size) __exceptthat __maybenull +#endif +#ifndef __inout_bcount_full_opt +#define __inout_bcount_full_opt(size) __inout_bcount_full(size) __exceptthat __maybenull +#endif + +#ifndef __deref_ecount +#define __deref_ecount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __elem_writableTo(size) +#endif +#ifndef __deref_bcount +#define __deref_bcount(size) __ecount(1) __post __elem_readableTo(1) __post __deref __notnull __post __deref __byte_writableTo(size) +#endif +#ifndef __deref_in +#define __deref_in __in __pre __deref __deref __readonly +#endif +#ifndef __deref_in_ecount +#define __deref_in_ecount(size) __deref_in __pre __deref __elem_readableTo(size) +#endif +#ifndef __deref_in_bcount +#define __deref_in_bcount(size) __deref_in __pre __deref __byte_readableTo(size) +#endif +#ifndef __deref_out +#define __deref_out __deref_ecount(1) __post __deref __valid __refparam +#endif +#ifndef __deref_out_ecount +#define __deref_out_ecount(size) __deref_ecount(size) __post __deref __valid __refparam +#endif +#ifndef __deref_out_bcount +#define __deref_out_bcount(size) __deref_bcount(size) __post __deref __valid __refparam +#endif +#ifndef __deref_out_ecount_part +#define __deref_out_ecount_part(size,length) __deref_out_ecount(size) __post __deref __elem_readableTo(length) +#endif +#ifndef __deref_out_bcount_part +#define __deref_out_bcount_part(size,length) __deref_out_bcount(size) __post __deref __byte_readableTo(length) +#endif +#ifndef __deref_out_ecount_full +#define __deref_out_ecount_full(size) __deref_out_ecount_part(size,size) +#endif +#ifndef __deref_out_bcount_full +#define __deref_out_bcount_full(size) __deref_out_bcount_part(size,size) +#endif +#ifndef __deref_inout +#define __deref_inout __notnull __elem_readableTo(1) __pre __deref __valid __post __deref __valid __refparam +#endif +#ifndef __deref_inout_ecount +#define __deref_inout_ecount(size) __deref_inout __pre __deref __elem_writableTo(size) __post __deref __elem_writableTo(size) +#endif +#ifndef __deref_inout_bcount +#define __deref_inout_bcount(size) __deref_inout __pre __deref __byte_writableTo(size) __post __deref __byte_writableTo(size) +#endif +#ifndef __deref_inout_ecount_part +#define __deref_inout_ecount_part(size,length) __deref_inout_ecount(size) __pre __deref __elem_readableTo(length) __post __deref __elem_readableTo(length) +#endif +#ifndef __deref_inout_bcount_part +#define __deref_inout_bcount_part(size,length) __deref_inout_bcount(size) __pre __deref __byte_readableTo(length) __post __deref __byte_readableTo(length) +#endif +#ifndef __deref_inout_ecount_full +#define __deref_inout_ecount_full(size) __deref_inout_ecount_part(size,size) +#endif +#ifndef __deref_inout_bcount_full +#define __deref_inout_bcount_full(size) __deref_inout_bcount_part(size,size) +#endif + +#ifndef __deref_ecount_opt +#define __deref_ecount_opt(size) __deref_ecount(size) __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_bcount_opt +#define __deref_bcount_opt(size) __deref_bcount(size) __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_in_opt +#define __deref_in_opt __deref_in __pre __deref __exceptthat __maybenull +#endif +#ifndef __deref_in_ecount_opt +#define __deref_in_ecount_opt(size) __deref_in_ecount(size) __pre __deref __exceptthat __maybenull +#endif +#ifndef __deref_in_bcount_opt +#define __deref_in_bcount_opt(size) __deref_in_bcount(size) __pre __deref __exceptthat __maybenull +#endif +#ifndef __deref_out_opt +#define __deref_out_opt __deref_out __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_out_ecount_opt +#define __deref_out_ecount_opt(size) __deref_out_ecount(size) __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_out_bcount_opt +#define __deref_out_bcount_opt(size) __deref_out_bcount(size) __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_out_ecount_part_opt +#define __deref_out_ecount_part_opt(size,length) __deref_out_ecount_part(size,length) __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_out_bcount_part_opt +#define __deref_out_bcount_part_opt(size,length) __deref_out_bcount_part(size,length) __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_out_ecount_full_opt +#define __deref_out_ecount_full_opt(size) __deref_out_ecount_full(size) __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_out_bcount_full_opt +#define __deref_out_bcount_full_opt(size) __deref_out_bcount_full(size) __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_inout_opt +#define __deref_inout_opt __deref_inout __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_inout_ecount_opt +#define __deref_inout_ecount_opt(size) __deref_inout_ecount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_inout_bcount_opt +#define __deref_inout_bcount_opt(size) __deref_inout_bcount(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_inout_ecount_part_opt +#define __deref_inout_ecount_part_opt(size,length) __deref_inout_ecount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_inout_bcount_part_opt +#define __deref_inout_bcount_part_opt(size,length) __deref_inout_bcount_part(size,length) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_inout_ecount_full_opt +#define __deref_inout_ecount_full_opt(size) __deref_inout_ecount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#endif +#ifndef __deref_inout_bcount_full_opt +#define __deref_inout_bcount_full_opt(size) __deref_inout_bcount_full(size) __pre __deref __exceptthat __maybenull __post __deref __exceptthat __maybenull +#endif + +#ifndef __deref_opt_ecount +#define __deref_opt_ecount(size) __deref_ecount(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_bcount +#define __deref_opt_bcount(size) __deref_bcount(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_in +#define __deref_opt_in __deref_in __exceptthat __maybenull +#endif +#ifndef __deref_opt_in_ecount +#define __deref_opt_in_ecount(size) __deref_in_ecount(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_in_bcount +#define __deref_opt_in_bcount(size) __deref_in_bcount(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out +#define __deref_opt_out __deref_out __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_ecount +#define __deref_opt_out_ecount(size) __deref_out_ecount(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_bcount +#define __deref_opt_out_bcount(size) __deref_out_bcount(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_ecount_part +#define __deref_opt_out_ecount_part(size,length) __deref_out_ecount_part(size,length) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_bcount_part +#define __deref_opt_out_bcount_part(size,length) __deref_out_bcount_part(size,length) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_ecount_full +#define __deref_opt_out_ecount_full(size) __deref_out_ecount_full(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_bcount_full +#define __deref_opt_out_bcount_full(size) __deref_out_bcount_full(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout +#define __deref_opt_inout __deref_inout __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_ecount +#define __deref_opt_inout_ecount(size) __deref_inout_ecount(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_bcount +#define __deref_opt_inout_bcount(size) __deref_inout_bcount(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_ecount_part +#define __deref_opt_inout_ecount_part(size,length) __deref_inout_ecount_part(size,length) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_bcount_part +#define __deref_opt_inout_bcount_part(size,length) __deref_inout_bcount_part(size,length) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_ecount_full +#define __deref_opt_inout_ecount_full(size) __deref_inout_ecount_full(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_bcount_full +#define __deref_opt_inout_bcount_full(size) __deref_inout_bcount_full(size) __exceptthat __maybenull +#endif + +#ifndef __deref_opt_ecount_opt +#define __deref_opt_ecount_opt(size) __deref_ecount_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_bcount_opt +#define __deref_opt_bcount_opt(size) __deref_bcount_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_in_opt +#define __deref_opt_in_opt __deref_in_opt __exceptthat __maybenull +#endif +#ifndef __deref_opt_in_ecount_opt +#define __deref_opt_in_ecount_opt(size) __deref_in_ecount_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_in_bcount_opt +#define __deref_opt_in_bcount_opt(size) __deref_in_bcount_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_opt +#define __deref_opt_out_opt __deref_out_opt __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_ecount_opt +#define __deref_opt_out_ecount_opt(size) __deref_out_ecount_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_bcount_opt +#define __deref_opt_out_bcount_opt(size) __deref_out_bcount_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_ecount_part_opt +#define __deref_opt_out_ecount_part_opt(size,length) __deref_out_ecount_part_opt(size,length) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_bcount_part_opt +#define __deref_opt_out_bcount_part_opt(size,length) __deref_out_bcount_part_opt(size,length) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_ecount_full_opt +#define __deref_opt_out_ecount_full_opt(size) __deref_out_ecount_full_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_out_bcount_full_opt +#define __deref_opt_out_bcount_full_opt(size) __deref_out_bcount_full_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_opt +#define __deref_opt_inout_opt __deref_inout_opt __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_ecount_opt +#define __deref_opt_inout_ecount_opt(size) __deref_inout_ecount_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_bcount_opt +#define __deref_opt_inout_bcount_opt(size) __deref_inout_bcount_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_ecount_part_opt +#define __deref_opt_inout_ecount_part_opt(size,length) __deref_inout_ecount_part_opt(size,length) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_bcount_part_opt +#define __deref_opt_inout_bcount_part_opt(size,length) __deref_inout_bcount_part_opt(size,length) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_ecount_full_opt +#define __deref_opt_inout_ecount_full_opt(size) __deref_inout_ecount_full_opt(size) __exceptthat __maybenull +#endif +#ifndef __deref_opt_inout_bcount_full_opt +#define __deref_opt_inout_bcount_full_opt(size) __deref_inout_bcount_full_opt(size) __exceptthat __maybenull +#endif + +// @@BEGIN_DDKSPLIT +// ------------------------------------------------------------------------------- +// Advanced Annotation Definitions +// +// Any of these may be used to directly annotate functions, and may be used in +// combination with each other or with regular buffer macros. For an explanation +// of each annotation, see the advanced annotations section. +// ------------------------------------------------------------------------------- +// @@END_DDKSPLIT + +#ifndef __out_awcount +#define __out_awcount(expr,size) __pre __notnull \ + __precond(expr) __byte_writableTo(size) \ + __precond(!(expr)) __byte_writableTo((size)*2) \ + __post __valid __refparam +#endif +#ifndef __in_awcount +#define __in_awcount(expr,size) __pre __valid \ + __pre __deref __readonly \ + __precond(expr) __byte_readableTo(size) \ + __precond(!(expr)) __elem_readableTo(size) +#endif +#ifndef __success +#define __success(expr) __inner_success(expr) +#endif +#ifndef __nullterminated +#define __nullterminated __readableTo(sentinel(0)) +#endif +#ifndef __nullnullterminated +#define __nullnullterminated +#endif +#ifndef __reserved +#define __reserved __pre __null +#endif +#ifndef __checkReturn +#define __checkReturn __inner_checkReturn +#endif +#ifndef __typefix +#define __typefix(ctype) __inner_typefix(ctype) +#endif +#ifndef __override +#define __override __inner_override +#endif +#ifndef __callback +#define __callback __inner_callback +#endif +#ifndef __format_string +#define __format_string +#endif +#ifndef __blocksOn +#define __blocksOn(resource) __inner_blocksOn(resource) +#endif +#ifndef __control_entrypoint +#define __control_entrypoint(category) __inner_control_entrypoint(category) +#endif +#ifndef __data_entrypoint +#define __data_entrypoint(category) __inner_data_entrypoint(category) +#endif + +#ifndef __fallthrough + __inner_fallthrough_dec + #define __fallthrough __inner_fallthrough +#endif + +// ------------------------------------------------------------------------------- +// Deprecated Annotation Definitions +// +// These should be removed from existing code. +// ------------------------------------------------------------------------------- + +// #define __opt __exceptthat __maybenull + +#ifdef __cplusplus +} +#endif + -- cgit v1.2.3