• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GdipAlloc函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GdipAlloc函数的典型用法代码示例。如果您正苦于以下问题:C++ GdipAlloc函数的具体用法?C++ GdipAlloc怎么用?C++ GdipAlloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GdipAlloc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: GdipCreateFontFamilyFromName

GpStatus WINGDIPAPI GdipCreateFontFamilyFromName(GDIPCONST WCHAR *name,
                                        GpFontCollection *fontCollection,
                                        GpFontFamily **FontFamily)
{
    GpStatus stat;
    GpFontFamily* ffamily;
    struct font_metrics fm;

    TRACE("%s, %p %p\n", debugstr_w(name), fontCollection, FontFamily);

    if (!(name && FontFamily))
        return InvalidParameter;
    if (fontCollection)
        FIXME("No support for FontCollections yet!\n");

    stat = find_installed_font(name, &fm);
    if (stat != Ok) return stat;

    ffamily = GdipAlloc(sizeof (GpFontFamily));
    if (!ffamily) return OutOfMemory;

    lstrcpynW(ffamily->FamilyName, name, LF_FACESIZE);
    ffamily->em_height = fm.em_height;
    ffamily->ascent = fm.ascent;
    ffamily->descent = fm.descent;
    ffamily->line_spacing = fm.line_spacing;
    ffamily->dpi = fm.dpi;

    *FontFamily = ffamily;

    TRACE("<-- %p\n", ffamily);

    return Ok;
}
开发者ID:miurahr,项目名称:wine,代码行数:34,代码来源:font.c


示例2: GdipSetStringFormatTabStops

GpStatus WINGDIPAPI GdipSetStringFormatTabStops(GpStringFormat *format, REAL firsttab,
    INT count, GDIPCONST REAL *tabs)
{
    TRACE("(%p, %0.2f, %i, %p)\n", format, firsttab, count, tabs);

    if(!format || !tabs)
        return InvalidParameter;

    if(count > 0){
        if(firsttab < 0.0)  return NotImplemented;
        /* first time allocation */
        if(format->tabcount == 0){
            format->tabs = GdipAlloc(sizeof(REAL)*count);
            if(!format->tabs)
                return OutOfMemory;
        }
        /* reallocation */
        if((format->tabcount < count) && (format->tabcount > 0)){
            REAL *ptr;
            ptr = HeapReAlloc(GetProcessHeap(), 0, format->tabs, sizeof(REAL)*count);
            if(!ptr)
                return OutOfMemory;
            format->tabs = ptr;
        }
        format->firsttab = firsttab;
        format->tabcount = count;
        memcpy(format->tabs, tabs, sizeof(REAL)*count);
    }

    return Ok;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:31,代码来源:stringformat.c


示例3: GdipCreateRegionRect

/*****************************************************************************
 * GdipCreateRegionRect [[email protected]]
 */
GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect,
        GpRegion **region)
{
    GpStatus stat;

    TRACE("%p, %p\n", rect, region);

    if (!(rect && region))
        return InvalidParameter;

    *region = GdipAlloc(sizeof(GpRegion));
    stat = init_region(*region, RegionDataRect);
    if(stat != Ok)
    {
        GdipDeleteRegion(*region);
        return stat;
    }

    (*region)->node.elementdata.rect.X = rect->X;
    (*region)->node.elementdata.rect.Y = rect->Y;
    (*region)->node.elementdata.rect.Width = rect->Width;
    (*region)->node.elementdata.rect.Height = rect->Height;

    return Ok;
}
开发者ID:RareHare,项目名称:reactos,代码行数:28,代码来源:region.c


示例4: GdipCreateStringFormat

GpStatus WINGDIPAPI GdipCreateStringFormat(INT attr, LANGID lang,
    GpStringFormat **format)
{
    TRACE("(%i, %x, %p)\n", attr, lang, format);

    if(!format)
        return InvalidParameter;

    *format = GdipAlloc(sizeof(GpStringFormat));
    if(!*format)   return OutOfMemory;

    (*format)->attr = attr;
    (*format)->lang = lang;
    (*format)->digitlang = LANG_NEUTRAL;
    (*format)->trimming = StringTrimmingCharacter;
    (*format)->digitsub = StringDigitSubstituteUser;
    (*format)->character_ranges = NULL;
    (*format)->range_count = 0;
    (*format)->generic_typographic = FALSE;
    /* tabstops */
    (*format)->tabcount = 0;
    (*format)->firsttab = 0.0;
    (*format)->tabs = NULL;

    TRACE("<-- %p\n", *format);

    return Ok;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:28,代码来源:stringformat.c


示例5: GdipCreateCustomLineCap

/* FIXME: Sometimes when fillPath is non-null and stroke path is null, the native
 * version of this function returns NotImplemented. I cannot figure out why. */
GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath,
    GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap)
{
    GpPathData *pathdata;

    TRACE("%p %p %d %f %p\n", fillPath, strokePath, baseCap, baseInset, customCap);

    if(!customCap || !(fillPath || strokePath))
        return InvalidParameter;

    *customCap = GdipAlloc(sizeof(GpCustomLineCap));
    if(!*customCap)    return OutOfMemory;

    if(strokePath){
        (*customCap)->fill = FALSE;
        pathdata = &strokePath->pathdata;
    }
    else{
        (*customCap)->fill = TRUE;
        pathdata = &fillPath->pathdata;
    }

    (*customCap)->pathdata.Points = GdipAlloc(pathdata->Count * sizeof(PointF));
    (*customCap)->pathdata.Types = GdipAlloc(pathdata->Count);

    if((!(*customCap)->pathdata.Types || !(*customCap)->pathdata.Points) &&
        pathdata->Count){
        GdipFree((*customCap)->pathdata.Points);
        GdipFree((*customCap)->pathdata.Types);
        GdipFree(*customCap);
        return OutOfMemory;
    }

    memcpy((*customCap)->pathdata.Points, pathdata->Points, pathdata->Count
           * sizeof(PointF));
    memcpy((*customCap)->pathdata.Types, pathdata->Types, pathdata->Count);
    (*customCap)->pathdata.Count = pathdata->Count;

    (*customCap)->inset = baseInset;
    (*customCap)->cap = baseCap;
    (*customCap)->join = LineJoinMiter;
    (*customCap)->scale = 1.0;

    TRACE("<-- %p\n", *customCap);

    return Ok;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:49,代码来源:customlinecap.c


示例6: GdipCloneStringFormat

/* coverity[+alloc : arg-*1] */
GpStatus WINGDIPAPI
GdipCloneStringFormat (GDIPCONST GpStringFormat *format,  GpStringFormat **newFormat)
{
	GpStringFormat *result;

	if (!format || !newFormat)
		return InvalidParameter;

	result = gdip_string_format_new ();
	if (!result)
		goto error;

	result->alignment = format->alignment;
	result->lineAlignment =  format->lineAlignment;
	result->hotkeyPrefix = format->hotkeyPrefix;
	result->formatFlags = format->formatFlags;
	result->trimming = format->trimming;
	result->substitute = format->substitute;
	result->language = format->language;
	result->firstTabOffset = format->firstTabOffset;
	result->numtabStops = format->numtabStops;
	result->charRangeCount = format->charRangeCount;

	/* Create a copy of tab stops for the clone */
	result->tabStops = (float *) GdipAlloc (sizeof (float) * format->numtabStops);
	if (!result->tabStops)
		goto error;

	memcpy (result->tabStops, format->tabStops, format->numtabStops * sizeof (float));

	/* Create a copy of char ranges for the clone */
	result->charRanges = (CharacterRange *) GdipAlloc (format->charRangeCount * sizeof (CharacterRange));
	if (result->charRanges == NULL)
		goto error;

	memcpy (result->charRanges, format->charRanges, format->charRangeCount * sizeof (CharacterRange));

	*newFormat = result;
	return Ok;

error:
	if (result)
		GdipDeleteStringFormat (result);

	*newFormat = NULL;
	return OutOfMemory;
}
开发者ID:mono,项目名称:libgdiplus,代码行数:48,代码来源:stringformat.c


示例7: GdipClonePen

GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
{
    GpStatus stat;

    TRACE("(%p, %p)\n", pen, clonepen);

    if(!pen || !clonepen)
        return InvalidParameter;

    *clonepen = GdipAlloc(sizeof(GpPen));
    if(!*clonepen)  return OutOfMemory;

    **clonepen = *pen;

    (*clonepen)->customstart = NULL;
    (*clonepen)->customend = NULL;
    (*clonepen)->brush = NULL;
    (*clonepen)->dashes = NULL;

    stat = GdipCloneBrush(pen->brush, &(*clonepen)->brush);

    if (stat == Ok && pen->customstart)
        stat = GdipCloneCustomLineCap(pen->customstart, &(*clonepen)->customstart);

    if (stat == Ok && pen->customend)
        stat = GdipCloneCustomLineCap(pen->customend, &(*clonepen)->customend);

    if (stat == Ok && pen->dashes)
    {
        (*clonepen)->dashes = GdipAlloc(pen->numdashes * sizeof(REAL));
        if ((*clonepen)->dashes)
            memcpy((*clonepen)->dashes, pen->dashes, pen->numdashes * sizeof(REAL));
        else
            stat = OutOfMemory;
    }

    if (stat != Ok)
    {
        GdipDeletePen(*clonepen);
        *clonepen = NULL;
        return stat;
    }

    TRACE("<-- %p\n", *clonepen);

    return Ok;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:47,代码来源:pen.c


示例8: gdip_texture_new

static GpTexture*
gdip_texture_new (void)
{
	GpTexture *result = (GpTexture *) GdipAlloc (sizeof (GpTexture));
	if (result)
		gdip_texture_init (result);

	return result;
}
开发者ID:mono,项目名称:libgdiplus,代码行数:9,代码来源:texturebrush.c


示例9: clone_font_family

static GpStatus clone_font_family(const GpFontFamily *family, GpFontFamily **clone)
{
    *clone = GdipAlloc(sizeof(GpFontFamily));
    if (!*clone) return OutOfMemory;

    **clone = *family;

    return Ok;
}
开发者ID:miurahr,项目名称:wine,代码行数:9,代码来源:font.c


示例10: gdip_string_format_new

static GpStringFormat *
gdip_string_format_new ()
{
	GpStringFormat *result = GdipAlloc (sizeof (GpStringFormat));
	if (result)
		gdip_string_format_init (result);

	return result;
}
开发者ID:mono,项目名称:libgdiplus,代码行数:9,代码来源:stringformat.c


示例11: 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;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:44,代码来源:brush.c


示例12: gdip_adjust_arrowcap_new

static GpAdjustableArrowCap*
gdip_adjust_arrowcap_new (void)
{
	GpAdjustableArrowCap *result = (GpAdjustableArrowCap *) GdipAlloc (sizeof (GpAdjustableArrowCap));

	if (result)
		gdip_adjust_arrowcap_init (result);

	return result;
}
开发者ID:bholmes,项目名称:libgdiplus,代码行数:10,代码来源:adjustablearrowcap.c


示例13: 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;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:44,代码来源:brush.c


示例14: gdip_pen_new

static GpPen*
gdip_pen_new (void)
{
	GpPen *result = (GpPen *) GdipAlloc (sizeof (GpPen));

	if (result)
		gdip_pen_init (result);

	return result;
}
开发者ID:mono,项目名称:libgdiplus,代码行数:10,代码来源:pen.c


示例15: 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;
}
开发者ID:miurahr,项目名称:wine,代码行数:76,代码来源:font.c


示例16: init_path_list

/* init list */
static BOOL init_path_list(path_list_node_t **node, REAL x, REAL y)
{
    *node = GdipAlloc(sizeof(path_list_node_t));
    if(!*node)
        return FALSE;

    (*node)->pt.X = x;
    (*node)->pt.Y = y;
    (*node)->type = PathPointTypeStart;
    (*node)->next = NULL;

    return TRUE;
}
开发者ID:johnedmonds,项目名称:wine,代码行数:14,代码来源:graphicspath.c


示例17: GdipCreateRegion

/*****************************************************************************
 * GdipCreateRegion [[email protected]]
 */
GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
{
    TRACE("%p\n", region);

    if(!region)
        return InvalidParameter;

    *region = GdipAlloc(sizeof(GpRegion));
    if(!*region)
        return OutOfMemory;

    return init_region(*region, RegionDataInfiniteRect);
}
开发者ID:AmesianX,项目名称:RosWine,代码行数:16,代码来源:region.c


示例18: GdipCreatePath

GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
{
    if(!path)
        return InvalidParameter;

    *path = GdipAlloc(sizeof(GpPath));
    if(!*path)  return OutOfMemory;

    (*path)->fill = fill;
    (*path)->newfigure = TRUE;

    return Ok;
}
开发者ID:WASSUM,项目名称:longene_travel,代码行数:13,代码来源:graphicspath.c


示例19: GdipCloneStringFormat

GpStatus WINGDIPAPI GdipCloneStringFormat(GDIPCONST GpStringFormat *format, GpStringFormat **newFormat)
{
    if(!format || !newFormat)
        return InvalidParameter;

    *newFormat = GdipAlloc(sizeof(GpStringFormat));
    if(!*newFormat)    return OutOfMemory;

    **newFormat = *format;

    if(format->tabcount > 0){
        (*newFormat)->tabs = GdipAlloc(sizeof(REAL) * format->tabcount);
        if(!(*newFormat)->tabs){
            GdipFree(*newFormat);
            return OutOfMemory;
        }
        memcpy((*newFormat)->tabs, format->tabs, sizeof(REAL) * format->tabcount);
    }
    else
        (*newFormat)->tabs = NULL;

    if(format->range_count > 0){
        (*newFormat)->character_ranges = GdipAlloc(sizeof(CharacterRange) * format->range_count);
        if(!(*newFormat)->character_ranges){
            GdipFree((*newFormat)->tabs);
            GdipFree(*newFormat);
            return OutOfMemory;
        }
        memcpy((*newFormat)->character_ranges, format->character_ranges,
               sizeof(CharacterRange) * format->range_count);
    }
    else
        (*newFormat)->character_ranges = NULL;

    TRACE("%p %p\n",format,newFormat);

    return Ok;
}
开发者ID:hoangduit,项目名称:reactos,代码行数:38,代码来源:stringformat.c


示例20: gdip_region_copy_tree

/*
 * gdip_region_copy_tree:
 * @source: the GpPathTree to copy
 * @dest: the GpPathTree copy
 *
 * Recursively copy (and allocate) the @source path tree into @dest.
 * If @source is present then we must have a valid @dest.
 */
GpStatus
gdip_region_copy_tree (GpPathTree *source, GpPathTree *dest)
{
	GpStatus status;

	if (!source)
		return Ok;

	g_assert (dest);
	if (source->path) {
		status = GdipClonePath (source->path, &dest->path);
		if (status != Ok)
			return status;

		dest->branch1 = NULL;
		dest->branch2 = NULL;
	} else {
		dest->path = NULL;
		dest->mode = source->mode;
		dest->branch1 = (GpPathTree *) GdipAlloc (sizeof (GpPathTree));
		if (!dest->branch1)
			return OutOfMemory;

		status = gdip_region_copy_tree (source->branch1, dest->branch1);
		if (status != Ok)
			return status;

		dest->branch2 = (GpPathTree *) GdipAlloc (sizeof (GpPathTree));
		if (!dest->branch2)
			return OutOfMemory;

		status = gdip_region_copy_tree (source->branch2, dest->branch2);
		if (status != Ok)
			return status;
	}

	return Ok;
}
开发者ID:mono,项目名称:libgdiplus,代码行数:46,代码来源:region-path-tree.c



注:本文中的GdipAlloc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GdipCreatePath函数代码示例发布时间:2022-05-30
下一篇:
C++ GdiFlush函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap