本文整理汇总了C++中TransformOperations::apply方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformOperations::apply方法的具体用法?C++ TransformOperations::apply怎么用?C++ TransformOperations::apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformOperations
的用法示例。
在下文中一共展示了TransformOperations::apply方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMatrixValue
void CSSMatrix::setMatrixValue(const String& string, ExceptionState& exceptionState)
{
if (string.isEmpty())
return;
RefPtr<MutableStylePropertySet> styleDeclaration = MutableStylePropertySet::create();
if (BisonCSSParser::parseValue(styleDeclaration.get(), CSSPropertyWebkitTransform, string, true, HTMLStandardMode, 0)) {
// Convert to TransformOperations. This can fail if a property
// requires style (i.e., param uses 'ems' or 'exs')
RefPtrWillBeRawPtr<CSSValue> value = styleDeclaration->getPropertyCSSValue(CSSPropertyWebkitTransform);
// Check for a "none" or empty transform. In these cases we can use the default identity matrix.
if (!value || (value->isPrimitiveValue() && (toCSSPrimitiveValue(value.get()))->getValueID() == CSSValueNone))
return;
DEFINE_STATIC_REF(RenderStyle, defaultStyle, RenderStyle::createDefaultStyle());
TransformOperations operations;
if (!TransformBuilder::createTransformOperations(value.get(), CSSToLengthConversionData(defaultStyle, defaultStyle, 0, 0, 1.0f), operations)) {
exceptionState.throwDOMException(SyntaxError, "Failed to interpret '" + string + "' as a transformation operation.");
return;
}
// Convert transform operations to a TransformationMatrix. This can fail
// if a param has a percentage ('%')
if (operations.dependsOnBoxSize())
exceptionState.throwDOMException(SyntaxError, "The transformation depends on the box size, which is not supported.");
TransformationMatrix t;
operations.apply(FloatSize(0, 0), t);
// set the matrix
m_matrix = t;
} else { // There is something there but parsing failed.
exceptionState.throwDOMException(SyntaxError, "Failed to parse '" + string + "'.");
}
}
示例2: setMatrixValue
void CSSMatrix::setMatrixValue(const String& string,
ExceptionState& exceptionState) {
if (string.isEmpty())
return;
if (const CSSValue* value =
CSSParser::parseSingleValue(CSSPropertyTransform, string)) {
// Check for a "none" transform. In these cases we can use the default
// identity matrix.
if (value->isIdentifierValue() &&
(toCSSIdentifierValue(value))->getValueID() == CSSValueNone)
return;
DEFINE_STATIC_REF(ComputedStyle, initialStyle, createInitialStyle());
TransformOperations operations =
TransformBuilder::createTransformOperations(
*value, CSSToLengthConversionData(initialStyle, initialStyle,
LayoutViewItem(nullptr), 1.0f));
// Convert transform operations to a TransformationMatrix. This can fail
// if a param has a percentage ('%')
if (operations.dependsOnBoxSize())
exceptionState.throwDOMException(SyntaxError,
"The transformation depends on the box "
"size, which is not supported.");
m_matrix = TransformationMatrix::create();
operations.apply(FloatSize(0, 0), *m_matrix);
} else { // There is something there but parsing failed.
exceptionState.throwDOMException(SyntaxError,
"Failed to parse '" + string + "'.");
}
}
示例3: setMatrixValue
void CSSMatrix::setMatrixValue(const String& string, ExceptionState& exceptionState)
{
if (string.isEmpty())
return;
// FIXME: crbug.com/154772 - should this continue to use legacy style parsing?
if (RefPtrWillBeRawPtr<CSSValue> value = CSSParser::parseSingleValue(CSSPropertyWebkitTransform, string)) {
// Check for a "none" transform. In these cases we can use the default identity matrix.
if (value->isPrimitiveValue() && (toCSSPrimitiveValue(value.get()))->getValueID() == CSSValueNone)
return;
// FIXME: This has a null pointer crash if we use ex units (crbug.com/414145)
DEFINE_STATIC_REF(RenderStyle, defaultStyle, RenderStyle::createDefaultStyle());
TransformOperations operations;
if (!TransformBuilder::createTransformOperations(value.get(), CSSToLengthConversionData(defaultStyle, defaultStyle, 0, 0, 1.0f), operations)) {
exceptionState.throwDOMException(SyntaxError, "Failed to interpret '" + string + "' as a transformation operation.");
return;
}
// Convert transform operations to a TransformationMatrix. This can fail
// if a param has a percentage ('%')
if (operations.dependsOnBoxSize())
exceptionState.throwDOMException(SyntaxError, "The transformation depends on the box size, which is not supported.");
TransformationMatrix t;
operations.apply(FloatSize(0, 0), t);
// set the matrix
m_matrix = t;
} else { // There is something there but parsing failed.
exceptionState.throwDOMException(SyntaxError, "Failed to parse '" + string + "'.");
}
}
示例4: applyTransformAnimation
static TransformationMatrix applyTransformAnimation(const TransformOperations& from, const TransformOperations& to, double progress, const FloatSize& boxSize, bool listsMatch)
{
TransformationMatrix matrix;
// First frame of an animation.
if (!progress) {
from.apply(boxSize, matrix);
return matrix;
}
// Last frame of an animation.
if (progress == 1) {
to.apply(boxSize, matrix);
return matrix;
}
// If we have incompatible operation lists, we blend the resulting matrices.
if (!listsMatch) {
TransformationMatrix fromMatrix;
to.apply(boxSize, matrix);
from.apply(boxSize, fromMatrix);
matrix.blend(fromMatrix, progress);
return matrix;
}
// Animation to "-webkit-transform: none".
if (!to.size()) {
TransformOperations blended(from);
for (auto& operation : blended.operations())
operation->blend(nullptr, progress, true)->apply(matrix, boxSize);
return matrix;
}
// Animation from "-webkit-transform: none".
if (!from.size()) {
TransformOperations blended(to);
for (auto& operation : blended.operations())
operation->blend(nullptr, 1 - progress, true)->apply(matrix, boxSize);
return matrix;
}
// Normal animation with a matching operation list.
TransformOperations blended(to);
for (size_t i = 0; i < blended.operations().size(); ++i)
blended.operations()[i]->blend(from.at(i), progress, !from.at(i))->apply(matrix, boxSize);
return matrix;
}
示例5: blendByUsingMatrixInterpolation
TransformOperations TransformOperations::blendByUsingMatrixInterpolation(const TransformOperations& from, double progress, const LayoutSize& size) const
{
TransformOperations result;
// Convert the TransformOperations into matrices
TransformationMatrix fromTransform;
TransformationMatrix toTransform;
from.apply(size, fromTransform);
apply(size, toTransform);
toTransform.blend(fromTransform, progress);
// Append the result
result.operations().append(Matrix3DTransformOperation::create(toTransform));
return result;
}