本文整理汇总了C++中CFX_FloatRect::Transform方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_FloatRect::Transform方法的具体用法?C++ CFX_FloatRect::Transform怎么用?C++ CFX_FloatRect::Transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_FloatRect
的用法示例。
在下文中一共展示了CFX_FloatRect::Transform方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AnnotList
DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
double a,
double b,
double c,
double d,
double e,
double f) {
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return;
CPDF_AnnotList AnnotList(pPage);
for (size_t i = 0; i < AnnotList.Count(); ++i) {
CPDF_Annot* pAnnot = AnnotList.GetAt(i);
// transformAnnots Rectangle
CFX_FloatRect rect = pAnnot->GetRect();
CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
(FX_FLOAT)e, (FX_FLOAT)f);
rect.Transform(&matrix);
CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayBy("Rect");
if (!pRectArray)
pRectArray = new CPDF_Array;
pRectArray->SetAt(0, new CPDF_Number(rect.left));
pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
pRectArray->SetAt(2, new CPDF_Number(rect.right));
pRectArray->SetAt(3, new CPDF_Number(rect.top));
pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray);
// Transform AP's rectangle
// To Do
}
}
示例2: SetClip_PathFill
void CFX_PSRenderer::SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_AffineMatrix* pObject2Device,
int fill_mode
)
{
StartRendering();
OutputPath(pPathData, pObject2Device);
CFX_FloatRect rect = pPathData->GetBoundingBox();
if (pObject2Device) {
rect.Transform(pObject2Device);
}
m_ClipBox.Intersect(rect.GetOutterRect());
if ((fill_mode & 3) == FXFILL_WINDING) {
OUTPUT_PS("W n\n");
} else {
OUTPUT_PS("W* n\n");
}
}
示例3: CheckRotate
static void CheckRotate(CPDF_Page& page, CFX_FloatRect& page_bbox)
{
int total_count = 0, rotated_count[3] = {0, 0, 0};
FX_POSITION pos = page.GetFirstObjectPosition();
while (pos) {
CPDF_PageObject* pObj = page.GetNextObject(pos);
if (pObj->m_Type != PDFPAGE_TEXT) {
continue;
}
total_count ++;
CPDF_TextObject* pText = (CPDF_TextObject*)pObj;
FX_FLOAT angle = pText->m_TextState.GetBaselineAngle();
if (angle == 0.0) {
continue;
}
int degree = (int)(angle * 180 / PI + 0.5);
if (degree % 90) {
continue;
}
if (degree < 0) {
degree += 360;
}
int index = degree / 90 % 3 - 1;
if (index < 0) {
continue;
}
rotated_count[index] ++;
}
if (total_count == 0) {
return;
}
CFX_AffineMatrix matrix;
if (rotated_count[0] > total_count * 2 / 3) {
matrix.Set(0, -1, 1, 0, 0, page.GetPageHeight());
} else if (rotated_count[1] > total_count * 2 / 3) {
matrix.Set(-1, 0, 0, -1, page.GetPageWidth(), page.GetPageHeight());
} else if (rotated_count[2] > total_count * 2 / 3) {
matrix.Set(0, 1, -1, 0, page.GetPageWidth(), 0);
} else {
return;
}
page.Transform(matrix);
page_bbox.Transform(&matrix);
}
示例4: _GetShadingBBox
CFX_FloatRect _GetShadingBBox(CPDF_Stream* pStream, int type, const CFX_AffineMatrix* pMatrix,
CPDF_Function** pFuncs, int nFuncs, CPDF_ColorSpace* pCS)
{
if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM || pFuncs == NULL || pCS == NULL) {
return CFX_FloatRect(0, 0, 0, 0);
}
CPDF_MeshStream stream;
if (!stream.Load(pStream, pFuncs, nFuncs, pCS)) {
return CFX_FloatRect(0, 0, 0, 0);
}
CFX_FloatRect rect;
FX_BOOL bStarted = FALSE;
FX_BOOL bGouraud = type == 4 || type == 5;
int full_point_count = type == 7 ? 16 : (type == 6 ? 12 : 1);
int full_color_count = (type == 6 || type == 7) ? 4 : 1;
while (!stream.m_BitStream.IsEOF()) {
FX_DWORD flag;
if (type != 5) {
flag = stream.GetFlag();
}
int point_count = full_point_count, color_count = full_color_count;
if (!bGouraud && flag) {
point_count -= 4;
color_count -= 2;
}
for (int i = 0; i < point_count; i ++) {
FX_FLOAT x, y;
stream.GetCoords(x, y);
if (bStarted) {
rect.UpdateRect(x, y);
} else {
rect.InitRect(x, y);
bStarted = TRUE;
}
}
stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * color_count);
if (bGouraud) {
stream.m_BitStream.ByteAlign();
}
}
rect.Transform(pMatrix);
return rect;
}
示例5: CalcBoundingBox
void CPDF_PathObject::CalcBoundingBox()
{
if (m_Path.IsNull()) {
return;
}
CFX_FloatRect rect;
FX_FLOAT width = m_GraphState.GetObject()->m_LineWidth;
if (m_bStroke && width != 0) {
rect = m_Path.GetBoundingBox(width, m_GraphState.GetObject()->m_MiterLimit);
} else {
rect = m_Path.GetBoundingBox();
}
rect.Transform(&m_Matrix);
if (width == 0 && m_bStroke) {
rect.left += -0.5f;
rect.right += 0.5f;
rect.bottom += -0.5f;
rect.top += 0.5f;
}
m_Left = rect.left;
m_Right = rect.right;
m_Top = rect.top;
m_Bottom = rect.bottom;
}
示例6: SetClip_PathStroke
void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData,
const CFX_AffineMatrix* pObject2Device,
const CFX_GraphStateData* pGraphState
)
{
StartRendering();
SetGraphState(pGraphState);
if (pObject2Device) {
CFX_ByteTextBuf buf;
buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ") << pObject2Device->b << FX_BSTRC(" ") <<
pObject2Device->c << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ") << pObject2Device->e <<
FX_BSTRC(" ") << pObject2Device->f << FX_BSTRC("]cm ");
m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize());
}
OutputPath(pPathData, NULL);
CFX_FloatRect rect = pPathData->GetBoundingBox(pGraphState->m_LineWidth, pGraphState->m_MiterLimit);
rect.Transform(pObject2Device);
m_ClipBox.Intersect(rect.GetOutterRect());
if (pObject2Device) {
OUTPUT_PS("strokepath W n sm\n");
} else {
OUTPUT_PS("strokepath W n\n");
}
}
示例7: DrawShading
void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
CFX_Matrix* pMatrix,
FX_RECT& clip_rect,
int alpha,
FX_BOOL bAlphaMode) {
CPDF_Function** pFuncs = pPattern->m_pFunctions;
int nFuncs = pPattern->m_nFuncs;
CPDF_Dictionary* pDict = pPattern->m_pShadingObj->GetDict();
CPDF_ColorSpace* pColorSpace = pPattern->m_pCS;
if (!pColorSpace) {
return;
}
FX_ARGB background = 0;
if (!pPattern->m_bShadingObj &&
pPattern->m_pShadingObj->GetDict()->KeyExist("Background")) {
CPDF_Array* pBackColor =
pPattern->m_pShadingObj->GetDict()->GetArray("Background");
if (pBackColor &&
pBackColor->GetCount() >= (FX_DWORD)pColorSpace->CountComponents()) {
CFX_FixedBufGrow<FX_FLOAT, 16> comps(pColorSpace->CountComponents());
for (int i = 0; i < pColorSpace->CountComponents(); i++) {
comps[i] = pBackColor->GetNumber(i);
}
FX_FLOAT R = 0.0f, G = 0.0f, B = 0.0f;
pColorSpace->GetRGB(comps, R, G, B);
background = ArgbEncode(255, (int32_t)(R * 255), (int32_t)(G * 255),
(int32_t)(B * 255));
}
}
if (pDict->KeyExist("BBox")) {
CFX_FloatRect rect = pDict->GetRect("BBox");
rect.Transform(pMatrix);
clip_rect.Intersect(rect.GetOutterRect());
}
CPDF_DeviceBuffer buffer;
buffer.Initialize(m_pContext, m_pDevice, &clip_rect, m_pCurObj, 150);
CFX_Matrix FinalMatrix = *pMatrix;
FinalMatrix.Concat(*buffer.GetMatrix());
CFX_DIBitmap* pBitmap = buffer.GetBitmap();
if (!pBitmap->GetBuffer()) {
return;
}
pBitmap->Clear(background);
int fill_mode = m_Options.m_Flags;
switch (pPattern->m_ShadingType) {
case kInvalidShading:
case kMaxShading:
return;
case kFunctionBasedShading:
DrawFuncShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs, pColorSpace,
alpha);
break;
case kAxialShading:
DrawAxialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
pColorSpace, alpha);
break;
case kRadialShading:
DrawRadialShading(pBitmap, &FinalMatrix, pDict, pFuncs, nFuncs,
pColorSpace, alpha);
break;
case kFreeFormGouraudTriangleMeshShading: {
DrawFreeGouraudShading(pBitmap, &FinalMatrix,
ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
pColorSpace, alpha);
} break;
case kLatticeFormGouraudTriangleMeshShading: {
DrawLatticeGouraudShading(pBitmap, &FinalMatrix,
ToStream(pPattern->m_pShadingObj), pFuncs,
nFuncs, pColorSpace, alpha);
} break;
case kCoonsPatchMeshShading:
case kTensorProductPatchMeshShading: {
DrawCoonPatchMeshes(
pPattern->m_ShadingType == kTensorProductPatchMeshShading, pBitmap,
&FinalMatrix, ToStream(pPattern->m_pShadingObj), pFuncs, nFuncs,
pColorSpace, fill_mode, alpha);
} break;
}
if (bAlphaMode) {
pBitmap->LoadChannel(FXDIB_Red, pBitmap, FXDIB_Alpha);
}
if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
pBitmap->ConvertColorScale(m_Options.m_ForeColor, m_Options.m_BackColor);
}
buffer.OutputToDevice();
}