本文整理汇总了C++中SkMatrix::setScaleY方法的典型用法代码示例。如果您正苦于以下问题:C++ SkMatrix::setScaleY方法的具体用法?C++ SkMatrix::setScaleY怎么用?C++ SkMatrix::setScaleY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkMatrix
的用法示例。
在下文中一共展示了SkMatrix::setScaleY方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_via
static Sink* create_via(const char* tag, Sink* wrapped) {
#define VIA(t, via, ...) if (0 == strcmp(t, tag)) { return new via(__VA_ARGS__); }
VIA("twice", ViaTwice, wrapped);
VIA("pipe", ViaPipe, wrapped);
VIA("serialize", ViaSerialization, wrapped);
VIA("2ndpic", ViaSecondPicture, wrapped);
VIA("sp", ViaSingletonPictures, wrapped);
VIA("tiles", ViaTiles, 256, 256, nullptr, wrapped);
VIA("tiles_rt", ViaTiles, 256, 256, new SkRTreeFactory, wrapped);
if (FLAGS_matrix.count() == 4) {
SkMatrix m;
m.reset();
m.setScaleX((SkScalar)atof(FLAGS_matrix[0]));
m.setSkewX ((SkScalar)atof(FLAGS_matrix[1]));
m.setSkewY ((SkScalar)atof(FLAGS_matrix[2]));
m.setScaleY((SkScalar)atof(FLAGS_matrix[3]));
VIA("matrix", ViaMatrix, m, wrapped);
VIA("upright", ViaUpright, m, wrapped);
}
#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
VIA("androidsdk", ViaAndroidSDK, wrapped);
#endif
#undef VIA
return nullptr;
}
示例2: onOnceBeforeDraw
void onOnceBeforeDraw() override {
fPath.moveTo(69.7030518991886f, 0);
fPath.cubicTo( 69.7030518991886f, 21.831149999999997f,
58.08369508178456f, 43.66448333333333f, 34.8449814469765f, 65.5f);
fPath.cubicTo( 11.608591683531916f, 87.33115f, -0.010765133872116195f, 109.16448333333332f,
-0.013089005235602302f, 131);
fPath.close();
fFlipped = fPath;
SkMatrix matrix;
matrix.reset();
matrix.setScaleX(0);
matrix.setScaleY(0);
matrix.setSkewX(1);
matrix.setSkewY(1);
fFlipped.transform(matrix);
}
示例3: SkMatrix
AffineTransform::operator SkMatrix() const
{
SkMatrix result;
result.setScaleX(WebCoreDoubleToSkScalar(a()));
result.setSkewX(WebCoreDoubleToSkScalar(c()));
result.setTranslateX(WebCoreDoubleToSkScalar(e()));
result.setScaleY(WebCoreDoubleToSkScalar(d()));
result.setSkewY(WebCoreDoubleToSkScalar(b()));
result.setTranslateY(WebCoreDoubleToSkScalar(f()));
// FIXME: Set perspective properly.
result.setPerspX(0);
result.setPerspY(0);
result.set(SkMatrix::kMPersp2, SK_Scalar1);
return result;
}
开发者ID:IllusionRom-deprecated,项目名称:android_platform_external_chromium_org_third_party_WebKit,代码行数:19,代码来源:AffineTransform.cpp
示例4: affineTransformToSkMatrix
SkMatrix affineTransformToSkMatrix(const AffineTransform& source)
{
SkMatrix result;
result.setScaleX(WebCoreDoubleToSkScalar(source.a()));
result.setSkewX(WebCoreDoubleToSkScalar(source.c()));
result.setTranslateX(WebCoreDoubleToSkScalar(source.e()));
result.setScaleY(WebCoreDoubleToSkScalar(source.d()));
result.setSkewY(WebCoreDoubleToSkScalar(source.b()));
result.setTranslateY(WebCoreDoubleToSkScalar(source.f()));
// FIXME: Set perspective properly.
result.setPerspX(0);
result.setPerspY(0);
result.set(SkMatrix::kMPersp2, SK_Scalar1);
return result;
}
示例5: makeMatrix
SkMatrix makeMatrix() {
SkMatrix matrix;
matrix.reset();
RandomSetMatrix setMatrix = (RandomSetMatrix) fRand.nextRangeU(0, kRandomSetMatrix_Last);
if (fPrintName) {
SkDebugf("%.*s%s\n", fPathDepth * 3, fTab, gRandomSetMatrixNames[setMatrix]);
}
switch (setMatrix) {
case kSetIdentity:
break;
case kSetTranslateX:
matrix.setTranslateX(makeScalar());
break;
case kSetTranslateY:
matrix.setTranslateY(makeScalar());
break;
case kSetTranslate:
matrix.setTranslate(makeScalar(), makeScalar());
break;
case kSetScaleX:
matrix.setScaleX(makeScalar());
break;
case kSetScaleY:
matrix.setScaleY(makeScalar());
break;
case kSetScale:
matrix.setScale(makeScalar(), makeScalar());
break;
case kSetScaleTranslate:
matrix.setScale(makeScalar(), makeScalar(), makeScalar(), makeScalar());
break;
case kSetSkewX:
matrix.setSkewX(makeScalar());
break;
case kSetSkewY:
matrix.setSkewY(makeScalar());
break;
case kSetSkew:
matrix.setSkew(makeScalar(), makeScalar());
break;
case kSetSkewTranslate:
matrix.setSkew(makeScalar(), makeScalar(), makeScalar(), makeScalar());
break;
case kSetRotate:
matrix.setRotate(makeScalar());
break;
case kSetRotateTranslate:
matrix.setRotate(makeScalar(), makeScalar(), makeScalar());
break;
case kSetPerspectiveX:
matrix.setPerspX(makeScalar());
break;
case kSetPerspectiveY:
matrix.setPerspY(makeScalar());
break;
case kSetAll:
matrix.setAll(makeScalar(), makeScalar(), makeScalar(),
makeScalar(), makeScalar(), makeScalar(),
makeScalar(), makeScalar(), makeScalar());
break;
}
return matrix;
}
示例6: test_transform_helper
// Called to test various transforms on a single SkRRect.
static void test_transform_helper(skiatest::Reporter* reporter, const SkRRect& orig) {
SkRRect dst;
dst.setEmpty();
// The identity matrix will duplicate the rrect.
bool success = orig.transform(SkMatrix::I(), &dst);
REPORTER_ASSERT(reporter, success);
REPORTER_ASSERT(reporter, orig == dst);
// Skew and Perspective make transform fail.
SkMatrix matrix;
matrix.reset();
matrix.setSkewX(SkIntToScalar(2));
assert_transform_failure(reporter, orig, matrix);
matrix.reset();
matrix.setSkewY(SkIntToScalar(3));
assert_transform_failure(reporter, orig, matrix);
matrix.reset();
matrix.setPerspX(4);
assert_transform_failure(reporter, orig, matrix);
matrix.reset();
matrix.setPerspY(5);
assert_transform_failure(reporter, orig, matrix);
// Rotation fails.
matrix.reset();
matrix.setRotate(SkIntToScalar(90));
assert_transform_failure(reporter, orig, matrix);
matrix.setRotate(SkIntToScalar(37));
assert_transform_failure(reporter, orig, matrix);
// Translate will keep the rect moved, but otherwise the same.
matrix.reset();
SkScalar translateX = SkIntToScalar(32);
SkScalar translateY = SkIntToScalar(15);
matrix.setTranslateX(translateX);
matrix.setTranslateY(translateY);
dst.setEmpty();
success = orig.transform(matrix, &dst);
REPORTER_ASSERT(reporter, success);
for (int i = 0; i < 4; ++i) {
REPORTER_ASSERT(reporter,
orig.radii((SkRRect::Corner) i) == dst.radii((SkRRect::Corner) i));
}
REPORTER_ASSERT(reporter, orig.rect().width() == dst.rect().width());
REPORTER_ASSERT(reporter, orig.rect().height() == dst.rect().height());
REPORTER_ASSERT(reporter, dst.rect().left() == orig.rect().left() + translateX);
REPORTER_ASSERT(reporter, dst.rect().top() == orig.rect().top() + translateY);
// Keeping the translation, but adding skew will make transform fail.
matrix.setSkewY(SkIntToScalar(7));
assert_transform_failure(reporter, orig, matrix);
// Scaling in -x will flip the round rect horizontally.
matrix.reset();
matrix.setScaleX(SkIntToScalar(-1));
dst.setEmpty();
success = orig.transform(matrix, &dst);
REPORTER_ASSERT(reporter, success);
{
GET_RADII;
// Radii have swapped in x.
REPORTER_ASSERT(reporter, origUL == dstUR);
REPORTER_ASSERT(reporter, origUR == dstUL);
REPORTER_ASSERT(reporter, origLR == dstLL);
REPORTER_ASSERT(reporter, origLL == dstLR);
}
// Width and height remain the same.
REPORTER_ASSERT(reporter, orig.rect().width() == dst.rect().width());
REPORTER_ASSERT(reporter, orig.rect().height() == dst.rect().height());
// Right and left have swapped (sort of)
REPORTER_ASSERT(reporter, orig.rect().right() == -dst.rect().left());
// Top has stayed the same.
REPORTER_ASSERT(reporter, orig.rect().top() == dst.rect().top());
// Keeping the scale, but adding a persp will make transform fail.
matrix.setPerspX(7);
assert_transform_failure(reporter, orig, matrix);
// Scaling in -y will flip the round rect vertically.
matrix.reset();
matrix.setScaleY(SkIntToScalar(-1));
dst.setEmpty();
success = orig.transform(matrix, &dst);
REPORTER_ASSERT(reporter, success);
{
GET_RADII;
// Radii have swapped in y.
REPORTER_ASSERT(reporter, origUL == dstLL);
REPORTER_ASSERT(reporter, origUR == dstLR);
REPORTER_ASSERT(reporter, origLR == dstUR);
REPORTER_ASSERT(reporter, origLL == dstUL);
}
// Width and height remain the same.
REPORTER_ASSERT(reporter, orig.rect().width() == dst.rect().width());
REPORTER_ASSERT(reporter, orig.rect().height() == dst.rect().height());
//.........这里部分代码省略.........
示例7: setSave
void SkSVGPaint::setSave(SkSVGParser& parser) {
SkTDArray<SkString*> clips;
SkSVGPaint* walking = parser.fHead;
int index;
SkMatrix sum;
sum.reset();
while (walking != NULL) {
for (index = kInitial + 1; index < kTerminal; index++) {
SkString* lastAttr = (*walking)[index];
if (lastAttr->size() == 0)
continue;
if (index == kTransform) {
const char* str = lastAttr->c_str();
SkASSERT(strncmp(str, "matrix(", 7) == 0);
str += 6;
const char* strEnd = strrchr(str, ')');
SkASSERT(strEnd != NULL);
SkString mat(str, strEnd - str);
SkSVGParser::ConvertToArray(mat);
SkScalar values[6];
SkParse::FindScalars(mat.c_str() + 1, values, 6);
SkMatrix matrix;
matrix.reset();
matrix.setScaleX(values[0]);
matrix.setSkewY(values[1]);
matrix.setSkewX(values[2]);
matrix.setScaleY(values[3]);
matrix.setTranslateX(values[4]);
matrix.setTranslateY(values[5]);
sum.setConcat(matrix, sum);
continue;
}
if ( index == kClipPath)
*clips.insert(0) = lastAttr;
}
walking = walking->fNext;
}
if ((sum == parser.fLastTransform) == false) {
SkMatrix inverse;
bool success = parser.fLastTransform.invert(&inverse);
SkASSERT(success == true);
SkMatrix output;
output.setConcat(inverse, sum);
parser.fLastTransform = sum;
SkString outputStr;
outputStr.appendUnichar('[');
outputStr.appendScalar(output.getScaleX());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getSkewX());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getTranslateX());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getSkewY());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getScaleY());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getTranslateY());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getPerspX());
outputStr.appendUnichar(',');
outputStr.appendScalar(output.getPerspY());
outputStr.append(",1]");
parser._startElement("matrix");
parser._addAttributeLen("matrix", outputStr.c_str(), outputStr.size());
parser._endElement();
}
#if 0 // incomplete
if (parser.fTransformClips.size() > 0) {
// need to reset the clip when the 'g' scope is ended
parser._startElement("add");
const char* start = strchr(current->f_clipPath.c_str(), '#') + 1;
SkASSERT(start);
parser._addAttributeLen("use", start, strlen(start) - 1);
parser._endElement(); // clip
}
#endif
}