当前位置: 首页>>代码示例>>C++>>正文


C++ Stretch函数代码示例

本文整理汇总了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);
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:33,代码来源:Canvas.cpp

示例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;
    }
开发者ID:KingSD502,项目名称:dUnlock-2.1.6,代码行数:53,代码来源:mpximageutil.cpp

示例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);
        }
    }
}
开发者ID:marstau,项目名称:shinsango,代码行数:32,代码来源:bitmap.cpp

示例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;
            }
        }
    }
}
开发者ID:marstau,项目名称:shinsango,代码行数:27,代码来源:bitmap.cpp

示例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();
}
开发者ID:ghsoftco,项目名称:basecode14,代码行数:30,代码来源:BaseMeshShapes.cpp

示例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++;
}
开发者ID:lxmzhv,项目名称:starfight,代码行数:31,代码来源:TrueLong.cpp

示例7: assert

void
Canvas::StretchNot(const Bitmap &src)
{
  assert(src.IsDefined());

  GLLogicOp invert(GL_COPY_INVERTED);
  Stretch(src);
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:8,代码来源:Canvas.cpp

示例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());
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:8,代码来源:Canvas.cpp

示例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());
}
开发者ID:damianob,项目名称:xcsoar,代码行数:8,代码来源:Canvas.cpp

示例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);
 }
开发者ID:LK8000,项目名称:LK8000,代码行数:8,代码来源:Canvas.hpp

示例11: assert

void
Canvas::stretch_transparent(const Bitmap &src, Color key)
{
  assert(src.IsDefined());

  // XXX
  Stretch(src);
}
开发者ID:damianob,项目名称:xcsoar,代码行数:8,代码来源:Canvas.cpp

示例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);
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:8,代码来源:Canvas.cpp

示例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);
 }
开发者ID:StefanL74,项目名称:XCSoar,代码行数:9,代码来源:Canvas.hpp

示例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);
 }
开发者ID:StefanL74,项目名称:XCSoar,代码行数:9,代码来源:Canvas.hpp

示例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;
}
开发者ID:CCChaos,项目名称:RyzomCore,代码行数:57,代码来源:CJDockContext.cpp


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