JpegBitmapEncoder.Rotation 屬性

定義

取得或設定值,表示聯合攝影專家群組 (JPEG) 影像旋轉的程度。

public:
 property System::Windows::Media::Imaging::Rotation Rotation { System::Windows::Media::Imaging::Rotation get(); void set(System::Windows::Media::Imaging::Rotation value); };
public System.Windows.Media.Imaging.Rotation Rotation { get; set; }
member this.Rotation : System.Windows.Media.Imaging.Rotation with get, set
Public Property Rotation As Rotation

屬性值

影像的旋轉度數。

範例

下列範例示範如何設定 屬性的值 Rotation

BitmapSource^ image = BitmapSource::Create(
   width, height,
   96, 96,
   PixelFormats::Indexed1,
   myPalette,
   pixels,
   stride);
BitmapSource image = BitmapSource.Create(
    width,
    height,
    96,
    96,
    PixelFormats.Indexed1,
    myPalette,
    pixels,
    stride);
Dim image As BitmapSource = System.Windows.Media.Imaging.BitmapSource.Create(width, height, 96, 96, PixelFormats.Indexed1, myPalette, pixels, stride)

System::IO::FileStream^ stream = gcnew System::IO::FileStream("new.jpg", FileMode::Create);
JpegBitmapEncoder^ encoder = gcnew JpegBitmapEncoder();
TextBlock^ myTextBlock = gcnew System::Windows::Controls::TextBlock();
myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString();
encoder->FlipHorizontal = true;
encoder->FlipVertical = false;
encoder->QualityLevel = 30;
encoder->Rotation = Rotation::Rotate90;
encoder->Frames->Add(BitmapFrame::Create(image));
encoder->Save(stream);
FileStream stream = new FileStream("new.jpg", FileMode.Create);
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
TextBlock myTextBlock = new TextBlock();
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString();
encoder.FlipHorizontal = true;
encoder.FlipVertical = false;
encoder.QualityLevel = 30;
encoder.Rotation = Rotation.Rotate90;
encoder.Frames.Add(BitmapFrame.Create(image));
encoder.Save(stream);
Dim stream As New FileStream("new.jpg", FileMode.Create)
Dim encoder As New JpegBitmapEncoder()
Dim myTextBlock As New TextBlock()
myTextBlock.Text = "Codec Author is: " + encoder.CodecInfo.Author.ToString()
encoder.FlipHorizontal = True
encoder.FlipVertical = False
encoder.QualityLevel = 30
encoder.Rotation = Rotation.Rotate90
encoder.Frames.Add(BitmapFrame.Create(image))
encoder.Save(stream)

備註

只有 90 度遞增才支援旋轉。

旋轉代表來源影像的無遺失轉換,並取代任何先前的無遺失轉換。

適用於