本文整理汇总了C++中CFX_PathData::Transform方法的典型用法代码示例。如果您正苦于以下问题:C++ CFX_PathData::Transform方法的具体用法?C++ CFX_PathData::Transform怎么用?C++ CFX_PathData::Transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFX_PathData
的用法示例。
在下文中一共展示了CFX_PathData::Transform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StartBitmapAlpha
FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha()
{
if (m_pDIBSource->IsOpaqueImage()) {
CFX_PathData path;
path.AppendRect(0, 0, 1, 1);
path.Transform(&m_ImageMatrix);
FX_DWORD fill_color = ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha);
m_pRenderStatus->m_pDevice->DrawPath(&path, NULL, NULL, fill_color, 0, FXFILL_WINDING);
} else {
const CFX_DIBSource* pAlphaMask = m_pDIBSource->IsAlphaMask() ? m_pDIBSource : m_pDIBSource->GetAlphaMask();
if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f || FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) {
int left, top;
CFX_DIBitmap* pTransformed = pAlphaMask->TransformTo(&m_ImageMatrix, left, top);
if (pTransformed == NULL) {
return TRUE;
}
m_pRenderStatus->m_pDevice->SetBitMask(pTransformed, left, top, ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
delete pTransformed;
} else {
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOutterRect();
int dest_width = m_ImageMatrix.a > 0 ? image_rect.Width() : -image_rect.Width();
int dest_height = m_ImageMatrix.d > 0 ? -image_rect.Height() : image_rect.Height();
int left = dest_width > 0 ? image_rect.left : image_rect.right;
int top = dest_height > 0 ? image_rect.top : image_rect.bottom;
m_pRenderStatus->m_pDevice->StretchBitMask(pAlphaMask, left, top, dest_width, dest_height,
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
}
if (m_pDIBSource != pAlphaMask) {
delete pAlphaMask;
}
}
return FALSE;
}
示例2: StartBitmapAlpha
bool CPDF_ImageRenderer::StartBitmapAlpha() {
if (m_pDIBSource->IsOpaqueImage()) {
CFX_PathData path;
path.AppendRect(0, 0, 1, 1);
path.Transform(&m_ImageMatrix);
uint32_t fill_color =
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha);
m_pRenderStatus->m_pDevice->DrawPath(&path, nullptr, nullptr, fill_color, 0,
FXFILL_WINDING);
return false;
}
CFX_MaybeOwned<CFX_DIBSource> pAlphaMask;
if (m_pDIBSource->IsAlphaMask())
pAlphaMask = const_cast<CFX_DIBSource*>(m_pDIBSource);
else
pAlphaMask = m_pDIBSource->CloneAlphaMask();
if (FXSYS_fabs(m_ImageMatrix.b) >= 0.5f ||
FXSYS_fabs(m_ImageMatrix.c) >= 0.5f) {
int left;
int top;
std::unique_ptr<CFX_DIBitmap> pTransformed =
pAlphaMask->TransformTo(&m_ImageMatrix, left, top);
if (!pTransformed)
return true;
m_pRenderStatus->m_pDevice->SetBitMask(
pTransformed.get(), left, top,
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
return false;
}
CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect();
FX_RECT image_rect = image_rect_f.GetOuterRect();
int dest_width =
m_ImageMatrix.a > 0 ? image_rect.Width() : -image_rect.Width();
int dest_height =
m_ImageMatrix.d > 0 ? -image_rect.Height() : image_rect.Height();
int left = dest_width > 0 ? image_rect.left : image_rect.right;
int top = dest_height > 0 ? image_rect.top : image_rect.bottom;
m_pRenderStatus->m_pDevice->StretchBitMask(
pAlphaMask.Get(), left, top, dest_width, dest_height,
ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha));
return false;
}
示例3: InitCheckPath
void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) {
if (!m_pCheckPath) {
m_pCheckPath.reset(new CFX_Path);
m_pCheckPath->Create();
FX_FLOAT fWidth = kSignPath;
FX_FLOAT fHeight = -kSignPath;
FX_FLOAT fBottom = kSignPath;
CFX_PointF pt1(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
CFX_PointF pt2(fWidth / 4.5f, fBottom + fHeight / 16.0f);
CFX_PointF pt3(fWidth / 3.0f, fBottom);
CFX_PointF pt4(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
CFX_PointF pt5(fWidth / 3.6f, fBottom + fHeight / 3.5f);
CFX_PointF pt12(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
CFX_PointF pt21(fWidth / 5.0f, fBottom + fHeight / 5.0f);
CFX_PointF pt23(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
CFX_PointF pt32(fWidth / 4.0f, fBottom);
CFX_PointF pt34(fWidth * (1 / 7.0f + 7 / 15.0f),
fBottom + fHeight * 4 / 5.0f);
CFX_PointF pt43(fWidth * (1 / 7.0f + 7 / 15.0f),
fBottom + fHeight * 4 / 5.0f);
CFX_PointF pt45(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
CFX_PointF pt54(fWidth / 3.4f, fBottom + fHeight / 3.5f);
CFX_PointF pt51(fWidth / 3.6f, fBottom + fHeight / 4.0f);
CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
m_pCheckPath->MoveTo(pt1.x, pt1.y);
FX_FLOAT px1 = pt12.x - pt1.x;
FX_FLOAT py1 = pt12.y - pt1.y;
FX_FLOAT px2 = pt21.x - pt2.x;
FX_FLOAT py2 = pt21.y - pt2.y;
m_pCheckPath->BezierTo(pt1.x + px1 * FX_BEZIER, pt1.y + py1 * FX_BEZIER,
pt2.x + px2 * FX_BEZIER, pt2.y + py2 * FX_BEZIER,
pt2.x, pt2.y);
px1 = pt23.x - pt2.x;
py1 = pt23.y - pt2.y;
px2 = pt32.x - pt3.x;
py2 = pt32.y - pt3.y;
m_pCheckPath->BezierTo(pt2.x + px1 * FX_BEZIER, pt2.y + py1 * FX_BEZIER,
pt3.x + px2 * FX_BEZIER, pt3.y + py2 * FX_BEZIER,
pt3.x, pt3.y);
px1 = pt34.x - pt3.x;
py1 = pt34.y - pt3.y;
px2 = pt43.x - pt4.x;
py2 = pt43.y - pt4.y;
m_pCheckPath->BezierTo(pt3.x + px1 * FX_BEZIER, pt3.y + py1 * FX_BEZIER,
pt4.x + px2 * FX_BEZIER, pt4.y + py2 * FX_BEZIER,
pt4.x, pt4.y);
px1 = pt45.x - pt4.x;
py1 = pt45.y - pt4.y;
px2 = pt54.x - pt5.x;
py2 = pt54.y - pt5.y;
m_pCheckPath->BezierTo(pt4.x + px1 * FX_BEZIER, pt4.y + py1 * FX_BEZIER,
pt5.x + px2 * FX_BEZIER, pt5.y + py2 * FX_BEZIER,
pt5.x, pt5.y);
px1 = pt51.x - pt5.x;
py1 = pt51.y - pt5.y;
px2 = pt15.x - pt1.x;
py2 = pt15.y - pt1.y;
m_pCheckPath->BezierTo(pt5.x + px1 * FX_BEZIER, pt5.y + py1 * FX_BEZIER,
pt1.x + px2 * FX_BEZIER, pt1.y + py2 * FX_BEZIER,
pt1.x, pt1.y);
FX_FLOAT fScale = fCheckLen / kSignPath;
CFX_Matrix mt;
mt.Set(1, 0, 0, 1, 0, 0);
mt.Scale(fScale, fScale);
CFX_PathData* pData = m_pCheckPath->GetPathData();
pData->Transform(&mt);
}
}
示例4: initCheckPath
void CFWL_CheckBoxTP::initCheckPath(FX_FLOAT fCheckLen) {
if (!m_pCheckPath) {
m_pCheckPath = new CFX_Path;
m_pCheckPath->Create();
FX_FLOAT fWidth = CHECKBOX_SIZE_SIGNPATH;
FX_FLOAT fHeight = -CHECKBOX_SIZE_SIGNPATH;
FX_FLOAT fBottom = CHECKBOX_SIZE_SIGNPATH;
FX_FLOAT px1, py1, px2, py2;
CFX_PointF pt1;
pt1.Set(fWidth / 15.0f, fBottom + fHeight * 2 / 5.0f);
CFX_PointF pt2;
pt2.Set(fWidth / 4.5f, fBottom + fHeight / 16.0f);
CFX_PointF pt3;
pt3.Set(fWidth / 3.0f, fBottom);
CFX_PointF pt4;
pt4.Set(fWidth * 14 / 15.0f, fBottom + fHeight * 15 / 16.0f);
CFX_PointF pt5;
pt5.Set(fWidth / 3.6f, fBottom + fHeight / 3.5f);
CFX_PointF pt12;
pt12.Set(fWidth / 7.0f, fBottom + fHeight * 2 / 7.0f);
CFX_PointF pt21;
pt21.Set(fWidth / 5.0f, fBottom + fHeight / 5.0f);
CFX_PointF pt23;
pt23.Set(fWidth / 4.4f, fBottom + fHeight * 0 / 16.0f);
CFX_PointF pt32;
pt32.Set(fWidth / 4.0f, fBottom);
CFX_PointF pt34;
pt34.Set(fWidth * (1 / 7.0f + 7 / 15.0f), fBottom + fHeight * 4 / 5.0f);
CFX_PointF pt43;
pt43.Set(fWidth * (1 / 7.0f + 7 / 15.0f), fBottom + fHeight * 4 / 5.0f);
CFX_PointF pt45;
pt45.Set(fWidth * 7 / 15.0f, fBottom + fHeight * 8 / 7.0f);
CFX_PointF pt54;
pt54.Set(fWidth / 3.4f, fBottom + fHeight / 3.5f);
CFX_PointF pt51;
pt51.Set(fWidth / 3.6f, fBottom + fHeight / 4.0f);
CFX_PointF pt15;
pt15.Set(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
m_pCheckPath->MoveTo(pt1.x, pt1.y);
px1 = pt12.x - pt1.x;
py1 = pt12.y - pt1.y;
px2 = pt21.x - pt2.x;
py2 = pt21.y - pt2.y;
m_pCheckPath->BezierTo(pt1.x + px1 * FWLTHEME_BEZIER,
pt1.y + py1 * FWLTHEME_BEZIER,
pt2.x + px2 * FWLTHEME_BEZIER,
pt2.y + py2 * FWLTHEME_BEZIER, pt2.x, pt2.y);
px1 = pt23.x - pt2.x;
py1 = pt23.y - pt2.y;
px2 = pt32.x - pt3.x;
py2 = pt32.y - pt3.y;
m_pCheckPath->BezierTo(pt2.x + px1 * FWLTHEME_BEZIER,
pt2.y + py1 * FWLTHEME_BEZIER,
pt3.x + px2 * FWLTHEME_BEZIER,
pt3.y + py2 * FWLTHEME_BEZIER, pt3.x, pt3.y);
px1 = pt34.x - pt3.x;
py1 = pt34.y - pt3.y;
px2 = pt43.x - pt4.x;
py2 = pt43.y - pt4.y;
m_pCheckPath->BezierTo(pt3.x + px1 * FWLTHEME_BEZIER,
pt3.y + py1 * FWLTHEME_BEZIER,
pt4.x + px2 * FWLTHEME_BEZIER,
pt4.y + py2 * FWLTHEME_BEZIER, pt4.x, pt4.y);
px1 = pt45.x - pt4.x;
py1 = pt45.y - pt4.y;
px2 = pt54.x - pt5.x;
py2 = pt54.y - pt5.y;
m_pCheckPath->BezierTo(pt4.x + px1 * FWLTHEME_BEZIER,
pt4.y + py1 * FWLTHEME_BEZIER,
pt5.x + px2 * FWLTHEME_BEZIER,
pt5.y + py2 * FWLTHEME_BEZIER, pt5.x, pt5.y);
px1 = pt51.x - pt5.x;
py1 = pt51.y - pt5.y;
px2 = pt15.x - pt1.x;
py2 = pt15.y - pt1.y;
m_pCheckPath->BezierTo(pt5.x + px1 * FWLTHEME_BEZIER,
pt5.y + py1 * FWLTHEME_BEZIER,
pt1.x + px2 * FWLTHEME_BEZIER,
pt1.y + py2 * FWLTHEME_BEZIER, pt1.x, pt1.y);
FX_FLOAT fScale = fCheckLen / CHECKBOX_SIZE_SIGNPATH;
CFX_Matrix mt;
mt.Set(1, 0, 0, 1, 0, 0);
mt.Scale(fScale, fScale);
CFX_PathData* pData = m_pCheckPath->GetPathData();
pData->Transform(&mt);
}
}