本文整理汇总了C++中SVGImageElement类的典型用法代码示例。如果您正苦于以下问题:C++ SVGImageElement类的具体用法?C++ SVGImageElement怎么用?C++ SVGImageElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SVGImageElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsSVGImageElementXmlspace
JSValue jsSVGImageElementXmlspace(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSSVGImageElement* castedThis = static_cast<JSSVGImageElement*>(asObject(slot.slotBase()));
UNUSED_PARAM(exec);
SVGImageElement* imp = static_cast<SVGImageElement*>(castedThis->impl());
return jsString(exec, imp->xmlspace());
}
示例2: ASSERT
void RenderSVGImage::layout()
{
ASSERT(needsLayout());
LayoutRepainter repainter(*this, checkForRepaintDuringLayout());
SVGImageElement* image = static_cast<SVGImageElement*>(node());
if (m_needsTransformUpdate) {
m_localTransform = image->animatedLocalTransform();
m_needsTransformUpdate = false;
}
// minimum height
setHeight(errorOccurred() ? intrinsicSize().height() : 0);
calcWidth();
calcHeight();
m_localBounds = FloatRect(image->x().value(image), image->y().value(image), image->width().value(image), image->height().value(image));
m_cachedLocalRepaintRect = FloatRect();
repainter.repaintAfterLayout();
setNeedsLayout(false);
}
示例3: jsSVGImageElementRequiredExtensions
JSValue jsSVGImageElementRequiredExtensions(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSSVGImageElement* castedThis = static_cast<JSSVGImageElement*>(asObject(slot.slotBase()));
UNUSED_PARAM(exec);
SVGImageElement* imp = static_cast<SVGImageElement*>(castedThis->impl());
return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->requiredExtensions()), imp);
}
示例4: ASSERT
void RenderSVGImage::layout()
{
ASSERT(needsLayout());
LayoutRepainter repainter(*this, m_everHadLayout && checkForRepaintDuringLayout());
SVGImageElement* image = static_cast<SVGImageElement*>(node());
bool updateCachedBoundariesInParents = false;
if (m_needsTransformUpdate) {
m_localTransform = image->animatedLocalTransform();
m_needsTransformUpdate = false;
updateCachedBoundariesInParents = true;
}
// FIXME: Optimize caching the repaint rects.
FloatRect oldBoundaries = m_localBounds;
m_localBounds = FloatRect(image->x().value(image), image->y().value(image), image->width().value(image), image->height().value(image));
m_cachedLocalRepaintRect = FloatRect();
if (!updateCachedBoundariesInParents)
updateCachedBoundariesInParents = oldBoundaries != m_localBounds;
// Invalidate all resources of this client if our layout changed.
if (m_everHadLayout && selfNeedsLayout())
SVGResourcesCache::clientLayoutChanged(this);
// If our bounds changed, notify the parents.
if (updateCachedBoundariesInParents)
RenderSVGModelObject::setNeedsBoundariesUpdate();
repainter.repaintAfterLayout();
setNeedsLayout(false);
}
示例5: savedInfo
void RenderSVGImage::paint(PaintInfo& paintInfo, int, int)
{
if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN)
return;
paintInfo.context->save();
paintInfo.context->concatCTM(localToParentTransform());
if (paintInfo.phase == PaintPhaseForeground) {
SVGResourceFilter* filter = 0;
PaintInfo savedInfo(paintInfo);
if (prepareToRenderSVGContent(this, paintInfo, m_localBounds, filter)) {
FloatRect destRect = m_localBounds;
FloatRect srcRect(0, 0, image()->width(), image()->height());
SVGImageElement* imageElt = static_cast<SVGImageElement*>(node());
if (imageElt->preserveAspectRatio().align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
imageElt->preserveAspectRatio().transformRect(destRect, srcRect);
paintInfo.context->drawImage(image(), DeviceColorSpace, destRect, srcRect);
}
finishRenderSVGContent(this, paintInfo, filter, savedInfo.context);
}
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->outlineWidth())
paintOutline(paintInfo.context, 0, 0, width(), height(), style());
paintInfo.context->restore();
}
示例6: jsSVGImageElementFarthestViewportElement
JSValue jsSVGImageElementFarthestViewportElement(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSSVGImageElement* castedThis = static_cast<JSSVGImageElement*>(asObject(slot.slotBase()));
UNUSED_PARAM(exec);
SVGImageElement* imp = static_cast<SVGImageElement*>(castedThis->impl());
return toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->farthestViewportElement()));
}
示例7: savedInfo
void RenderSVGImage::paint(PaintInfo& paintInfo, int, int)
{
if (paintInfo.context->paintingDisabled() || style()->visibility() == HIDDEN)
return;
paintInfo.context->save();
paintInfo.context->concatCTM(localTransform());
if (paintInfo.phase == PaintPhaseForeground) {
SVGResourceFilter* filter = 0;
PaintInfo savedInfo(paintInfo);
prepareToRenderSVGContent(this, paintInfo, m_localBounds, filter);
FloatRect destRect = m_localBounds;
FloatRect srcRect(0, 0, image()->width(), image()->height());
SVGImageElement* imageElt = static_cast<SVGImageElement*>(node());
if (imageElt->preserveAspectRatio()->align() != SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE)
adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatio());
paintInfo.context->drawImage(image(), destRect, srcRect);
finishRenderSVGContent(this, paintInfo, m_localBounds, filter, savedInfo.context);
}
paintInfo.context->restore();
}
示例8: toSVGImageElement
bool RenderSVGImage::updateImageViewport()
{
SVGImageElement* image = toSVGImageElement(element());
FloatRect oldBoundaries = m_objectBoundingBox;
bool updatedViewport = false;
SVGLengthContext lengthContext(image);
m_objectBoundingBox = FloatRect(image->x()->currentValue()->value(lengthContext), image->y()->currentValue()->value(lengthContext), image->width()->currentValue()->value(lengthContext), image->height()->currentValue()->value(lengthContext));
bool boundsChanged = oldBoundaries != m_objectBoundingBox;
// Images with preserveAspectRatio=none should force non-uniform scaling. This can be achieved
// by setting the image's container size to its intrinsic size.
// See: http://www.w3.org/TR/SVG/single-page.html, 7.8 The ‘preserveAspectRatio’ attribute.
IntSize newViewportSize;
if (image->preserveAspectRatio()->currentValue()->align() == SVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE) {
LayoutSize intrinsicSize = m_imageResource->intrinsicSize(style()->effectiveZoom());
if (intrinsicSize != m_imageResource->imageSize(style()->effectiveZoom())) {
newViewportSize = roundedIntSize(intrinsicSize);
updatedViewport = true;
}
} else if (boundsChanged) {
newViewportSize = enclosingIntRect(m_objectBoundingBox).size();
updatedViewport = true;
}
if (updatedViewport)
m_imageResource->setContainerSizeForRenderer(newViewportSize);
m_needsBoundariesUpdate |= boundsChanged;
return updatedViewport;
}
示例9: jsSVGImageElementExternalResourcesRequired
JSValue jsSVGImageElementExternalResourcesRequired(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSSVGImageElement* castedThis = static_cast<JSSVGImageElement*>(asObject(slot.slotBase()));
UNUSED_PARAM(exec);
SVGImageElement* imp = static_cast<SVGImageElement*>(castedThis->impl());
RefPtr<SVGAnimatedBoolean> obj = imp->externalResourcesRequiredAnimated();
return toJS(exec, castedThis->globalObject(), obj.get(), imp);
}
示例10: jsSVGImageElementTransform
JSValue jsSVGImageElementTransform(ExecState* exec, const Identifier&, const PropertySlot& slot)
{
JSSVGImageElement* castedThis = static_cast<JSSVGImageElement*>(asObject(slot.slotBase()));
UNUSED_PARAM(exec);
SVGImageElement* imp = static_cast<SVGImageElement*>(castedThis->impl());
RefPtr<SVGAnimatedTransformList> obj = imp->transformAnimated();
return toJS(exec, castedThis->globalObject(), obj.get(), imp);
}
示例11: element
void SVGImageLoader::dispatchLoadEvent()
{
if (image()->errorOccurred()) {
element()->dispatchEvent(Event::create(EventTypeNames::error));
} else {
SVGImageElement* imageElement = toSVGImageElement(element());
imageElement->sendSVGLoadEventToSelfAndAncestorChainIfPossible();
}
}
示例12: element
void SVGImageLoader::dispatchLoadEvent()
{
if (image()->errorOccurred())
element()->dispatchEvent(Event::create(eventNames().errorEvent, false, false));
else {
SVGImageElement* imageElement = static_cast<SVGImageElement*>(element());
if (imageElement->externalResourcesRequiredBaseValue())
imageElement->sendSVGLoadEventIfPossible(true);
}
}
示例13: srcRect
void RenderSVGImage::paintForeground(PaintInfo& paintInfo)
{
RefPtr<Image> image = m_imageResource->image();
FloatRect destRect = m_objectBoundingBox;
FloatRect srcRect(0, 0, image->width(), image->height());
SVGImageElement* imageElement = static_cast<SVGImageElement*>(node());
imageElement->preserveAspectRatio().transformRect(destRect, srcRect);
paintInfo.context->drawImage(image.get(), ColorSpaceDeviceRGB, destRect, srcRect);
}
示例14: NS_ASSERTION
void
nsSVGImageFrame::ReflowSVG()
{
NS_ASSERTION(nsSVGUtils::OuterSVGIsCallingReflowSVG(this),
"This call is probably a wasteful mistake");
MOZ_ASSERT(!(GetStateBits() & NS_FRAME_IS_NONDISPLAY),
"ReflowSVG mechanism not designed for this");
if (!nsSVGUtils::NeedsReflowSVG(this)) {
return;
}
float x, y, width, height;
SVGImageElement *element = static_cast<SVGImageElement*>(mContent);
element->GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
Rect extent(x, y, width, height);
if (!extent.IsEmpty()) {
mRect = nsLayoutUtils::RoundGfxRectToAppRect(extent,
PresContext()->AppUnitsPerCSSPixel());
} else {
mRect.SetEmpty();
}
if (mState & NS_FRAME_FIRST_REFLOW) {
// Make sure we have our filter property (if any) before calling
// FinishAndStoreOverflow (subsequent filter changes are handled off
// nsChangeHint_UpdateEffects):
nsSVGEffects::UpdateEffects(this);
if (!mReflowCallbackPosted) {
nsIPresShell* shell = PresContext()->PresShell();
mReflowCallbackPosted = true;
shell->PostReflowCallback(this);
}
}
nsRect overflow = nsRect(nsPoint(0,0), mRect.Size());
nsOverflowAreas overflowAreas(overflow, overflow);
FinishAndStoreOverflow(overflowAreas, mRect.Size());
mState &= ~(NS_FRAME_FIRST_REFLOW | NS_FRAME_IS_DIRTY |
NS_FRAME_HAS_DIRTY_CHILDREN);
// Invalidate, but only if this is not our first reflow (since if it is our
// first reflow then we haven't had our first paint yet).
if (!(GetParent()->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
InvalidateFrame();
}
}
示例15: jsSVGImageElementPrototypeFunctionGetPresentationAttribute
JSValue JSC_HOST_CALL jsSVGImageElementPrototypeFunctionGetPresentationAttribute(ExecState* exec, JSObject*, JSValue thisValue, const ArgList& args)
{
UNUSED_PARAM(args);
if (!thisValue.inherits(&JSSVGImageElement::s_info))
return throwError(exec, TypeError);
JSSVGImageElement* castedThisObj = static_cast<JSSVGImageElement*>(asObject(thisValue));
SVGImageElement* imp = static_cast<SVGImageElement*>(castedThisObj->impl());
const UString& name = args.at(0).toString(exec);
JSC::JSValue result = toJS(exec, castedThisObj->globalObject(), WTF::getPtr(imp->getPresentationAttribute(name)));
return result;
}