本文整理汇总了C++中NinePieceImage::setImageSlices方法的典型用法代码示例。如果您正苦于以下问题:C++ NinePieceImage::setImageSlices方法的具体用法?C++ NinePieceImage::setImageSlices怎么用?C++ NinePieceImage::setImageSlices使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NinePieceImage
的用法示例。
在下文中一共展示了NinePieceImage::setImageSlices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mapNinePieceImageSlice
void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, CSSValue* value, NinePieceImage& image)
{
if (!value || !value->isBorderImageSliceValue())
return;
// Retrieve the border image value.
CSSBorderImageSliceValue* borderImageSlice = toCSSBorderImageSliceValue(value);
// Set up a length box to represent our image slices.
LengthBox box;
Quad* slices = borderImageSlice->slices();
if (slices->top()->isPercentage())
box.m_top = Length(slices->top()->getDoubleValue(), Percent);
else
box.m_top = Length(slices->top()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->bottom()->isPercentage())
box.m_bottom = Length(slices->bottom()->getDoubleValue(), Percent);
else
box.m_bottom = Length((int)slices->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->left()->isPercentage())
box.m_left = Length(slices->left()->getDoubleValue(), Percent);
else
box.m_left = Length(slices->left()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->right()->isPercentage())
box.m_right = Length(slices->right()->getDoubleValue(), Percent);
else
box.m_right = Length(slices->right()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
image.setImageSlices(box);
// Set our fill mode.
image.setFill(borderImageSlice->m_fill);
}
示例2: mapNinePieceImageSlice
void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, const CSSValue& value, NinePieceImage& image)
{
if (!value.isBorderImageSliceValue())
return;
// Retrieve the border image value.
const CSSBorderImageSliceValue& borderImageSlice = toCSSBorderImageSliceValue(value);
// Set up a length box to represent our image slices.
LengthBox box;
CSSQuadValue* slices = borderImageSlice.slices();
if (slices->top()->isPercentage())
box.m_top = Length(slices->top()->getDoubleValue(), Percent);
else
box.m_top = Length(slices->top()->getIntValue(), Fixed);
if (slices->bottom()->isPercentage())
box.m_bottom = Length(slices->bottom()->getDoubleValue(), Percent);
else
box.m_bottom = Length(slices->bottom()->getIntValue(), Fixed);
if (slices->left()->isPercentage())
box.m_left = Length(slices->left()->getDoubleValue(), Percent);
else
box.m_left = Length(slices->left()->getIntValue(), Fixed);
if (slices->right()->isPercentage())
box.m_right = Length(slices->right()->getDoubleValue(), Percent);
else
box.m_right = Length(slices->right()->getIntValue(), Fixed);
image.setImageSlices(box);
// Set our fill mode.
image.setFill(borderImageSlice.m_fill);
}
示例3: mapNinePieceImageSlice
void CSSToStyleMap::mapNinePieceImageSlice(CSSValue& value, NinePieceImage& image)
{
if (!is<CSSBorderImageSliceValue>(value))
return;
// Retrieve the border image value.
auto& borderImageSlice = downcast<CSSBorderImageSliceValue>(value);
// Set up a length box to represent our image slices.
LengthBox box;
Quad* slices = borderImageSlice.slices();
if (slices->top()->isPercentage())
box.top() = Length(slices->top()->getDoubleValue(), Percent);
else
box.top() = Length(slices->top()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->bottom()->isPercentage())
box.bottom() = Length(slices->bottom()->getDoubleValue(), Percent);
else
box.bottom() = Length((int)slices->bottom()->getFloatValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->left()->isPercentage())
box.left() = Length(slices->left()->getDoubleValue(), Percent);
else
box.left() = Length(slices->left()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
if (slices->right()->isPercentage())
box.right() = Length(slices->right()->getDoubleValue(), Percent);
else
box.right() = Length(slices->right()->getIntValue(CSSPrimitiveValue::CSS_NUMBER), Fixed);
image.setImageSlices(box);
// Set our fill mode.
image.setFill(borderImageSlice.m_fill);
}
示例4: mapNinePieceImageSlice
void CSSToStyleMap::mapNinePieceImageSlice(StyleResolverState&, const CSSValue& value, NinePieceImage& image)
{
if (!value.isBorderImageSliceValue())
return;
// Retrieve the border image value.
const CSSBorderImageSliceValue& borderImageSlice = toCSSBorderImageSliceValue(value);
// Set up a length box to represent our image slices.
LengthBox box;
CSSQuadValue* slices = borderImageSlice.slices();
box.m_top = convertBorderImageSliceSide(*slices->top());
box.m_bottom = convertBorderImageSliceSide(*slices->bottom());
box.m_left = convertBorderImageSliceSide(*slices->left());
box.m_right = convertBorderImageSliceSide(*slices->right());
image.setImageSlices(box);
// Set our fill mode.
image.setFill(borderImageSlice.m_fill);
}