您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ sourceRect函数代码示例

51自学网 2021-06-03 08:07:49
  C++
这篇教程C++ sourceRect函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中sourceRect函数的典型用法代码示例。如果您正苦于以下问题:C++ sourceRect函数的具体用法?C++ sourceRect怎么用?C++ sourceRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了sourceRect函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: painter

void QGraphicsViewAdapter::render(){	osg::notify( osg::INFO )<<"Current write = "<<_currentWrite<<std::endl;	QImage& image = _qimages[_currentWrite];#if 1	// paint the image with the graphics view	QPainter painter( &image );	QRectF destinationRect( 0, 0, image.width(), image.height() );	QRect sourceRect( 0, 0, ( int )( _graphicsScene->width() ), ( int )( _graphicsScene->height() ) );	_graphicsView->render( &painter, destinationRect, sourceRect );	painter.end();#else	// paint the image with the graphics view	QPixmap pixmap( image.width(), image.height() );	QPainter painter( &pixmap );	QRectF destinationRect( 0, 0, image.width(), image.height() );	QRect sourceRect( 0, 0, _graphicsScene->width(), _graphicsScene->height() );	_graphicsView->render( &painter, destinationRect, sourceRect );	painter.end();	image = pixmap.toImage();#endif	// convert into OpenGL format - flipping around the Y axis and swizzling the pixels	image = QGLWidget::convertToGLFormat( image );	// swap the write buffers in a thread safe way	OpenThreads::ScopedLock<OpenThreads::Mutex> lock( _qimagesMutex );	std::swap( _currentWrite, _previousWrite );	_newImageAvailable = true;}
开发者ID:garajm,项目名称:RealityNotFound,代码行数:32,


示例2: t

void WVuMeter::paintEvent(QPaintEvent *) {    ScopedTimer t("WVuMeter::paintEvent");    QStyleOption option;    option.initFrom(this);    QStylePainter p(this);    p.drawPrimitive(QStyle::PE_Widget, option);    if (!m_pPixmapBack.isNull() && !m_pPixmapBack->isNull()) {        // Draw background.        m_pPixmapBack->draw(0, 0, &p);    }    if (!m_pPixmapVu.isNull() && !m_pPixmapVu->isNull()) {        int idx = static_cast<int>(getControlParameterDisplay() * m_iNoPos);        // Range check        if (idx > m_iNoPos)            idx = m_iNoPos;        else if (idx < 0)            idx = 0;        // Draw (part of) vu        if (m_bHorizontal) {            // This is a hack to fix something weird with horizontal VU meters:            if (idx == 0)                idx = 1;            QPointF targetPoint(0, 0);            QRectF sourceRect(0, 0, idx, m_pPixmapVu->height());            m_pPixmapVu->draw(targetPoint, &p, sourceRect);            if(m_iPeakHoldSize > 0 && m_iPeakPos > 0) {                targetPoint = QPointF(m_iPeakPos - m_iPeakHoldSize, 0);                sourceRect = QRectF(m_iPeakPos - m_iPeakHoldSize, 0,                                    m_iPeakHoldSize, m_pPixmapVu->height());                m_pPixmapVu->draw(targetPoint, &p, sourceRect);            }        } else {            QPointF targetPoint(0, m_iNoPos - idx);            QRectF sourceRect(0, m_iNoPos - idx, m_pPixmapVu->width(), idx);            m_pPixmapVu->draw(targetPoint, &p, sourceRect);            if (m_iPeakHoldSize > 0 && m_iPeakPos > 0) {                targetPoint = QPointF(0, m_pPixmapVu->height() - m_iPeakPos);                sourceRect = QRectF(0, m_pPixmapVu->height() - m_iPeakPos,                                    m_pPixmapVu->width(), m_iPeakHoldSize);                m_pPixmapVu->draw(targetPoint, &p, sourceRect);            }        }    }}
开发者ID:davidkohr,项目名称:mixxx,代码行数:53,


示例3: GetLocalTransform

void ImageLayerComposite::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface){  gfx3DMatrix local = GetLocalTransform();  // Snap image edges to pixel boundaries  gfxRect sourceRect(0, 0, 0, 0);  if (mImageHost &&      mImageHost->IsAttached() &&      (mImageHost->GetDeprecatedTextureHost() || mImageHost->GetTextureHost())) {    IntSize size =      mImageHost->GetTextureHost() ? mImageHost->GetTextureHost()->GetSize()                                   : mImageHost->GetDeprecatedTextureHost()->GetSize();    sourceRect.SizeTo(size.width, size.height);    if (mScaleMode != SCALE_NONE &&        sourceRect.width != 0.0 && sourceRect.height != 0.0) {      NS_ASSERTION(mScaleMode == SCALE_STRETCH,                   "No other scalemodes than stretch and none supported yet.");      local.Scale(mScaleToSize.width / sourceRect.width,                  mScaleToSize.height / sourceRect.height, 1.0);    }  }  // Snap our local transform first, and snap the inherited transform as well.  // This makes our snapping equivalent to what would happen if our content  // was drawn into a ThebesLayer (gfxContext would snap using the local  // transform, then we'd snap again when compositing the ThebesLayer).  mEffectiveTransform =      SnapTransform(local, sourceRect, nullptr) *      SnapTransformTranslation(aTransformToSurface, nullptr);  ComputeEffectiveTransformForMaskLayer(aTransformToSurface);}
开发者ID:cctuan,项目名称:mozilla-central,代码行数:31,


示例4: GetLocalTransform

voidImageLayerMLGPU::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface){  Matrix4x4 local = GetLocalTransform();  // Snap image edges to pixel boundaries.  gfxRect sourceRect(0, 0, 0, 0);  if (mHost && mHost->IsAttached()) {    IntSize size = mHost->GetImageSize();    sourceRect.SizeTo(size.width, size.height);  }  // Snap our local transform first, and snap the inherited transform as well.  // This makes our snapping equivalent to what would happen if our content  // was drawn into a PaintedLayer (gfxContext would snap using the local  // transform, then we'd snap again when compositing the PaintedLayer).  mEffectiveTransform =      SnapTransform(local, sourceRect, nullptr) *      SnapTransformTranslation(aTransformToSurface, nullptr);  mEffectiveTransformForBuffer = mEffectiveTransform;  if (mScaleMode == ScaleMode::STRETCH &&      mScaleToSize.width != 0.0 &&      mScaleToSize.height != 0.0)  {    Size scale(sourceRect.Width() / mScaleToSize.width,               sourceRect.Height() / mScaleToSize.height);    mScale = Some(scale);  }  ComputeEffectiveTransformForMaskLayers(aTransformToSurface);}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:32,


示例5: DrawSurfaceWithTextureCoords

static voidDrawSurfaceWithTextureCoords(DrawTarget *aDest,                             const gfx::Rect& aDestRect,                             SourceSurface *aSource,                             const gfx::Rect& aTextureCoords,                             gfx::Filter aFilter,                             float aOpacity,                             SourceSurface *aMask,                             const Matrix* aMaskTransform){  // Convert aTextureCoords into aSource's coordinate space  gfxRect sourceRect(aTextureCoords.x * aSource->GetSize().width,                     aTextureCoords.y * aSource->GetSize().height,                     aTextureCoords.width * aSource->GetSize().width,                     aTextureCoords.height * aSource->GetSize().height);  // Floating point error can accumulate above and we know our visible region  // is integer-aligned, so round it out.  sourceRect.Round();  // Compute a transform that maps sourceRect to aDestRect.  Matrix matrix =    gfxUtils::TransformRectToRect(sourceRect,                                  gfx::IntPoint(aDestRect.x, aDestRect.y),                                  gfx::IntPoint(aDestRect.XMost(), aDestRect.y),                                  gfx::IntPoint(aDestRect.XMost(), aDestRect.YMost()));  // Only use REPEAT if aTextureCoords is outside (0, 0, 1, 1).  gfx::Rect unitRect(0, 0, 1, 1);  ExtendMode mode = unitRect.Contains(aTextureCoords) ? ExtendMode::CLAMP : ExtendMode::REPEAT;  FillRectWithMask(aDest, aDestRect, aSource, aFilter, DrawOptions(aOpacity),                   mode, aMask, aMaskTransform, &matrix);}
开发者ID:hoosteeno,项目名称:gecko-dev,代码行数:34,


示例6: GetLocalTransform

void ImageLayer::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface){  gfx::Matrix4x4 local = GetLocalTransform();  // Snap image edges to pixel boundaries  gfxRect sourceRect(0, 0, 0, 0);  if (mContainer) {    sourceRect.SizeTo(gfx::ThebesIntSize(mContainer->GetCurrentSize()));    if (mScaleMode != ScaleMode::SCALE_NONE &&        sourceRect.width != 0.0 && sourceRect.height != 0.0) {      NS_ASSERTION(mScaleMode == ScaleMode::STRETCH,                   "No other scalemodes than stretch and none supported yet.");      local.PreScale(mScaleToSize.width / sourceRect.width,                     mScaleToSize.height / sourceRect.height, 1.0);    }  }  // Snap our local transform first, and snap the inherited transform as well.  // This makes our snapping equivalent to what would happen if our content  // was drawn into a PaintedLayer (gfxContext would snap using the local  // transform, then we'd snap again when compositing the PaintedLayer).  mEffectiveTransform =      SnapTransform(local, sourceRect, nullptr) *      SnapTransformTranslation(aTransformToSurface, nullptr);  ComputeEffectiveTransformForMaskLayer(aTransformToSurface);}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:25,


示例7: state

void QPaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount,                                         const QPixmap &pixmap, QPainter::PixmapFragmentHints /*hints*/){    if (pixmap.isNull())        return;    qreal oldOpacity = state()->opacity;    QTransform oldTransform = state()->matrix;    for (int i = 0; i < fragmentCount; ++i) {        QTransform transform = oldTransform;        transform.translate(fragments[i].x, fragments[i].y);        transform.rotate(fragments[i].rotation);        state()->opacity = oldOpacity * fragments[i].opacity;        state()->matrix = transform;        opacityChanged();        transformChanged();        qreal w = fragments[i].scaleX * fragments[i].width;        qreal h = fragments[i].scaleY * fragments[i].height;        QRectF sourceRect(fragments[i].sourceLeft, fragments[i].sourceTop,                          fragments[i].width, fragments[i].height);        drawPixmap(QRectF(-0.5 * w, -0.5 * h, w, h), pixmap, sourceRect);    }    state()->opacity = oldOpacity;    state()->matrix = oldTransform;    opacityChanged();    transformChanged();}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:30,


示例8: qsgsimpletexturenode_update

static void qsgsimpletexturenode_update(QSGGeometry *g,                                        QSGTexture *texture,                                        const QRectF &rect,                                        QSGSimpleTextureNode::TextureCoordinatesTransformMode texCoordMode){    if (!texture)        return;    QSize ts = texture->textureSize();    QRectF sourceRect(0, 0, ts.width(), ts.height());    // Maybe transform the texture coordinates    if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorHorizontally)) {        float tmp = sourceRect.left();        sourceRect.setLeft(sourceRect.right());        sourceRect.setRight(tmp);    }    if (texCoordMode.testFlag(QSGSimpleTextureNode::MirrorVertically)) {        float tmp = sourceRect.top();        sourceRect.setTop(sourceRect.bottom());        sourceRect.setBottom(tmp);    }    QSGGeometry::updateTexturedRectGeometry(g, rect, texture->convertToNormalizedSourceRect(sourceRect));}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:25,


示例9: FCN_EXCEPTION

    void IrrlichtGraphics::drawImage(const Image* image,                                int srcX,                                int srcY,                                int dstX,                                int dstY,                                int width,                                int height)    {        if (mClipStack.empty())        {            throw FCN_EXCEPTION("Clip stack is empty, perhaps you called a draw funtion outside of _beginDraw() and _endDraw()?");        }        const ClipRectangle& top = mClipStack.top();        const IrrlichtImage* srcImage = dynamic_cast<const IrrlichtImage*>(image);        if (srcImage == NULL)        {            throw FCN_EXCEPTION("Trying to draw an image of unknown format, must be an IrrlichtImage.");        }        irr::core::position2d<irr::s32> destPos(dstX + top.xOffset, dstY + top.yOffset);        irr::core::rect<irr::s32> sourceRect(srcX, srcY, srcX + width, srcY + height);        irr::core::rect<irr::s32> clipRect(top.x, top.y, top.x + top.width, top.y + top.height);        irr::video::SColor color(255, 255, 255, 255);        mDriver->draw2DImage(srcImage->getTexture(), destPos, sourceRect, &clipRect, color, true);    }
开发者ID:fifengine,项目名称:fifechan,代码行数:29,


示例10: Q_UNUSED

void DragTool::paintEvent(QPaintEvent *event){    Q_UNUSED(event);    QMargins margins = contentsMargins();    QPixmap pixmap = d->icon.pixmap(d->iconSize, isEnabled() ? QIcon::Normal : QIcon::Disabled, QIcon::Off);    QPainter painter(this);    QRect targetRect((width() - pixmap.width()) / 2,                     margins.top() + (d->iconSize.height() - pixmap.height()) / 2,                     pixmap.width(),                     pixmap.height());    QRect sourceRect(0, 0, pixmap.width(), pixmap.height());    painter.drawPixmap(targetRect, pixmap, sourceRect);    QRect textRect = painter.boundingRect(QRect(), Qt::AlignLeft | Qt::TextSingleLine, d->title);    QRect boundingRect(0, d->iconSize.height(), width(), textRect.height());    painter.drawText(boundingRect, Qt::AlignHCenter | Qt::TextSingleLine, d->title);    // draw a weak frame if mouse is inside widget    if (!d->disableFrame && rect().contains(QWidget::mapFromGlobal(QCursor::pos()))) {        QRect rect(0, 0, width() - 1, height() - 1);        QPen pen = painter.pen();        pen.setStyle(Qt::DotLine);        painter.setPen(pen);        painter.drawRect(rect);        d->framePainted = true;    } else {        d->framePainted = false;    }}
开发者ID:C-sjia,项目名称:qt-creator,代码行数:29,


示例11: t

void WVuMeter::paintEvent(QPaintEvent *) {    ScopedTimer t("WVuMeter::paintEvent");    QStyleOption option;    option.initFrom(this);    QStylePainter p(this);    p.drawPrimitive(QStyle::PE_Widget, option);    if (!m_pPixmapBack.isNull() && !m_pPixmapBack->isNull()) {        // Draw background.        m_pPixmapBack->draw(0, 0, &p);    }    if (!m_pPixmapVu.isNull() && !m_pPixmapVu->isNull()) {        // Draw (part of) vu        if (m_bHorizontal) {            // This is a hack to fix something weird with horizontal VU meters:            if (m_iPos == 0)                m_iPos = 1;            QPointF targetPoint(0, 0);            QRectF sourceRect(0, 0, m_iPos, m_pPixmapVu->height());            m_pPixmapVu->draw(targetPoint, &p, sourceRect);            if(m_iPeakHoldSize > 0 && m_iPeakPos > 0) {                targetPoint = QPointF(m_iPeakPos - m_iPeakHoldSize, 0);                sourceRect = QRectF(m_iPeakPos - m_iPeakHoldSize, 0,                                    m_iPeakHoldSize, m_pPixmapVu->height());                m_pPixmapVu->draw(targetPoint, &p, sourceRect);            }        } else {            QPointF targetPoint(0, m_iNoPos - m_iPos);            QRectF sourceRect(0, m_iNoPos - m_iPos, m_pPixmapVu->width(), m_iPos);            m_pPixmapVu->draw(targetPoint, &p, sourceRect);            if (m_iPeakHoldSize > 0 && m_iPeakPos > 0) {                targetPoint = QPointF(0, m_pPixmapVu->height() - m_iPeakPos);                sourceRect = QRectF(0, m_pPixmapVu->height() - m_iPeakPos,                                    m_pPixmapVu->width(), m_iPeakHoldSize);                m_pPixmapVu->draw(targetPoint, &p, sourceRect);            }        }    }    m_iLastPos = m_iPos;    m_iLastPeakPos = m_iPeakPos;}
开发者ID:Adna1206,项目名称:mixxx,代码行数:46,


示例12: sourceRect

void CTransparentBitmap::Draw(CFbsBitGc& gc,TInt aX, TInt aY)	{//	gc.BitBlt(TPoint(aX,aY),iMaskBitmap);	if (iSrcBitmap && iMaskBitmap)		{		TRect sourceRect( TPoint( 0,0 ),iSrcBitmap->SizeInPixels() );		gc.BitBltMasked(TPoint(aX,aY),iSrcBitmap,sourceRect,iMaskBitmap,ETrue);		}	}
开发者ID:flaithbheartaigh,项目名称:lemonplayer,代码行数:9,


示例13: sourceRect

void WaylandSurfaceNode::setTexture(QSGTexture *texture){    if (m_currentMaterial->state()->texture() == texture)        return;    m_currentMaterial->state()->setTexture(texture);    QSize ts = texture->textureSize();    QRectF sourceRect(0, 0, ts.width(), ts.height());    QSGGeometry::updateTexturedRectGeometry(&m_geometry, m_rect, texture->convertToNormalizedSourceRect(sourceRect));    markDirty(DirtyMaterial);}
开发者ID:Distrotech,项目名称:qtwayland,代码行数:11,


示例14: texture

void WaylandSurfaceNode::setRect(const QRectF &rect){    if (m_rect == rect)        return;    m_rect = rect;    if (texture()) {        QSize ts = texture()->textureSize();        QRectF sourceRect(0, 0, ts.width(), ts.height());        QSGGeometry::updateTexturedRectGeometry(&m_geometry, m_rect, texture()->convertToNormalizedSourceRect(sourceRect));    }}
开发者ID:Distrotech,项目名称:qtwayland,代码行数:12,


示例15: qsgsimpletexturenode_update

QT_BEGIN_NAMESPACEstatic void qsgsimpletexturenode_update(QSGGeometry *g,                                        QSGTexture *texture,                                        const QRectF &rect){    if (!texture)        return;    QSize ts = texture->textureSize();    QRectF sourceRect(0, 0, ts.width(), ts.height());    QSGGeometry::updateTexturedRectGeometry(g, rect, texture->convertToNormalizedSourceRect(sourceRect));}
开发者ID:ghjinlei,项目名称:qt5,代码行数:13,


示例16: sourceRect

void BitmapTextureImageBuffer::updateContents(TextureMapper*, GraphicsLayer* sourceLayer, const IntRect& targetRect, const IntPoint& sourceOffset, UpdateContentsFlag){    GraphicsContext* context = m_image->context();    context->clearRect(targetRect);    IntRect sourceRect(targetRect);    sourceRect.setLocation(sourceOffset);    context->save();    context->translate(targetRect.x() - sourceOffset.x(), targetRect.y() - sourceOffset.y());    sourceLayer->paintGraphicsLayerContents(*context, sourceRect);    context->restore();}
开发者ID:awong-chromium,项目名称:webkit,代码行数:13,


示例17: Q_D

void KoPatternBackground::paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &/*context*/, const QPainterPath &fillPath) const{    Q_D(const KoPatternBackground);    if (! d->imageData)        return;    painter.save();    if (d->repeat == Tiled) {        // calculate scaling of pixmap        QSizeF targetSize = d->targetSize();        QSizeF imageSize = d->imageData->imageSize();        qreal scaleX = targetSize.width() / imageSize.width();        qreal scaleY = targetSize.height() / imageSize.height();        QRectF targetRect = fillPath.boundingRect();        // undo scaling on target rectangle        targetRect.setWidth(targetRect.width() / scaleX);        targetRect.setHeight(targetRect.height() / scaleY);        // determine pattern offset        QPointF offset = d->offsetFromRect(targetRect, imageSize);        // create matrix for pixmap scaling        QTransform matrix;        matrix.scale(scaleX, scaleY);        painter.setClipPath(fillPath);        painter.setWorldTransform(matrix, true);        painter.drawTiledPixmap(targetRect, d->imageData->pixmap(imageSize.toSize()), -offset);    } else if (d->repeat == Original) {        QRectF sourceRect(QPointF(0, 0), d->imageData->imageSize());        QRectF targetRect(QPoint(0, 0), d->targetSize());        targetRect.moveCenter(fillPath.boundingRect().center());        painter.setClipPath(fillPath);        painter.drawPixmap(targetRect, d->imageData->pixmap(sourceRect.size().toSize()), sourceRect);    } else if (d->repeat == Stretched) {        painter.setClipPath(fillPath);        // undo conversion of the scaling so that we can use a nicely scaled image of the correct size        qreal zoomX, zoomY;        converter.zoom(&zoomX, &zoomY);        zoomX = zoomX ? 1 / zoomX : zoomX;        zoomY = zoomY ? 1 / zoomY : zoomY;        painter.scale(zoomX, zoomY);        QRectF targetRect = converter.documentToView(fillPath.boundingRect());        painter.drawPixmap(targetRect.topLeft(), d->imageData->pixmap(targetRect.size().toSize()));    }    painter.restore();}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:51,


示例18: sourceRect

CPoissonExt::CPoissonExt(int layer_index, cv::Mat& vector, cv::Mat& extends1, cv::Mat& extends2,bool gpu_flag):_layer_index(layer_index),_vector(vector),_extends1(extends1),_extends2(extends2),_gpu_flag(gpu_flag){	w=vector.cols;	h=vector.rows;	ex=(_extends1.cols-w)/2;	Rect sourceRect(ex,ex,w, h);	_image1=_extends1(sourceRect).clone();	_image2=_extends2(sourceRect).clone();	type=new int[(w+2*ex)*(h+ex*2)];	index=new int[(w+2*ex)*(h+ex*2)];}
开发者ID:Nuos,项目名称:Image-Morphing,代码行数:14,


示例19: getImageData

template <bool premultiplied> PassRefPtr<ImageData>static getImageData(const IntRect& rect, const SharedBitmap* bitmap){    PassRefPtr<ImageData> imageData = ImageData::create(rect.width(), rect.height());    const unsigned char* src = static_cast<const unsigned char*>(bitmap->bytes());    if (!src)        return imageData;    IntRect sourceRect(0, 0, bitmap->width(), bitmap->height());    sourceRect.intersect(rect);    if (sourceRect.isEmpty())        return imageData;    unsigned char* dst = imageData->data()->data()->data();    memset(dst, 0, imageData->data()->data()->length());    src += (sourceRect.y() * bitmap->width() + sourceRect.x()) * 4;    dst += ((sourceRect.y() - rect.y()) * imageData->width() + sourceRect.x() - rect.x()) * 4;    int bytesToCopy = sourceRect.width() * 4;    int srcSkip = (bitmap->width() - sourceRect.width()) * 4;    int dstSkip = (imageData->width() - sourceRect.width()) * 4;    const unsigned char* dstEnd = dst + sourceRect.height() * imageData->width() * 4;    while (dst < dstEnd) {        const unsigned char* dstRowEnd = dst + bytesToCopy;        while (dst < dstRowEnd) {            // Convert ARGB little endian to RGBA big endian            int blue = *src++;            int green = *src++;            int red = *src++;            int alpha = *src++;            if (premultiplied) {                *dst++ = static_cast<unsigned char>((red * alpha + 254) / 255);                *dst++ = static_cast<unsigned char>((green * alpha + 254) / 255);                *dst++ = static_cast<unsigned char>((blue * alpha + 254) / 255);                *dst++ = static_cast<unsigned char>(alpha);            } else {                *dst++ = static_cast<unsigned char>(red);                *dst++ = static_cast<unsigned char>(green);                *dst++ = static_cast<unsigned char>(blue);                *dst++ = static_cast<unsigned char>(alpha);                ++src;            }        }        src += srcSkip;        dst += dstSkip;    }    return imageData;}
开发者ID:azrul2202,项目名称:WebKit-Smartphone,代码行数:49,


示例20: sourceRect

void SDLImage::draw(SDL_Surface *where, int posX, int posY, Rect *src, ui8 rotation) const{	if (!surf)		return;	Rect sourceRect(margins.x, margins.y, surf->w, surf->h);	//TODO: rotation and scaling	if (src)	{		sourceRect = sourceRect & *src;	}	Rect destRect(posX, posY, surf->w, surf->h);	destRect += sourceRect.topLeft();	sourceRect -= margins;	CSDL_Ext::blitSurface(surf, &sourceRect, where, &destRect);}
开发者ID:DavidZeni,项目名称:vcmi,代码行数:15,


示例21: getImageData

static PassRefPtr<Uint8ClampedArray> getImageData(const IntRect& rect, const SharedBitmap* bitmap){    RefPtr<Uint8ClampedArray> imageData = Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4);    const unsigned char* src = static_cast<const unsigned char*>(bitmap->bytes());    if (!src)        return imageData.release();    IntRect sourceRect(0, 0, bitmap->width(), bitmap->height());    sourceRect.intersect(rect);    if (sourceRect.isEmpty())        return imageData.release();    unsigned char* dst = imageData->data();    imageData->zeroFill();    src += (sourceRect.y() * bitmap->width() + sourceRect.x()) * 4;    dst += ((sourceRect.y() - rect.y()) * rect.width() + sourceRect.x() - rect.x()) * 4;    int bytesToCopy = sourceRect.width() * 4;    int srcSkip = (bitmap->width() - sourceRect.width()) * 4;    int dstSkip = (rect.width() - sourceRect.width()) * 4;    const unsigned char* dstEnd = dst + sourceRect.height() * rect.width() * 4;    while (dst < dstEnd) {        const unsigned char* dstRowEnd = dst + bytesToCopy;        while (dst < dstRowEnd) {            // Convert ARGB little endian to RGBA big endian            int blue = *src++;            int green = *src++;            int red = *src++;            int alpha = *src++;            if (premultiplied) {                *dst++ = static_cast<unsigned char>((red * alpha + 254) / 255);                *dst++ = static_cast<unsigned char>((green * alpha + 254) / 255);                *dst++ = static_cast<unsigned char>((blue * alpha + 254) / 255);                *dst++ = static_cast<unsigned char>(alpha);            } else {                *dst++ = static_cast<unsigned char>(red);                *dst++ = static_cast<unsigned char>(green);                *dst++ = static_cast<unsigned char>(blue);                *dst++ = static_cast<unsigned char>(alpha);                ++src;            }        }        src += srcSkip;        dst += dstSkip;    }    return imageData.release();}
开发者ID:harlanlewis,项目名称:webkit,代码行数:48,


示例22: sourceRect

void BitmapTexture::updateContents(TextureMapper* textureMapper, GraphicsLayer* sourceLayer, const IntRect& targetRect, const IntPoint& offset, UpdateContentsFlag updateContentsFlag){    std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(targetRect.size());    GraphicsContext* context = imageBuffer->context();    context->setImageInterpolationQuality(textureMapper->imageInterpolationQuality());    context->setTextDrawingMode(textureMapper->textDrawingMode());    IntRect sourceRect(targetRect);    sourceRect.setLocation(offset);    context->translate(-offset.x(), -offset.y());    sourceLayer->paintGraphicsLayerContents(*context, sourceRect);    RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);    updateContents(image.get(), targetRect, IntPoint(), updateContentsFlag);}
开发者ID:houzhenggang,项目名称:webkit,代码行数:16,


示例23: sourceRect

//! draws the element and its childrenvoid CGUIImage::draw(){	if (!IsVisible)		return;	IGUISkin* skin = Environment->getSkin();	video::IVideoDriver* driver = Environment->getVideoDriver();	if (Texture)	{		core::rect<s32> sourceRect(SourceRect);		if (sourceRect.getWidth() == 0 || sourceRect.getHeight() == 0)		{			sourceRect = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(Texture->getOriginalSize()));		}		if (ScaleImage)		{			const video::SColor Colors[] = {Color,Color,Color,Color};			core::rect<s32> clippingRect(AbsoluteClippingRect);			checkBounds(clippingRect);			driver->draw2DImage(Texture, AbsoluteRect, sourceRect,				&clippingRect, Colors, UseAlphaChannel);		}		else		{			core::rect<s32> clippingRect(AbsoluteRect.UpperLeftCorner, sourceRect.getSize());			checkBounds(clippingRect);			clippingRect.clipAgainst(AbsoluteClippingRect);			driver->draw2DImage(Texture, AbsoluteRect.UpperLeftCorner, sourceRect,				&clippingRect, Color, UseAlphaChannel);		}	}	else	{		core::rect<s32> clippingRect(AbsoluteClippingRect);		checkBounds(clippingRect);		skin->draw2DRectangle(this, skin->getColor(EGDC_3D_DARK_SHADOW), AbsoluteRect, &clippingRect);	}	IGUIElement::draw();}
开发者ID:2223108045,项目名称:YGOMobile,代码行数:47,


示例24: actualPos

// // Sprite::VOnRestore - Chapter 10, page 319//HRESULT Sprite::VOnRender(double fTime, float fElapsedTime){	CPoint actualPos( m_Position - m_Hotspot );	CRect sourceRect( CPoint(0,0), CPoint(m_Width-1, m_Height-1 ) );	// Adjust for the frame	sourceRect.top += ( m_CurrentFrame * m_TextureHeight );	sourceRect.bottom += ( m_CurrentFrame * m_TextureHeight );	Vec3 center(1.0f, 1.0f, 0.0f);	Vec3 translation((const float)actualPos.x, (const float)actualPos.y, 0.0f);	if (m_d3dSprite && m_pTexture)	{		m_d3dSprite->Begin(D3DXSPRITE_ALPHABLEND);		m_d3dSprite->Draw(m_pTexture, &sourceRect, &center, &translation, g_White);		m_d3dSprite->End();	}	return S_OK;}
开发者ID:wsantas,项目名称:gamecode4,代码行数:24,


示例25: GetSizeInPixels

void CHlpPicture::Draw(CGraphicsContext& aGc, const TPoint& aTopLeft, const TRect& aClipRect, MGraphicsDeviceMap* aMap) const	{	if	(iImageCountForPicture != KHlpModelMaximumNumberOfImagesForV6Point2Files)		{		// If there is only one image to represent this image, then we revert to using		// the scaling code, as per v6.0 and 6.1		TSize size;		GetSizeInPixels(aMap, size);		TRect destRect(aTopLeft, size);		TMargins cropMargins;		GetCropInTwips(cropMargins);		TSize originalSize;		GetOriginalSizeInTwips(originalSize);		TRect sourceRect(TPoint(cropMargins.iLeft,cropMargins.iTop), TPoint(originalSize.iWidth-cropMargins.iRight,originalSize.iHeight-cropMargins.iBottom));		sourceRect = CCoeEnv::Static()->ScreenDevice()->TwipsToPixels(sourceRect);		aGc.SetClippingRect(aClipRect);		aGc.DrawBitmap(destRect, iImage, sourceRect);		}	else		{		// There are (by default anyway) 3 images available for use at various zoom states,		// hence we must ensure that we don't scale the bitmap.		TMargins cropMargins;		GetCropInTwips(cropMargins);		TRect sourceRect;		TRect destRect;		TSize size(iImage->SizeInPixels());		destRect = TRect(aTopLeft, size);		sourceRect = TRect(TPoint(cropMargins.iLeft, cropMargins.iTop), TPoint(size.iWidth - cropMargins.iRight, size.iHeight - cropMargins.iBottom));		aGc.SetClippingRect(aClipRect);		aGc.DrawBitmap(destRect, iImage, sourceRect);		}	}
开发者ID:cdaffara,项目名称:symbiandump-ossapps,代码行数:38,


示例26: topLeft

void tst_QOpenGL::textureblitterPartOriginTopLeftSourceRectTransform(){    TestVertex3D topLeft(uv_top_left);    TestVertex3D bottomLeft(uv_bottom_left);    TestVertex3D topRight(uv_top_right);    TestVertex3D bottomRight(uv_bottom_right);    QRectF sourceRect(50,190,170,170);    QSize textureSize(400,400);    QMatrix3x3 sourceMatrix = QOpenGLTextureBlitter::sourceTransform(sourceRect, textureSize, QOpenGLTextureBlitter::OriginTopLeft);    const float x_point_ratio = sourceRect.topLeft().x() / textureSize.width();    const float y_point_ratio = sourceRect.topLeft().y() / textureSize.height();    const float width_ratio = sourceRect.width() / textureSize.width();    const float height_ratio = sourceRect.height() / textureSize.height();    TestVertex3D uvTopLeft = sourceMatrix * topLeft;    const float expected_top_left[] = { x_point_ratio, 1 - y_point_ratio - height_ratio, 1 };    TestVertex3D expectedTopLeft(expected_top_left);    QVERIFY(q_fuzzy_compare(uvTopLeft, expectedTopLeft));    TestVertex3D uvBottomLeft = sourceMatrix * bottomLeft;    const float expected_bottom_left[] = { x_point_ratio, 1 - y_point_ratio, 1 };    TestVertex3D expectedBottomLeft(expected_bottom_left);    QVERIFY(q_fuzzy_compare(uvBottomLeft, expectedBottomLeft));    TestVertex3D uvTopRight = sourceMatrix * topRight;    const float expected_top_right[] = { x_point_ratio + width_ratio, 1 - y_point_ratio - height_ratio, 1 };    TestVertex3D expectedTopRight(expected_top_right);    QVERIFY(q_fuzzy_compare(uvTopRight, expectedTopRight));    TestVertex3D uvBottomRight = sourceMatrix * bottomRight;    const float expected_bottom_right[] = { x_point_ratio + width_ratio, 1 - y_point_ratio, 1 };    TestVertex3D expectedBottomRight(expected_bottom_right);    QVERIFY(q_fuzzy_compare(uvBottomRight, expectedBottomRight));}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:37,


示例27: CBitmap

void CQTTDemoView::OnDraw(CDC* pDC){	{		/*		CDC *mdc = new CDC;		//De lam cai gi vay troi?		mdc->CreateCompatibleDC(pDC);		CBitmap* m_bitmap = new CBitmap();		//Ham de load cai file den cai bitmap // Win32 API		m_bitmap->m_hObject=(HBITMAP)::LoadImage(			NULL,			"tamtit.bmp",			IMAGE_BITMAP,			520,			758,			LR_LOADFROMFILE);		//Phai select object thi no moi ve dc.		mdc->SelectObject(m_bitmap);		CRect rect;		//Lay client Rect		GetClientRect(&rect);		//BitBlt() // Khong hieu		//pDC->BitBlt(100,100,400,500,mdc,0,0,SRCCOPY);		float radians = 3.1416f*0/180;		float minx = 0;		float miny = 0;		float cosine = (float)cos(radians);		float sine = (float)sin(radians);		XFORM xform;		xform.eM11 = cosine;		xform.eM12 = -sine;		xform.eM21 = sine;		xform.eM22 = cosine;		xform.eDx = (float)-minx;		xform.eDy = (float)-miny;		pDC->BitBlt(0,0,400,500,mdc,100,100,SRCCOPY);				SetGraphicsMode(pDC->m_hDC, GM_ADVANCED);		SetWorldTransform(pDC->GetSafeHdc(),&xform);		pDC->TransparentBlt(100,100,400,500,mdc,0,0,400,500,RGB(144,3,225));		mdc->DeleteDC();				CBrush brush;		brush.CreatePatternBrush(m_bitmap);		*/		// Block for Graphics		Bitmap* originalBitmap = new Bitmap(L"gameloft_logo.png");		Graphics g(pDC->GetSafeHdc());		g.SetSmoothingMode(SmoothingModeHighQuality);		g.SetInterpolationMode(InterpolationModeHighQualityBicubic);		g.SetPixelOffsetMode(PixelOffsetModeHighQuality);				for (int i = 0; i < PATH_COUNT; i++)		{			//g.RotateTransform(45);						if( i == PATH_IMAGE)			{				REAL left		= 34;				REAL top		= 59;				REAL width		= 106;				REAL height		= 76;				RectF sourceRect(					left,					top, 					width, 					height				);				RectF sourceBound;				m_Paths[i].GetBounds(&sourceBound);								Bitmap* secondBitmap = originalBitmap->Clone(sourceRect, PixelFormatDontCare);				m_Matrixs[i];				g.SetTransform(m_Matrixs[i]);				g.DrawImage(secondBitmap,0,0);				Matrix* m = m_Matrixs[i]->Clone();				m->Reset();				g.SetTransform(m);				g.DrawPath(m_pPens[i], & m_Paths[i]);				delete m;							}			else{				g.FillPath(m_pBrushes[i], & m_Paths[i]);				g.DrawPath(m_pPens[i], & m_Paths[i]);			}						//g.GetTransform()		}	}	//Dung de paint may cai nut de co the xoay, resize v.v...	m_Tracker.Draw(pDC);}
开发者ID:seancyw,项目名称:dev-center,代码行数:89,



注:本文中的sourceRect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ sources函数代码示例
C++ sourceModel函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。