本文整理汇总了C++中CFX_DIBitmap::CompositeMask方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_DIBitmap::CompositeMask方法的具体用法?C++ CFX_DIBitmap::CompositeMask怎么用?C++ CFX_DIBitmap::CompositeMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_DIBitmap
的用法示例。
在下文中一共展示了CFX_DIBitmap::CompositeMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTilingPattern
//.........这里部分代码省略.........
status.RenderObjectList(pPattern->m_pForm, &matrix);
m_pDevice->RestoreState();
}
m_pDevice->RestoreState();
delete pStates;
return;
}
if (bAligned) {
int orig_x = FXSYS_round(mtPattern2Device.e);
int orig_y = FXSYS_round(mtPattern2Device.f);
min_col = (clip_box.left - orig_x) / width;
if (clip_box.left < orig_x) {
min_col--;
}
max_col = (clip_box.right - orig_x) / width;
if (clip_box.right <= orig_x) {
max_col--;
}
min_row = (clip_box.top - orig_y) / height;
if (clip_box.top < orig_y) {
min_row--;
}
max_row = (clip_box.bottom - orig_y) / height;
if (clip_box.bottom <= orig_y) {
max_row--;
}
}
FX_FLOAT left_offset = cell_bbox.left - mtPattern2Device.e;
FX_FLOAT top_offset = cell_bbox.bottom - mtPattern2Device.f;
CFX_DIBitmap* pPatternBitmap = NULL;
if (width * height < 16) {
CFX_DIBitmap* pEnlargedBitmap =
DrawPatternBitmap(m_pContext->m_pDocument, m_pContext->m_pPageCache,
pPattern, pObj2Device, 8, 8, m_Options.m_Flags);
pPatternBitmap = pEnlargedBitmap->StretchTo(width, height);
delete pEnlargedBitmap;
} else {
pPatternBitmap = DrawPatternBitmap(
m_pContext->m_pDocument, m_pContext->m_pPageCache, pPattern,
pObj2Device, width, height, m_Options.m_Flags);
}
if (!pPatternBitmap) {
m_pDevice->RestoreState();
return;
}
if (m_Options.m_ColorMode == RENDER_COLOR_GRAY) {
pPatternBitmap->ConvertColorScale(m_Options.m_ForeColor,
m_Options.m_BackColor);
}
FX_ARGB fill_argb = GetFillArgb(pPageObj);
int clip_width = clip_box.right - clip_box.left;
int clip_height = clip_box.bottom - clip_box.top;
CFX_DIBitmap screen;
if (!screen.Create(clip_width, clip_height, FXDIB_Argb)) {
return;
}
screen.Clear(0);
FX_DWORD* src_buf = (FX_DWORD*)pPatternBitmap->GetBuffer();
for (int col = min_col; col <= max_col; col++) {
for (int row = min_row; row <= max_row; row++) {
int start_x, start_y;
if (bAligned) {
start_x = FXSYS_round(mtPattern2Device.e) + col * width - clip_box.left;
start_y = FXSYS_round(mtPattern2Device.f) + row * height - clip_box.top;
} else {
FX_FLOAT orig_x = col * pPattern->m_XStep;
FX_FLOAT orig_y = row * pPattern->m_YStep;
mtPattern2Device.Transform(orig_x, orig_y);
start_x = FXSYS_round(orig_x + left_offset) - clip_box.left;
start_y = FXSYS_round(orig_y + top_offset) - clip_box.top;
}
if (width == 1 && height == 1) {
if (start_x < 0 || start_x >= clip_box.Width() || start_y < 0 ||
start_y >= clip_box.Height()) {
continue;
}
FX_DWORD* dest_buf =
(FX_DWORD*)(screen.GetBuffer() + screen.GetPitch() * start_y +
start_x * 4);
if (pPattern->m_bColored) {
*dest_buf = *src_buf;
} else {
*dest_buf = (*(uint8_t*)src_buf << 24) | (fill_argb & 0xffffff);
}
} else {
if (pPattern->m_bColored) {
screen.CompositeBitmap(start_x, start_y, width, height,
pPatternBitmap, 0, 0);
} else {
screen.CompositeMask(start_x, start_y, width, height, pPatternBitmap,
fill_argb, 0, 0);
}
}
}
}
CompositeDIBitmap(&screen, clip_box.left, clip_box.top, 0, 255,
FXDIB_BLEND_NORMAL, FALSE);
m_pDevice->RestoreState();
delete pPatternBitmap;
}
示例2: CompositeDIBitmap
void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap,
int left,
int top,
FX_ARGB mask_argb,
int bitmap_alpha,
int blend_mode,
int Transparency) {
if (pDIBitmap == NULL) {
return;
}
FX_BOOL bIsolated = Transparency & PDFTRANS_ISOLATED;
FX_BOOL bGroup = Transparency & PDFTRANS_GROUP;
if (blend_mode == FXDIB_BLEND_NORMAL) {
if (!pDIBitmap->IsAlphaMask()) {
if (bitmap_alpha < 255) {
pDIBitmap->MultiplyAlpha(bitmap_alpha);
}
if (m_pDevice->SetDIBits(pDIBitmap, left, top)) {
return;
}
} else {
FX_DWORD fill_argb = m_Options.TranslateColor(mask_argb);
if (bitmap_alpha < 255) {
((uint8_t*)&fill_argb)[3] =
((uint8_t*)&fill_argb)[3] * bitmap_alpha / 255;
}
if (m_pDevice->SetBitMask(pDIBitmap, left, top, fill_argb)) {
return;
}
}
}
FX_BOOL bBackAlphaRequired = blend_mode && bIsolated && !m_bDropObjects;
FX_BOOL bGetBackGround =
((m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT)) ||
(!(m_pDevice->GetRenderCaps() & FXRC_ALPHA_OUTPUT) &&
(m_pDevice->GetRenderCaps() & FXRC_GET_BITS) && !bBackAlphaRequired);
if (bGetBackGround) {
if (bIsolated || !bGroup) {
if (pDIBitmap->IsAlphaMask()) {
return;
}
m_pDevice->SetDIBits(pDIBitmap, left, top, blend_mode);
} else {
FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
top + pDIBitmap->GetHeight());
rect.Intersect(m_pDevice->GetClipBox());
CFX_DIBitmap* pClone = NULL;
FX_BOOL bClone = FALSE;
if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) {
bClone = TRUE;
pClone = m_pDevice->GetBackDrop()->Clone(&rect);
CFX_DIBitmap* pForeBitmap = m_pDevice->GetBitmap();
pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
pForeBitmap, rect.left, rect.top);
left = left >= 0 ? 0 : left;
top = top >= 0 ? 0 : top;
if (!pDIBitmap->IsAlphaMask())
pClone->CompositeBitmap(0, 0, pClone->GetWidth(), pClone->GetHeight(),
pDIBitmap, left, top, blend_mode);
else
pClone->CompositeMask(0, 0, pClone->GetWidth(), pClone->GetHeight(),
pDIBitmap, mask_argb, left, top, blend_mode);
} else {
pClone = pDIBitmap;
}
if (m_pDevice->GetBackDrop()) {
m_pDevice->SetDIBits(pClone, rect.left, rect.top);
} else {
if (pDIBitmap->IsAlphaMask()) {
return;
}
m_pDevice->SetDIBits(pDIBitmap, rect.left, rect.top, blend_mode);
}
if (bClone) {
delete pClone;
}
}
return;
}
int back_left, back_top;
FX_RECT rect(left, top, left + pDIBitmap->GetWidth(),
top + pDIBitmap->GetHeight());
nonstd::unique_ptr<CFX_DIBitmap> pBackdrop(
GetBackdrop(m_pCurObj, rect, back_left, back_top,
blend_mode > FXDIB_BLEND_NORMAL && bIsolated));
if (!pBackdrop)
return;
if (!pDIBitmap->IsAlphaMask()) {
pBackdrop->CompositeBitmap(left - back_left, top - back_top,
pDIBitmap->GetWidth(), pDIBitmap->GetHeight(),
pDIBitmap, 0, 0, blend_mode);
} else {
pBackdrop->CompositeMask(left - back_left, top - back_top,
pDIBitmap->GetWidth(), pDIBitmap->GetHeight(),
pDIBitmap, mask_argb, 0, 0, blend_mode);
}
nonstd::unique_ptr<CFX_DIBitmap> pBackdrop1(new CFX_DIBitmap);
pBackdrop1->Create(pBackdrop->GetWidth(), pBackdrop->GetHeight(),
//.........这里部分代码省略.........