* contrib/hbtip/encqp.prg
* QP decoder will now accept LF EOLs (to work well with
non-compliant mailers).
* external/libhpdf/hpdfpags.h
* external/libhpdf/hpdffdfb.c
* external/libhpdf/hpdfxref.c
* external/libhpdf/hpdfcons.h
* external/libhpdf/hpdfextg.c
* external/libhpdf/hpdfencc.c
* external/libhpdf/hpdffdfj.c
+ external/libhpdf/hpdfpdfa.c
* external/libhpdf/hpdfextg.h
* external/libhpdf/hpdfstre.c
* external/libhpdf/hpdffdfn.c
+ external/libhpdf/hpdfpdfa.h
* external/libhpdf/hpdffdf1.c
* external/libhpdf/hpdfenck.c
* external/libhpdf/hpdfstri.c
* external/libhpdf/hpdfstre.h
* external/libhpdf/hpdffdft.c
* external/libhpdf/hpdfoutl.c
* external/libhpdf/hpdfenco.c
* external/libhpdf/hpdfecyd.c
* external/libhpdf/hpdfimap.c
* external/libhpdf/hpdfoutl.h
* external/libhpdf/hpdfenco.h
* external/libhpdf/Makefile
* external/libhpdf/hpdffond.h
* external/libhpdf/hpdfency.h
* external/libhpdf/hpdffon1.c
* external/libhpdf/hpdffont.c
* external/libhpdf/hpdfcata.c
* external/libhpdf/hpdffont.h
* external/libhpdf/hpdfutil.c
* external/libhpdf/hpdfcata.h
* external/libhpdf/hpdfutil.h
* external/libhpdf/hpdfdict.c
* external/libhpdf/hpdfreal.c
* external/libhpdf/hpdfarra.c
* external/libhpdf/hpdfdocp.c
* external/libhpdf/libhpdf.dif
* external/libhpdf/hpdfconf.h
* external/libhpdf/hpdfinfo.c
* external/libhpdf/hpdfanno.c
* external/libhpdf/hpdfgsta.c
* external/libhpdf/hpdfdest.c
* external/libhpdf/hpdfinfo.h
* external/libhpdf/hpdfanno.h
* external/libhpdf/hpdfnumb.c
* external/libhpdf/hpdffdfc.c
* external/libhpdf/hpdfgsta.h
* external/libhpdf/hpdfdest.h
* external/libhpdf/hpdfdoc.c
* external/libhpdf/hpdferro.c
* external/libhpdf/hpdffdfi.c
* external/libhpdf/hpdfbina.c
* external/libhpdf/hpdfdoc.h
* external/libhpdf/hpdffdfk.c
* external/libhpdf/hpdflist.c
* external/libhpdf/hpdferro.h
* external/libhpdf/hpdfimag.c
* external/libhpdf/hpdfencj.c
* external/libhpdf/hpdflist.h
* external/libhpdf/hpdfecy.c
* external/libhpdf/hpdfimag.h
* external/libhpdf/hpdfencn.c
* external/libhpdf/hpdffonc.c
* external/libhpdf/hpdfu3d.c
* external/libhpdf/hpdfencr.h
* external/libhpdf/hpdffdf.c
* external/libhpdf/hpdfu3d.h
* external/libhpdf/hpdfmmgr.c
* external/libhpdf/hpdfmmgr.h
* external/libhpdf/hpdfnull.c
* external/libhpdf/README
* external/libhpdf/hpdffott.c
* external/libhpdf/hpdfpage.c
+ external/libhpdf/hpdfndic.c
* external/libhpdf/hpdfobje.c
* external/libhpdf/hpdfname.c
* external/libhpdf/hpdfpage.h
+ external/libhpdf/hpdfndic.h
* external/libhpdf/hpdf.h
* external/libhpdf/hpdfobje.h
* external/libhpdf/hpdfvers.h
* external/libhpdf/hpdfpago.c
* external/libhpdf/hpdftype.h
* external/libhpdf/hpdfpags.c
* external/libhpdf/hpdfbool.c
+ libharu updated to official 2.2.0 release (from 2.1.0).
Patch sent by Tamas Tevesz.
* Added new files to Makefile.
154 lines
4.1 KiB
C
154 lines
4.1 KiB
C
/*
|
|
* << Haru Free PDF Library >> -- hpdf_ext_gstate.c
|
|
*
|
|
* URL: http://libharu.org
|
|
*
|
|
* Copyright (c) 1999-2006 Takeshi Kanno <takeshi_kanno@est.hi-ho.ne.jp>
|
|
* Copyright (c) 2007-2009 Antony Dovgal <tony@daylessday.org>
|
|
*
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
* provided that the above copyright notice appear in all copies and
|
|
* that both that copyright notice and this permission notice appear
|
|
* in supporting documentation.
|
|
* It is provided "as is" without express or implied warranty.
|
|
*
|
|
*/
|
|
|
|
#include "hpdfconf.h"
|
|
#include "hpdfutil.h"
|
|
#include "hpdfextg.h"
|
|
#include "hpdf.h"
|
|
|
|
static const char *HPDF_BM_NAMES[] = {
|
|
"Normal",
|
|
"Multiply",
|
|
"Screen",
|
|
"Overlay",
|
|
"Darken",
|
|
"Lighten",
|
|
"ColorDodge",
|
|
"ColorBurn",
|
|
"HardLight",
|
|
"SoftLight",
|
|
"Difference",
|
|
"Exclusion"
|
|
};
|
|
|
|
|
|
HPDF_BOOL
|
|
HPDF_ExtGState_Validate (HPDF_ExtGState ext_gstate)
|
|
{
|
|
if (!ext_gstate || (ext_gstate->header.obj_class !=
|
|
(HPDF_OSUBCLASS_EXT_GSTATE | HPDF_OCLASS_DICT) &&
|
|
ext_gstate->header.obj_class !=
|
|
(HPDF_OSUBCLASS_EXT_GSTATE_R | HPDF_OCLASS_DICT)))
|
|
return HPDF_FALSE;
|
|
|
|
return HPDF_TRUE;
|
|
}
|
|
|
|
|
|
HPDF_STATUS
|
|
ExtGState_Check (HPDF_ExtGState ext_gstate)
|
|
{
|
|
if (!HPDF_ExtGState_Validate (ext_gstate))
|
|
return HPDF_INVALID_OBJECT;
|
|
|
|
if (ext_gstate->header.obj_class ==
|
|
(HPDF_OSUBCLASS_EXT_GSTATE_R | HPDF_OCLASS_DICT))
|
|
return HPDF_RaiseError (ext_gstate->error, HPDF_EXT_GSTATE_READ_ONLY,
|
|
0);
|
|
|
|
return HPDF_OK;
|
|
}
|
|
|
|
|
|
HPDF_Dict
|
|
HPDF_ExtGState_New (HPDF_MMgr mmgr,
|
|
HPDF_Xref xref)
|
|
{
|
|
HPDF_Dict obj = HPDF_Dict_New (mmgr);
|
|
|
|
HPDF_PTRACE ((" HPDF_ExtGState_New\n"));
|
|
|
|
if (!obj)
|
|
return NULL;
|
|
|
|
if (HPDF_Xref_Add (xref, obj) != HPDF_OK)
|
|
return NULL;
|
|
|
|
if (HPDF_Dict_AddName (obj, "Type", "ExtGState") != HPDF_OK)
|
|
return NULL;
|
|
|
|
obj->header.obj_class |= HPDF_OSUBCLASS_EXT_GSTATE;
|
|
|
|
return obj;
|
|
}
|
|
|
|
|
|
HPDF_EXPORT(HPDF_STATUS)
|
|
HPDF_ExtGState_SetAlphaStroke (HPDF_ExtGState ext_gstate,
|
|
HPDF_REAL value)
|
|
{
|
|
HPDF_STATUS ret = ExtGState_Check (ext_gstate);
|
|
|
|
if (ret != HPDF_OK)
|
|
return ret;
|
|
|
|
if (value < 0 || value > 1.0f)
|
|
return HPDF_RaiseError (ext_gstate->error,
|
|
HPDF_EXT_GSTATE_OUT_OF_RANGE, 0);
|
|
|
|
return HPDF_Dict_AddReal (ext_gstate, "CA", value);
|
|
}
|
|
|
|
|
|
HPDF_EXPORT(HPDF_STATUS)
|
|
HPDF_ExtGState_SetAlphaFill (HPDF_ExtGState ext_gstate,
|
|
HPDF_REAL value)
|
|
{
|
|
HPDF_STATUS ret = ExtGState_Check (ext_gstate);
|
|
|
|
if (ret != HPDF_OK)
|
|
return ret;
|
|
|
|
if (value < 0 || value > 1.0f)
|
|
return HPDF_RaiseError (ext_gstate->error,
|
|
HPDF_EXT_GSTATE_OUT_OF_RANGE, 0);
|
|
|
|
return HPDF_Dict_AddReal (ext_gstate, "ca", value);
|
|
}
|
|
|
|
|
|
HPDF_EXPORT(HPDF_STATUS)
|
|
HPDF_ExtGState_SetBlendMode (HPDF_ExtGState ext_gstate,
|
|
HPDF_BlendMode bmode)
|
|
{
|
|
HPDF_STATUS ret = ExtGState_Check (ext_gstate);
|
|
|
|
if (ret != HPDF_OK)
|
|
return ret;
|
|
|
|
if ((int)bmode < 0 || (int)bmode > (int)HPDF_BM_EOF)
|
|
return HPDF_RaiseError (ext_gstate->error,
|
|
HPDF_EXT_GSTATE_OUT_OF_RANGE, 0);
|
|
|
|
return HPDF_Dict_AddName (ext_gstate, "BM", HPDF_BM_NAMES[(int)bmode]);
|
|
}
|
|
|
|
/*
|
|
HPDF_STATUS
|
|
HPDF_ExtGState_SetStrokeAdjustment (HPDF_ExtGState ext_gstate,
|
|
HPDF_BOOL value)
|
|
{
|
|
HPDF_STATUS ret = ExtGState_Check (ext_gstate);
|
|
|
|
if (ret != HPDF_OK)
|
|
return ret;
|
|
|
|
return HPDF_Dict_AddBoolean (ext_gstate, "SA", value);
|
|
}
|
|
*/
|
|
|