当前位置: 首页>>代码示例>>C++>>正文


C++ CPDF_Page::BackgroundAlphaNeeded方法代码示例

本文整理汇总了C++中CPDF_Page::BackgroundAlphaNeeded方法的典型用法代码示例。如果您正苦于以下问题:C++ CPDF_Page::BackgroundAlphaNeeded方法的具体用法?C++ CPDF_Page::BackgroundAlphaNeeded怎么用?C++ CPDF_Page::BackgroundAlphaNeeded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPDF_Page的用法示例。


在下文中一共展示了CPDF_Page::BackgroundAlphaNeeded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page)
{
	if(!page) return FALSE;
	CPDF_Page* pPage = (CPDF_Page*)page;

	return pPage->BackgroundAlphaNeeded();
}
开发者ID:azunite,项目名称:pdfium_ch,代码行数:7,代码来源:fpdfeditpage.cpp

示例2: CPDFPageFromFPDFPage

DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page) {
  CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
  return pPage && pPage->BackgroundAlphaNeeded();
}
开发者ID:,项目名称:,代码行数:4,代码来源:

示例3: WinDC

DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, FPDF_PAGE page, int start_x, int start_y, int size_x, int size_y,
                                       int rotate, int flags)
{
    if (page==NULL) return;
    CPDF_Page* pPage = (CPDF_Page*)page;

    CRenderContext* pContext = FX_NEW CRenderContext;
    pPage->SetPrivateData((void*)1, pContext, DropContext);

#ifndef _WIN32_WCE
    CFX_DIBitmap* pBitmap = NULL;
    FX_BOOL bBackgroundAlphaNeeded=FALSE;
    bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded();
    if (bBackgroundAlphaNeeded)
    {

        pBitmap = FX_NEW CFX_DIBitmap;
        pBitmap->Create(size_x, size_y, FXDIB_Argb);
        pBitmap->Clear(0x00ffffff);
#ifdef _SKIA_SUPPORT_
        pContext->m_pDevice = FX_NEW CFX_SkiaDevice;
        ((CFX_SkiaDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
#else
        pContext->m_pDevice = FX_NEW CFX_FxgeDevice;
        ((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
#endif
    }
    else
        pContext->m_pDevice = FX_NEW CFX_WindowsDevice(dc);
    if (flags & FPDF_NO_CATCH)
        Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL);
    else {
        try {
            Func_RenderPage(pContext, page, start_x, start_y, size_x, size_y, rotate, flags,TRUE,NULL);
        } catch (...) {
        }
    }
    if (bBackgroundAlphaNeeded)
    {
        if (pBitmap)
        {
            CFX_WindowsDevice WinDC(dc);

            if (WinDC.GetDeviceCaps(FXDC_DEVICE_CLASS) == FXDC_PRINTER)
            {
                CFX_DIBitmap* pDst = FX_NEW CFX_DIBitmap;
                pDst->Create(pBitmap->GetWidth(), pBitmap->GetHeight(),FXDIB_Rgb32);
                FXSYS_memcpy(pDst->GetBuffer(), pBitmap->GetBuffer(), pBitmap->GetPitch()*pBitmap->GetHeight());
//				WinDC.SetDIBits(pDst,0,0);
                WinDC.StretchDIBits(pDst,0,0,size_x*2,size_y*2);
                delete pDst;
            }
            else
                WinDC.SetDIBits(pBitmap,0,0);

        }
    }
#else
    // get clip region
    RECT rect, cliprect;
    rect.left = start_x;
    rect.top = start_y;
    rect.right = start_x + size_x;
    rect.bottom = start_y + size_y;
    GetClipBox(dc, &cliprect);
    IntersectRect(&rect, &rect, &cliprect);
    int width = rect.right - rect.left;
    int height = rect.bottom - rect.top;

#ifdef DEBUG_TRACE
    {
        char str[128];
        sprintf(str, "Rendering DIB %d x %d", width, height);
        CPDF_ModuleMgr::Get()->ReportError(999, str);
    }
#endif

    // Create a DIB section
    LPVOID pBuffer;
    BITMAPINFOHEADER bmih;
    FXSYS_memset(&bmih, 0, sizeof bmih);
    bmih.biSize = sizeof bmih;
    bmih.biBitCount = 24;
    bmih.biHeight = -height;
    bmih.biPlanes = 1;
    bmih.biWidth = width;
    pContext->m_hBitmap = CreateDIBSection(dc, (BITMAPINFO*)&bmih, DIB_RGB_COLORS, &pBuffer, NULL, 0);
    if (pContext->m_hBitmap == NULL) {
#if defined(DEBUG) || defined(_DEBUG)
        char str[128];
        sprintf(str, "Error CreateDIBSection: %d x %d, error code = %d", width, height, GetLastError());
        CPDF_ModuleMgr::Get()->ReportError(FPDFERR_OUT_OF_MEMORY, str);
#else
        CPDF_ModuleMgr::Get()->ReportError(FPDFERR_OUT_OF_MEMORY, NULL);
#endif
    }
    FXSYS_memset(pBuffer, 0xff, height*((width*3+3)/4*4));

#ifdef DEBUG_TRACE
    {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的CPDF_Page::BackgroundAlphaNeeded方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。