本文整理汇总了C++中GdipFree函数的典型用法代码示例。如果您正苦于以下问题:C++ GdipFree函数的具体用法?C++ GdipFree怎么用?C++ GdipFree使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GdipFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gdip_adjust_arrowcap_destroy
GpStatus
gdip_adjust_arrowcap_destroy (GpCustomLineCap *cap)
{
if (!cap)
return InvalidParameter;
GdipFree (cap);
return Ok;
}
示例2: GdipCreatePathGradient
GpStatus WINGDIPAPI GdipCreatePathGradient(GDIPCONST GpPointF* points,
INT count, GpWrapMode wrap, GpPathGradient **grad)
{
COLORREF col = ARGB2COLORREF(0xffffffff);
if(!points || !grad)
return InvalidParameter;
if(count <= 0)
return OutOfMemory;
*grad = GdipAlloc(sizeof(GpPathGradient));
if (!*grad) return OutOfMemory;
(*grad)->pathdata.Count = count;
(*grad)->pathdata.Points = GdipAlloc(count * sizeof(PointF));
(*grad)->pathdata.Types = GdipAlloc(count);
if(!(*grad)->pathdata.Points || !(*grad)->pathdata.Types){
GdipFree((*grad)->pathdata.Points);
GdipFree((*grad)->pathdata.Types);
GdipFree(*grad);
return OutOfMemory;
}
memcpy((*grad)->pathdata.Points, points, count * sizeof(PointF));
memset((*grad)->pathdata.Types, PathPointTypeLine, count);
(*grad)->brush.lb.lbStyle = BS_SOLID;
(*grad)->brush.lb.lbColor = col;
(*grad)->brush.lb.lbHatch = 0;
(*grad)->brush.gdibrush = CreateSolidBrush(col);
(*grad)->brush.bt = BrushTypePathGradient;
(*grad)->centercolor = 0xffffffff;
(*grad)->wrap = wrap;
(*grad)->gamma = FALSE;
(*grad)->center.X = 0.0;
(*grad)->center.Y = 0.0;
(*grad)->focus.X = 0.0;
(*grad)->focus.Y = 0.0;
return Ok;
}
示例3: cairo_DrawString
GpStatus
cairo_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc,
GDIPCONST GpStringFormat *format, GpBrush *brush)
{
cairo_matrix_t SavedMatrix;
GpStringFormat *fmt;
GpStringDetailStruct *StringDetails;
WCHAR *CleanString;
GpDrawTextData data; /* avoid recomputation of stuff done while measuring */
int StringLen = length;
GpStatus status = AllocStringData (&CleanString, &StringDetails, length);
if (status != Ok)
return status;
/* a NULL format is valid, it means get the generic default values (and free them later) */
if (!format) {
GdipStringFormatGetGenericDefault ((GpStringFormat **)&fmt);
} else {
fmt = (GpStringFormat *)format;
}
/* is the following ok ? */
cairo_get_font_matrix (graphics->ct, &SavedMatrix);
status = MeasureString (graphics, stringUnicode, &StringLen, font, rc, fmt, brush, NULL, NULL, NULL, CleanString, StringDetails, &data);
if ((status == Ok) && (StringLen > 0)) {
status = DrawString (graphics, stringUnicode, StringLen, font, rc, fmt, brush, CleanString, StringDetails, &data);
}
/* Restore matrix to original values */
cairo_set_font_matrix (graphics->ct, &SavedMatrix);
/* Cleanup */
GdipFree (CleanString);
GdipFree (StringDetails);
/* we must delete the default stringformat (when one wasn't provided by the caller) */
if (format != fmt)
GdipDeleteStringFormat (fmt);
return status;
}
示例4: GdipDeleteFontFamily
/*****************************************************************************
* GdipDeleteFontFamily [[email protected]]
*
* Removes the specified FontFamily
*
* PARAMS
* *FontFamily [I] The family to delete
*
* RETURNS
* SUCCESS: Ok
* FAILURE: InvalidParameter if FontFamily is NULL.
*
*/
GpStatus WINGDIPAPI GdipDeleteFontFamily(GpFontFamily *FontFamily)
{
if (!FontFamily)
return InvalidParameter;
TRACE("Deleting %p (%s)\n", FontFamily, debugstr_w(FontFamily->FamilyName));
GdipFree (FontFamily);
return Ok;
}
示例5: free_path_list
/* free all nodes including argument */
static void free_path_list(path_list_node_t *node)
{
path_list_node_t *n = node;
while(n) {
n = n->next;
GdipFree(node);
node = n;
}
}
示例6: GdipCombineRegionRect
/*****************************************************************************
* GdipCombineRegionRect [[email protected]]
*/
GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
GDIPCONST GpRectF *rect, CombineMode mode)
{
GpRegion *rect_region;
region_element *left, *right = NULL;
GpStatus stat;
TRACE("%p %s %d\n", region, debugstr_rectf(rect), mode);
if (!(region && rect))
return InvalidParameter;
stat = GdipCreateRegionRect(rect, &rect_region);
if (stat != Ok)
return stat;
/* simply replace region data */
if(mode == CombineModeReplace){
delete_element(®ion->node);
memcpy(region, rect_region, sizeof(GpRegion));
GdipFree(rect_region);
return Ok;
}
left = GdipAlloc(sizeof(region_element));
if (left)
{
memcpy(left, ®ion->node, sizeof(region_element));
stat = clone_element(&rect_region->node, &right);
if (stat == Ok)
{
fuse_region(region, left, right, mode);
GdipDeleteRegion(rect_region);
return Ok;
}
}
else
stat = OutOfMemory;
GdipFree(left);
GdipDeleteRegion(rect_region);
return stat;
}
示例7: GdipCreatePathGradientFromPath
/* FIXME: path gradient brushes not truly supported (drawn as solid brushes) */
GpStatus WINGDIPAPI GdipCreatePathGradientFromPath(GDIPCONST GpPath* path,
GpPathGradient **grad)
{
COLORREF col = ARGB2COLORREF(0xffffffff);
if(!path || !grad)
return InvalidParameter;
*grad = GdipAlloc(sizeof(GpPathGradient));
if (!*grad) return OutOfMemory;
(*grad)->pathdata.Count = path->pathdata.Count;
(*grad)->pathdata.Points = GdipAlloc(path->pathdata.Count * sizeof(PointF));
(*grad)->pathdata.Types = GdipAlloc(path->pathdata.Count);
if(!(*grad)->pathdata.Points || !(*grad)->pathdata.Types){
GdipFree((*grad)->pathdata.Points);
GdipFree((*grad)->pathdata.Types);
GdipFree(*grad);
return OutOfMemory;
}
memcpy((*grad)->pathdata.Points, path->pathdata.Points,
path->pathdata.Count * sizeof(PointF));
memcpy((*grad)->pathdata.Types, path->pathdata.Types, path->pathdata.Count);
(*grad)->brush.lb.lbStyle = BS_SOLID;
(*grad)->brush.lb.lbColor = col;
(*grad)->brush.lb.lbHatch = 0;
(*grad)->brush.gdibrush = CreateSolidBrush(col);
(*grad)->brush.bt = BrushTypePathGradient;
(*grad)->centercolor = 0xffffffff;
(*grad)->wrap = WrapModeClamp;
(*grad)->gamma = FALSE;
/* FIXME: this should be set to the "centroid" of the path by default */
(*grad)->center.X = 0.0;
(*grad)->center.Y = 0.0;
(*grad)->focus.X = 0.0;
(*grad)->focus.Y = 0.0;
return Ok;
}
示例8: GdipCreateFont
/*******************************************************************************
* GdipCreateFont [[email protected]]
*
* Create a new font based off of a FontFamily
*
* PARAMS
* *fontFamily [I] Family to base the font off of
* emSize [I] Size of the font
* style [I] Bitwise OR of FontStyle enumeration
* unit [I] Unit emSize is measured in
* **font [I] the resulting Font object
*
* RETURNS
* SUCCESS: Ok
* FAILURE: InvalidParameter if fontfamily or font is NULL.
* FAILURE: FontFamilyNotFound if an invalid FontFamily is given
*
* NOTES
* UnitDisplay is unsupported.
* emSize is stored separately from lfHeight, to hold the fraction.
*/
GpStatus WINGDIPAPI GdipCreateFont(GDIPCONST GpFontFamily *fontFamily,
REAL emSize, INT style, Unit unit, GpFont **font)
{
HFONT hfont;
OUTLINETEXTMETRICW otm;
LOGFONTW lfw;
HDC hdc;
GpStatus stat;
int ret;
if (!fontFamily || !font || emSize < 0.0)
return InvalidParameter;
TRACE("%p (%s), %f, %d, %d, %p\n", fontFamily,
debugstr_w(fontFamily->FamilyName), emSize, style, unit, font);
memset(&lfw, 0, sizeof(lfw));
stat = GdipGetFamilyName(fontFamily, lfw.lfFaceName, LANG_NEUTRAL);
if (stat != Ok) return stat;
lfw.lfHeight = -units_to_pixels(emSize, unit, fontFamily->dpi);
lfw.lfWeight = style & FontStyleBold ? FW_BOLD : FW_REGULAR;
lfw.lfItalic = style & FontStyleItalic;
lfw.lfUnderline = style & FontStyleUnderline;
lfw.lfStrikeOut = style & FontStyleStrikeout;
hfont = CreateFontIndirectW(&lfw);
hdc = CreateCompatibleDC(0);
SelectObject(hdc, hfont);
otm.otmSize = sizeof(otm);
ret = GetOutlineTextMetricsW(hdc, otm.otmSize, &otm);
DeleteDC(hdc);
DeleteObject(hfont);
if (!ret) return NotTrueTypeFont;
*font = GdipAlloc(sizeof(GpFont));
if (!*font) return OutOfMemory;
(*font)->unit = unit;
(*font)->emSize = emSize;
(*font)->otm = otm;
stat = clone_font_family(fontFamily, &(*font)->family);
if (stat != Ok)
{
GdipFree(*font);
return stat;
}
TRACE("<-- %p\n", *font);
return Ok;
}
示例9: GdipCombineRegionPath
/*****************************************************************************
* GdipCombineRegionPath [[email protected]]
*/
GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode mode)
{
GpRegion *path_region;
region_element *left, *right = NULL;
GpStatus stat;
TRACE("%p %p %d\n", region, path, mode);
if (!(region && path))
return InvalidParameter;
stat = GdipCreateRegionPath(path, &path_region);
if (stat != Ok)
return stat;
/* simply replace region data */
if(mode == CombineModeReplace){
delete_element(®ion->node);
memcpy(region, path_region, sizeof(GpRegion));
GdipFree(path_region);
return Ok;
}
left = GdipAlloc(sizeof(region_element));
if (left)
{
*left = region->node;
stat = clone_element(&path_region->node, &right);
if (stat == Ok)
{
fuse_region(region, left, right, mode);
GdipDeleteRegion(path_region);
return Ok;
}
}
else
stat = OutOfMemory;
GdipFree(left);
GdipDeleteRegion(path_region);
return stat;
}
示例10: GdipDeleteFont
/*******************************************************************************
* GdipDeleteFont [[email protected]]
*/
GpStatus WINGDIPAPI GdipDeleteFont(GpFont* font)
{
TRACE("(%p)\n", font);
if(!font)
return InvalidParameter;
GdipFree(font);
return Ok;
}
示例11: cairo_MeasureString
GpStatus
cairo_MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, int length, GDIPCONST GpFont *font, GDIPCONST RectF *rc,
GDIPCONST GpStringFormat *format, RectF *boundingBox, int *codepointsFitted, int *linesFilled)
{
cairo_matrix_t SavedMatrix;
GpStringFormat *fmt;
GpStringDetailStruct *StringDetails;
WCHAR *CleanString;
int StringLen = length;
GpStatus status;
status = AllocStringData (&CleanString, &StringDetails, length);
if (status != Ok)
return status;
/* a NULL format is valid, it means get the generic default values (and free them later) */
if (!format) {
GdipStringFormatGetGenericDefault ((GpStringFormat **)&fmt);
} else {
fmt = (GpStringFormat *)format;
}
/* is the following ok ? */
cairo_get_font_matrix (graphics->ct, &SavedMatrix);
status = MeasureString (graphics, stringUnicode, &StringLen, font, rc, fmt, NULL, boundingBox, codepointsFitted,
linesFilled, CleanString, StringDetails, NULL);
/* Restore matrix to original values */
cairo_set_font_matrix (graphics->ct, &SavedMatrix);
/* Cleanup */
GdipFree (CleanString);
GdipFree (StringDetails);
/* we must delete the default stringformat (when one wasn't provided by the caller) */
if (format != fmt)
GdipDeleteStringFormat (fmt);
return status;
}
示例12: GdipDeleteRegion
/*****************************************************************************
* GdipDeleteRegion [[email protected]]
*/
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
{
TRACE("%p\n", region);
if (!region)
return InvalidParameter;
delete_element(®ion->node);
GdipFree(region);
return Ok;
}
示例13: transform_region_element
/* Transforms GpRegion elements with given matrix */
static GpStatus transform_region_element(region_element* element, GpMatrix *matrix)
{
GpStatus stat;
switch(element->type)
{
case RegionDataEmptyRect:
case RegionDataInfiniteRect:
return Ok;
case RegionDataRect:
{
/* We can't transform a rectangle, so convert it to a path. */
GpRegion *new_region;
GpPath *path;
stat = GdipCreatePath(FillModeAlternate, &path);
if (stat == Ok)
{
stat = GdipAddPathRectangle(path,
element->elementdata.rect.X, element->elementdata.rect.Y,
element->elementdata.rect.Width, element->elementdata.rect.Height);
if (stat == Ok)
stat = GdipCreateRegionPath(path, &new_region);
GdipDeletePath(path);
}
if (stat == Ok)
{
/* Steal the element from the created region. */
memcpy(element, &new_region->node, sizeof(region_element));
GdipFree(new_region);
}
else
return stat;
}
/* Fall-through to do the actual conversion. */
case RegionDataPath:
if (!element->elementdata.path->pathdata.Count)
return Ok;
stat = GdipTransformMatrixPoints(matrix,
element->elementdata.path->pathdata.Points,
element->elementdata.path->pathdata.Count);
return stat;
default:
stat = transform_region_element(element->elementdata.combine.left, matrix);
if (stat == Ok)
stat = transform_region_element(element->elementdata.combine.right, matrix);
return stat;
}
}
示例14: GdipCombineRegionRegion
/*****************************************************************************
* GdipCombineRegionRegion [[email protected]]
*/
GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
GpRegion *region2, CombineMode mode)
{
region_element *left, *right = NULL;
GpStatus stat;
GpRegion *reg2copy;
TRACE("%p %p %d\n", region1, region2, mode);
if(!(region1 && region2))
return InvalidParameter;
/* simply replace region data */
if(mode == CombineModeReplace){
stat = GdipCloneRegion(region2, ®2copy);
if(stat != Ok) return stat;
delete_element(®ion1->node);
memcpy(region1, reg2copy, sizeof(GpRegion));
GdipFree(reg2copy);
return Ok;
}
left = GdipAlloc(sizeof(region_element));
if (!left)
return OutOfMemory;
*left = region1->node;
stat = clone_element(®ion2->node, &right);
if (stat != Ok)
{
GdipFree(left);
return OutOfMemory;
}
fuse_region(region1, left, right, mode);
region1->num_children += region2->num_children;
return Ok;
}
示例15: GdipCreateTexture
/* coverity[+alloc : arg-*2] */
GpStatus WINGDIPAPI
GdipCreateTexture (GpImage *image, GpWrapMode wrapMode, GpTexture **texture)
{
cairo_surface_t *imageSurface = NULL;
GpTexture *result;
GpStatus status;
if (!image || !texture)
return InvalidParameter;
if ((wrapMode < WrapModeTile) || (wrapMode > WrapModeClamp))
return OutOfMemory;
if (image->type != ImageTypeBitmap)
return NotImplemented;
result = gdip_texture_new ();
if (!result)
return OutOfMemory;
result->image = NULL;
status = GdipCloneImage (image, &result->image);
if (status != Ok)
goto failure;
/* note: we must keep the scan0 alive, so we must use the cloned image (and not the original) see bug #80971 */
imageSurface = cairo_image_surface_create_for_data ((BYTE*)result->image->active_bitmap->scan0,
image->cairo_format, image->active_bitmap->width, image->active_bitmap->height, image->active_bitmap->stride);
if (!imageSurface)
goto failure;
result->wrapMode = wrapMode;
if (result->image->surface)
cairo_surface_destroy (result->image->surface);
result->image->surface = imageSurface;
result->rectangle.X = 0;
result->rectangle.Y = 0;
result->rectangle.Width = image->active_bitmap->width;
result->rectangle.Height = image->active_bitmap->height;
*texture = result;
return Ok;
failure:
if (result->image)
GdipDisposeImage (result->image);
if (imageSurface)
cairo_surface_destroy (imageSurface);
GdipFree (result);
*texture = NULL;
return status;
}