DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, FPDF_DWORD color) { if (bitmap == NULL) return; #ifdef _SKIA_SUPPORT_ CFX_SkiaDevice device; #else CFX_FxgeDevice device; #endif device.Attach((CFX_DIBitmap*)bitmap); if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) color |= 0xFF000000; FX_RECT rect(left, top, left+width, top+height); device.FillRect(&rect, color); }
DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, int left, int top, int width, int height, int red, int green, int blue, int alpha) { if (bitmap == NULL) return; #ifdef _SKIA_SUPPORT_ CFX_SkiaDevice device; #else CFX_FxgeDevice device; #endif device.Attach((CFX_DIBitmap*)bitmap); if (!((CFX_DIBitmap*)bitmap)->HasAlpha()) alpha = 255; FX_RECT rect(left, top, left+width, top+height); device.FillRect(&rect, FXARGB_MAKE(alpha, red, green, blue)); }
DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, FPDF_BITMAP bitmap, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y, int rotate, int flags) { if (!hHandle || !page) return ; CPDF_Page* pPage = (CPDF_Page*)page; CPDF_RenderOptions options; if (flags & FPDF_LCD_TEXT) options.m_Flags |= RENDER_CLEARTYPE; else options.m_Flags &= ~RENDER_CLEARTYPE; //Grayscale output if (flags & FPDF_GRAYSCALE) { options.m_ColorMode = RENDER_COLOR_GRAY; options.m_ForeColor = 0; options.m_BackColor = 0xffffff; } options.m_AddFlags = flags >> 8; options.m_pOCContext = FX_NEW CPDF_OCContext(pPage->m_pDocument); //FXMT_CSLOCK_OBJ(&pPage->m_PageLock); CFX_AffineMatrix matrix; pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); FX_RECT clip; clip.left = start_x; clip.right = start_x + size_x; clip.top = start_y; clip.bottom = start_y + size_y; #ifdef _SKIA_SUPPORT_ CFX_SkiaDevice* pDevice = FX_NEW CFX_SkiaDevice; #else CFX_FxgeDevice* pDevice = NULL; pDevice = FX_NEW CFX_FxgeDevice; #endif if (!pDevice) return; pDevice->Attach((CFX_DIBitmap*)bitmap); pDevice->SaveState(); pDevice->SetClip_Rect(&clip); CPDF_RenderContext* pContext = NULL; pContext = FX_NEW CPDF_RenderContext; if (!pContext) { delete pDevice; pDevice = NULL; return; } // CPDF_Document* pDoc = pPage->m_pDocument; CPDFDoc_Environment* pEnv = (CPDFDoc_Environment*)hHandle; CPDFSDK_Document* pFXDoc = pEnv->GetCurrentDoc(); if(!pFXDoc) { delete pContext; delete pDevice; pContext = NULL; pDevice = NULL; return; } if(CPDFSDK_PageView* pPageView = pFXDoc->GetPageView(pPage)) { pPageView->PageView_OnDraw(pDevice, &matrix, &options); } pDevice->RestoreState(); if(options.m_pOCContext) { delete options.m_pOCContext; options.m_pOCContext = NULL; } if(pContext) { delete pContext; pContext = NULL; } if(pDevice) { delete pDevice; pDevice = NULL; } }