本文整理汇总了C++中Stretch函数的典型用法代码示例。如果您正苦于以下问题:C++ Stretch函数的具体用法?C++ Stretch怎么用?C++ Stretch使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Stretch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
void
Canvas::StretchMono(int dest_x, int dest_y,
unsigned dest_width, unsigned dest_height,
const Bitmap &src,
int src_x, int src_y,
unsigned src_width, unsigned src_height,
Color fg_color, Color bg_color)
{
assert(IsDefined());
assert(src.IsDefined());
#ifndef _WIN32_WCE
if (bg_color == COLOR_BLACK && (src_width != dest_width ||
src_height != dest_height)) {
/* workaround for a WINE bug: stretching a mono bitmap ignores the
text color; this kludge makes the text color white */
SetTextColor(COLOR_BLACK);
SetBackgroundColor(COLOR_WHITE);
Stretch(dest_x, dest_y, dest_width, dest_height,
src, src_x, src_y, src_width, src_height,
MERGEPAINT);
return;
}
#endif
/* on GDI, monochrome bitmaps are special: they are painted with the
destination HDC's current colors */
SetTextColor(fg_color);
SetBackgroundTransparent();
Stretch(dest_x, dest_y, dest_width, dest_height,
src, src_x, src_y, src_width, src_height);
}
示例2: sourceAspectRatio
// -----------------------------------------------------------------------------
// Calculates the decode size and prepares members for scaling.
// -----------------------------------------------------------------------------
//
TSize CMPXImageUtil::CalculateDecodeSize(const TSize& aSize)
{
const TFrameInfo& frameInfo = iImageDecoder->FrameInfo();
TSize bitmapSize = frameInfo.iOverallSizeInPixels;
TReal sourceAspectRatio( TReal( bitmapSize.iWidth) / bitmapSize.iHeight );
TReal destinationAspectRatio( TReal( aSize.iWidth ) / aSize.iHeight );
TReal xScale = TReal( bitmapSize.iWidth ) / aSize.iWidth;
TReal yScale = TReal( bitmapSize.iHeight ) / aSize.iHeight;
TReal scale(0.0f);
if ( sourceAspectRatio > destinationAspectRatio )
{
scale = xScale;
iSize.iWidth = aSize.iWidth;
iSize.iHeight = Stretch( TReal( bitmapSize.iHeight ) / scale ,
aSize.iHeight );
}
else
{
scale = yScale;
iSize.iWidth = Stretch( TReal( bitmapSize.iWidth ) / scale ,
aSize.iWidth);
iSize.iHeight = aSize.iHeight;
}
if ((frameInfo.iFlags & TFrameInfo::EFullyScaleable))
{
iScaleRquired = EFalse;
bitmapSize = iSize;
}
else
//Decoder only supports 2, 4 and 8 scallyng, the image will need
//to be reescaled after decoding.
//Decoding to a scale that is just a bit bigger thant the target,
//this will save memory and resources and we will get a sharp image
//after scaling.
{
TInt intscale = ( scale >= 8 ) ? 8 :
( scale >= 4 ) ? 4 :
( scale >= 2 ) ? 2 : 1;
TUint xCorrection = ( bitmapSize.iWidth % intscale ) ? 1 : 0;
TUint yCorrection = ( bitmapSize.iHeight % intscale ) ? 1 : 0;
bitmapSize.iWidth /= intscale;
bitmapSize.iHeight /= intscale;
bitmapSize += TSize( xCorrection, yCorrection );
iScaleRquired = ETrue;
}
return bitmapSize;
}
示例3: getHeight
void Bitmap::drawShadow(Bitmap & where, int x, int y, int intensity, Color color, double scale, bool facingRight) const {
const double newheight = getHeight() * scale;
Bitmap shade(getWidth(), (int) fabs(newheight));
Stretch(shade);
/* Could be slow, but meh, lets do it for now to make it look like a real shadow */
for (int h = 0; h < shade.getHeight(); ++h){
for (int w = 0; w < shade.getWidth(); ++w){
Color pix = shade.getPixel(w, h);
if (pix != MaskColor()){
shade.putPixel(w, h, color);
}
}
}
transBlender(0, 0, 0, intensity);
if (scale > 0){
if (facingRight){
shade.translucent().drawVFlip(x, y, where);
} else {
shade.translucent().drawHVFlip(x, y, where);
}
} else if (scale < 0){
y -= fabs(newheight);
if (facingRight){
shade.translucent().draw(x + 3, y, where);
} else {
shade.translucent().drawHFlip(x - 3, y, where);
}
}
}
示例4: switch
void StretchedBitmap::finish(){
if (getData() != where.getData()){
switch (filter){
case NoFilter: Stretch(where); break;
case HqxFilter: {
if (scaleToFilter.getWidth() > 1 &&
scaleToFilter.getHeight() > 1){
StretchHqx(scaleToFilter);
scaleToFilter.Stretch(where);
} else {
StretchHqx(where);
}
break;
}
case XbrFilter: {
if (scaleToFilter.getWidth() > 1 &&
scaleToFilter.getHeight() > 1){
StretchXbr(scaleToFilter);
scaleToFilter.Stretch(where);
} else {
StretchXbr(where);
}
break;
}
}
}
}
示例5: Allocate
void BaseMesh::CreateBox(float w, float h, float d, int refinement)
{
Allocate(8, 12);
MeshVertex Temp(Vec3f::Origin, Vec3f::Origin, RGBColor::White, Vec2f::Origin);
int i,vc=VertexCount(),ic=IndexCount();
MeshVertex *V = Vertices();
DWORD *I = Indices();
for(i=0;i<8;i++)
{
Temp.Pos = Vec3f(CubeVData[i][0],CubeVData[i][1],CubeVData[i][2]);
V[i] = Temp; ///load the vertices
}
for(i=0;i<12;i++)
{
I[i*3+0] = CubeIData[i][0];
I[i*3+1] = CubeIData[i][1];
I[i*3+2] = CubeIData[i][2]; //load the triangles
}
for(i=0;i<refinement;i++)
{
TwoPatch(); //refine the requested number of times
}
Stretch(Vec3f(0.5f*w, 0.5f*h, 0.5f*d)); //stretch to the requested dimensions
GenerateNormals();
}
示例6: Stretch
void TrueLong::ShiftUp( ulong cnt )
{
if( IsZero() ) return;
ulong word_cnt = cnt >> 4;
Stretch( meenl + word_cnt + 1 );
memset( value + meenl, 0, (word_cnt + 1)*2 );
if( word_cnt )
{
memmove( value + word_cnt, value, meenl*2 );
memset( value, 0, word_cnt*2 );
}
meenl += word_cnt;
uchar bits = uchar(cnt) & 0x0F; // Вот на такое кол-во бит и осталось сдвинуть массив
if( !bits ) return;
ushort *beg = value + word_cnt, *cur = value + meenl - 1;
ushort add = 0;
for( ulong* curl; cur >= beg; cur-- )
{
curl = (ulong*)cur;
(*curl) <<= bits;
cur[1] |= add;
add = *cur;
*cur = 0;
}
cur[1] |= add;
if( value[meenl] )
meenl++;
}
示例7: assert
void
Canvas::StretchNot(const Bitmap &src)
{
assert(src.IsDefined());
GLLogicOp invert(GL_COPY_INVERTED);
Stretch(src);
}
示例8: Stretch
void
Canvas::Stretch(int dest_x, int dest_y,
unsigned dest_width, unsigned dest_height,
const GLTexture &texture)
{
Stretch(dest_x, dest_y, dest_width, dest_height,
texture, 0, 0, texture.GetWidth(), texture.GetHeight());
}
示例9: Stretch
void
Canvas::Stretch(PixelScalar dest_x, PixelScalar dest_y,
UPixelScalar dest_width, UPixelScalar dest_height,
const GLTexture &texture)
{
Stretch(dest_x, dest_y, dest_width, dest_height,
texture, 0, 0, texture.GetWidth(), texture.GetHeight());
}
示例10: Stretch
void Stretch(int dest_x, int dest_y,
unsigned dest_width, unsigned dest_height,
const Canvas &src,
int src_x, int src_y,
unsigned src_width, unsigned src_height) {
Stretch(dest_x, dest_y, dest_width, dest_height,
src.buffer, src_x, src_y, src_width, src_height);
}
示例11: assert
void
Canvas::stretch_transparent(const Bitmap &src, Color key)
{
assert(src.IsDefined());
// XXX
Stretch(src);
}
示例12: Stretch
void
Canvas::Stretch(const Canvas &src,
int src_x, int src_y,
unsigned src_width, unsigned src_height)
{
Stretch(0, 0, GetWidth(), GetHeight(),
src, src_x, src_y, src_width, src_height);
}
示例13: StretchNotOr
void StretchNotOr(PixelScalar dest_x, PixelScalar dest_y,
UPixelScalar dest_width, UPixelScalar dest_height,
const Bitmap &src,
PixelScalar src_x, PixelScalar src_y,
UPixelScalar src_width, UPixelScalar src_height) {
Stretch(dest_x, dest_y, dest_width, dest_height,
src, src_x, src_y, src_width, src_height,
MERGEPAINT);
}
示例14: StretchAnd
void StretchAnd(PixelScalar dest_x, PixelScalar dest_y,
UPixelScalar dest_width, UPixelScalar dest_height,
const Bitmap &src,
PixelScalar src_x, PixelScalar src_y,
UPixelScalar src_width, UPixelScalar src_height) {
Stretch(dest_x, dest_y, dest_width, dest_height,
src, src_x, src_y, src_width, src_height,
SRCAND);
}
示例15: ASSERT
BOOL CCJDockContext::TrackDockBar()
{
if (::GetCapture() != NULL)
return FALSE;
m_pBar->SetCapture();
ASSERT(m_pBar == CWnd::GetCapture());
while (CWnd::GetCapture() == m_pBar)
{
MSG msg;
if (!::GetMessage(&msg, NULL, 0, 0))
{
AfxPostQuitMessage(msg.wParam);
break;
}
switch (msg.message)
{
case WM_LBUTTONUP:
if (m_bDragging)
EndDragDockBar();
else
EndResize();
return TRUE;
case WM_MOUSEMOVE:
if (m_bDragging)
MoveDockBar(msg.pt);
else
Stretch(msg.pt);
break;
case WM_KEYUP:
if (m_bDragging)
OnKey((int)msg.wParam, FALSE);
break;
case WM_KEYDOWN:
if (m_bDragging)
OnKey((int)msg.wParam, TRUE);
if (msg.wParam == VK_ESCAPE)
{
CancelLoop();
return FALSE;
}
break;
case WM_RBUTTONDOWN:
CancelLoop();
return FALSE;
// just dispatch rest of the messages
default:
DispatchMessage(&msg);
break;
}
}
CancelLoop();
return FALSE;
}