本文整理汇总了C++中CPDF_Function类的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Function类的具体用法?C++ CPDF_Function怎么用?C++ CPDF_Function使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CPDF_Function类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj)
{
if (pFuncObj == NULL) {
return NULL;
}
CPDF_Function* pFunc = NULL;
int type;
if (pFuncObj->GetType() == PDFOBJ_STREAM) {
type = ((CPDF_Stream*)pFuncObj)->GetDict()->GetInteger(FX_BSTRC("FunctionType"));
} else if (pFuncObj->GetType() == PDFOBJ_DICTIONARY) {
type = ((CPDF_Dictionary*)pFuncObj)->GetInteger(FX_BSTRC("FunctionType"));
} else {
return NULL;
}
if (type == 0) {
pFunc = FX_NEW CPDF_SampledFunc;
} else if (type == 2) {
pFunc = FX_NEW CPDF_ExpIntFunc;
} else if (type == 3) {
pFunc = FX_NEW CPDF_StitchFunc;
} else if (type == 4) {
pFunc = FX_NEW CPDF_PSFunc;
} else {
return NULL;
}
if (!pFunc->Init(pFuncObj)) {
delete pFunc;
return NULL;
}
return pFunc;
}
示例2: Load
FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray)
{
CFX_ByteString name = pArray->GetString(1);
if (name == FX_BSTRC("None")) {
m_Type = None;
} else {
m_Type = Colorant;
CPDF_Object* pAltCS = pArray->GetElementValue(2);
if (pAltCS == m_pArray) {
return FALSE;
}
m_pAltCS = Load(pDoc, pAltCS);
if (!m_pAltCS) {
return FALSE;
}
CPDF_Object* pFuncObj = pArray->GetElementValue(3);
if (pFuncObj && pFuncObj->GetType() != PDFOBJ_NAME) {
m_pFunc = CPDF_Function::Load(pFuncObj);
}
if (m_pFunc && m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
delete m_pFunc;
m_pFunc = NULL;
}
}
return TRUE;
}
示例3: ToArray
FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Array* pObj = ToArray(pArray->GetElementValue(1));
if (!pObj)
return FALSE;
m_nComponents = pObj->GetCount();
CPDF_Object* pAltCS = pArray->GetElementValue(2);
if (!pAltCS || pAltCS == m_pArray) {
return FALSE;
}
m_pAltCS = Load(pDoc, pAltCS);
m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3));
if (!m_pAltCS || !m_pFunc) {
return FALSE;
}
if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
return FALSE;
}
return TRUE;
}
示例4: Load
FX_BOOL CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Object* pObj = pArray->GetElementValue(1);
if (!pObj) {
return FALSE;
}
if (pObj->GetType() != PDFOBJ_ARRAY) {
return FALSE;
}
m_nComponents = ((CPDF_Array*)pObj)->GetCount();
CPDF_Object* pAltCS = pArray->GetElementValue(2);
if (!pAltCS || pAltCS == m_pArray) {
return FALSE;
}
m_pAltCS = Load(pDoc, pAltCS);
m_pFunc = CPDF_Function::Load(pArray->GetElementValue(3));
if (m_pAltCS == NULL || m_pFunc == NULL) {
return FALSE;
}
if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) {
return FALSE;
}
return TRUE;
}
示例5: FX_BSTRC
CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
FX_RECT* pClipRect, const CFX_AffineMatrix* pMatrix)
{
if (pSMaskDict == NULL) {
return NULL;
}
CFX_DIBitmap* pMask = NULL;
int width = pClipRect->right - pClipRect->left;
int height = pClipRect->bottom - pClipRect->top;
FX_BOOL bLuminosity = FALSE;
bLuminosity = pSMaskDict->GetConstString(FX_BSTRC("S")) != FX_BSTRC("Alpha");
CPDF_Stream* pGroup = pSMaskDict->GetStream(FX_BSTRC("G"));
if (pGroup == NULL) {
return NULL;
}
CPDF_Function* pFunc = NULL;
CPDF_Object* pFuncObj = pSMaskDict->GetElementValue(FX_BSTRC("TR"));
if (pFuncObj && (pFuncObj->GetType() == PDFOBJ_DICTIONARY || pFuncObj->GetType() == PDFOBJ_STREAM)) {
pFunc = CPDF_Function::Load(pFuncObj);
}
CFX_AffineMatrix matrix = *pMatrix;
matrix.TranslateI(-pClipRect->left, -pClipRect->top);
CPDF_Form form(m_pContext->m_pDocument, m_pContext->m_pPageResources, pGroup);
form.ParseContent(NULL, NULL, NULL, NULL);
CFX_FxgeDevice bitmap_device;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (!bitmap_device.Create(width, height, bLuminosity ? FXDIB_Rgb32 : FXDIB_8bppMask)) {
return NULL;
}
#else
if (!bitmap_device.Create(width, height, bLuminosity ? FXDIB_Rgb : FXDIB_8bppMask)) {
return NULL;
}
#endif
CFX_DIBitmap& bitmap = *bitmap_device.GetBitmap();
CPDF_Object* pCSObj = NULL;
CPDF_ColorSpace* pCS = NULL;
if (bLuminosity) {
CPDF_Array* pBC = pSMaskDict->GetArray(FX_BSTRC("BC"));
FX_ARGB back_color = 0xff000000;
if (pBC) {
pCSObj = pGroup->GetDict()->GetDict(FX_BSTRC("Group"))->GetElementValue(FX_BSTRC("CS"));
pCS = m_pContext->m_pDocument->LoadColorSpace(pCSObj);
if (pCS) {
FX_FLOAT R, G, B;
FX_DWORD num_floats = 8;
if (pCS->CountComponents() > (FX_INT32)num_floats) {
num_floats = (FX_DWORD)pCS->CountComponents();
}
CFX_FixedBufGrow<FX_FLOAT, 8> float_array(num_floats);
FX_FLOAT* pFloats = float_array;
FXSYS_memset32(pFloats, 0, num_floats * sizeof(FX_FLOAT));
int count = pBC->GetCount() > 8 ? 8 : pBC->GetCount();
for (int i = 0; i < count; i ++) {
pFloats[i] = pBC->GetNumber(i);
}
pCS->GetRGB(pFloats, R, G, B);
back_color = 0xff000000 | ((FX_INT32)(R * 255) << 16) | ((FX_INT32)(G * 255) << 8) | (FX_INT32)(B * 255);
m_pContext->m_pDocument->GetPageData()->ReleaseColorSpace(pCSObj);
}
}
bitmap.Clear(back_color);
} else {
bitmap.Clear(0);
}
CPDF_Dictionary* pFormResource = NULL;
if (form.m_pFormDict) {
pFormResource = form.m_pFormDict->GetDict(FX_BSTRC("Resources"));
}
CPDF_RenderOptions options;
options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA;
CPDF_RenderStatus status;
status.Initialize(m_Level + 1, m_pContext, &bitmap_device, NULL, NULL, NULL, NULL,
&options, 0, m_bDropObjects, pFormResource, TRUE, NULL, 0, pCS ? pCS->GetFamily() : 0, bLuminosity);
status.RenderObjectList(&form, &matrix);
pMask = FX_NEW CFX_DIBitmap;
if (!pMask->Create(width, height, FXDIB_8bppMask)) {
delete pMask;
return NULL;
}
FX_LPBYTE dest_buf = pMask->GetBuffer();
int dest_pitch = pMask->GetPitch();
FX_LPBYTE src_buf = bitmap.GetBuffer();
int src_pitch = bitmap.GetPitch();
FX_LPBYTE pTransfer = FX_Alloc(FX_BYTE, 256);
if (pFunc) {
CFX_FixedBufGrow<FX_FLOAT, 16> results(pFunc->CountOutputs());
for (int i = 0; i < 256; i ++) {
FX_FLOAT input = (FX_FLOAT)i / 255.0f;
int nresult;
pFunc->Call(&input, 1, results, nresult);
pTransfer[i] = FXSYS_round(results[0] * 255);
}
} else {
for (int i = 0; i < 256; i ++) {
pTransfer[i] = i;
}
}
if (bLuminosity) {
int Bpp = bitmap.GetBPP() / 8;
//.........这里部分代码省略.........
示例6: GetRGB
FX_BOOL CPDF_SeparationCS::GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOAT& B) const
{
if (m_Type == None) {
return FALSE;
}
if (m_pFunc == NULL) {
if (m_pAltCS == NULL) {
return FALSE;
}
int nComps = m_pAltCS->CountComponents();
CFX_FixedBufGrow<FX_FLOAT, 16> results(nComps);
for (int i = 0; i < nComps; i ++) {
results[i] = *pBuf;
}
m_pAltCS->GetRGB(results, R, G, B);
return TRUE;
}
CFX_FixedBufGrow<FX_FLOAT, 16> results(m_pFunc->CountOutputs());
int nresults = 0;
m_pFunc->Call(pBuf, 1, results, nresults);
if (nresults == 0) {
return FALSE;
}
if (m_pAltCS) {
m_pAltCS->GetRGB(results, R, G, B);
return TRUE;
}
R = G = B = 0;
return FALSE;
}