📄 gdiplusgraphics.h
字号:
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,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -