本文整理汇总了C++中CFX_FxgeDevice类的典型用法代码示例。如果您正苦于以下问题:C++ CFX_FxgeDevice类的具体用法?C++ CFX_FxgeDevice怎么用?C++ CFX_FxgeDevice使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFX_FxgeDevice类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FPDF_RenderPageBitmap_Start
DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags,
IFSDK_PAUSE* pause) {
if (!bitmap || !pause || pause->version != 1)
return FPDF_RENDER_FAILED;
CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
if (!pPage)
return FPDF_RENDER_FAILED;
CPDF_PageRenderContext* pContext = new CPDF_PageRenderContext;
pPage->SetRenderContext(WrapUnique(pContext));
CFX_FxgeDevice* pDevice = new CFX_FxgeDevice;
pContext->m_pDevice.reset(pDevice);
CFX_DIBitmap* pBitmap = CFXBitmapFromFPDFBitmap(bitmap);
pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false);
IFSDK_PAUSE_Adapter IPauseAdapter(pause);
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
rotate, flags, FALSE, &IPauseAdapter);
if (pContext->m_pRenderer) {
return CPDF_ProgressiveRenderer::ToFPDFStatus(
pContext->m_pRenderer->GetStatus());
}
return FPDF_RENDER_FAILED;
}
示例2: ASSERT
void CFDE_TextOut::SetDIBitmap(CFX_DIBitmap* pDIB) {
ASSERT(pDIB);
m_pRenderDevice.reset();
CFX_FxgeDevice* device = new CFX_FxgeDevice;
device->Attach(pDIB, false, nullptr, false);
m_pRenderDevice.reset(new CFDE_RenderDevice(device, FALSE));
}
示例3: ASSERT
void CFDE_TextOut::SetDIBitmap(CFX_DIBitmap* pDIB) {
ASSERT(pDIB);
m_pRenderDevice.reset();
CFX_FxgeDevice* device = new CFX_FxgeDevice;
device->Attach(pDIB, false, nullptr, false);
m_pRenderDevice = pdfium::MakeUnique<CFDE_RenderDevice>(device, false);
}
示例4: GetBackground
void CPDF_RenderContext::GetBackground(CFX_DIBitmap* pBuffer,
const CPDF_PageObject* pObj,
const CPDF_RenderOptions* pOptions,
CFX_Matrix* pFinalMatrix) {
CFX_FxgeDevice device;
device.Attach(pBuffer, false, nullptr, false);
FX_RECT rect(0, 0, device.GetWidth(), device.GetHeight());
device.FillRect(&rect, 0xffffffff);
Render(&device, pObj, pOptions, pFinalMatrix);
}
示例5: DrawAxialShading
void CFWL_FormTP::InitCaption(FX_BOOL bActive) {
if (bActive) {
CFX_FxgeDevice dev;
CFX_Graphics gs;
CFX_Path path;
path.Create();
if (m_pActiveBitmap) {
delete m_pActiveBitmap;
m_pActiveBitmap = NULL;
}
m_pActiveBitmap = new CFX_DIBitmap;
m_pActiveBitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb);
dev.Attach(m_pActiveBitmap);
gs.Create(&dev);
path.AddRectangle(0, 0, 1, 5);
DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[0][0],
m_pThemeData->clrHeadBK[0][1], &path);
path.Clear();
path.AddRectangle(0, 5, 1, 15);
DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[0][1],
m_pThemeData->clrHeadBK[0][2], &path);
path.Clear();
path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19);
DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption,
m_pThemeData->clrHeadBK[0][2],
m_pThemeData->clrHeadBK[0][3], &path);
} else {
CFX_FxgeDevice dev;
CFX_Graphics gs;
CFX_Path path;
path.Create();
if (m_pDeactivebitmap) {
delete m_pDeactivebitmap;
m_pDeactivebitmap = NULL;
}
m_pDeactivebitmap = new CFX_DIBitmap;
m_pDeactivebitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb);
dev.Attach(m_pDeactivebitmap);
gs.Create(&dev);
path.AddRectangle(0, 0, 1, 5);
DrawAxialShading(&gs, 0, 0, 0, 5, m_pThemeData->clrHeadBK[1][0],
m_pThemeData->clrHeadBK[1][1], &path);
path.Clear();
path.AddRectangle(0, 5, 1, 15);
DrawAxialShading(&gs, 0, 5, 0, 20, m_pThemeData->clrHeadBK[1][1],
m_pThemeData->clrHeadBK[1][2], &path);
path.Clear();
path.AddRectangle(0, 20, 1, FWLTHEME_CAPACITY_CYCaption - 19);
DrawAxialShading(&gs, 0, 20, 0, FWLTHEME_CAPACITY_CYCaption,
m_pThemeData->clrHeadBK[1][2],
m_pThemeData->clrHeadBK[1][3], &path);
}
}
示例6: FXSYS_fabs
CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj,
const FX_RECT& rect,
int& left,
int& top,
FX_BOOL bBackAlphaRequired) {
FX_RECT bbox = rect;
bbox.Intersect(m_pDevice->GetClipBox());
left = bbox.left;
top = bbox.top;
CFX_Matrix deviceCTM = m_pDevice->GetCTM();
FX_FLOAT scaleX = FXSYS_fabs(deviceCTM.a);
FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d);
int width = FXSYS_round(bbox.Width() * scaleX);
int height = FXSYS_round(bbox.Height() * scaleY);
std::unique_ptr<CFX_DIBitmap> pBackdrop(new CFX_DIBitmap);
if (bBackAlphaRequired && !m_bDropObjects)
pBackdrop->Create(width, height, FXDIB_Argb);
else
m_pDevice->CreateCompatibleBitmap(pBackdrop.get(), width, height);
if (!pBackdrop->GetBuffer())
return nullptr;
FX_BOOL bNeedDraw;
if (pBackdrop->HasAlpha())
bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT);
else
bNeedDraw = !(m_pDevice->GetRenderCaps() & FXRC_GET_BITS);
if (!bNeedDraw) {
m_pDevice->GetDIBits(pBackdrop.get(), left, top);
return pBackdrop.release();
}
CFX_Matrix FinalMatrix = m_DeviceMatrix;
FinalMatrix.TranslateI(-left, -top);
FinalMatrix.Scale(scaleX, scaleY);
pBackdrop->Clear(pBackdrop->HasAlpha() ? 0 : 0xffffffff);
CFX_FxgeDevice device;
device.Attach(pBackdrop.get(), false, nullptr, false);
m_pContext->Render(&device, pObj, &m_Options, &FinalMatrix);
return pBackdrop.release();
}
示例7: geRect
void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap* pOutBitmap,
const CFX_ByteString str,
FX_FLOAT geWidth,
FXTEXT_CHARPOS* pCharPos,
FX_FLOAT locX,
FX_FLOAT locY,
int32_t barWidth) {
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
CFX_FxgeDevice ge;
ge.Create((int)geWidth, iTextHeight, m_colorSpace, nullptr);
FX_RECT geRect(0, 0, (int)geWidth, iTextHeight);
ge.FillRect(&geRect, m_backgroundColor);
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
ge.DrawNormalText(str.GetLength(), pCharPos, m_pFont, (FX_FLOAT)iFontSize,
&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
CFX_FxgeDevice geBitmap;
geBitmap.Attach(pOutBitmap, false, nullptr, false);
geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY);
}
示例8: renderPageBitmap
static void renderPageBitmap(FPDF_BITMAP bitmap, FPDF_PAGE page, int destLeft, int destTop,
int destRight, int destBottom, SkMatrix* transform, int flags) {
// Note: this code ignores the currently unused RENDER_NO_NATIVETEXT,
// FPDF_RENDER_LIMITEDIMAGECACHE, FPDF_RENDER_FORCEHALFTONE, FPDF_GRAYSCALE,
// and FPDF_ANNOT flags. To add support for that refer to FPDF_RenderPage_Retail
// in fpdfview.cpp
CRenderContext* pContext = FX_NEW CRenderContext;
CPDF_Page* pPage = (CPDF_Page*) page;
pPage->SetPrivateData((void*) 1, pContext, DropContext);
CFX_FxgeDevice* fxgeDevice = FX_NEW CFX_FxgeDevice;
pContext->m_pDevice = fxgeDevice;
// Reverse the bytes (last argument TRUE) since the Android
// format is ARGB while the renderer uses BGRA internally.
fxgeDevice->Attach((CFX_DIBitmap*) bitmap, 0, TRUE);
CPDF_RenderOptions* renderOptions = pContext->m_pOptions;
if (!renderOptions) {
renderOptions = FX_NEW CPDF_RenderOptions;
pContext->m_pOptions = renderOptions;
}
if (flags & FPDF_LCD_TEXT) {
renderOptions->m_Flags |= RENDER_CLEARTYPE;
} else {
renderOptions->m_Flags &= ~RENDER_CLEARTYPE;
}
const CPDF_OCContext::UsageType usage = (flags & FPDF_PRINTING)
? CPDF_OCContext::Print : CPDF_OCContext::View;
renderOptions->m_AddFlags = flags >> 8;
renderOptions->m_pOCContext = new CPDF_OCContext(pPage->m_pDocument, usage);
fxgeDevice->SaveState();
FX_RECT clip;
clip.left = destLeft;
clip.right = destRight;
clip.top = destTop;
clip.bottom = destBottom;
fxgeDevice->SetClip_Rect(&clip);
CPDF_RenderContext* pageContext = FX_NEW CPDF_RenderContext;
pContext->m_pContext = pageContext;
pageContext->Create(pPage);
CFX_AffineMatrix matrix;
if (!transform) {
pPage->GetDisplayMatrix(matrix, destLeft, destTop, destRight - destLeft,
destBottom - destTop, 0);
} else {
// PDF's coordinate system origin is left-bottom while
// in graphics it is the top-left, so remap the origin.
matrix.Set(1, 0, 0, -1, 0, pPage->GetPageHeight());
SkScalar transformValues[6];
transform->asAffine(transformValues);
matrix.Concat(transformValues[SkMatrix::kAScaleX], transformValues[SkMatrix::kASkewY],
transformValues[SkMatrix::kASkewX], transformValues[SkMatrix::kAScaleY],
transformValues[SkMatrix::kATransX], transformValues[SkMatrix::kATransY]);
}
pageContext->AppendObjectList(pPage, &matrix);
pContext->m_pRenderer = FX_NEW CPDF_ProgressiveRenderer;
pContext->m_pRenderer->Start(pageContext, fxgeDevice, renderOptions, NULL);
fxgeDevice->RestoreState();
pPage->RemovePrivateData((void*) 1);
delete pContext;
}
示例9: FX_UTF8Encode
void CBC_OnedUPCAWriter::ShowChars(const CFX_WideStringC& contents,
CFX_DIBitmap* pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple,
int32_t& e) {
if (!device && !pOutBitmap) {
e = BCExceptionIllegalArgument;
return;
}
int32_t leftPadding = 7 * multiple;
int32_t leftPosition = 10 * multiple + leftPadding;
CFX_ByteString str = FX_UTF8Encode(contents);
int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
FXSYS_memset(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLen);
CFX_ByteString tempStr = str.Mid(1, 5);
FX_FLOAT strWidth = (FX_FLOAT)35 * multiple;
FX_FLOAT blank = 0.0;
CFX_FxgeDevice geBitmap;
if (pOutBitmap)
geBitmap.Attach(pOutBitmap, false, nullptr, false);
iLen = tempStr.GetLength();
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
if (!pOutBitmap) {
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect(
(FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight),
(FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
matr.Concat(*matrix);
matr.TransformRect(rect);
FX_RECT re = rect.GetOutterRect();
device->FillRect(&re, m_backgroundColor);
CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect1(
(FX_FLOAT)(leftPosition + 40 * multiple),
(FX_FLOAT)(m_Height - iTextHeight),
(FX_FLOAT)((leftPosition + 40 * multiple) + strWidth - 0.5),
(FX_FLOAT)m_Height);
matr1.Concat(*matrix);
matr1.TransformRect(rect1);
re = rect1.GetOutterRect();
device->FillRect(&re, m_backgroundColor);
FX_FLOAT strWidth1 = (FX_FLOAT)multiple * 7;
CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect2(0.0, (FX_FLOAT)(m_Height - iTextHeight),
(FX_FLOAT)strWidth1 - 1, (FX_FLOAT)m_Height);
matr2.Concat(*matrix);
matr2.TransformRect(rect2);
re = rect2.GetOutterRect();
device->FillRect(&re, m_backgroundColor);
CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect3(
(FX_FLOAT)(leftPosition + 85 * multiple),
(FX_FLOAT)(m_Height - iTextHeight),
(FX_FLOAT)((leftPosition + 85 * multiple) + strWidth1 - 0.5),
(FX_FLOAT)m_Height);
matr3.Concat(*matrix);
matr3.TransformRect(rect3);
re = rect3.GetOutterRect();
device->FillRect(&re, m_backgroundColor);
}
if (!pOutBitmap)
strWidth = strWidth * m_outputHScale;
CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank);
CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
CFX_FxgeDevice ge;
if (pOutBitmap) {
ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
ge.GetBitmap()->Clear(m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
} else {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(FX_FLOAT)leftPosition * m_outputHScale,
(FX_FLOAT)(m_Height - iTextHeight + iFontSize));
if (matrix) {
affine_matrix1.Concat(*matrix);
}
device->DrawNormalText(
iLen, pCharPos + 1, m_pFont, CFX_GEModule::Get()->GetFontCache(),
(FX_FLOAT)iFontSize, &affine_matrix1, m_fontColor, FXTEXT_CLEARTYPE);
}
tempStr = str.Mid(6, 5);
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank);
if (pOutBitmap) {
FX_RECT rect2(0, 0, (int)strWidth, iTextHeight);
ge.FillRect(&rect2, m_backgroundColor);
ge.DrawNormalText(iLen, pCharPos + 6, m_pFont,
CFX_GEModule::Get()->GetFontCache(), (FX_FLOAT)iFontSize,
&affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple,
//.........这里部分代码省略.........
示例10: DrawCoonPatchMeshes
static void DrawCoonPatchMeshes(FX_BOOL bTensor,
CFX_DIBitmap* pBitmap,
CFX_Matrix* pObject2Bitmap,
CPDF_Stream* pShadingStream,
CPDF_Function** pFuncs,
int nFuncs,
CPDF_ColorSpace* pCS,
int fill_mode,
int alpha) {
ASSERT(pBitmap->GetFormat() == FXDIB_Argb);
CFX_FxgeDevice device;
device.Attach(pBitmap);
CPDF_MeshStream stream;
if (!stream.Load(pShadingStream, pFuncs, nFuncs, pCS))
return;
if (!_CheckCoonTensorPara(stream))
return;
CPDF_PatchDrawer patch;
patch.alpha = alpha;
patch.pDevice = &device;
patch.fill_mode = fill_mode;
patch.path.SetPointCount(13);
FX_PATHPOINT* pPoints = patch.path.GetPoints();
pPoints[0].m_Flag = FXPT_MOVETO;
for (int i = 1; i < 13; i++) {
pPoints[i].m_Flag = FXPT_BEZIERTO;
}
CFX_FloatPoint coords[16];
for (int i = 0; i < 16; i++) {
coords[i].Set(0.0f, 0.0f);
}
int point_count = bTensor ? 16 : 12;
while (!stream.m_BitStream.IsEOF()) {
FX_DWORD flag = stream.GetFlag();
int iStartPoint = 0, iStartColor = 0, i = 0;
if (flag) {
iStartPoint = 4;
iStartColor = 2;
CFX_FloatPoint tempCoords[4];
for (i = 0; i < 4; i++) {
tempCoords[i] = coords[(flag * 3 + i) % 12];
}
FXSYS_memcpy(coords, tempCoords, sizeof(CFX_FloatPoint) * 4);
Coon_Color tempColors[2];
tempColors[0] = patch.patch_colors[flag];
tempColors[1] = patch.patch_colors[(flag + 1) % 4];
FXSYS_memcpy(patch.patch_colors, tempColors, sizeof(Coon_Color) * 2);
}
for (i = iStartPoint; i < point_count; i++) {
stream.GetCoords(coords[i].x, coords[i].y);
pObject2Bitmap->Transform(coords[i].x, coords[i].y);
}
for (i = iStartColor; i < 4; i++) {
FX_FLOAT r = 0.0f, g = 0.0f, b = 0.0f;
stream.GetColor(r, g, b);
patch.patch_colors[i].comp[0] = (int32_t)(r * 255);
patch.patch_colors[i].comp[1] = (int32_t)(g * 255);
patch.patch_colors[i].comp[2] = (int32_t)(b * 255);
}
CFX_FloatRect bbox = CFX_FloatRect::GetBBox(coords, point_count);
if (bbox.right <= 0 || bbox.left >= (FX_FLOAT)pBitmap->GetWidth() ||
bbox.top <= 0 || bbox.bottom >= (FX_FLOAT)pBitmap->GetHeight()) {
continue;
}
Coon_Bezier C1, C2, D1, D2;
C1.FromPoints(coords[0].x, coords[0].y, coords[11].x, coords[11].y,
coords[10].x, coords[10].y, coords[9].x, coords[9].y);
C2.FromPoints(coords[3].x, coords[3].y, coords[4].x, coords[4].y,
coords[5].x, coords[5].y, coords[6].x, coords[6].y);
D1.FromPoints(coords[0].x, coords[0].y, coords[1].x, coords[1].y,
coords[2].x, coords[2].y, coords[3].x, coords[3].y);
D2.FromPoints(coords[9].x, coords[9].y, coords[8].x, coords[8].y,
coords[7].x, coords[7].y, coords[6].x, coords[6].y);
patch.Draw(1, 1, 0, 0, C1, C2, D1, D2);
}
}