本文整理汇总了C++中HTMLImageElement::compositeOperator方法的典型用法代码示例。如果您正苦于以下问题:C++ HTMLImageElement::compositeOperator方法的具体用法?C++ HTMLImageElement::compositeOperator怎么用?C++ HTMLImageElement::compositeOperator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLImageElement
的用法示例。
在下文中一共展示了HTMLImageElement::compositeOperator方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readyWRATHWidgetIntoRect
void RenderImage::readyWRATHWidgetIntoRect(PaintedWidgetsOfWRATHHandle& handle,
ContextOfWRATH *wrath_context, const IntRect& rect)
{
RenderImage_ReadyWRATHWidgetIntoRect *d(RenderImage_ReadyWRATHWidgetIntoRect::object(this, handle));
ContextOfWRATH::AutoPushNode autoPushRoot(wrath_context, d->m_root_node);
d->m_image.visible(false);
if (!m_imageResource->hasImage() || m_imageResource->errorOccurred() || rect.width() <= 0 || rect.height() <= 0) {
return;
}
RefPtr<Image> img = m_imageResource->image(rect.width(), rect.height());
if (!img || img->isNull()) {
return;
}
HTMLImageElement* imageElt = (node() && node()->hasTagName(imgTag)) ? static_cast<HTMLImageElement*>(node()) : 0;
CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
Image* image = m_imageResource->image().get();
/*
bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, rect.size());
[WRATH-TODO]: What to do with the above function call?
*/
/*
context->drawImage(m_imageResource->image(rect.width(), rect.height()).get(), style()->colorSpace(), rect, compositeOperator, useLowQualityScaling);
*/
d->m_image.visible(true);
WRATH_drawImage(d->m_image, wrath_context,
m_imageResource->image(rect.width(), rect.height()).get(), style()->colorSpace(), rect, compositeOperator, false /*useLowQualityScaling*/);
}
示例2: paintIntoRect
void RenderImage::paintIntoRect(GraphicsContext* context, const IntRect& rect)
{
if (!hasImage() || errorOccurred() || rect.width() <= 0 || rect.height() <= 0)
return;
Image* img = image(rect.width(), rect.height());
if (!img || img->isNull())
return;
HTMLImageElement* imageElt = (node() && node()->hasTagName(imgTag)) ? static_cast<HTMLImageElement*>(node()) : 0;
CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
bool useLowQualityScaling = RenderImageScaleObserver::shouldImagePaintAtLowQuality(this, rect.size());
context->drawImage(image(rect.width(), rect.height()), style()->colorSpace(), rect, compositeOperator, useLowQualityScaling);
}
示例3: paintIntoRect
void RenderImage::paintIntoRect(GraphicsContext* context, const IntRect& rect)
{
if (!m_imageResource->hasImage() || m_imageResource->errorOccurred() || rect.width() <= 0 || rect.height() <= 0)
return;
RefPtr<Image> img = m_imageResource->image(rect.width(), rect.height());
if (!img || img->isNull())
return;
HTMLImageElement* imageElt = (node() && node()->hasTagName(imgTag)) ? static_cast<HTMLImageElement*>(node()) : 0;
CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
Image* image = m_imageResource->image().get();
bool useLowQualityScaling = shouldPaintAtLowQuality(context, image, image, rect.size());
context->drawImage(m_imageResource->image(rect.width(), rect.height()).get(), style()->colorSpace(), rect, compositeOperator, useLowQualityScaling);
}
示例4: paintIntoRect
void RenderImage::paintIntoRect(GraphicsContext& context, const FloatRect& rect)
{
if (!imageResource().hasImage() || imageResource().errorOccurred() || rect.width() <= 0 || rect.height() <= 0)
return;
RefPtr<Image> img = imageResource().image(rect.width(), rect.height());
if (!img || img->isNull())
return;
HTMLImageElement* imageElement = is<HTMLImageElement>(element()) ? downcast<HTMLImageElement>(element()) : nullptr;
CompositeOperator compositeOperator = imageElement ? imageElement->compositeOperator() : CompositeSourceOver;
Image* image = imageResource().image().get();
bool useLowQualityScaling = image && shouldPaintAtLowQuality(context, *image, image, LayoutSize(rect.size()));
ImageOrientationDescription orientationDescription(shouldRespectImageOrientation());
#if ENABLE(CSS_IMAGE_ORIENTATION)
orientationDescription.setImageOrientationEnum(style().imageOrientation());
#endif
context.drawImage(*img, style().colorSpace(), rect,
ImagePaintingOptions(compositeOperator, BlendModeNormal, orientationDescription, useLowQualityScaling));
}
示例5: paintIntoRect
void RenderImage::paintIntoRect(GraphicsContext* context, const LayoutRect& rect)
{
IntRect alignedRect = pixelSnappedIntRect(rect);
if (!m_imageResource->hasImage() || m_imageResource->errorOccurred() || alignedRect.width() <= 0 || alignedRect.height() <= 0)
return;
RefPtr<Image> img = m_imageResource->image(alignedRect.width(), alignedRect.height());
if (!img || img->isNull())
return;
HTMLImageElement* imageElt = isHTMLImageElement(node()) ? toHTMLImageElement(node()) : 0;
CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
Image* image = m_imageResource->image().get();
InterpolationQuality interpolationQuality = chooseInterpolationQuality(context, image, image, alignedRect.size());
InspectorInstrumentation::willPaintImage(this);
InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality();
context->setImageInterpolationQuality(interpolationQuality);
context->drawImage(m_imageResource->image(alignedRect.width(), alignedRect.height()).get(), alignedRect, compositeOperator, shouldRespectImageOrientation());
context->setImageInterpolationQuality(previousInterpolationQuality);
InspectorInstrumentation::didPaintImage(this);
}
示例6: paintIntoRect
void ImagePainter::paintIntoRect(GraphicsContext* context, const LayoutRect& rect)
{
IntRect alignedRect = pixelSnappedIntRect(rect);
if (!m_renderImage.imageResource()->hasImage() || m_renderImage.imageResource()->errorOccurred() || alignedRect.width() <= 0 || alignedRect.height() <= 0)
return;
RefPtr<Image> img = m_renderImage.imageResource()->image(alignedRect.width(), alignedRect.height());
if (!img || img->isNull())
return;
HTMLImageElement* imageElt = isHTMLImageElement(m_renderImage.node()) ? toHTMLImageElement(m_renderImage.node()) : 0;
CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
Image* image = img.get();
InterpolationQuality interpolationQuality = BoxPainter::chooseInterpolationQuality(m_renderImage, context, image, image, alignedRect.size());
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", "data", InspectorPaintImageEvent::data(m_renderImage));
// FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeline migrates to tracing.
InspectorInstrumentation::willPaintImage(&m_renderImage);
InterpolationQuality previousInterpolationQuality = context->imageInterpolationQuality();
context->setImageInterpolationQuality(interpolationQuality);
context->drawImage(image, alignedRect, compositeOperator, m_renderImage.shouldRespectImageOrientation());
context->setImageInterpolationQuality(previousInterpolationQuality);
InspectorInstrumentation::didPaintImage(&m_renderImage);
}
示例7: paintReplaced
void RenderImage::paintReplaced(PaintInfo& paintInfo, int tx, int ty)
{
int cWidth = contentWidth();
int cHeight = contentHeight();
int leftBorder = borderLeft();
int topBorder = borderTop();
int leftPad = paddingLeft();
int topPad = paddingTop();
if (document()->printing() && !view()->printImages())
return;
GraphicsContext* context = paintInfo.context;
if (!hasImage() || errorOccurred()) {
if (paintInfo.phase == PaintPhaseSelection)
return;
if (cWidth > 2 && cHeight > 2) {
// Draw an outline rect where the image should be.
context->setStrokeStyle(SolidStroke);
context->setStrokeColor(Color::lightGray);
context->setFillColor(Color::transparent);
context->drawRect(IntRect(tx + leftBorder + leftPad, ty + topBorder + topPad, cWidth, cHeight));
bool errorPictureDrawn = false;
int imageX = 0;
int imageY = 0;
// When calculating the usable dimensions, exclude the pixels of
// the ouline rect so the error image/alt text doesn't draw on it.
int usableWidth = cWidth - 2;
int usableHeight = cHeight - 2;
if (errorOccurred() && !image()->isNull() && (usableWidth >= image()->width()) && (usableHeight >= image()->height())) {
// Center the error image, accounting for border and padding.
int centerX = (usableWidth - image()->width()) / 2;
if (centerX < 0)
centerX = 0;
int centerY = (usableHeight - image()->height()) / 2;
if (centerY < 0)
centerY = 0;
imageX = leftBorder + leftPad + centerX + 1;
imageY = topBorder + topPad + centerY + 1;
context->drawImage(image(), IntPoint(tx + imageX, ty + imageY));
errorPictureDrawn = true;
}
if (!m_altText.isEmpty()) {
String text = m_altText;
text.replace('\\', backslashAsCurrencySymbol());
context->setFont(style()->font());
context->setFillColor(style()->color());
int ax = tx + leftBorder + leftPad;
int ay = ty + topBorder + topPad;
const Font& font = style()->font();
int ascent = font.ascent();
// Only draw the alt text if it'll fit within the content box,
// and only if it fits above the error image.
TextRun textRun(text.characters(), text.length());
int textWidth = font.width(textRun);
if (errorPictureDrawn) {
if (usableWidth >= textWidth && font.height() <= imageY)
context->drawText(textRun, IntPoint(ax, ay + ascent));
} else if (usableWidth >= textWidth && cHeight >= font.height())
context->drawText(textRun, IntPoint(ax, ay + ascent));
}
}
} else if (hasImage() && cWidth > 0 && cHeight > 0) {
Image* img = image(cWidth, cHeight);
if (!img || img->isNull())
return;
#if PLATFORM(MAC)
if (style()->highlight() != nullAtom && !paintInfo.context->paintingDisabled())
paintCustomHighlight(tx - m_x, ty - m_y, style()->highlight(), true);
#endif
IntSize contentSize(cWidth, cHeight);
bool useLowQualityScaling = RenderImageScaleObserver::shouldImagePaintAtLowQuality(this, contentSize);
IntRect rect(IntPoint(tx + leftBorder + leftPad, ty + topBorder + topPad), contentSize);
HTMLImageElement* imageElt = (element() && element()->hasTagName(imgTag)) ? static_cast<HTMLImageElement*>(element()) : 0;
CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
context->drawImage(image(cWidth, cHeight), rect, compositeOperator, useLowQualityScaling);
}
}