本文整理汇总了C++中destRect函数的典型用法代码示例。如果您正苦于以下问题:C++ destRect函数的具体用法?C++ destRect怎么用?C++ destRect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了destRect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: DCHECK
void CanvasGdiplus::RestoreLayer()
{
DCHECK(layers_.size());
CanvasLayer* layer = layers_.top();
layers_.pop();
DCHECK(layer);
Gdiplus::Graphics* current = GetCurrentGraphics();
Gdiplus::Bitmap* native_bitmap =
layer->mem_bitmap.GetNativeBitmap();
Gdiplus::ImageAttributes ia;
Gdiplus::ColorMatrix cm =
{
1.0, 0.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 0.0, (static_cast<float>(layer->alpha))/255, 0.0,
0.0, 0.0, 0.0, 0.0, 1.0
};
ia.SetColorMatrix(&cm);
Gdiplus::Rect destRect(layer->bounds.x(), layer->bounds.y(),
layer->bounds.width(), layer->bounds.height());
current->DrawImage(native_bitmap, destRect,
layer->bounds.x(), layer->bounds.y(),
layer->bounds.width(), layer->bounds.height(),
Gdiplus::UnitPixel, &ia);
delete layer;
}
开发者ID:Strongc,项目名称:Chrome_Library,代码行数:30,代码来源:canvas_gdiplus.cpp
示例2: drawRect
void Surface::transBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor) {
Common::Rect drawRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
// Clip the display area to on-screen
if (!clip(drawRect, destRect))
// It's completely off-screen
return;
if (flipped)
drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom,
src.w - drawRect.left, src.h - drawRect.top);
Common::Point destPt(destRect.left, destRect.top);
addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(),
destPt.y + drawRect.height()));
// Draw loop
const int TRANSPARENCY = 0xFF;
for (int yp = 0; yp < drawRect.height(); ++yp) {
const byte *srcP = (const byte *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp);
for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
if (*srcP != TRANSPARENCY)
*destP = overrideColor ? overrideColor : *srcP;
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
}
开发者ID:fissionchris,项目名称:scummvm,代码行数:33,代码来源:surface.cpp
示例3: destRect
void Scalpel3DOScreen::SHblitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
if (!_vm->_isScreenDoubled) {
ScalpelScreen::SHblitFrom(src, pt, srcBounds);
return;
}
Common::Rect srcRect = srcBounds;
Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());
if (!srcRect.isValidRect() || !clip(srcRect, destRect))
return;
// Add dirty area remapped to the 640x200 surface
addDirtyRect(Common::Rect(destRect.left * 2, destRect.top * 2, destRect.right * 2, destRect.bottom * 2));
// Transfer the area, doubling each pixel
for (int yp = 0; yp < srcRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(srcRect.left, srcRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destRect.left * 2, (destRect.top + yp) * 2);
for (int xp = srcRect.left; xp < srcRect.right; ++xp, ++srcP, destP += 2) {
*destP = *srcP;
*(destP + 1) = *srcP;
*(destP + 640) = *srcP;
*(destP + 640 + 1) = *srcP;
}
}
}
开发者ID:86400,项目名称:scummvm,代码行数:28,代码来源:scalpel_3do_screen.cpp
示例4: destRect
void Text::display() {
auto tp = _position;
auto font = _batcher->getFont();
auto fontHeight = font->getFontHeight();
auto start = font->getFontStart();
auto length = font->getFontLength();
auto glyphs = font->getFontGlyphs();
if(!_used) {
_index = _batcher->addString();
}
for(int i = 0; _text[i] != 0; i++) {
char c = _text[i];
if(_text[i] == '\n') {
tp.y += fontHeight * _scaling.y;
tp.x = _position.x;
} else {
// Check for correct glyph
auto gi = c - start;
if(gi < 0 || gi >= length)
gi = length;
glm::vec4 destRect(tp, glyphs[gi].size * _scaling);
//Add the character to the font batcher
_batcher->add(destRect, glyphs[gi].uvRect, _depth, _tint, _index);
tp.x += glyphs[gi].size.x * _scaling.x;
}
}
}
开发者ID:kurtd5105,项目名称:AmorphousClone,代码行数:31,代码来源:Text.cpp
示例5: uvRect
void BrickParticle::draw(Bengine::SpriteBatch & spriteBatch)
{
static int textureID = Bengine::ResourceManager::getTexture("Textures/brick.png").id;
const glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
glm::vec4 destRect(m_position.x, m_position.y, m_width, m_height);
spriteBatch.draw(destRect, uvRect, textureID, 0.0f, Bengine::ColorRGBA8(2, 29, 39, 255));
}
开发者ID:datosh,项目名称:Bengine,代码行数:7,代码来源:brick_particles.cpp
示例6: check
void FOculusRiftHMD::RenderTexture_RenderThread(class FRHICommandListImmediate& RHICmdList, class FRHITexture2D* BackBuffer, class FRHITexture2D* SrcTexture) const
{
check(IsInRenderingThread());
check(pCustomPresent);
auto RenderContext = pCustomPresent->GetRenderContext();
if (RenderContext && RenderContext->GetFrameSettings()->Flags.bMirrorToWindow)
{
if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_Distorted)
{
FTexture2DRHIRef MirrorTexture = pCustomPresent->GetMirrorTexture();
if (MirrorTexture)
{
CopyTexture_RenderThread(RHICmdList, BackBuffer, MirrorTexture);
}
}
else if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_Undistorted)
{
auto FrameSettings = RenderContext->GetFrameSettings();
FIntRect destRect(0, 0, BackBuffer->GetSizeX() / 2, BackBuffer->GetSizeY());
for (int i = 0; i < 2; ++i)
{
CopyTexture_RenderThread(RHICmdList, BackBuffer, SrcTexture, destRect, FrameSettings->EyeRenderViewport[i]);
destRect.Min.X += BackBuffer->GetSizeX() / 2;
destRect.Max.X += BackBuffer->GetSizeX() / 2;
}
}
else if (RenderContext->GetFrameSettings()->MirrorWindowMode == FSettings::eMirrorWindow_SingleEye)
{
auto FrameSettings = RenderContext->GetFrameSettings();
CopyTexture_RenderThread(RHICmdList, BackBuffer, SrcTexture, FIntRect(), FrameSettings->EyeRenderViewport[0]);
}
}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:34,代码来源:OculusRiftRender.cpp
示例7: srcRect
bool
TOSMagnify::CreateImage(BPoint mouseLoc, bool force)
{
bool created = false;
if (Window() && Window()->Lock()) {
int32 width, height;
fParent->PixelCount(&width, &height);
int32 pixelSize = fParent->PixelSize();
BRect srcRect(0, 0, width - 1, height - 1);
srcRect.OffsetBy(mouseLoc.x - (width / 2),
mouseLoc.y - (height / 2));
if (force || CopyScreenRect(srcRect)) {
srcRect.OffsetTo(BPoint(0, 0));
BRect destRect(Bounds());
DrawBitmap(fBitmap, srcRect, destRect);
DrawGrid(width, height, destRect, pixelSize);
DrawSelection();
Sync();
created = true;
}
Window()->Unlock();
} else
printf("window problem\n");
return created;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:31,代码来源:Magnify.cpp
示例8: srcRect
void Scalpel3DOScreen::rawBlitFrom(const Graphics::Surface &src, const Common::Point &pt) {
Common::Rect srcRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
addDirtyRect(destRect);
copyRectToSurface(src, destRect.left, destRect.top, srcRect);
}
开发者ID:86400,项目名称:scummvm,代码行数:7,代码来源:scalpel_3do_screen.cpp
示例9: measure
void SpriteFont::draw(SpriteBatch& batch, const char* s, glm::vec2 position, glm::vec2 scaling,
float depth, ColorRGBA8 tint, Justification just /* = Justification::LEFT */) {
glm::vec2 tp = position;
// Apply justification
if (just == Justification::MIDDLE) {
tp.x -= measure(s).x * scaling.x / 2;
} else if (just == Justification::RIGHT) {
tp.x -= measure(s).x * scaling.x;
}
for (int si = 0; s[si] != 0; si++) {
char c = s[si];
if (s[si] == '\n') {
tp.y += _fontHeight * scaling.y;
tp.x = position.x;
} else {
// Check for correct glyph
int gi = c - _regStart;
if (gi < 0 || gi >= _regLength)
gi = _regLength;
glm::vec4 destRect(tp, _glyphs[gi].size * scaling);
batch.draw(destRect, _glyphs[gi].uvRect, _texID, depth, tint);
tp.x += _glyphs[gi].size.x * scaling.x;
}
}
}
开发者ID:stevencox92,项目名称:GraphicsTutorials,代码行数:25,代码来源:SpriteFont.cpp
示例10: createSurfaceFromData
void ShareableBitmap::paint(GraphicsContext& context, float scaleFactor, const IntPoint& dstPoint, const IntRect& srcRect)
{
RefPtr<cairo_surface_t> surface = createSurfaceFromData(data(), m_size);
FloatRect destRect(dstPoint, srcRect.size());
FloatRect srcRectScaled(srcRect);
srcRectScaled.scale(scaleFactor);
context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRectScaled, context);
}
开发者ID:rhythmkay,项目名称:webkit,代码行数:8,代码来源:ShareableBitmapCairo.cpp
示例11: destRect
void Agent::draw(GameEngine::SpriteBatch& spriteBatch){
glm::vec4 destRect(m_position.x, m_position.y, AGENT_WIDTH, AGENT_WIDTH);
const glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
spriteBatch.draw(destRect, uvRect, m_textureID, 0.0f, m_color, m_direction);
}
开发者ID:Ayrie,项目名称:SpacePanic,代码行数:8,代码来源:Agent.cpp
示例12: srcRect
void BaseSurface::SHtransBlitFrom(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor, int scaleVal) {
Common::Rect srcRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w * SCALE_THRESHOLD / scaleVal,
pt.y + src.h * SCALE_THRESHOLD / scaleVal);
Graphics::Screen::transBlitFrom(src, srcRect, destRect, TRANSPARENCY,
flipped, overrideColor);
}
开发者ID:86400,项目名称:scummvm,代码行数:9,代码来源:surface.cpp
示例13: tileAt
void TiledLayerChromium::updateCompositorResources(GraphicsContext3D* context)
{
// Painting could cause compositing to get turned off, which may cause the tiler to become invalidated mid-update.
if (m_skipsDraw || m_updateRect.isEmpty() || !m_tiler->numTiles())
return;
int left, top, right, bottom;
m_tiler->contentRectToTileIndices(m_updateRect, left, top, right, bottom);
for (int j = top; j <= bottom; ++j) {
for (int i = left; i <= right; ++i) {
UpdatableTile* tile = tileAt(i, j);
if (!tile)
tile = createTile(i, j);
else if (!tile->dirty())
continue;
// Calculate page-space rectangle to copy from.
IntRect sourceRect = m_tiler->tileContentRect(tile);
const IntPoint anchor = sourceRect.location();
sourceRect.intersect(m_tiler->layerRectToContentRect(tile->m_dirtyLayerRect));
// Paint rect not guaranteed to line up on tile boundaries, so
// make sure that sourceRect doesn't extend outside of it.
sourceRect.intersect(m_paintRect);
if (sourceRect.isEmpty())
continue;
ASSERT(tile->texture()->isReserved());
// Calculate tile-space rectangle to upload into.
IntRect destRect(IntPoint(sourceRect.x() - anchor.x(), sourceRect.y() - anchor.y()), sourceRect.size());
if (destRect.x() < 0)
CRASH();
if (destRect.y() < 0)
CRASH();
// Offset from paint rectangle to this tile's dirty rectangle.
IntPoint paintOffset(sourceRect.x() - m_paintRect.x(), sourceRect.y() - m_paintRect.y());
if (paintOffset.x() < 0)
CRASH();
if (paintOffset.y() < 0)
CRASH();
if (paintOffset.x() + destRect.width() > m_paintRect.width())
CRASH();
if (paintOffset.y() + destRect.height() > m_paintRect.height())
CRASH();
tile->texture()->bindTexture(context);
const GC3Dint filter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST;
GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, filter));
GLC(context, context->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, filter));
GLC(context, context->bindTexture(GraphicsContext3D::TEXTURE_2D, 0));
textureUpdater()->updateTextureRect(context, tile->texture(), sourceRect, destRect);
tile->clearDirty();
}
}
}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:57,代码来源:TiledLayerChromium.cpp
示例14: adoptRef
void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
{
RefPtr<cairo_surface_t> surface = adoptRef(cairo_image_surface_create_for_data(static_cast<unsigned char*>(data()),
CAIRO_FORMAT_ARGB32,
m_size.width(), m_size.height(),
m_size.width() * 4));
FloatRect destRect(dstPoint, srcRect.size());
context.platformContext()->drawSurfaceToContext(surface.get(), destRect, srcRect, &context);
}
开发者ID:CannedFish,项目名称:deepin-webkit,代码行数:9,代码来源:ShareableBitmapCairo.cpp
示例15: drawRect
void Surface::transBlitFromUnscaled(const Graphics::Surface &src, const Common::Point &pt,
bool flipped, int overrideColor) {
Common::Rect drawRect(0, 0, src.w, src.h);
Common::Rect destRect(pt.x, pt.y, pt.x + src.w, pt.y + src.h);
// Clip the display area to on-screen
if (!clip(drawRect, destRect))
// It's completely off-screen
return;
if (flipped)
drawRect = Common::Rect(src.w - drawRect.right, src.h - drawRect.bottom,
src.w - drawRect.left, src.h - drawRect.top);
Common::Point destPt(destRect.left, destRect.top);
addDirtyRect(Common::Rect(destPt.x, destPt.y, destPt.x + drawRect.width(),
destPt.y + drawRect.height()));
switch (src.format.bytesPerPixel) {
case 1:
// 8-bit palettized: Draw loop
assert(_surface.format.bytesPerPixel == 1); // Security check
for (int yp = 0; yp < drawRect.height(); ++yp) {
const byte *srcP = (const byte *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
byte *destP = (byte *)getBasePtr(destPt.x, destPt.y + yp);
for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
if (*srcP != TRANSPARENCY)
*destP = overrideColor ? overrideColor : *srcP;
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
break;
case 2:
// 3DO 15-bit RGB565: Draw loop
assert(_surface.format.bytesPerPixel == 2); // Security check
for (int yp = 0; yp < drawRect.height(); ++yp) {
const uint16 *srcP = (const uint16 *)src.getBasePtr(
flipped ? drawRect.right - 1 : drawRect.left, drawRect.top + yp);
uint16 *destP = (uint16 *)getBasePtr(destPt.x, destPt.y + yp);
for (int xp = 0; xp < drawRect.width(); ++xp, ++destP) {
if (*srcP) // RGB 0, 0, 0 -> transparent on 3DO
*destP = *srcP; // overrideColor ? overrideColor : *srcP;
srcP = flipped ? srcP - 1 : srcP + 1;
}
}
break;
default:
error("Surface: unsupported bytesperpixel");
break;
}
}
开发者ID:winterheart,项目名称:scummvm,代码行数:56,代码来源:surface.cpp
示例16: ShowNextImage
void
SlideShowSaver::Draw(BView *view, int32 frame)
{
fLock.Lock();
view->SetLowColor(0, 0, 0);
view->SetHighColor(192, 192, 192);
view->SetViewColor(192, 192, 192);
bool bResult = false;
if (fNewDirectory == true) {
// Already have a bitmap on the first frame
bResult = true;
} else {
bResult = ShowNextImage(true, false);
// try rewinding to beginning
if (bResult == false)
bResult = ShowNextImage(true, true);
}
fNewDirectory = false;
if (bResult == true && fBitmap != NULL) {
BRect destRect(0, 0, fBitmap->Bounds().Width(), fBitmap->Bounds().Height()),
vwBounds = view->Bounds();
if (destRect.Width() < vwBounds.Width()) {
destRect.OffsetBy((vwBounds.Width() - destRect.Width()) / 2, 0);
}
if (destRect.Height() < vwBounds.Height()) {
destRect.OffsetBy(0, (vwBounds.Height() - destRect.Height()) / 2);
}
BRect border = destRect, bounds = view->Bounds();
// top
view->FillRect(BRect(0, 0, bounds.right, border.top-1), B_SOLID_LOW);
// left
view->FillRect(BRect(0, border.top, border.left-1, border.bottom), B_SOLID_LOW);
// right
view->FillRect(BRect(border.right+1, border.top, bounds.right, border.bottom), B_SOLID_LOW);
// bottom
view->FillRect(BRect(0, border.bottom+1, bounds.right, bounds.bottom), B_SOLID_LOW);
if (fShowBorder == true) {
BRect strokeRect = destRect;
strokeRect.InsetBy(-1, -1);
view->StrokeRect(strokeRect);
}
view->DrawBitmap(fBitmap, fBitmap->Bounds(), destRect);
if (fShowCaption == true)
DrawCaption(view);
}
fLock.Unlock();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:56,代码来源:SlideShowSaver.cpp
示例17: p
void MusicWidget::paintEvent(QPaintEvent *e)
{
QPainter p(this);
QRect srcRect = m_bkgndLogo.rect();
QRect destRect(srcRect);
int xpos = width() - m_bkgndLogo.width() - 30;
int ypos = m_currentSongLabel->y() - m_bkgndLogo.height() - 10;
destRect.moveTopLeft(QPoint(xpos, ypos));
p.drawPixmap(destRect, m_bkgndLogo);
}
开发者ID:Pengfei-Gao,项目名称:develop-reference-data,代码行数:10,代码来源:musicWidget.cpp
示例18: destRect
void Bullet::Draw(Engine2D::SpriteBatch & spriteBatch) {
glm::vec4 destRect(_position.x + BULLET_RADIUS, _position.y + BULLET_RADIUS, BULLET_RADIUS * 2, BULLET_RADIUS * 2);
glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
Engine2D::ColorRGBA8 c;
c.r = 64;
c.b = 64;
c.g = 64;
c.a = 255;
spriteBatch.Draw(destRect, uvRect, Engine2D::ResourceManager::getTexture("Images/Player16x16.png").id, 0.0f, c);
}
开发者ID:SimpleManGames,项目名称:ZombieGame,代码行数:10,代码来源:Bullet.cpp
示例19: uvRect
void ParticleBatch2D::draw(SpriteBatch* spriteBatch) {
glm::vec4 uvRect(0.0f, 0.0f, 1.0f, 1.0f);
for (int i = 0; i < m_maxParticles; i++) {
auto& p = m_particles[i];
if (m_particles[i].lifeTime > 0.0f) {
glm::vec4 destRect(p.position.x, p.position.y, p.width, p.width);
spriteBatch->draw(destRect, uvRect, m_texture.id, 0.0f, p.color);
}
}
}
开发者ID:Kirbk,项目名称:STMC,代码行数:10,代码来源:ParticleBatch2D.cpp
示例20: destRect
void Surface::blitFrom(const Graphics::Surface &src, const Common::Point &pt, const Common::Rect &srcBounds) {
Common::Rect srcRect = srcBounds;
Common::Rect destRect(pt.x, pt.y, pt.x + srcRect.width(), pt.y + srcRect.height());
if (srcRect.isValidRect() && clip(srcRect, destRect)) {
// Surface is at least partially or completely on-screen
addDirtyRect(destRect);
_surface.copyRectToSurface(src, destRect.left, destRect.top, srcRect);
}
}
开发者ID:winterheart,项目名称:scummvm,代码行数:10,代码来源:surface.cpp
注:本文中的destRect函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论