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


C++ CFX_DIBitmap::GetScanline方法代码示例

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


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

示例1: Continue

FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause)
{
    if (m_Status == 1) {
        if (m_Stretcher.Continue(pPause)) {
            return TRUE;
        }
        if (m_Storer.GetBitmap()) {
            m_Storer.Replace(m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0));
        }
        return FALSE;
    } else if (m_Status == 2) {
        return m_Stretcher.Continue(pPause);
    } else if (m_Status != 3) {
        return FALSE;
    }
    if (m_Stretcher.Continue(pPause)) {
        return TRUE;
    }
    int stretch_width = m_StretchClip.Width();
    int stretch_height = m_StretchClip.Height();
    if (m_Storer.GetBitmap() == NULL) {
        return FALSE;
    }
    FX_LPCBYTE stretch_buf = m_Storer.GetBitmap()->GetBuffer();
    FX_LPCBYTE stretch_buf_mask = NULL;
    if (m_Storer.GetBitmap()->m_pAlphaMask) {
        stretch_buf_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetBuffer();
    }
    int stretch_pitch = m_Storer.GetBitmap()->GetPitch();
    CFX_DIBitmap* pTransformed = FX_NEW CFX_DIBitmap;
    if (!pTransformed) {
        return FALSE;
    }
    FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource);
    if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) {
        delete pTransformed;
        return FALSE;
    }
    pTransformed->Clear(0);
    if (pTransformed->m_pAlphaMask) {
        pTransformed->m_pAlphaMask->Clear(0);
    }
    CFX_AffineMatrix result2stretch(1.0f, 0.0f, 0.0f, 1.0f, (FX_FLOAT)(m_ResultLeft), (FX_FLOAT)(m_ResultTop));
    result2stretch.Concat(m_dest2stretch);
    result2stretch.TranslateI(-m_StretchClip.left, -m_StretchClip.top);
    if (stretch_buf_mask == NULL && pTransformed->m_pAlphaMask) {
        pTransformed->m_pAlphaMask->Clear(0xff000000);
    } else if (pTransformed->m_pAlphaMask) {
        int stretch_pitch_mask = m_Storer.GetBitmap()->m_pAlphaMask->GetPitch();
        if (!(m_Flags & FXDIB_DOWNSAMPLE) && !(m_Flags & FXDIB_BICUBIC_INTERPOL)) {
            CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
            for (int row = 0; row < m_ResultHeight; row ++) {
                FX_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row);
                for (int col = 0; col < m_ResultWidth; col ++) {
                    int src_col_l, src_row_l, res_x, res_y;
                    result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y);
                    if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && src_row_l <= stretch_height) {
                        if (src_col_l == stretch_width) {
                            src_col_l--;
                        }
                        if (src_row_l == stretch_height) {
                            src_row_l--;
                        }
                        int src_col_r = src_col_l + 1;
                        int src_row_r = src_row_l + 1;
                        if (src_col_r == stretch_width) {
                            src_col_r--;
                        }
                        if (src_row_r == stretch_height) {
                            src_row_r--;
                        }
                        int row_offset_l = src_row_l * stretch_pitch_mask;
                        int row_offset_r = src_row_r * stretch_pitch_mask;
                        *dest_pos_mask = _bilinear_interpol(stretch_buf_mask, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0);
                    }
                    dest_pos_mask++;
                }
            }
        } else if (m_Flags & FXDIB_BICUBIC_INTERPOL) {
            CFX_BilinearMatrix result2stretch_fix(result2stretch, 8);
            int pos_pixel[8];
            for (int row = 0; row < m_ResultHeight; row ++) {
                FX_BYTE* dest_pos_mask = (FX_BYTE*)pTransformed->m_pAlphaMask->GetScanline(row);
                for (int col = 0; col < m_ResultWidth; col ++) {
                    int src_col_l, src_row_l, res_x, res_y;
                    result2stretch_fix.Transform(col, row, src_col_l, src_row_l, res_x, res_y);
                    if (src_col_l >= 0 && src_col_l <= stretch_width && src_row_l >= 0 && src_row_l <= stretch_height) {
                        int u_w[4], v_w[4];
                        if (src_col_l == stretch_width) {
                            src_col_l--;
                        }
                        if (src_row_l == stretch_height) {
                            src_row_l--;
                        }
                        _bicubic_get_pos_weight(pos_pixel, u_w, v_w, src_col_l, src_row_l, res_x, res_y, stretch_width, stretch_height);
                        *dest_pos_mask = _bicubic_interpol(stretch_buf_mask, stretch_pitch_mask, pos_pixel, u_w, v_w, res_x, res_y, 1, 0);
                    }
                    dest_pos_mask++;
                }
            }
//.........这里部分代码省略.........
开发者ID:MWisBest,项目名称:android_external_pdfium,代码行数:101,代码来源:fx_dib_transform.cpp


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