本文整理汇总了C++中HPDF_Array_New函数的典型用法代码示例。如果您正苦于以下问题:C++ HPDF_Array_New函数的具体用法?C++ HPDF_Array_New怎么用?C++ HPDF_Array_New使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HPDF_Array_New函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: AddAnnotation
static HPDF_STATUS
AddAnnotation (HPDF_Page page,
HPDF_Annotation annot)
{
HPDF_Array array;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_Pages\n"));
/* find "Annots" entry */
array = HPDF_Dict_GetItem (page, "Annots", HPDF_OCLASS_ARRAY);
if (!array) {
array = HPDF_Array_New (page->mmgr);
if (!array)
return HPDF_Error_GetCode (page->error);
ret = HPDF_Dict_Add (page, "Annots", array);
if (ret != HPDF_OK)
return ret;
}
if ((ret = HPDF_Array_Add (array, annot)) != HPDF_OK)
return ret;
/* Add Parent to the annotation */
ret = HPDF_Dict_Add( annot, "P", page);
return ret;
}
开发者ID:porchdog,项目名称:libharu,代码行数:30,代码来源:hpdf_pages.c
示例2: HPDF_Box_Array_New
HPDF_Array
HPDF_Box_Array_New (HPDF_MMgr mmgr,
HPDF_Box box)
{
HPDF_Array obj;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_Box_Array_New\n"));
obj = HPDF_Array_New (mmgr);
if (!obj)
return NULL;
ret += HPDF_Array_Add (obj, HPDF_Real_New (mmgr, box.left));
ret += HPDF_Array_Add (obj, HPDF_Real_New (mmgr, box.bottom));
ret += HPDF_Array_Add (obj, HPDF_Real_New (mmgr, box.right));
ret += HPDF_Array_Add (obj, HPDF_Real_New (mmgr, box.top));
if (ret != HPDF_OK) {
HPDF_Array_Free (obj);
return NULL;
}
return obj;
}
开发者ID:12307,项目名称:poco,代码行数:25,代码来源:hpdf_array.c
示例3: HPDF_NameTree_New
HPDF_NameTree
HPDF_NameTree_New (HPDF_MMgr mmgr,
HPDF_Xref xref)
{
HPDF_STATUS ret = HPDF_OK;
HPDF_NameTree ntree;
HPDF_Array items;
HPDF_PTRACE (" HPDF_NameTree_New\n");
ntree = HPDF_Dict_New (mmgr);
if (!ntree)
return NULL;
if (HPDF_Xref_Add (xref, ntree) != HPDF_OK)
return NULL;
ntree->header.obj_class |= HPDF_OSUBCLASS_NAMETREE;
items = HPDF_Array_New (mmgr);
if (!ntree)
return NULL;
ret += HPDF_Dict_Add (ntree, "Names", items);
if (ret != HPDF_OK)
return NULL;
return ntree;
}
开发者ID:Elena-Andr,项目名称:libharu-android,代码行数:29,代码来源:hpdf_namedict.c
示例4: HPDF_Pages_New
HPDF_Pages
HPDF_Pages_New (HPDF_MMgr mmgr,
HPDF_Pages parent,
HPDF_Xref xref)
{
HPDF_STATUS ret = HPDF_OK;
HPDF_Pages pages;
HPDF_PTRACE((" HPDF_Pages_New\n"));
pages = HPDF_Dict_New (mmgr);
if (!pages)
return NULL;
pages->header.obj_class |= HPDF_OSUBCLASS_PAGES;
pages->before_write_fn = Pages_BeforeWrite;
if (HPDF_Xref_Add (xref, pages) != HPDF_OK)
return NULL;
/* add requiered elements */
ret += HPDF_Dict_AddName (pages, "Type", "Pages");
ret += HPDF_Dict_Add (pages, "Kids", HPDF_Array_New (pages->mmgr));
ret += HPDF_Dict_Add (pages, "Count", HPDF_Number_New (pages->mmgr, 0));
if (ret == HPDF_OK && parent)
ret += HPDF_Pages_AddKids (parent, pages);
if (ret != HPDF_OK)
return NULL;
return pages;
}
开发者ID:porchdog,项目名称:libharu,代码行数:34,代码来源:hpdf_pages.c
示例5: HPDF_LineAnnot_SetCaption
HPDF_LineAnnot_SetCaption (HPDF_Annotation annot, HPDF_BOOL showCaption, HPDF_LineAnnotCapPosition position, HPDF_INT horzOffset, HPDF_INT vertOffset)
{
HPDF_STATUS ret = HPDF_OK;
HPDF_Array capOffset;
HPDF_PTRACE((" HPDF_LineAnnot_SetCaption\n"));
ret += HPDF_Dict_AddBoolean ( annot, "Cap", showCaption);
ret += HPDF_Dict_AddName( annot, "CP", HPDF_LINE_ANNOT_CAP_POSITION_NAMES[(HPDF_INT)position]);
if (ret != HPDF_OK)
return HPDF_Error_GetCode ( annot->error);
capOffset = HPDF_Array_New ( annot->mmgr);
if ( !capOffset)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "CO", capOffset)) != HPDF_OK)
return ret;
ret += HPDF_Array_AddNumber (capOffset, horzOffset);
ret += HPDF_Array_AddNumber (capOffset, vertOffset);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (capOffset->error);
return HPDF_OK;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:27,代码来源:hpdf_annotation.c
示例6: HPDF_EXPORT
HPDF_EXPORT(HPDF_STATUS) HPDF_U3D_Add3DView(HPDF_U3D u3d, HPDF_Dict view)
{
HPDF_Array views = NULL;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE ((" HPDF_Add3DView\n"));
if (u3d == NULL || view == NULL) {
return HPDF_INVALID_U3D_DATA;
}
views = (HPDF_Array)HPDF_Dict_GetItem (u3d, "VA", HPDF_OCLASS_ARRAY);
if (views == NULL) {
views = HPDF_Array_New (u3d->mmgr);
if (!views) {
return HPDF_Error_GetCode (u3d->error);
}
ret = HPDF_Dict_Add (u3d, "VA", views);
if (ret == HPDF_OK) {
ret = HPDF_Dict_AddNumber (u3d, "DV", 0);
} else {
HPDF_Array_Free (views);
return ret;
}
}
if (ret == HPDF_OK) {
ret = HPDF_Array_Add( views, view);
}
return ret;
}
开发者ID:binzhang,项目名称:libharu,代码行数:33,代码来源:hpdf_u3d.c
示例7: HPDF_MarkupAnnot_SetRectDiff
HPDF_MarkupAnnot_SetRectDiff (HPDF_Annotation annot, HPDF_Rect rect) /* RD entry : this is the difference between Rect and the text annotation rectangle */
{
HPDF_Array array;
HPDF_STATUS ret = HPDF_OK;
HPDF_REAL tmp;
HPDF_PTRACE((" HPDF_MarkupAnnot_SetRectDiff\n"));
array = HPDF_Array_New ( annot->mmgr);
if ( !array)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "RD", array)) != HPDF_OK)
return ret;
if (rect.top < rect.bottom) {
tmp = rect.top;
rect.top = rect.bottom;
rect.bottom = tmp;
}
ret += HPDF_Array_AddReal (array, rect.left);
ret += HPDF_Array_AddReal (array, rect.bottom);
ret += HPDF_Array_AddReal (array, rect.right);
ret += HPDF_Array_AddReal (array, rect.top);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (array->error);
return HPDF_OK;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:31,代码来源:hpdf_annotation.c
示例8: HPDF_FreeTextAnnot_Set3PointCalloutLine
HPDF_FreeTextAnnot_Set3PointCalloutLine ( HPDF_Annotation annot, HPDF_Point startPoint, HPDF_Point kneePoint, HPDF_Point endPoint) /* Callout line will be in default user space */
{
HPDF_Array clPoints;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_FreeTextAnnot_Set3PointCalloutLine\n"));
clPoints = HPDF_Array_New ( annot->mmgr);
if ( !clPoints)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "CL", clPoints)) != HPDF_OK)
return ret;
ret += HPDF_Array_AddReal (clPoints, startPoint.x);
ret += HPDF_Array_AddReal (clPoints, startPoint.y);
ret += HPDF_Array_AddReal (clPoints, kneePoint.x);
ret += HPDF_Array_AddReal (clPoints, kneePoint.y);
ret += HPDF_Array_AddReal (clPoints, endPoint.x);
ret += HPDF_Array_AddReal (clPoints, endPoint.y);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (clPoints->error);
return HPDF_OK;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:26,代码来源:hpdf_annotation.c
示例9: HPDF_Destination_New
HPDF_Destination
HPDF_Destination_New (HPDF_MMgr mmgr,
HPDF_Page target,
HPDF_Xref xref)
{
HPDF_Destination dst;
HPDF_PTRACE((" HPDF_Destination_New\n"));
if (!HPDF_Page_Validate (target)) {
HPDF_SetError (mmgr->error, HPDF_INVALID_PAGE, 0);
return NULL;
}
dst = HPDF_Array_New (mmgr);
if (!dst)
return NULL;
dst->header.obj_class |= HPDF_OSUBCLASS_DESTINATION;
if (HPDF_Xref_Add (xref, dst) != HPDF_OK)
return NULL;
/* first item of array must be target page */
if (HPDF_Array_Add (dst, target) != HPDF_OK)
return NULL;
/* default type is HPDF_FIT */
if (HPDF_Array_AddName (dst,
HPDF_DESTINATION_TYPE_NAMES[(HPDF_INT)HPDF_FIT]) != HPDF_OK)
return NULL;
return dst;
}
开发者ID:Allamaprabhu7,项目名称:APPDfTest,代码行数:34,代码来源:hpdf_destination.c
示例10: HPDF_3DView_Add3DC3DMeasure
HPDF_3DView_Add3DC3DMeasure(HPDF_Dict view,
HPDF_3DMeasure measure)
{
HPDF_STATUS ret = HPDF_OK;
HPDF_Array array;
void* a;
a = HPDF_Dict_GetItem (view, "MA", HPDF_OCLASS_ARRAY);
if ( a )
{
array = (HPDF_Array)a;
}
else
{
array = HPDF_Array_New (view->mmgr);
if (!array)
return 0;
if (HPDF_Dict_Add (view, "MA", array) != HPDF_OK)
return 0;
}
ret = HPDF_Array_Add(array, measure);
return ret;
}
开发者ID:binzhang,项目名称:libharu,代码行数:28,代码来源:hpdf_u3d.c
示例11: HPDF_PDFA_GenerateID
/* Generate an ID for the trailer dict, PDF/A needs this.
TODO: Better algorithm for generate unique ID.
*/
HPDF_STATUS
HPDF_PDFA_GenerateID(HPDF_Doc pdf)
{
HPDF_Array id;
HPDF_BYTE *currentTime;
HPDF_BYTE idkey[HPDF_MD5_KEY_LEN];
HPDF_MD5_CTX md5_ctx;
time_t ltime;
ltime = time(NULL);
currentTime = (HPDF_BYTE *)ctime(<ime);
id = HPDF_Dict_GetItem(pdf->trailer, "ID", HPDF_OCLASS_ARRAY);
if (!id) {
id = HPDF_Array_New(pdf->mmgr);
if (!id || HPDF_Dict_Add(pdf->trailer, "ID", id) != HPDF_OK)
return pdf->error.error_no;
HPDF_MD5Init(&md5_ctx);
HPDF_MD5Update(&md5_ctx, (HPDF_BYTE *) "libHaru", sizeof("libHaru") - 1);
HPDF_MD5Update(&md5_ctx, currentTime, HPDF_StrLen((const char *)currentTime, -1));
HPDF_MD5Final(idkey, &md5_ctx);
if (HPDF_Array_Add (id, HPDF_Binary_New (pdf->mmgr, idkey, HPDF_MD5_KEY_LEN)) != HPDF_OK)
return pdf->error.error_no;
if (HPDF_Array_Add (id, HPDF_Binary_New (pdf->mmgr,idkey,HPDF_MD5_KEY_LEN)) != HPDF_OK)
return pdf->error.error_no;
return HPDF_OK;
}
return HPDF_OK;
}
开发者ID:QuimFerrer,项目名称:core,代码行数:38,代码来源:hpdfpdfa.c
示例12: AddResource
HPDF_STATUS
AddResource (HPDF_Page page)
{
HPDF_STATUS ret = HPDF_OK;
HPDF_Dict resource;
HPDF_Array procset;
HPDF_PTRACE((" HPDF_Page_AddResource\n"));
resource = HPDF_Dict_New (page->mmgr);
if (!resource)
return HPDF_Error_GetCode (page->error);
/* althoth ProcSet-entry is obsolete, add it to resouce for
* compatibility
*/
ret += HPDF_Dict_Add (page, "Resources", resource);
procset = HPDF_Array_New (page->mmgr);
if (!procset)
return HPDF_Error_GetCode (page->error);
ret += HPDF_Dict_Add (resource, "ProcSet", procset);
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "PDF"));
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "Text"));
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "ImageB"));
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "ImageC"));
ret += HPDF_Array_Add (procset, HPDF_Name_New (page->mmgr, "ImageI"));
return ret;
}
开发者ID:Jacktony,项目名称:iPhonePDF,代码行数:32,代码来源:hpdf_pages.c
示例13: HPDF_TextMarkupAnnot_SetQuadPoints
HPDF_TextMarkupAnnot_SetQuadPoints ( HPDF_Annotation annot, HPDF_Point lb, HPDF_Point rb, HPDF_Point lt, HPDF_Point rt) /* l-left, r-right, b-bottom, t-top positions */
{
HPDF_Array quadPoints;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_TextMarkupAnnot_SetQuadPoints\n"));
quadPoints = HPDF_Array_New ( annot->mmgr);
if ( !quadPoints)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "QuadPoints", quadPoints)) != HPDF_OK)
return ret;
ret += HPDF_Array_AddReal (quadPoints, lb.x);
ret += HPDF_Array_AddReal (quadPoints, lb.y);
ret += HPDF_Array_AddReal (quadPoints, rb.x);
ret += HPDF_Array_AddReal (quadPoints, rb.y);
ret += HPDF_Array_AddReal (quadPoints, lt.x);
ret += HPDF_Array_AddReal (quadPoints, lt.y);
ret += HPDF_Array_AddReal (quadPoints, rt.x);
ret += HPDF_Array_AddReal (quadPoints, rt.y);
if (ret != HPDF_OK)
return HPDF_Error_GetCode (quadPoints->error);
return HPDF_OK;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:28,代码来源:hpdf_annotation.c
示例14: HPDF_LinkAnnot_SetBorderStyle
HPDF_LinkAnnot_SetBorderStyle (HPDF_Annotation annot,
HPDF_REAL width,
HPDF_UINT16 dash_on,
HPDF_UINT16 dash_off)
{
HPDF_Array array;
HPDF_STATUS ret;
HPDF_PTRACE((" HPDF_LinkAnnot_SetBorderStyle\n"));
if (!CheckSubType (annot, HPDF_ANNOT_LINK))
return HPDF_INVALID_ANNOTATION;
if (width < 0)
return HPDF_RaiseError (annot->error, HPDF_INVALID_PARAMETER, 0);
array = HPDF_Array_New (annot->mmgr);
if (!array)
return HPDF_CheckError (annot->error);
if ((ret = HPDF_Dict_Add (annot, "Border", array)) != HPDF_OK)
return HPDF_CheckError (annot->error);
ret += HPDF_Array_AddNumber (array, 0);
ret += HPDF_Array_AddNumber (array, 0);
ret += HPDF_Array_AddReal (array, width);
if (ret != HPDF_OK)
return HPDF_CheckError (annot->error);
if (dash_on && dash_off) {
HPDF_Array dash = HPDF_Array_New (annot->mmgr);
if (!dash)
return HPDF_CheckError (annot->error);
if ((ret = HPDF_Array_Add (array, dash)) != HPDF_OK)
return HPDF_CheckError (annot->error);
ret += HPDF_Array_AddNumber (dash, dash_on);
ret += HPDF_Array_AddNumber (dash, dash_off);
if (ret != HPDF_OK)
return HPDF_CheckError (annot->error);
}
return HPDF_OK;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:47,代码来源:hpdf_annotation.c
示例15: HPDF_LineAnnot_SetPosition
HPDF_LineAnnot_SetPosition (HPDF_Annotation annot,
HPDF_Point startPoint, HPDF_LineAnnotEndingStyle startStyle,
HPDF_Point endPoint, HPDF_LineAnnotEndingStyle endStyle)
{
HPDF_Array lineEndPoints;
HPDF_Array lineEndStyles;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_LineAnnot_SetPosition\n"));
lineEndPoints = HPDF_Array_New ( annot->mmgr);
if ( !lineEndPoints)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "L", lineEndPoints)) != HPDF_OK)
return ret;
ret += HPDF_Array_AddReal (lineEndPoints, startPoint.x);
ret += HPDF_Array_AddReal (lineEndPoints, startPoint.y);
ret += HPDF_Array_AddReal (lineEndPoints, endPoint.x);
ret += HPDF_Array_AddReal (lineEndPoints, endPoint.y);
if (ret != HPDF_OK)
return HPDF_Error_GetCode ( lineEndPoints->error);
lineEndStyles = HPDF_Array_New ( annot->mmgr);
if ( !lineEndStyles)
return HPDF_Error_GetCode ( annot->error);
if ((ret = HPDF_Dict_Add ( annot, "LE", lineEndStyles)) != HPDF_OK)
return ret;
ret += HPDF_Array_AddName (lineEndStyles, HPDF_LINE_ANNOT_ENDING_STYLE_NAMES[(HPDF_INT)startStyle]);
ret += HPDF_Array_AddName (lineEndStyles, HPDF_LINE_ANNOT_ENDING_STYLE_NAMES[(HPDF_INT)endStyle]);
if (ret != HPDF_OK)
return HPDF_Error_GetCode ( lineEndStyles->error);
return HPDF_OK;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:40,代码来源:hpdf_annotation.c
示例16: CreatePallet
static HPDF_STATUS
CreatePallet (HPDF_Dict image,
png_structp png_ptr,
png_infop info_ptr)
{
HPDF_INT num_pl = 0;
png_color *src_pl = NULL;
HPDF_BYTE *ppallet;
HPDF_BYTE *p;
HPDF_UINT i;
HPDF_Array array;
/* png_get_PLTE does not call PngErrorFunc even if it failed.
* so we call HPDF_Set_Error to set error-code.
*/
if (png_get_PLTE(png_ptr, info_ptr, (png_color**)&src_pl, &num_pl) !=
PNG_INFO_PLTE)
return HPDF_SetError (image->error, HPDF_LIBPNG_ERROR,
HPDF_CANNOT_GET_PALLET);
/* make a pallet array for indexed image. */
ppallet = HPDF_GetMem (image->mmgr, num_pl * 3);
if (!ppallet)
return image->error->error_no;
p = ppallet;
for (i = 0; i < num_pl; i++, src_pl++) {
*p++ = src_pl->red;
*p++ = src_pl->green;
*p++ = src_pl->blue;
}
array = HPDF_Array_New (image->mmgr);
if (array) {
HPDF_Binary b;
HPDF_Dict_Add (image, "ColorSpace", array);
HPDF_Array_AddName (array, "Indexed");
HPDF_Array_AddName (array, "DeviceRGB");
HPDF_Array_AddNumber (array, num_pl - 1);
b = HPDF_Binary_New (image->mmgr, ppallet, num_pl * 3);
if (b)
HPDF_Array_Add (array, b);
}
HPDF_FreeMem (image->mmgr, ppallet);
return image->error->error_no;
}
开发者ID:ProjectTegano,项目名称:Tegano,代码行数:52,代码来源:hpdf_image_png.c
示例17: HPDF_Annotation_New
HPDF_Annotation
HPDF_Annotation_New (HPDF_MMgr mmgr,
HPDF_Xref xref,
HPDF_AnnotType type,
HPDF_Rect rect)
{
HPDF_Annotation annot;
HPDF_Array array;
HPDF_STATUS ret = HPDF_OK;
HPDF_REAL tmp;
HPDF_PTRACE((" HPDF_Annotation_New\n"));
annot = HPDF_Dict_New (mmgr);
if (!annot)
return NULL;
if (HPDF_Xref_Add (xref, annot) != HPDF_OK)
return NULL;
array = HPDF_Array_New (mmgr);
if (!array)
return NULL;
if (HPDF_Dict_Add (annot, "Rect", array) != HPDF_OK)
return NULL;
if (rect.top < rect.bottom) {
tmp = rect.top;
rect.top = rect.bottom;
rect.bottom = tmp;
}
ret += HPDF_Array_AddReal (array, rect.left);
ret += HPDF_Array_AddReal (array, rect.bottom);
ret += HPDF_Array_AddReal (array, rect.right);
ret += HPDF_Array_AddReal (array, rect.top);
ret += HPDF_Dict_AddName (annot, "Type", "Annot");
ret += HPDF_Dict_AddName (annot, "Subtype",
HPDF_ANNOT_TYPE_NAMES[(HPDF_INT)type]);
if (ret != HPDF_OK)
return NULL;
annot->header.obj_class |= HPDF_OSUBCLASS_ANNOTATION;
return annot;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:49,代码来源:hpdf_annotation.c
示例18: HPDF_Annot_SetNoColor
HPDF_Annot_SetNoColor (HPDF_Annotation annot)
{
HPDF_Array cArray;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_Annot_SetNoColor\n"));
cArray = HPDF_Array_New (annot->mmgr);
if (!cArray)
return HPDF_Error_GetCode ( annot->error);
ret = HPDF_Dict_Add (annot, "C", cArray);
return ret;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:15,代码来源:hpdf_annotation.c
示例19: HPDF_MarkupAnnot_SetInteriorTransparent
HPDF_MarkupAnnot_SetInteriorTransparent (HPDF_Annotation annot) /* IC with No Color entry */
{
HPDF_Array cArray;
HPDF_STATUS ret = HPDF_OK;
HPDF_PTRACE((" HPDF_MarkupAnnot_SetInteriorTransparent\n"));
cArray = HPDF_Array_New ( annot->mmgr);
if (!cArray)
return HPDF_Error_GetCode ( annot->error);
ret = HPDF_Dict_Add (annot, "IC", cArray);
return ret;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:15,代码来源:hpdf_annotation.c
示例20: HPDF_Image_SetColorMask
HPDF_Image_SetColorMask (HPDF_Image image,
HPDF_UINT rmin,
HPDF_UINT rmax,
HPDF_UINT gmin,
HPDF_UINT gmax,
HPDF_UINT bmin,
HPDF_UINT bmax)
{
HPDF_Array array;
const char *name;
HPDF_STATUS ret = HPDF_OK;
if (!HPDF_Image_Validate (image))
return HPDF_INVALID_IMAGE;
if (HPDF_Dict_GetItem (image, "ImageMask", HPDF_OCLASS_BOOLEAN))
return HPDF_RaiseError (image->error, HPDF_INVALID_OPERATION, 0);
if (HPDF_Image_GetBitsPerComponent (image) != 8)
return HPDF_RaiseError (image->error, HPDF_INVALID_BIT_PER_COMPONENT,
0);
name = HPDF_Image_GetColorSpace (image);
if (!name || HPDF_StrCmp (COL_RGB, name) != 0)
return HPDF_RaiseError (image->error, HPDF_INVALID_COLOR_SPACE, 0);
/* Each integer must be in the range 0 to 2^BitsPerComponent - 1 */
if (rmax > 255 || gmax > 255 || bmax > 255)
return HPDF_RaiseError (image->error, HPDF_INVALID_PARAMETER, 0);
array = HPDF_Array_New (image->mmgr);
if (!array)
return HPDF_CheckError (image->error);
ret += HPDF_Dict_Add (image, "Mask", array);
ret += HPDF_Array_AddNumber (array, rmin);
ret += HPDF_Array_AddNumber (array, rmax);
ret += HPDF_Array_AddNumber (array, gmin);
ret += HPDF_Array_AddNumber (array, gmax);
ret += HPDF_Array_AddNumber (array, bmin);
ret += HPDF_Array_AddNumber (array, bmax);
if (ret != HPDF_OK)
return HPDF_CheckError (image->error);
return HPDF_OK;
}
开发者ID:AKKF,项目名称:libharu,代码行数:47,代码来源:hpdf_image.c
注:本文中的HPDF_Array_New函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论