This topic provides examples of using CGraphicsContext::DrawBitmap() to draw a bitmap that is stretched or compressed.
The bitmap blitting functions of the bitmapped graphics context ( CBitmapContext ) cannot be used to perform scaling of the bitmap. They always draws the bitmap using its dimensions in pixels. The overloaded GDI CGraphicsContext::DrawBitmap() function, however, can be used to draw a bitmap that is:
stretched or compressed to a set size in twips
stretched and/or compressed to fit a given rectangle.
Note : DrawBitmap() is slower than BitBlt() . You should therefore use BitBlt() in preference wherever possible.
These examples assume that bitmap is a pointer to a valid CFbsBitmap object.
A bitmap can have a real world size in twips set for it, and be drawn scaled to that size.
Construct a TSize with the required dimensions in twips.
Set the size of the bitmap using CFbsBitmap::SetSizeInTwips() . The default size in twips of a bitmap when loaded is (0,0) .
Draw the bitmap using DrawBitmap()
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License v1.0.