728x90
728x170
■ TransformedBitmap 클래스를 사용해 변환 비트맵을 생성하는 방법을 보여준다.
▶ 예제 코드 (C#)
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
#region 변환 비트맵 생성하기 - CreateTransformedBitmap(bitmapSource, desiredSize)
/// <summary>
/// 변환 비트맵 생성하기
/// </summary>
/// <param name="bitmapSource">비트맵 소스</param>
/// <param name="desiredSize">희망 크기</param>
/// <returns>생성 변환 비트맵</returns>
public TransformedBitmap CreateTransformedBitmap(BitmapSource bitmapSource, Size desiredSize)
{
TransformedBitmap transformedBitmap = new TransformedBitmap();
transformedBitmap.BeginInit();
transformedBitmap.Source = bitmapSource;
ScaleTransform scaleTransform = new ScaleTransform
(
desiredSize.Width / bitmapSource.Width,
desiredSize.Height / bitmapSource.Height
);
transformedBitmap.Transform = scaleTransform;
transformedBitmap.EndInit();
return transformedBitmap;
}
#endregion
728x90
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] RenderTargetBitmap 클래스 : MediaPlayer 객체에서 비트맵 구하기 (0) | 2014.01.26 |
---|---|
[C#/WPF] MediaPlayer 클래스 : 미디어 재생하기 (0) | 2014.01.26 |
[C#/WPF] MediaPlayer 클래스 : 비디오 크기 구하기 (0) | 2014.01.26 |
[C#/WPF] BitConverter 클래스 : Color 객체 구하기 (0) | 2014.01.26 |
[C#/WPF] BitConverter 클래스 : Color 색상 값 계산하기 (0) | 2014.01.26 |
[C#/WPF] BitmapSource 클래스 : JPEG 파일 저장하기 (0) | 2014.01.26 |
[C#/WPF] DrawingVisual 클래스 : 라운드 사각형 이미지 구하기 (0) | 2014.01.25 |
[C#/WPF] RenderTargetBitmap 클래스 : DrawingVisual 객체에서 비트맵 구하기 (0) | 2014.01.25 |
[C#/WPF] BitmapImage 클래스 : 부분 비트맵 이미지 구하기 (0) | 2014.01.25 |
[C#/WPF] BitmapImage 클래스 : 회전 비트맵 이미지 구하기 (0) | 2014.01.25 |