本文整理汇总了C++中RenderImage类的典型用法代码示例。如果您正苦于以下问题:C++ RenderImage类的具体用法?C++ RenderImage怎么用?C++ RenderImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RenderImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toRenderImage
void Pasteboard::writeImage(Element& element, const URL&, const String& title)
{
if (!(element.renderer() && element.renderer()->isRenderImage()))
return;
RenderImage* renderer = toRenderImage(element.renderer());
CachedImage* cachedImage = renderer->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return;
Image* image = cachedImage->imageForRenderer(renderer);
ASSERT(image);
m_dataObject->clearAll();
URL url = getURLForImageElement(element);
if (!url.isEmpty()) {
m_dataObject->setURL(url, title);
m_dataObject->setMarkup(createMarkup(element, IncludeNode, 0, ResolveAllURLs));
}
GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->getGdkPixbuf());
m_dataObject->setImage(pixbuf.get());
if (m_gtkClipboard)
PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(m_gtkClipboard);
}
示例2: document
RenderObject* HTMLPlugInImageElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
// Once a PlugIn Element creates its renderer, it needs to be told when the Document goes
// inactive or reactivates so it can clear the renderer before going into the page cache.
if (!m_needsDocumentActivationCallbacks) {
m_needsDocumentActivationCallbacks = true;
document()->registerForPageCacheSuspensionCallbacks(this);
}
if (displayState() == DisplayingSnapshot) {
RenderSnapshottedPlugIn* renderSnapshottedPlugIn = new (arena) RenderSnapshottedPlugIn(this);
renderSnapshottedPlugIn->updateSnapshot(m_snapshotImage);
return renderSnapshottedPlugIn;
}
// Fallback content breaks the DOM->Renderer class relationship of this
// class and all superclasses because createObject won't necessarily
// return a RenderEmbeddedObject, RenderPart or even RenderWidget.
if (useFallbackContent())
return RenderObject::createObject(this, style);
if (isImageType()) {
RenderImage* image = new (arena) RenderImage(this);
image->setImageResource(RenderImageResource::create());
return image;
}
return new (arena) RenderEmbeddedObject(this);
}
示例3: appendServerMapMousePosition
static void appendServerMapMousePosition(StringBuilder& url, Event* event)
{
if (!event->isMouseEvent())
return;
ASSERT(event->target());
Node* target = event->target()->toNode();
ASSERT(target);
if (!isHTMLImageElement(*target))
return;
HTMLImageElement& imageElement = toHTMLImageElement(*target);
if (!imageElement.isServerMap())
return;
if (!imageElement.renderer() || !imageElement.renderer()->isRenderImage())
return;
RenderImage* renderer = toRenderImage(imageElement.renderer());
// FIXME: This should probably pass true for useTransforms.
FloatPoint absolutePosition = renderer->absoluteToLocal(FloatPoint(toMouseEvent(event)->pageX(), toMouseEvent(event)->pageY()));
int x = absolutePosition.x();
int y = absolutePosition.y();
url.append('?');
url.appendNumber(x);
url.append(',');
url.appendNumber(y);
}
示例4: toRenderImage
void ImageInputType::altAttributeChanged()
{
RenderImage* image = toRenderImage(element()->renderer());
if (!image)
return;
image->updateAltText();
}
示例5: ASSERT
void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
{
ASSERT(node);
ASSERT(node->renderer());
ASSERT(node->renderer()->isImage());
RenderImage* renderer = toRenderImage(node->renderer());
CachedImage* cachedImage = renderer->cachedImage();
ASSERT(cachedImage);
Image* image = cachedImage->image();
ASSERT(image);
// If the image is wrapped in a link, |url| points to the target of the
// link. This isn't useful to us, so get the actual image URL.
AtomicString urlString;
if (node->hasTagName(HTMLNames::imgTag) || node->hasTagName(HTMLNames::inputTag))
urlString = static_cast<Element*>(node)->getAttribute(HTMLNames::srcAttr);
#if ENABLE(SVG)
else if (node->hasTagName(SVGNames::imageTag))
urlString = static_cast<Element*>(node)->getAttribute(XLinkNames::hrefAttr);
#endif
else if (node->hasTagName(HTMLNames::embedTag) || node->hasTagName(HTMLNames::objectTag)) {
Element* element = static_cast<Element*>(node);
urlString = element->getAttribute(element->imageSourceAttributeName());
}
KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(deprecatedParseURL(urlString));
NativeImageSkia* bitmap = 0;
#if !PLATFORM(CG)
bitmap = image->nativeImageForCurrentFrame();
#endif
ChromiumBridge::clipboardWriteImage(bitmap, url, title);
}
示例6: ASSERT
void Pasteboard::writeImage(Node* node, const KURL&, const String&)
{
ASSERT(node && node->renderer() && node->renderer()->isImage());
RenderImage* renderer = static_cast<RenderImage*>(node->renderer());
CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage());
ASSERT(cachedImage);
Image* image = cachedImage->image();
ASSERT(image);
clear();
RefPtr<SharedBitmap> sourceBmp = image->nativeImageForCurrentFrame();
if (!sourceBmp)
return;
IntRect rect(0, 0, sourceBmp->width(), sourceBmp->height());
BitmapInfo bmpInfo;
void* pixels;
HBITMAP resultBitmap = sourceBmp->clipBitmap(rect, true, bmpInfo, pixels);
if (!resultBitmap)
return;
if (::OpenClipboard(m_owner)) {
::SetClipboardData(CF_BITMAP, resultBitmap);
::CloseClipboard();
} else
DeleteObject(resultBitmap);
}
示例7: ASSERT
void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
{
ASSERT(node);
if (!(node->renderer() && node->renderer()->isImage()))
return;
RenderImage* renderer = toRenderImage(node->renderer());
CachedImage* cachedImage = renderer->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return;
Image* image = cachedImage->imageForRenderer(renderer);
ASSERT(image);
NativeImagePtr bitmap = image->nativeImageForCurrentFrame();
if (!bitmap)
return;
// If the image is wrapped in a link, |url| points to the target of the
// link. This isn't useful to us, so get the actual image URL.
AtomicString urlString;
if (node->hasTagName(HTMLNames::imgTag) || node->hasTagName(HTMLNames::inputTag))
urlString = static_cast<Element*>(node)->getAttribute(HTMLNames::srcAttr);
#if ENABLE(SVG)
else if (node->hasTagName(SVGNames::imageTag))
urlString = static_cast<Element*>(node)->getAttribute(XLinkNames::hrefAttr);
#endif
else if (node->hasTagName(HTMLNames::embedTag) || node->hasTagName(HTMLNames::objectTag)) {
Element* element = static_cast<Element*>(node);
urlString = element->getAttribute(element->imageSourceAttributeName());
}
KURL url = urlString.isEmpty() ? KURL() : node->document()->completeURL(stripLeadingAndTrailingHTMLSpaces(urlString));
PlatformSupport::clipboardWriteImage(bitmap, url, title);
}
示例8: ASSERT
void Pasteboard::writeImage(Node* node, const KURL&, const String& title)
{
ASSERT(node);
if (!(node->renderer() && node->renderer()->isImage()))
return;
RenderImage* renderer = toRenderImage(node->renderer());
CachedImage* cachedImage = renderer->cachedImage();
if (!cachedImage || cachedImage->errorOccurred())
return;
Image* image = cachedImage->imageForRenderer(renderer);
ASSERT(image);
GtkClipboard* clipboard = gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD);
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
KURL url = getURLForImageNode(node);
if (!url.isEmpty()) {
dataObject->setURL(url, title);
dataObject->setMarkup(createMarkup(static_cast<Element*>(node), IncludeNode, 0, ResolveAllURLs));
}
GRefPtr<GdkPixbuf> pixbuf = adoptGRef(image->getGdkPixbuf());
dataObject->setImage(pixbuf.get());
PasteboardHelper::defaultPasteboardHelper()->writeClipboardContents(clipboard);
}
示例9: appendServerMapMousePosition
static void appendServerMapMousePosition(String& url, Event* event)
{
if (!event->isMouseEvent())
return;
ASSERT(event->target());
Node* target = event->target()->toNode();
ASSERT(target);
if (!target->hasTagName(imgTag))
return;
HTMLImageElement* imageElement = static_cast<HTMLImageElement*>(event->target()->toNode());
if (!imageElement || !imageElement->isServerMap())
return;
RenderImage* renderer = toRenderImage(imageElement->renderer());
if (!renderer)
return;
// FIXME: This should probably pass true for useTransforms.
FloatPoint absolutePosition = renderer->absoluteToLocal(FloatPoint(static_cast<MouseEvent*>(event)->pageX(), static_cast<MouseEvent*>(event)->pageY()));
int x = absolutePosition.x();
int y = absolutePosition.y();
url += "?";
url += String::number(x);
url += ",";
url += String::number(y);
}
示例10: HTMLImageLoader
void HTMLObjectElement::attach()
{
HTMLPlugInElement::attach();
if (renderer() && !m_useFallbackContent) {
if (isImageType()) {
if (!m_imageLoader)
m_imageLoader = new HTMLImageLoader(this);
m_imageLoader->updateFromElement();
if (renderer()) {
RenderImage* imageObj = static_cast<RenderImage*>(renderer());
imageObj->setCachedImage(m_imageLoader->image());
}
} else {
if (m_needWidgetUpdate) {
// Set m_needWidgetUpdate to false before calling updateWidget because updateWidget may cause
// this method or recalcStyle (which also calls updateWidget) to be called.
m_needWidgetUpdate = false;
static_cast<RenderPartObject*>(renderer())->updateWidget(true);
} else {
m_needWidgetUpdate = true;
setChanged();
}
}
}
}
示例11: getCachedImage
static CachedImage* getCachedImage(Element* element)
{
ASSERT(element);
RenderObject* renderer = element->renderer();
if (!renderer || !renderer->isImage())
return 0;
RenderImage* image = static_cast<RenderImage*>(renderer);
return image->cachedImage();
}
示例12: createRenderer
RenderObject* ImageContentData::createRenderer(Document& doc, RenderStyle* pseudoStyle) const
{
RenderImage* image = RenderImage::createAnonymous(&doc);
image->setPseudoStyle(pseudoStyle);
if (m_image)
image->setImageResource(RenderImageResourceStyleImage::create(m_image.get()));
else
image->setImageResource(RenderImageResource::create());
return image;
}
示例13: RenderImage
RenderObject* HTMLImageElement::createRenderer(RenderStyle* style)
{
if (style->hasContent())
return RenderObject::createObject(this, style);
RenderImage* image = new RenderImage(this);
image->setImageResource(RenderImageResource::create());
image->setImageDevicePixelRatio(m_imageDevicePixelRatio);
return image;
}
示例14: RenderImage
RenderObject* ImageContentData::createRenderer(Document& document, RenderStyle& pseudoStyle) const
{
// FIXME: We should find a way to avoid setting the style twice here.
RenderImage* image = new RenderImage(document, pseudoStyle);
image->setPseudoStyle(&pseudoStyle);
if (m_image)
image->setImageResource(RenderImageResourceStyleImage::create(*m_image));
else
image->setImageResource(RenderImageResource::create());
return image;
}
示例15: getImage
static Image* getImage(Element* element)
{
ASSERT(element);
RenderObject* renderer = element->renderer();
if (!renderer || !renderer->isImage())
return 0;
RenderImage* image = toRenderImage(renderer);
if (image->cachedImage() && !image->cachedImage()->errorOccurred())
return image->cachedImage()->image();
return 0;
}