BitmapFrame 클래스
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
디코더에서 반환되고 인코더에서 허용하는 이미지 데이터를 나타냅니다.
public ref class BitmapFrame abstract : System::Windows::Media::Imaging::BitmapSource, System::Windows::Markup::IUriContext
public abstract class BitmapFrame : System.Windows.Media.Imaging.BitmapSource, System.Windows.Markup.IUriContext
type BitmapFrame = class
inherit BitmapSource
interface IUriContext
Public MustInherit Class BitmapFrame
Inherits BitmapSource
Implements IUriContext
- 상속
- 구현
예제
다음 코드 예제에서는 .를 사용하여 BitmapSource새로 BitmapFrame 만드는 방법을 보여 줍니다.
int width = 128;
int height = width;
int stride = width/8;
byte[] pixels = new byte[height*stride];
// Try creating a new image with a custom palette.
List<System.Windows.Media.Color> colors = new List<System.Windows.Media.Color>();
colors.Add(System.Windows.Media.Colors.Red);
colors.Add(System.Windows.Media.Colors.Blue);
colors.Add(System.Windows.Media.Colors.Green);
BitmapPalette myPalette = new BitmapPalette(colors);
// Creates a new empty image with the pre-defined palette
BitmapSource image = BitmapSource.Create(
width,
height,
96,
96,
PixelFormats.Indexed1,
myPalette,
pixels,
stride);
FileStream stream = new FileStream("empty.tif", FileMode.Create);
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();
encoder.Frames.Add(BitmapFrame.Create(image));
MessageBox.Show(myPalette.Colors.Count.ToString());
encoder.Save(stream);
Dim width As Integer = 128
Dim height As Integer = width
Dim stride As Integer = CType(width / 8, Integer)
Dim pixels(height * stride) As Byte
' Try creating a new image with a custom palette.
Dim colors As New List(Of System.Windows.Media.Color)()
colors.Add(System.Windows.Media.Colors.Red)
colors.Add(System.Windows.Media.Colors.Blue)
colors.Add(System.Windows.Media.Colors.Green)
Dim myPalette As New BitmapPalette(colors)
' Creates a new empty image with the pre-defined palette
Dim image As BitmapSource = System.Windows.Media.Imaging.BitmapSource.Create(width, height, 96, 96, PixelFormats.Indexed1, myPalette, pixels, stride)
Dim stream As New FileStream("empty.tif", FileMode.Create)
Dim encoder As New TiffBitmapEncoder()
Dim myTextBlock As New TextBlock()
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString()
encoder.Frames.Add(BitmapFrame.Create(image))
MessageBox.Show(myPalette.Colors.Count.ToString())
encoder.Save(stream)
다음 코드 예제에서는 개체를 사용하여 BitmapFrame PNG(이식 가능한 네트워크 그래픽) 그래픽을 열고 메서드를 사용하여 메타데이터를 CreateInPlaceBitmapMetadataWriter 작성하는 방법을 보여 줍니다.
Stream^ pngStream = gcnew FileStream("smiley.png", FileMode::Open, FileAccess::ReadWrite, FileShare::ReadWrite);
PngBitmapDecoder^ pngDecoder = gcnew PngBitmapDecoder(pngStream, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default);
BitmapFrame^ pngFrame = pngDecoder->Frames[0];
InPlaceBitmapMetadataWriter^ pngInplace = pngFrame->CreateInPlaceBitmapMetadataWriter();
if (pngInplace->TrySave())
{
pngInplace->SetQuery("/Text/Description", "Have a nice day.");
}
pngStream->Close();
Stream pngStream = new System.IO.FileStream("smiley.png", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
PngBitmapDecoder pngDecoder = new PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapFrame pngFrame = pngDecoder.Frames[0];
InPlaceBitmapMetadataWriter pngInplace = pngFrame.CreateInPlaceBitmapMetadataWriter();
if (pngInplace.TrySave())
{ pngInplace.SetQuery("/Text/Description", "Have a nice day."); }
pngStream.Close();
Dim pngStream As New System.IO.FileStream("smiley.png", FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)
Dim pngDecoder As New PngBitmapDecoder(pngStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default)
Dim pngFrame As BitmapFrame = pngDecoder.Frames(0)
Dim pngInplace As InPlaceBitmapMetadataWriter = pngFrame.CreateInPlaceBitmapMetadataWriter()
If pngInplace.TrySave() = True Then
pngInplace.SetQuery("/Text/Description", "Have a nice day.")
End If
pngStream.Close()
설명
BitmapFrame는 이미지의 특정 프레임과 연결된 액세스 권한을 BitmapSource 제공하여 정의 Thumbnail 되지 않은 추가 기능을 제공합니다. BitmapFrame 또한 속성 또는 메서드를 사용하여 메타데이터 정보의 쓰기를 MetadataCreateInPlaceBitmapMetadataWriter 지원합니다.
디코더에서 반환되는 모든 BitmapFrame 값은 항상 고정됩니다. 수정 가능한 복사본이 필요한 경우 먼저 메서드를 사용하여 BitmapFrame 복사본을 Clone 만들어야 합니다.
태그가 지정된 TIFF(이미지 파일 형식) 및 GIF(그래픽 교환 형식) 형식 이미지만 여러 프레임을 지원합니다.
생성자
| 속성 | Description |
|---|---|
| BitmapFrame() |
BitmapFrame 클래스의 새 인스턴스를 초기화합니다. |
속성
| 속성 | Description |
|---|---|
| BaseUri |
파생 클래스에서 재정의되는 경우 현재 컨텍스트의 기반을 Uri 나타내는 값을 가져오거나 설정합니다. |
| CanFreeze |
개체를 수정할 수 없게 만들 수 있는지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 Freezable) |
| ColorContexts |
파생 클래스에서 재정의되는 경우 이 ColorContext클래스와 연결된 개체의 BitmapFrame 컬렉션을 가져옵니다. |
| Decoder |
파생 클래스에서 재정의되는 경우 이 인스턴스와 연결된 디코더를 BitmapFrame가져옵니다. |
| DependencyObjectType |
이 인스턴스의 DependencyObjectType CLR 형식을 래핑하는 값을 가져옵니다. (다음에서 상속됨 DependencyObject) |
| Dispatcher |
연결된 이 값을 DispatcherDispatcherObject 가져옵니다. (다음에서 상속됨 DispatcherObject) |
| DpiX |
이미지의 dpi(인치당 가로 점)를 가져옵니다. (다음에서 상속됨 BitmapSource) |
| DpiY |
이미지의 인치당 세로 점(dpi)을 가져옵니다. (다음에서 상속됨 BitmapSource) |
| Format |
비트맵 데이터의 네이티브 PixelFormat 를 가져옵니다. (다음에서 상속됨 BitmapSource) |
| HasAnimatedProperties |
하나 이상의 AnimationClock 개체가 이 개체의 종속성 속성과 연결되어 있는지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 Animatable) |
| Height |
디바이스 독립적 단위(단위당 1/96인치)에서 원본 비트맵의 높이를 가져옵니다. (다음에서 상속됨 BitmapSource) |
| IsDownloading |
콘텐츠가 현재 다운로드 중인지 여부를 BitmapSource 나타내는 값을 가져옵니다. (다음에서 상속됨 BitmapSource) |
| IsFrozen |
개체를 현재 수정할 수 있는지 여부를 나타내는 값을 가져옵니다. (다음에서 상속됨 Freezable) |
| IsSealed |
이 인스턴스가 현재 봉인되어 있는지 여부를 나타내는 값을 가져옵니다(읽기 전용). (다음에서 상속됨 DependencyObject) |
| Metadata |
이 비트맵 이미지와 연결된 메타데이터를 가져옵니다. (다음에서 상속됨 BitmapSource) |
| Palette |
비트맵이 지정된 경우 비트맵의 색상표를 가져옵니다. (다음에서 상속됨 BitmapSource) |
| PixelHeight |
비트맵의 높이를 픽셀 단위로 가져옵니다. (다음에서 상속됨 BitmapSource) |
| PixelWidth |
비트맵의 너비를 픽셀 단위로 가져옵니다. (다음에서 상속됨 BitmapSource) |
| Thumbnail |
파생 클래스에서 재정의된 경우 이 BitmapFrame클래스와 연결된 썸네일 이미지를 가져옵니다. |
| Width |
디바이스 독립적 단위(단위당 1/96인치)에서 비트맵의 너비를 가져옵니다. (다음에서 상속됨 BitmapSource) |
메서드
이벤트
| 속성 | Description |
|---|---|
| Changed |
포함된 개체 또는 개체를 수정할 때 Freezable 발생합니다. (다음에서 상속됨 Freezable) |
| DecodeFailed |
이미지 헤더가 손상되어 이미지가 로드되지 않을 때 발생합니다. (다음에서 상속됨 BitmapSource) |
| DownloadCompleted |
비트맵 콘텐츠가 완전히 다운로드되었을 때 발생합니다. (다음에서 상속됨 BitmapSource) |
| DownloadFailed |
비트맵 콘텐츠를 다운로드하지 못한 경우에 발생합니다. (다음에서 상속됨 BitmapSource) |
| DownloadProgress |
비트맵 콘텐츠의 다운로드 진행률이 변경될 때 발생합니다. (다음에서 상속됨 BitmapSource) |
명시적 인터페이스 구현
| 속성 | Description |
|---|---|
| IFormattable.ToString(String, IFormatProvider) |
지정된 형식을 사용하여 현재 인스턴스의 값 형식을 지정합니다. (다음에서 상속됨 ImageSource) |