void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, CFX_AffineMatrix* pMatrix, CPDF_Page* pPage, CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions) { if (m_pWidgetDict->GetInteger("F") & ANNOTFLAG_HIDDEN) { return; } CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode); if (pStream == NULL) { return; } CFX_FloatRect form_bbox = pStream->GetDict()->GetRect("BBox"); CFX_AffineMatrix form_matrix = pStream->GetDict()->GetMatrix("Matrix"); form_matrix.TransformRect(form_bbox); CFX_FloatRect arect = m_pWidgetDict->GetRect("Rect"); CFX_AffineMatrix matrix; matrix.MatchRect(arect, form_bbox); matrix.Concat(*pMatrix); CPDF_Form form(m_pField->m_pForm->m_pDocument, m_pField->m_pForm->m_pFormDict->GetDict("DR"), pStream); form.ParseContent(NULL, NULL, NULL, NULL); CPDF_RenderContext context; context.Create(pPage); context.DrawObjectList(pDevice, &form, &matrix, pOptions); }
static CFX_DIBitmap* DrawPatternBitmap(CPDF_Document* pDoc, CPDF_PageRenderCache* pCache, CPDF_TilingPattern* pPattern, const CFX_AffineMatrix* pObject2Device, int width, int height, int flags) { CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, pPattern->m_bColored ? FXDIB_Argb : FXDIB_8bppMask)) { delete pBitmap; return NULL; } CFX_FxgeDevice bitmap_device; bitmap_device.Attach(pBitmap); pBitmap->Clear(0); CFX_FloatRect cell_bbox = pPattern->m_BBox; pPattern->m_Pattern2Form.TransformRect(cell_bbox); pObject2Device->TransformRect(cell_bbox); CFX_FloatRect bitmap_rect(0.0f, 0.0f, (FX_FLOAT)width, (FX_FLOAT)height); CFX_AffineMatrix mtAdjust; mtAdjust.MatchRect(bitmap_rect, cell_bbox); CFX_AffineMatrix mtPattern2Bitmap = *pObject2Device; mtPattern2Bitmap.Concat(mtAdjust); CPDF_RenderOptions options; if (!pPattern->m_bColored) { options.m_ColorMode = RENDER_COLOR_ALPHA; } flags |= RENDER_FORCE_HALFTONE; options.m_Flags = flags; CPDF_RenderContext context; context.Create(pDoc, pCache, NULL); context.DrawObjectList(&bitmap_device, pPattern->m_pForm, &mtPattern2Bitmap, &options); return pBitmap; }