本文整理汇总了C++中SVGMatrix类的典型用法代码示例。如果您正苦于以下问题:C++ SVGMatrix类的具体用法?C++ SVGMatrix怎么用?C++ SVGMatrix使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SVGMatrix类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rotateFromVectorCallback
static v8::Handle<v8::Value> rotateFromVectorCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.rotateFromVector");
if (args.Length() < 2)
return throwError("Not enough arguments", V8Proxy::TypeError);
RefPtr<SVGPropertyTearOff<SVGMatrix> > wrapper = V8SVGMatrix::toNative(args.Holder());
if (wrapper->role() == AnimValRole) {
V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
return v8::Handle<v8::Value>();
}
SVGMatrix& impInstance = wrapper->propertyReference();
SVGMatrix* imp = &impInstance;
ExceptionCode ec = 0;
{
EXCEPTION_BLOCK(float, x, static_cast<float>(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)->NumberValue()));
EXCEPTION_BLOCK(float, y, static_cast<float>(MAYBE_MISSING_PARAMETER(args, 1, MissingIsUndefined)->NumberValue()));
SVGMatrix result = imp->rotateFromVector(x, y, ec);
if (UNLIKELY(ec))
goto fail;
return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(result)));
}
fail:
V8Proxy::setDOMException(ec);
return v8::Handle<v8::Value>();
}
示例2: cAttrGetter
static v8::Handle<v8::Value> cAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
INC_STATS("DOM.SVGMatrix.c._get");
SVGPropertyTearOff<SVGMatrix>* wrapper = V8SVGMatrix::toNative(info.Holder());
SVGMatrix& impInstance = wrapper->propertyReference();
SVGMatrix* imp = &impInstance;
return v8::Number::New(imp->c());
}
示例3:
SVGMatrix *SVGStyledTransformableElement::getScreenCTM() const
{
SVGMatrix *ctm = SVGLocatable::getScreenCTM(this);
if(m_localMatrix)
ctm->multiply(m_localMatrix.get());
return ctm;
}
示例4: flipYCallback
static v8::Handle<v8::Value> flipYCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.flipY");
RefPtr<SVGPropertyTearOff<SVGMatrix> > wrapper = V8SVGMatrix::toNative(args.Holder());
if (wrapper->role() == AnimValRole) {
V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
return v8::Handle<v8::Value>();
}
SVGMatrix& impInstance = wrapper->propertyReference();
SVGMatrix* imp = &impInstance;
return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(imp->flipY())));
}
示例5: viewBoxToViewTransform
SVGMatrix *SVGPatternElement::getCTM() const
{
SVGMatrix *mat = SVGSVGElement::createSVGMatrix();
if (mat)
{
RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(width()->baseVal()->value(),
height()->baseVal()->value());
mat->multiply(viewBox.get());
}
return mat;
}
示例6: bAttrSetter
static void bAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
INC_STATS("DOM.SVGMatrix.b._set");
SVGPropertyTearOff<SVGMatrix>* wrapper = V8SVGMatrix::toNative(info.Holder());
if (wrapper->role() == AnimValRole) {
V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
return;
}
SVGMatrix& impInstance = wrapper->propertyReference();
SVGMatrix* imp = &impInstance;
double v = static_cast<double>(value->NumberValue());
imp->setB(v);
wrapper->commitChange();
return;
}
示例7: skewYCallback
static v8::Handle<v8::Value> skewYCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.skewY");
if (args.Length() < 1)
return throwError("Not enough arguments", V8Proxy::TypeError);
RefPtr<SVGPropertyTearOff<SVGMatrix> > wrapper = V8SVGMatrix::toNative(args.Holder());
if (wrapper->role() == AnimValRole) {
V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
return v8::Handle<v8::Value>();
}
SVGMatrix& impInstance = wrapper->propertyReference();
SVGMatrix* imp = &impInstance;
EXCEPTION_BLOCK(float, angle, static_cast<float>(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)->NumberValue()));
return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(imp->skewY(angle))));
}
示例8: y
SVGMatrix *SVGSVGElement::getScreenCTM() const
{
SVGMatrix *mat = SVGStyledLocatableElement::getScreenCTM();
if(mat)
{
mat->translate(x()->baseVal()->value(), y()->baseVal()->value());
if(attributes()->getNamedItem(SVGNames::viewBoxAttr))
{
RefPtr<SVGMatrix> viewBox = viewBoxToViewTransform(width()->baseVal()->value(), height()->baseVal()->value());
mat->multiply(viewBox.get());
}
}
return mat;
}
示例9: SetMatrix
void
SVGTransform::SetMatrix(SVGMatrix& aMatrix, ErrorResult& rv)
{
if (mIsAnimValItem) {
rv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
return;
}
SetMatrix(aMatrix.GetMatrix());
}
示例10: inverseCallback
static v8::Handle<v8::Value> inverseCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.inverse");
RefPtr<SVGPropertyTearOff<SVGMatrix> > wrapper = V8SVGMatrix::toNative(args.Holder());
if (wrapper->role() == AnimValRole) {
V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
return v8::Handle<v8::Value>();
}
SVGMatrix& impInstance = wrapper->propertyReference();
SVGMatrix* imp = &impInstance;
ExceptionCode ec = 0;
{
SVGMatrix result = imp->inverse(ec);
if (UNLIKELY(ec))
goto fail;
return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(result)));
}
fail:
V8Proxy::setDOMException(ec);
return v8::Handle<v8::Value>();
}
示例11: multiplyCallback
static v8::Handle<v8::Value> multiplyCallback(const v8::Arguments& args)
{
INC_STATS("DOM.SVGMatrix.multiply");
if (args.Length() < 1)
return throwError("Not enough arguments", V8Proxy::TypeError);
RefPtr<SVGPropertyTearOff<SVGMatrix> > wrapper = V8SVGMatrix::toNative(args.Holder());
if (wrapper->role() == AnimValRole) {
V8Proxy::setDOMException(NO_MODIFICATION_ALLOWED_ERR);
return v8::Handle<v8::Value>();
}
SVGMatrix& impInstance = wrapper->propertyReference();
SVGMatrix* imp = &impInstance;
if (args.Length() > 0 && !isUndefinedOrNull(args[0]) && !V8SVGMatrix::HasInstance(args[0])) {
V8Proxy::throwTypeError();
return notHandledByInterceptor();
}
EXCEPTION_BLOCK(RefPtr<SVGPropertyTearOff<SVGMatrix> >, secondMatrix, V8SVGMatrix::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8SVGMatrix::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0);
if (!secondMatrix) {
V8Proxy::setDOMException(WebCore::TYPE_MISMATCH_ERR);
return v8::Handle<v8::Value>();
}
return toV8(WTF::getPtr(SVGPropertyTearOff<SVGMatrix>::create(imp->multiply(secondMatrix->propertyReference()))));
}
示例12: DOMSVGPoint
already_AddRefed<nsISVGPoint>
DOMSVGTranslatePoint::MatrixTransform(SVGMatrix& matrix)
{
float a = matrix.A(), b = matrix.B(), c = matrix.C();
float d = matrix.D(), e = matrix.E(), f = matrix.F();
float x = mPt.GetX();
float y = mPt.GetY();
nsCOMPtr<nsISVGPoint> point = new DOMSVGPoint(a*x + c*y + e, b*x + d*y + f);
return point.forget();
}
示例13: create
Ref<SVGTransform> SVGSVGElement::createSVGTransformFromMatrix(SVGMatrix& matrix)
{
return SVGTransform::create(SVGTransformValue { matrix.propertyReference() });
}
示例14: StringFromTransformList
String SVGTransformList::StringFromTransformList() const
{
IO::StringWriter str;
unsigned int numberOfItems = m_p->m_items.GetSize();
for (size_t i = 0; i < numberOfItems; i++)
{
SVGTransform* transform = m_p->m_items[i];
SVGTransformType type = transform->get_type();
SVGMatrix* matrix = transform->get_matrix();
double a = matrix->get_a();
double b = matrix->get_b();
double c = matrix->get_c();
double d = matrix->get_d();
double e = matrix->get_e();
double f = matrix->get_f();
if (i > 0) str << " ";
switch (type)
{
case SVG_TRANSFORM_TRANSLATE:
{
str << "translate(" << e << "," << f << ")";
}
break;
case SVG_TRANSFORM_SCALE:
{
// swprintf(str2, OLESTR("scale(%g, %g)"), a, d);
// str += str2;
str << "scale(" << a << "," << d << ")";
}
break;
case SVG_TRANSFORM_ROTATE:
{
double angle = transform->get_angle();
// swprintf(str2, OLESTR("rotate(%g, %g, %g)"), angle, e, f);
// str += str2;
str << "rotate(" << angle << "," << e << "," << f << ")";
}
break;
case SVG_TRANSFORM_SKEWX:
{
double angle = transform->get_angle();
// swprintf(str2, OLESTR("skewX(%g)"), angle);
// str += str2;
str << "skewX(" << angle << ")";
}
break;
case SVG_TRANSFORM_SKEWY:
{
double angle = transform->get_angle();
// swprintf(str2, OLESTR("skewY(%g)"), angle);
// str += str2;
str << "skewY(" << angle << ")";
}
break;
case SVG_TRANSFORM_MATRIX:
{
// swprintf(str2, OLESTR("matrix(%g %g %g %g %g %g)"), a, b, c, d, e, f);
// str += str2;
str << "matrix(" << a << "," << b << "," << c << "," << d << "," << e << "," << f << ")";
}
break;
default:
ASSERT(0);
}
}
return str.str();
}