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


C++ ImageAttributes类代码示例

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


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

示例1: LoadImage

bool ImagesEngine::RenderPage(HDC hDC, RectI screenRect, int pageNo, float zoom, int rotation, RectD *pageRect, RenderTarget target, AbortCookie **cookie_out)
{
    Bitmap *bmp = LoadImage(pageNo);
    if (!bmp)
        return false;

    RectD pageRc = pageRect ? *pageRect : PageMediabox(pageNo);
    RectI screen = Transform(pageRc, pageNo, zoom, rotation).Round();

    Graphics g(hDC);
    g.SetCompositingQuality(CompositingQualityHighQuality);
    g.SetSmoothingMode(SmoothingModeAntiAlias);
    g.SetPageUnit(UnitPixel);

    Color white(0xFF, 0xFF, 0xFF);
    Rect screenR(screenRect.x, screenRect.y, screenRect.dx, screenRect.dy);
    g.SetClip(screenR);
    g.FillRectangle(&SolidBrush(white), screenR);

    Matrix m;
    GetTransform(m, pageNo, zoom, rotation);
    m.Translate((REAL)(screenRect.x - screen.x), (REAL)(screenRect.y - screen.y), MatrixOrderAppend);
    g.SetTransform(&m);

    RectI pageRcI = PageMediabox(pageNo).Round();
    ImageAttributes imgAttrs;
    imgAttrs.SetWrapMode(WrapModeTileFlipXY);
    Status ok = g.DrawImage(bmp, Rect(0, 0, pageRcI.dx, pageRcI.dy), 0, 0, pageRcI.dx, pageRcI.dy, UnitPixel, &imgAttrs);
    return ok == Ok;
}
开发者ID:Livit,项目名称:moonpdf,代码行数:30,代码来源:ImagesEngine.cpp

示例2: if

void CSkinButton2::DrawImage(Gdiplus::Graphics& gdi,BTN_DRAW_HUE hue)
{
	if(hue == DRAW_NORMAL)
	{
		if( m_pPngImage && m_pPngImage->m_pBitmap )
		{
			RectF grect; grect.X=0, grect.Y=0; grect.Width = m_pPngImage->m_pBitmap->GetWidth(); grect.Height = m_pPngImage->m_pBitmap->GetHeight();
			gdi.DrawImage(*m_pPngImage,grect );
		}
	}
	else if(hue == DRAW_LIGHT)
	{
		if( m_pPngImage && m_pPngImage->m_pBitmap )
		{
			ImageAttributes ia;
			ia.SetColorMatrix(&m_LightMat);
			RectF grect; grect.X=0, grect.Y=0; grect.Width = m_pPngImage->m_pBitmap->GetWidth(); grect.Height = m_pPngImage->m_pBitmap->GetHeight();
			gdi.DrawImage(*m_pPngImage, grect, 0, 0, grect.Width, grect.Height, UnitPixel, &ia);
		}
	}
	else if(hue == DRAW_GRAY )
	{
		if( m_pPngImage && m_pPngImage->m_pBitmap )
		{
			ImageAttributes ia;
			ia.SetColorMatrix(&m_GrayMat);
			RectF grect; grect.X=0, grect.Y=0; grect.Width = m_pPngImage->m_pBitmap->GetWidth(); grect.Height = m_pPngImage->m_pBitmap->GetHeight();
			gdi.DrawImage(*m_pPngImage, grect, 0, 0, grect.Width, grect.Height, UnitPixel, &ia);
		}
	}
}
开发者ID:2Dou,项目名称:PlayBox,代码行数:31,代码来源:SkinButton2.cpp

示例3: UtcDaliImageFactoryCompatibleResource03

// Different requests, compatible resource
int UtcDaliImageFactoryCompatibleResource03(void)
{
  TestApplication application;
  tet_infoline( "UtcDaliImageFactoryCompatibleResource03 - Two requests mapping to same resource" );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize(80.0f, 80.0f);
  application.GetPlatform().SetClosestImageSize(testSize);

  // this time use defined attributes, nut just NULL
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( 120, 120 );

  // request with default attributes ( size is 0,0 )
  RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, &attr );
  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // emulate load success
  EmulateImageLoaded( application, 80, 80 );

  ImageAttributes attr2 = ImageAttributes::New();
  attr2.SetSize( 80, 80 );
  RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr2 );
  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );

  DALI_TEST_CHECK( req != req2 ); // different requests
  DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:36,代码来源:utc-Dali-Internal-ImageFactory.cpp

示例4: UtcDaliImageFactoryInCompatibleResource

// Different requests, incompatible resource, so two loads result:
int UtcDaliImageFactoryInCompatibleResource(void)
{
  TestApplication application;
  tet_infoline( "UtcDaliImageFactoryCompatibleResource02 - Two requests mapping to same resource." );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize(2048.0f, 2048.0f);
  application.GetPlatform().SetClosestImageSize(testSize);

  // request with default attributes ( size is 0,0 )
  RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // emulate load success
  EmulateImageLoaded( application, testSize.x, testSize.y );

  // Request substantially different size than actual image.
  // This will issue a second resource load as difference in sizes is greater than
  // the small fudge factor used in the ImageFactory cache.
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( testSize.x - 16, testSize.y - 16 );
  RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );

  DALI_TEST_CHECK( req != req2 ); // different requests
  DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // differnet resources
  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:35,代码来源:utc-Dali-Internal-ImageFactory.cpp

示例5: UtcDaliImageFactoryCompatibleResource02

// Different requests, compatible resource
int UtcDaliImageFactoryCompatibleResource02(void)
{
  TestApplication application;
  tet_infoline( "UtcDaliImageFactoryCompatibleResource02 - Two requests mapping to same resource." );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize( 2048.0f, 2048.0f );
  application.GetPlatform().SetClosestImageSize( testSize );

  // request with default attributes ( size is 0,0 )
  RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // emulate load success
  EmulateImageLoaded( application, testSize.x, testSize.y );

  // Request slightly bigger size than actual image.
  // This will load the same resource as the ImageFactory cache uses a small fudge factor in matching.
  // See UtcDaliImageFactoryReload06
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( testSize.x + 1, testSize.y + 1 );
  RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );

  DALI_TEST_CHECK( req != req2 ); // different requests
  DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource
  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:35,代码来源:utc-Dali-Internal-ImageFactory.cpp

示例6: draw

VOID Balls::draw(Graphics *graphics, Image *images[]) const
{ 
	ImageAttributes imAttr;
	imAttr.SetColorKey(COLOR_KEY, COLOR_KEY);
	for(size_t i = 0; i < NUMBER_OF_BALLS; i++)
		graphics->DrawImage(images[i], Rect(static_cast<INT>(points_[i].getX()) - RShari, static_cast<INT>(points_[i].getY()) - RShari, 2 * RShari, 2 * RShari), 0, 0, 2 * RShari, 2 * RShari, Unit::UnitPixel, &imAttr, 0); 
}
开发者ID:MyLibh,项目名称:Billiards,代码行数:7,代码来源:Balls.cpp

示例7: get_meter

/*
 * Called by SysStats when the Overlay should render itself
 */
STDMETHODIMP CAnimatorOverlay::Render(LONG _hdc)
{
	// Get state of animation meter
	IMeter *iMeter = 0;
	framecount = 1;
	currentframe = 0;
	get_meter(&iMeter);
	if (iMeter)
	{
		iMeter->GetAsLong(L"framecount", &framecount);
		iMeter->GetAsLong(L"currentframe", &currentframe);
	}

	if (alphaEnd == alpha)
		CompositeOverlayImpl<IAnimatorOverlay>::Render(_hdc);
	else
	{
		// Create a private HDC to draw into so that we can mask it.
		long width = 128;
		long height = 128;
		model->get_Width(&width);
		model->get_Height(&height);
		HDCImage hdc((HDC)_hdc, width, height);

		// Render the composite
		CompositeOverlayImpl<IAnimatorOverlay>::Render(hdc);

		// Copy private HDC into the passed HDC
		Graphics g((HDC)_hdc);
		g.SetInterpolationMode(InterpolationModeHighQuality);
		g.SetSmoothingMode(SmoothingModeAntiAlias);
		float delta = framecount <= 1 ? 0.0 : ((float)currentframe)/(framecount-1.0);
		ColorMatrix colorMatrix = {
						1.0f, 0.0f, 0.0f, 0.0f, 0.0f,
						0.0f, 1.0f, 0.0f, 0.0f, 0.0f,
						0.0f, 0.0f, 1.0f, 0.0f, 0.0f,
						0.0f, 0.0f, 0.0f, ((float)alpha+(alphaEnd-alpha)*delta)/255.0f, 0.0f,
						0.0f, 0.0f, 0.0f, 0.0f, 1.0f};

 		// Create an ImageAttributes object and set its color matrix.
		ImageAttributes imageAtt;
		imageAtt.SetColorMatrix(&colorMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);

		g.DrawImage(
		   &hdc.GetImage(),
		   Rect(0, 0, width, height),	// Destination rectangle
		   0,						// Source rectangle X
		   0,						// Source rectangle Y
		   width,		// Source rectangle width
		   height,		// Source rectangle height
		   UnitPixel,
		   &imageAtt);
	}

	return S_OK;
}
开发者ID:Templier,项目名称:desktopx,代码行数:59,代码来源:AnimatorOverlay.cpp

示例8: ASSERT

BOOL CGif::DrawImage(CDC * pDC, POINT * pPoint, int srcx, int srcy, int srcwidth, int srcheight, float * pfClrAttr)
{
	ASSERT(NULL != m_pImage);
	if (NULL == m_pImage) return 1;

	if (IsNull()) return 2;

	Graphics graph(pDC->GetSafeHdc());

	Gdiplus::Point points[3];

	memset(points, 0, sizeof (points));
	if (NULL == pPoint)
	{
		points[1].X = m_nWidth;
		points[2].Y = m_nHeight;
	}
	else
	{
		for (BYTE i = 0;i < 3;i++)
		{
			points[i].X = pPoint[i].x;
			points[i].Y = pPoint[i].y;
		}
	}
	if ((0 == srcwidth)||(0 == srcheight))
	{
		srcwidth = m_nWidth;
		srcheight = m_nHeight;
	}
	if (NULL == pfClrAttr)
	{
		graph.DrawImage(m_pImage, points, 3, srcx, srcy, srcwidth, srcheight, UnitPixel);
	}
	else
	{
#ifdef _DEBUG
		for (BYTE i = 0;i < 25;i++)
		{
			ASSERT(0 <= pfClrAttr[i]);
		}
#endif
		ColorMatrix colorMatrix;
		memcpy(&colorMatrix, pfClrAttr, sizeof (colorMatrix));

		ImageAttributes imageAttr;
		imageAttr.SetColorMatrix(&colorMatrix);

		graph.DrawImage(m_pImage, points, 3, srcx, srcy, srcwidth, srcheight, UnitPixel, &imageAttr);
	}

	graph.ReleaseHDC(pDC->GetSafeHdc());

	return TRUE;
}
开发者ID:lincoln56,项目名称:robinerp,代码行数:55,代码来源:Gif.cpp

示例9: SetImageDistanceField

void ImageView::SetImageDistanceField(const std::string& filename)
{
  ImageAttributes attributes = Dali::ImageAttributes::NewDistanceField(1.0f, 1);
  const Vector3 size = Self().GetCurrentSize();

  attributes.SetSize( size.x, size.y );
  Image image = Image::NewDistanceField(filename, attributes);
  mImageActor.SetImage( image );

  DistanceFieldEffect effect = DistanceFieldEffect::New();
  Self().SetShaderEffect( effect );
}
开发者ID:Tarnyko,项目名称:dal-toolkit,代码行数:12,代码来源:image-view-impl.cpp

示例10: ASSERT

//╩Л╨о╩Ф╩╜
bool CPngImageEx::AlphaDrawImage(CDC * pDestDC, INT xDest, INT yDest, INT cxDest, INT cyDest, INT xSrc, INT ySrc, INT cxSrc, INT cySrc, BYTE cbAlphaDepth)
{
	//WIN 7 ж╢пп
	if ( CD2DEngine::GetD2DEngine() )
	{
		CD2DEngine::GetD2DEngine()->DrawImage(m_pWnd, m_strImageName, xDest, yDest, cxDest, cyDest, xSrc, ySrc, cxSrc, cySrc, cbAlphaDepth  );
		return true;
	}

	//╢╢╫╗╩╨ЁЕ
	if ((cxDest!=cxSrc)||(cyDest!=cySrc))
	{
		//╪стьеп╤о
		ASSERT(m_pImage!=NULL);
		if (m_pImage==NULL) return false;

		//╢╢╫╗фад╩
		ASSERT(pDestDC!=NULL);
		Graphics graphics(pDestDC->GetSafeHdc());

		//╧╧тЛн╩жц
		RectF rcDrawRect;
		rcDrawRect.X=(REAL)xDest;
		rcDrawRect.Y=(REAL)yDest;
		rcDrawRect.Width=(REAL)cxDest;
		rcDrawRect.Height=(REAL)cyDest;

		//м╦цВ╬ьуС
		ColorMatrix Matrix=
		{
			1.0f,0.0f,0.0f,0.0f,0.0f, 
				0.0f,1.0f,0.0f,0.0f,0.0f, 
				0.0f,0.0f,1.0f,0.0f,0.0f,
				0.0f,0.0f,0.0f,cbAlphaDepth/255.0f,0.0f, 
				0.0f,0.0f,0.0f,0.0f,1.0f
		};

		//иХжцйТпт
		ImageAttributes Attributes; 
		Attributes.SetColorMatrix(&Matrix,ColorMatrixFlagsDefault,ColorAdjustTypeBitmap); 

		//╩Ф╩╜м╪оЯ
		graphics.DrawImage(m_pImage,rcDrawRect,(REAL)xSrc,(REAL)ySrc,(REAL)cxSrc,(REAL)cySrc,UnitPixel,&Attributes);	
	}
	else
	{
		//фум╗╣Всц
		AlphaDrawImage(pDestDC,xDest,yDest,cxDest,cyDest,xSrc,ySrc,cbAlphaDepth);
	}

	return true;
}
开发者ID:cyrillic7,项目名称:CPFrom,代码行数:53,代码来源:PngImageEx.cpp

示例11: UtcDaliImageActorGetCurrentImageSize03

int UtcDaliImageActorGetCurrentImageSize03(void)
{
  TestApplication application;
  tet_infoline("Positive test for Dali::ImageActor::GetCurrentImageSize - Test that using an image resource with a requested size sets the actor size with it's nearest size immediately rather than on load");

  Vector2 closestImageSize( 80, 45);

  application.GetPlatform().SetClosestImageSize(closestImageSize);

  ImageAttributes attrs;
  attrs.SetSize(40, 30);
  Image image = Image::New("image.jpg", attrs);
  ImageActor actor = ImageActor::New( image );
  Stage::GetCurrent().Add(actor);

  application.SendNotification(); // Flush update messages
  application.Render();           // Process resource request
  application.SendNotification(); // Flush update messages
  application.Render();           // Process resource request

  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );

  // Now complete the image load
  Integration::ResourceRequest* req = application.GetPlatform().GetRequest();
  Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, false );
  bitmap->GetPackedPixelsProfile()->ReserveBuffer( Pixel::RGBA8888,  closestImageSize.width, closestImageSize.height, closestImageSize.width, closestImageSize.height );

  Integration::ResourcePointer resourcePtr(bitmap); // reference it
  application.GetPlatform().SetResourceLoaded(req->GetId(), req->GetType()->id, resourcePtr);
  application.Render();           // Process LoadComplete
  application.SendNotification(); // Process event messages
  application.GetPlatform().DiscardRequest(); // Ensure load request is discarded
  application.GetPlatform().ClearReadyResources(); //

  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );

  // Test that setting a size on the actor can be 'undone' with SetNaturalSize()
  Vector2 size(200.0f, 200.0f);
  actor.SetSize(size);

  // flush the queue and render once
  application.SendNotification();
  application.Render();
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), size, TEST_LOCATION );

  actor.SetToNaturalSize();
  application.SendNotification();
  application.Render();
  DALI_TEST_EQUALS( actor.GetCurrentImageSize(), closestImageSize, TEST_LOCATION );
  END_TEST;
}
开发者ID:Tarnyko,项目名称:dali-core,代码行数:51,代码来源:utc-Dali-ImageActor.cpp

示例12: TurnGreyscale

/*
** Turns the image greyscale by applying a greyscale color matrix.
** Note that the returned bitmap image must be freed by caller.
**
*/
Bitmap* TintedImage::TurnGreyscale(Bitmap* source)
{
	ImageAttributes ImgAttr;
	ImgAttr.SetColorMatrix(&c_GreyScaleMatrix, ColorMatrixFlagsDefault, ColorAdjustTypeBitmap);

	// We need a blank bitmap to paint our greyscale to in case of alpha
	Rect r(0, 0, source->GetWidth(), source->GetHeight());
	Bitmap* bitmap = new Bitmap(r.Width, r.Height, PixelFormat32bppPARGB);

	Graphics graphics(bitmap);
	graphics.DrawImage(source, r, 0, 0, r.Width, r.Height, UnitPixel, &ImgAttr);

	return bitmap;
}
开发者ID:AlonTzarafi,项目名称:rainmeter,代码行数:19,代码来源:TintedImage.cpp

示例13: UtcDaliImageFactoryReload06

// Initally two different requests map to same resource.
// After overwriting the file, they load different image resources.
int UtcDaliImageFactoryReload06(void)
{
  TestApplication application;
  tet_infoline( "UtcDaliImageFactoryReload06 - Two requests first mapping to same resource, then different resources." );

  ImageFactory& imageFactory  = Internal::ThreadLocalStorage::Get().GetImageFactory();

  Vector2 testSize(2048.0f, 2048.0f);
    application.GetPlatform().SetClosestImageSize( testSize );

  // request with default attributes ( size is 0,0 )
  RequestPtr req = imageFactory.RegisterRequest( gTestImageFilename, NULL );
  ResourceTicketPtr ticket = imageFactory.Load( *req.Get() );

  application.SendNotification();
  application.Render();
  application.SendNotification();
  application.Render();

  // emulate load success
  EmulateImageLoaded( application, testSize.x, testSize.y );

  // Request bigger size than actual image.
  // This will load the same resource.
  // However if image size changes later on to eg. 512*512 (file is overwritten),
  // reissuing these two requests will load different resources.
  ImageAttributes attr = ImageAttributes::New();
  attr.SetSize( testSize.x + 1, testSize.y + 1 );
  RequestPtr req2 = imageFactory.RegisterRequest( gTestImageFilename, &attr );
  ResourceTicketPtr ticket2 = imageFactory.Load( *req2.Get() );

  DALI_TEST_CHECK( req != req2 ); // different requests
  DALI_TEST_EQUALS( ticket->GetId(), ticket2->GetId(), TEST_LOCATION ); // same resource

  Vector2 newSize(512.0f, 512.0f);
  application.GetPlatform().SetClosestImageSize(newSize);

  // reload fixed size (192,192) request
  ticket2 = imageFactory.Reload( *req2.Get() );

  // emulate load success
  // note: this is the only way to emulate what size is loaded by platform abstraction
  EmulateImageLoaded( application, testSize.x + 1, testSize.y + 1 );

  // reload default size request
  ticket = imageFactory.Reload( *req.Get() );

  DALI_TEST_CHECK( ticket->GetId() != ticket2->GetId() ); // different resources
  END_TEST;
}
开发者ID:mettalla,项目名称:dali,代码行数:52,代码来源:utc-Dali-Internal-ImageFactory.cpp

示例14: HighlightBitmap

/*
gamma 参数的典型值在 1.0 到 2.2 之间;但在某些情况下,0.1 到 5.0 范围内的值也很有用。
imageAttr.SetGamma 参数值越大,图像越暗,反之则越亮
*/
Bitmap * HighlightBitmap(Bitmap * pSrc, float fGamma, BOOL bCreate )
{
	if (pSrc == NULL) return NULL;
	if (fGamma <= 0.0f) return NULL;

	RectF rc(0.0f, 0.0f, (float)pSrc->GetWidth(), (float)pSrc->GetHeight());
	if ( rc.IsEmptyArea()) return NULL;

	Bitmap * pResult = !bCreate ? pSrc : new Bitmap( (int)rc.Width, (int)rc.Height, pSrc->GetPixelFormat() );
	if( pResult == NULL ) return NULL;

	Graphics * g = Graphics::FromImage(pResult);
	if ( g == NULL)
	{
		if (bCreate) { delete pResult; pResult = NULL; }
		return NULL;
	}
	
	ImageAttributes imageAttr;

	//////////////////////////////////////////////////////////////////////////
#if TRUE
	imageAttr.SetGamma( 1/fGamma );
#else
	Gdiplus:: ColorMatrix HotMat = 
	{1.05f, 0.00f, 0.00f, 0.00f,0.00f,
	0.00f, 1.05f, 0.00f, 0.00f, 0.00f,
	0.00f, 0.00f, 1.05f, 0.00f, 0.00f,
	0.00f, 0.00f, 0.00f, 1.00f, 0.00f,
	0.05f, 0.05f, 0.05f, 0.00f, 1.00f};
	imageAttr.SetColorMatrix(&HotMat);
#endif
	//////////////////////////////////////////////////////////////////////////

	Status status = g->DrawImage(pSrc, rc, 0, 0, (float)pSrc->GetWidth(), (float)pSrc->GetHeight()
		,Gdiplus:: UnitPixel, &imageAttr);

	delete g; g = NULL;

	if ( Ok != status )
	{
		if (bCreate) { delete pResult; pResult = NULL; }
		return NULL;
	}

	return pResult;
}
开发者ID:cugxiangzhenwei,项目名称:WorkPlatForm,代码行数:51,代码来源:GDIPlusInit.cpp

示例15: dc

void CEnteringRoomDlg::OnPaint()
{
	CPaintDC dc(this); // device context for painting
	// TODO: 在此处添加消息处理程序代码
	// 不为绘图消息调用 CDialog::OnPaint()
	
	//中间
	CRect rcClient ;
	GetClientRect( &rcClient ) ;
	Graphics    graphics(dc);

	ImageAttributes imgAtt;
	imgAtt.SetWrapMode(WrapModeTileFlipXY);//GDI+在位伸图片时会自动加上渐变效果。但此处不需要,所以得加上此属性

	//去掉边框
	//左上、上中、右上
	graphics.DrawImage(m_imgTopLeft,Rect(0, 0, m_imgTopLeft->GetWidth(), m_imgTopLeft->GetHeight()), 
		                            0, 0, m_imgTopLeft->GetWidth(),  m_imgTopLeft->GetHeight(),UnitPixel,&imgAtt);//没拉抻

	graphics.DrawImage(m_imgTopMid, Rect(m_imgTopLeft->GetWidth(), 0, rcClient.Width() - m_imgTopLeft->GetWidth() * 2, m_imgTopMid->GetHeight()), 
		                            0, 0, rcClient.Width() - m_imgTopLeft->GetWidth() * 2, m_imgTopMid->GetHeight(), UnitPixel,&imgAtt);

	graphics.DrawImage(m_imgTopRight, Rect(rcClient.right - m_imgTopRight->GetWidth() - 1, 0, m_imgTopRight->GetWidth(), m_imgTopRight->GetHeight()), 
		                             0, 0, m_imgTopRight->GetWidth(), m_imgTopRight->GetHeight(), UnitPixel,&imgAtt);

	//左中、右中
	graphics.DrawImage(m_imgMidLeft, Rect(0, m_imgTopMid->GetHeight(), m_imgMidLeft->GetWidth(), rcClient.Height() - m_imgTopMid->GetHeight() * 2), 
		                             0, 0, m_imgMidLeft->GetWidth(), rcClient.Height() - m_imgTopMid->GetHeight() * 2, UnitPixel,&imgAtt);

	graphics.DrawImage(m_imgMidRight, Rect(rcClient.right - m_imgMidRight->GetWidth() - 1, m_imgTopMid->GetHeight(), m_imgMidRight->GetWidth(), rcClient.Height() - m_imgTopMid->GetHeight() * 2), 
		                              0, 0,  m_imgMidRight->GetWidth(), rcClient.Height() - m_imgTopMid->GetHeight() * 2,UnitPixel,&imgAtt);

	//左下、下中、右下
	graphics.DrawImage(m_imgBottomLeft,Rect(0, rcClient.bottom - m_imgBottomLeft->GetHeight() - 1, m_imgBottomLeft->GetWidth(), m_imgBottomLeft->GetHeight()), 
		                               0, 0, m_imgBottomLeft->GetWidth(), m_imgBottomLeft->GetHeight(), UnitPixel,&imgAtt);

	graphics.DrawImage(m_imgBottomMid, Rect(m_imgMidLeft->GetWidth(), rcClient.bottom - m_imgBottomMid->GetHeight() - 1, rcClient.Width() - m_imgMidLeft->GetWidth() * 2, m_imgBottomMid->GetHeight()), 
		                               0, 0,rcClient.Width() - m_imgMidLeft->GetWidth() * 2, m_imgBottomMid->GetHeight(), UnitPixel,&imgAtt);

	graphics.DrawImage(m_imgBottomRight,Rect(rcClient.right - m_imgBottomRight->GetWidth() - 1, rcClient.bottom - m_imgBottomRight->GetHeight() - 1, m_imgBottomRight->GetWidth(), m_imgBottomRight->GetHeight()),
		                                0, 0, m_imgBottomRight->GetWidth(), m_imgBottomRight->GetHeight(), UnitPixel,&imgAtt);
	//中间
	graphics.DrawImage( m_pPic->GetCurImage() ,Rect(m_imgMidLeft->GetWidth(), m_imgTopMid->GetHeight(), rcClient.Width() - m_imgMidLeft->GetWidth() * 2 - 1 , rcClient.Height() - m_imgTopMid->GetHeight() * 2 - 1),
		                        0, 0,  rcClient.Width() - m_imgMidLeft->GetWidth() * 2 - 1 , rcClient.Height() - m_imgTopMid->GetHeight() * 2 - 1,UnitPixel,&imgAtt) ;
	/*graphics.DrawImage( m_pPic->GetCurImage() ,Rect(0, 0, rcClient.Width(), rcClient.Height()),
		0, 0,  rcClient.Width(), rcClient.Height(),UnitPixel,&imgAtt) ;*/
}
开发者ID:mengskysama,项目名称:V8,代码行数:47,代码来源:EnteringRoomDlg.cpp


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