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


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

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


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

示例1: Continue


//.........这里部分代码省略.........
        } 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_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->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_scan = _bicubic_interpol(stretch_buf, stretch_pitch, pos_pixel, u_w, v_w, res_x, res_y, 1, 0);
                    }
                    dest_scan ++;
                }
            }
        } else {
            CPDF_FixedMatrix result2stretch_fix(result2stretch, 8);
            for (int row = 0; row < m_ResultHeight; row ++) {
                FX_LPBYTE dest_scan = (FX_LPBYTE)pTransformed->GetScanline(row);
                for (int col = 0; col < m_ResultWidth; col ++) {
                    int src_col, src_row;
                    result2stretch_fix.Transform(col, row, src_col, src_row);
                    if (src_col >= 0 && src_col <= stretch_width && src_row >= 0 && src_row <= stretch_height) {
                        if (src_col == stretch_width) {
                            src_col --;
                        }
                        if (src_row == stretch_height) {
                            src_row --;
                        }
                        FX_LPCBYTE src_pixel = stretch_buf + stretch_pitch * src_row + src_col;
                        *dest_scan = *src_pixel;
                    }
                    dest_scan ++;
                }
            }
        }
    } else {
        int Bpp = m_Storer.GetBitmap()->GetBPP() / 8;
        int destBpp = pTransformed->GetBPP() / 8;
        if (Bpp == 1) {
            FX_BOOL bHasAlpha = m_Storer.GetBitmap()->HasAlpha();
            FX_DWORD argb[256];
            FX_ARGB* pPal = m_Storer.GetBitmap()->GetPalette();
            if (pPal) {
                for (int i = 0; i < 256; i ++) {
                    argb[i] = pPal[i];
                }
            } else {
                if (m_Storer.GetBitmap()->IsCmykImage())
                    for (int i = 0; i < 256; i ++) {
                        argb[i] = 255 - i;
                    }
                else
                    for (int i = 0; i < 256; i ++) {
                        argb[i] = 0xff000000 | (i * 0x010101);
                    }
            }
            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 = (FX_BYTE*)pTransformed->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;
                            int row_offset_r = src_row_r * stretch_pitch;
                            FX_DWORD r_bgra_cmyk = argb[_bilinear_interpol(stretch_buf, row_offset_l, row_offset_r, src_col_l, src_col_r, res_x, res_y, 1, 0)];
                            if (transformF == FXDIB_Rgba) {
                                dest_pos[0] = (FX_BYTE)(r_bgra_cmyk >> 24);
                                dest_pos[1] = (FX_BYTE)(r_bgra_cmyk >> 16);
                                dest_pos[2] = (FX_BYTE)(r_bgra_cmyk >> 8);
                            } else {
                                *(FX_DWORD*)dest_pos = r_bgra_cmyk;
                            }
                        }
                        dest_pos += destBpp;
                    }
                }
开发者ID:MWisBest,项目名称:android_external_pdfium,代码行数:101,代码来源:fx_dib_transform.cpp


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