本文整理汇总了C++中FloatRect::normalized方法的典型用法代码示例。如果您正苦于以下问题:C++ FloatRect::normalized方法的具体用法?C++ FloatRect::normalized怎么用?C++ FloatRect::normalized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FloatRect
的用法示例。
在下文中一共展示了FloatRect::normalized方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void StillImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
const FloatRect& src, ColorSpace, CompositeOperator op, BlendMode blendMode)
{
if (m_pixmap->isNull())
return;
FloatRect normalizedSrc = src.normalized();
FloatRect normalizedDst = dst.normalized();
CompositeOperator previousOperator = ctxt->compositeOperation();
BlendMode previousBlendMode = ctxt->blendModeOperation();
ctxt->setCompositeOperation(op, blendMode);
if (ctxt->hasShadow()) {
ShadowBlur shadow(ctxt->state());
GraphicsContext* shadowContext = shadow.beginShadowLayer(ctxt, normalizedDst);
if (shadowContext) {
QPainter* shadowPainter = shadowContext->platformContext();
shadowPainter->drawPixmap(normalizedDst, *m_pixmap, normalizedSrc);
shadow.endShadowLayer(ctxt);
}
}
ctxt->platformContext()->drawPixmap(normalizedDst, *m_pixmap, normalizedSrc);
ctxt->setCompositeOperation(previousOperator, previousBlendMode);
}
示例2: draw
void ImageBufferData::draw(GraphicsContext* thisContext, GraphicsContext* otherContext, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, bool useLowQualityScale) const
{
const FloatRect normDestRect = destRect.normalized();
const FloatRect normSrcRect = srcRect.normalized();
if (normSrcRect.isEmpty() || normDestRect.isEmpty())
return; // Nothing to draw.
if (thisContext->platformContext()->isEmpty() && platformBufferHandle(m_buffer)) {
CompositeOperator oldOperator = otherContext->compositeOperation();
otherContext->setCompositeOperation(op);
otherContext->platformContext()->drawBuffer(m_buffer, normDestRect, normSrcRect);
otherContext->setCompositeOperation(oldOperator);
} else {
dispatchSyncCompositingMessage(BlackBerry::Platform::createFunctionCallMessage(
&flushAndDraw, this, otherContext, styleColorSpace, normDestRect, normSrcRect, op, useLowQualityScale));
}
}
示例3: draw
// Drawing Routines
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
{
QRectF normalizedDst = dst.normalized();
QRectF normalizedSrc = src.normalized();
startAnimation();
if (normalizedSrc.isEmpty() || normalizedDst.isEmpty())
return;
QPixmap* image = nativeImageForCurrentFrame();
if (!image)
return;
if (mayFillWithSolidColor()) {
fillWithSolidColor(ctxt, normalizedDst, solidColor(), styleColorSpace, op);
return;
}
#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
normalizedSrc = adjustSourceRectForDownSampling(normalizedSrc, image->size());
#endif
CompositeOperator previousOperator = ctxt->compositeOperation();
ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
if (ctxt->hasShadow()) {
ShadowBlur* shadow = ctxt->shadowBlur();
GraphicsContext* shadowContext = shadow->beginShadowLayer(ctxt, normalizedDst);
if (shadowContext) {
QPainter* shadowPainter = shadowContext->platformContext();
shadowPainter->drawPixmap(normalizedDst, *image, normalizedSrc);
shadow->endShadowLayer(ctxt);
}
}
ctxt->platformContext()->drawPixmap(normalizedDst, *image, normalizedSrc);
ctxt->setCompositeOperation(previousOperator);
if (imageObserver())
imageObserver()->didDraw(this);
}
示例4: draw
// Drawing Routines
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
{
QRectF normalizedDst = dst.normalized();
QRectF normalizedSrc = src.normalized();
startAnimation();
if (normalizedSrc.isEmpty() || normalizedDst.isEmpty())
return;
QPixmap* image = nativeImageForCurrentFrame();
if (!image)
return;
if (mayFillWithSolidColor()) {
fillWithSolidColor(ctxt, normalizedDst, solidColor(), styleColorSpace, op);
return;
}
CompositeOperator previousOperator = ctxt->compositeOperation();
ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
ContextShadow* shadow = ctxt->contextShadow();
if (shadow->m_type != ContextShadow::NoShadow) {
QPainter* shadowPainter = shadow->beginShadowLayer(ctxt, normalizedDst);
if (shadowPainter) {
shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255);
shadowPainter->drawPixmap(normalizedDst, *image, normalizedSrc);
shadow->endShadowLayer(ctxt);
}
}
ctxt->platformContext()->drawPixmap(normalizedDst, *image, normalizedSrc);
ctxt->setCompositeOperation(previousOperator);
if (imageObserver())
imageObserver()->didDraw(this);
}
示例5: readyWRATHWidgets
void BitmapImage::readyWRATHWidgets(PaintedWidgetsOfWRATHHandleT<Image>& handle, ContextOfWRATH *ctx,
const FloatRect& dst, const FloatRect& src,
ColorSpace styleColorSpace, CompositeOperator op)
{
BitmapImage_readyWRATHWidgets *d(BitmapImage_readyWRATHWidgets::object(this, handle));
ContextOfWRATH::AutoPushNode autoPushRoot(ctx, d->m_root_node);
d->m_solid_color.visible(false);
if (d->m_image_rect_item.widget())
d->m_image_rect_item.widget()->visible(false);
FloatRect normalizedDst = dst.normalized();
FloatRect normalizedSrc = src.normalized();
startAnimation();
if (normalizedSrc.isEmpty() || normalizedDst.isEmpty())
return;
NativeImagePtr nativeImage = nativeImageForCurrentFrame();
if (!nativeImage)
return;
// "Hardcode" the requirement for the underlying wrath image type to WRATHImage.
// The reason is support for setting texture coordinates, which isn't possible for WRATHCompoundImage
WRATHImage* image = nativeImage->getWrathImage();
if (!image)
return;
if (mayFillWithSolidColor()) {
d->m_solid_color.visible(true);
readyWRATHWidgetSolidColor(d->m_solid_color, ctx, this, normalizedDst, solidColor(), styleColorSpace, op);
return;
}
// ImageRectOfWRATH methods handle changing the op with respect to composite operator
/*
CompositeOperator previousOperator = ctxt->compositeOperation();
ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
*/
if(!nativeImage->hasAlpha() && op == CompositeSourceOver)
{
op=CompositeCopy;
}
/*
[WRATH-DANGER]: No shadows
ContextShadow* shadow = ctxt->contextShadow();
if (shadow->m_type != ContextShadow::NoShadow) {
QPainter* shadowPainter = shadow->beginShadowLayer(ctxt, normalizedDst);
if (shadowPainter) {
shadowPainter->setOpacity(static_cast<qreal>(shadow->m_color.alpha()) / 255);
shadowPainter->drawPixmap(normalizedDst, *image, normalizedSrc);
shadow->endShadowLayer(ctxt);
}
}
*/
/*
[WRATH-DANGER]: Possible rounding errors from converting to IntRect
*/
d->m_image_rect_item.update(ctx, nativeImage,
normalizedDst, IntRect(normalizedSrc),
op);
if (d->m_image_rect_item.widget())
d->m_image_rect_item.widget()->visible(true);
/*
ctxt->platformContext()->drawPixmap(normalizedDst, *image, normalizedSrc);
*/
/*
ctxt->setCompositeOperation(previousOperator);
*/
if (imageObserver())
imageObserver()->didDraw(this);
}