次の方法で共有


CGContext.AsBitmapContext メソッド

定義

CGContext を CGBitmapContext にキャストします。

public CoreGraphics.CGBitmapContext AsBitmapContext ();
member this.AsBitmapContext : unit -> CoreGraphics.CGBitmapContext

戻り値

注釈

CGContext にはさまざまな種類 (通常、ビットマップ、PDF) がありますが、Apple ではそれらを区別する方法はサポートされていません。 特定の CGContext オブジェクトは、実際には、いくつかの状況で CGBitmapContext オブジェクトであることが知られています (または BeginImageContextWithOptions(CGSize, Boolean, nfloat)を使用BeginImageContext(CGSize)してコンテキストを作成した後に を呼び出すGetImageFromCurrentImageContext())。

これらは実際には CGBitmapContext オブジェクトであり、それを変換することで、アプリケーション開発者は、その上のさまざまなビットマップ プロパティにアクセスできます。

UIGraphics.BeginImageContextWithOptions (image.Size, false, UIScreen.MainScreen.Scale);
CGBitmapContext effectInContext = UIGraphics.GetCurrentContext ().AsBitmapContext ()

// Now, you can access some interesting properties like "Data", "Width", 
// "Height", "BytesPerRow" from the underlying bitmap

var effectInBuffer = new vImageBuffer () {
        Data = effectInContext.Data,
        Width = effectInContext.Width,
        Height = effectInContext.Height,
        BytesPerRow = effectInContext.BytesPerRow
};

適用対象