本文整理汇总了C++中CFX_DIBitmap::IsAlphaMask方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_DIBitmap::IsAlphaMask方法的具体用法?C++ CFX_DIBitmap::IsAlphaMask怎么用?C++ CFX_DIBitmap::IsAlphaMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_DIBitmap
的用法示例。
在下文中一共展示了CFX_DIBitmap::IsAlphaMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Continue
FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) {
if (m_Status == 1) {
if (m_pQuickStretcher->Continue(pPause)) {
return TRUE;
}
if (m_pQuickStretcher->m_pBitmap->IsAlphaMask())
m_pRenderStatus->m_pDevice->SetBitMask(
m_pQuickStretcher->m_pBitmap, m_pQuickStretcher->m_ResultLeft,
m_pQuickStretcher->m_ResultTop, m_FillArgb);
else
m_pRenderStatus->m_pDevice->SetDIBits(
m_pQuickStretcher->m_pBitmap, m_pQuickStretcher->m_ResultLeft,
m_pQuickStretcher->m_ResultTop, m_BlendType);
return FALSE;
}
if (m_Status == 2) {
if (m_pTransformer->Continue(pPause)) {
return TRUE;
}
CFX_DIBitmap* pBitmap = m_pTransformer->m_Storer.Detach();
if (pBitmap == NULL) {
return FALSE;
}
if (pBitmap->IsAlphaMask()) {
if (m_BitmapAlpha != 255) {
m_FillArgb = FXARGB_MUL_ALPHA(m_FillArgb, m_BitmapAlpha);
}
m_Result = m_pRenderStatus->m_pDevice->SetBitMask(
pBitmap, m_pTransformer->m_ResultLeft, m_pTransformer->m_ResultTop,
m_FillArgb);
} else {
if (m_BitmapAlpha != 255) {
pBitmap->MultiplyAlpha(m_BitmapAlpha);
}
m_Result = m_pRenderStatus->m_pDevice->SetDIBits(
pBitmap, m_pTransformer->m_ResultLeft, m_pTransformer->m_ResultTop,
m_BlendType);
}
delete pBitmap;
return FALSE;
}
if (m_Status == 3) {
return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause);
}
if (m_Status == 4) {
if (m_Loader.Continue(m_LoadHandle, pPause)) {
return TRUE;
}
if (StartRenderDIBSource()) {
return Continue(pPause);
}
}
return FALSE;
}
示例2: src_bitmap
static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc,
const CFX_AffineMatrix* pDestMatrix) {
ASSERT(pSrc->GetFormat() == FXDIB_1bppRgb ||
pSrc->GetFormat() == FXDIB_1bppMask ||
pSrc->GetFormat() == FXDIB_1bppCmyk);
CFX_DIBExtractor src_bitmap(pSrc);
CFX_DIBitmap* pSrcBitmap = src_bitmap;
if (pSrcBitmap == NULL) {
return NULL;
}
int src_width = pSrcBitmap->GetWidth(), src_height = pSrcBitmap->GetHeight();
uint8_t* src_buf = pSrcBitmap->GetBuffer();
FX_DWORD src_pitch = pSrcBitmap->GetPitch();
FX_FLOAT dest_area = pDestMatrix->GetUnitArea();
FX_FLOAT area_scale =
FXSYS_Div((FX_FLOAT)(src_width * src_height), dest_area);
FX_FLOAT size_scale = FXSYS_sqrt(area_scale);
CFX_AffineMatrix adjusted_matrix(*pDestMatrix);
adjusted_matrix.Scale(size_scale, size_scale);
CFX_FloatRect result_rect_f = adjusted_matrix.GetUnitRect();
FX_RECT result_rect = result_rect_f.GetOutterRect();
CFX_AffineMatrix src2result;
src2result.e = adjusted_matrix.c + adjusted_matrix.e;
src2result.f = adjusted_matrix.d + adjusted_matrix.f;
src2result.a = adjusted_matrix.a / pSrcBitmap->GetWidth();
src2result.b = adjusted_matrix.b / pSrcBitmap->GetWidth();
src2result.c = -adjusted_matrix.c / pSrcBitmap->GetHeight();
src2result.d = -adjusted_matrix.d / pSrcBitmap->GetHeight();
src2result.TranslateI(-result_rect.left, -result_rect.top);
CFX_AffineMatrix result2src;
result2src.SetReverse(src2result);
CPDF_FixedMatrix result2src_fix(result2src, 8);
int result_width = result_rect.Width();
int result_height = result_rect.Height();
CFX_DIBitmap* pTempBitmap = new CFX_DIBitmap;
if (!pTempBitmap->Create(result_width, result_height, pSrc->GetFormat())) {
delete pTempBitmap;
if (pSrcBitmap != src_bitmap) {
delete pSrcBitmap;
}
return NULL;
}
pTempBitmap->CopyPalette(pSrc->GetPalette());
uint8_t* dest_buf = pTempBitmap->GetBuffer();
int dest_pitch = pTempBitmap->GetPitch();
FXSYS_memset(dest_buf, pSrc->IsAlphaMask() ? 0 : 0xff,
dest_pitch * result_height);
if (pSrcBitmap->IsAlphaMask()) {
for (int dest_y = 0; dest_y < result_height; dest_y++) {
uint8_t* dest_scan = dest_buf + dest_y * dest_pitch;
for (int dest_x = 0; dest_x < result_width; dest_x++) {
int src_x, src_y;
result2src_fix.Transform(dest_x, dest_y, src_x, src_y);
if (src_x < 0 || src_x >= src_width || src_y < 0 ||
src_y >= src_height) {
continue;
}
if (!((src_buf + src_pitch * src_y)[src_x / 8] &
(1 << (7 - src_x % 8)))) {
continue;
}
dest_scan[dest_x / 8] |= 1 << (7 - dest_x % 8);
}
}
} else {
for (int dest_y = 0; dest_y < result_height; dest_y++) {
uint8_t* dest_scan = dest_buf + dest_y * dest_pitch;
for (int dest_x = 0; dest_x < result_width; dest_x++) {
int src_x, src_y;
result2src_fix.Transform(dest_x, dest_y, src_x, src_y);
if (src_x < 0 || src_x >= src_width || src_y < 0 ||
src_y >= src_height) {
continue;
}
if ((src_buf + src_pitch * src_y)[src_x / 8] & (1 << (7 - src_x % 8))) {
continue;
}
dest_scan[dest_x / 8] &= ~(1 << (7 - dest_x % 8));
}
}
}
if (pSrcBitmap != src_bitmap) {
delete pSrcBitmap;
}
return pTempBitmap;
}