本文整理汇总了C++中Transformation::ApplyToCoordinate方法的典型用法代码示例。如果您正苦于以下问题:C++ Transformation::ApplyToCoordinate方法的具体用法?C++ Transformation::ApplyToCoordinate怎么用?C++ Transformation::ApplyToCoordinate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transformation
的用法示例。
在下文中一共展示了Transformation::ApplyToCoordinate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DetermineLinearGradientPoints
void XARGenerator::DetermineLinearGradientPoints(const Gradient* pGradient, const Transformation& trans,
const RectD& boundings, DocCoord& p1, DocCoord& p2)
{
if (pGradient->units == Gradient::ObjectBoundingBox) {
PointD pLower = boundings.LowerCoord();
PointD pHigher = boundings.HigherCoord();
p1 = DocCoord((INT32)pLower.x, m_docSize.y - (INT32)pLower.y);
p2 = DocCoord((INT32)pHigher.x, m_docSize.y - (INT32)pHigher.y);
#ifdef SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "using ObjectBoundingBox %d,%d %d,%d\n", p1.x, p1.y, p2.x, p2.y);
#endif
} else { // Gradient->units == Gradient::UserSpaceOnUse
double fX1 = pGradient->x1;
double fY1 = pGradient->y1;
double fX2 = pGradient->x2;
double fY2 = pGradient->y2;
trans.ApplyToCoordinate(fX1, fY1, &fX1, &fY1);
trans.ApplyToCoordinate(fX2, fY2, &fX2, &fY2);
p1 = DocCoord((INT32)fX1, m_docSize.y - (INT32)fY1);
p2 = DocCoord((INT32)fX2, m_docSize.y - (INT32)fY2);
#if SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "using UserSpaceOnUse %d,%d %d,%d\n", p1.x, p1.y, p2.x, p2.y);
#endif
}
}
示例2: DetermineRadialGradientPoints
void XARGenerator::DetermineRadialGradientPoints(const Gradient* pGradient, const Transformation& trans,
const RectD& boundings, DocCoord& pC, DocCoord& pMaj, DocCoord& pMin)
{
if (pGradient->units == Gradient::ObjectBoundingBox) {
PointD p1m = (boundings.p11+boundings.p12)*0.5;
PointD p2m = (boundings.p21+boundings.p22)*0.5;
PointD p1M = (boundings.p11+boundings.p21)*0.5;
PointD p2M = (boundings.p12+boundings.p22)*0.5;
double fCX = p1M.x + (p2M.x-p1M.x)*pGradient->cx;
double fCY = p2m.y + (p1m.y-p2m.y)*pGradient->cy;
double fXM = fCX + (p2M.x-p1M.x)*pGradient->r;
double fYM = fCY;
double fXm = fCX;
double fYm = fCY + (p1m.y-p2m.y)*pGradient->r;
pC = DocCoord((INT32)fCX, (INT32)fCY);
pMaj = DocCoord((INT32)fXM, m_docSize.y - (INT32)fYM);
pMin = DocCoord((INT32)fXm, m_docSize.y - (INT32)fYm);
#ifdef SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "using ObjectBoundingBox %d,%d %d,%d (%d,%d)\n", pMaj.x, pMaj.y, pMin.x, pMin.y, pC.x, pC.y);
#endif
} else { // Gradient->units == Gradient::UserSpaceOnUse
double fX = pGradient->cx;
double fY = pGradient->cy;
double fR = pGradient->r;
double fX1 = fX + fR;
double fY1 = fY;
double fX2 = fX;
double fY2 = fY + fR;
trans.ApplyToCoordinate(fX, fY, &fX, &fY);
trans.ApplyToCoordinate(fX1, fY1, &fX1, &fY1);
trans.ApplyToCoordinate(fX2, fY2, &fX2, &fY2);
pC = DocCoord((INT32)fX, m_docSize.y - (INT32)fY);
pMaj = DocCoord((INT32)fX1, m_docSize.y - (INT32)fY1);
pMin = DocCoord((INT32)fX2, m_docSize.y - (INT32)fY2);
#if SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "using UserSpaceOnUse %d,%d %d,%d (%d,%d)\n", pMaj.x, pMaj.y, pMin.x, pMin.y, pC.x, pC.y);
#endif
}
}
示例3: OutputFillLinearGradient
bool XARGenerator::OutputFillLinearGradient(const Style& style, const Transformation& trans, const RectD& boundings)
{
bool ok = true;
CXaraFileRecord Rec(0);
const Gradient* pGradient = style.GetFillGradient();
const GradientStopList& stops = pGradient->stops;
if (stops.GetCount() < 1) {
#if SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "gradient '%s' has no stop points, giving up\n", (const char *)pGradient->xmlId.mb_str(wxConvUTF8));
#endif
return false;
}
#if SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "using linear fill gradient '%s' with %d colours\n", (const char *)pGradient->xmlId.mb_str(wxConvUTF8), stops.GetCount());
svgtrace(DBGTRACE_GRADIENTS, "gradient trans: ");
DebugDumpTransformation(DBGTRACE_GRADIENTS, trans);
#endif
// start and end points of gradient
DocCoord p1, p2;
DetermineLinearGradientPoints(pGradient, trans, boundings, p1, p2);
if (pGradient->units == Gradient::ObjectBoundingBox) {
// first and last offsets of gradient
double fOffsetFirst, fOffsetLast;
if (stops.GetCount() == 1) {
fOffsetFirst = 0.0;
fOffsetLast = 1.0;
} else { // stops.GetCount() > 1
GradientStop* pStop1 = stops.GetFirst()->GetData();
GradientStop* pStop2 = stops.GetLast()->GetData();
fOffsetFirst = pStop1->offset;
fOffsetLast = pStop2->offset;
}
#if 0
// determine vector of direction of object gradient
double fDX=1.0, fDY=0.0;
trans.ApplyToCoordinate(fDX, fDY, &fDX, &fDY);
double fMod = sqrt(fDX*fDX+fDY*fDY);
fDX /= fMod;
fDY /= fMod;
#if SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "direction of gradient: %.2f %.2f\n", fDX, fDY);
#endif
#endif
PointD pLower = boundings.LowerCoord();
PointD pHigher = boundings.HigherCoord();
double fWidth = fabs(pHigher.x - pLower.x);
//double fHeight = fabs(pHigher.x - pLower.x);
p1.x += (INT32)(fWidth * fOffsetFirst);
//p1.y += (INT32)(fHeight * fOffsetFirst);
p2.x -= (INT32)(fWidth * (1.0 - fOffsetLast));
//p2.y -= (INT32)(fHeight * (1.0 - fOffsetLast));
#ifdef SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "new ObjectBoundingBox %d,%d %d,%d\n", p1.x, p1.y, p2.x, p2.y);
#endif
}
if (stops.GetCount() < 3) { // 1 or 2 stops
wxColour col1, col2;
double fOpacity1, fOpacity2;
if (stops.GetCount() == 1) {
GradientStop* pStop1 = stops.GetFirst()->GetData();
col2 = col1 = pStop1->stopColour;
fOpacity1 = fOpacity2 = pStop1->stopOpacity;
} else { // stops.GetCount() == 2
GradientStop* pStop1 = stops.GetFirst()->GetData();
GradientStop* pStop2 = stops.GetLast()->GetData();
col1 = pStop1->stopColour;
col2 = pStop2->stopColour;
fOpacity1 = pStop1->stopOpacity;
fOpacity2 = pStop2->stopOpacity;
}
#if SVGDEBUG
svgtrace(DBGTRACE_GRADIENTS, "stop points: %d, %d and %d, %d\n", p1.x, p1.y, p2.x, p2.y);
#endif
UINT32 iRecNo1 = DefineColour(col1);
UINT32 iRecNo2 = DefineColour(col2);
Rec.Reinit(TAG_LINEARFILL, TAG_LINEARFILL_SIZE);
ok = Rec.WriteCoord(p1);
ok = Rec.WriteCoord(p2);
ok = Rec.WriteReference(iRecNo1);
ok = Rec.WriteReference(iRecNo2);
ok = Rec.WriteDOUBLE(0.0); // bias
ok = Rec.WriteDOUBLE(0.0); // gain
ok = m_pExporter->WriteRecord(&Rec);
if (fOpacity1 != 1.0 || fOpacity2 != 1.0) {
// the fill has also alpha transparency
BYTE bOpacity1 = (BYTE)((1.0-fOpacity1)*255.0);
//.........这里部分代码省略.........