CGImageDestination Class
Definition
Use this class to save images and have detailed control over how the images are saved.
public class CGImageDestination : IDisposable, ObjCRuntime.INativeObject
type CGImageDestination = class
interface INativeObject
interface IDisposable
- Inheritance
-
CGImageDestination
- Implements
Remarks
You create new instances of CGImageDestination by calling one of the factory methods. There are three versions of it:
- Storing the generated image into a file pointed to by an NSUrl.
- Storing the generated image into an NSMutableData
- Storing the generated image into a CGDataConsumer
In the classic API, those methods were called FromUrl, FromData and Create respectively. But this naming was incorrect, as it did not really create an image destination from a url, or a data. In the Unified API, they have all been turned into Create(NSMutableData, String, Int32, CGImageDestinationOptions) methods.
Once you have created the image, you can call
To write out the image, you must call the Close() method.
// The following example shows how to store an image into
// an in-memory PNG file stored inside an NSData.
NSData ImageToPng (CGImage image)
{
var storage = new NSMutableData ()
var dest = CGImageDestination.Create (storage, MobileCoreServices.UTType.PNG, imageCount: 1);
dest.AddImage (image);
dest.Close ();
return storage;
}
Properties
Handle |
Handle (pointer) to the unmanaged object representation. |
TypeIdentifiers |