JSSVGMatrixCustom.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "JSSVGMatrix.h"
#include "AffineTransform.h"
#include "SVGException.h"
using namespace KJS;
namespace WebCore {
JSValue* JSSVGMatrix::inverse(ExecState* exec, const List&)
{
const AffineTransform& imp(*impl());
KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp.inverse()));
if (!imp.isInvertible())
setDOMException(exec, SVG_MATRIX_NOT_INVERTABLE);
return result;
}
JSValue* JSSVGMatrix::rotateFromVector(ExecState* exec, const List& args)
{
AffineTransform& imp(*impl());
float x = args[0]->toFloat(exec);
float y = args[1]->toFloat(exec);
KJS::JSValue* result = toJS(exec, new JSSVGPODTypeWrapper<AffineTransform>(imp.rotateFromVector(x, y)));
if (x == 0.0 || y == 0.0)
setDOMException(exec, SVG_INVALID_VALUE_ERR);
return result;
}
}
#endif // ENABLE(SVG)