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

要将图像旋转的角度。

示例

下面的示例演示如何设置属性的值 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 度增量的旋转。

旋转表示源图像的无损失转换,并替换任何以前的无丢失转换。

适用于