This documentation is for the old version. Go to the latest Graphics Mill docs

CustomFormatWriter.SaveFrameBitmap Method

Write the specified bitmap to a file at current position.

Namespace: Aurigma.GraphicsMill.Codecs
Assembly: Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)

Syntax

Visual Basic
Protected Friend MustOverride Sub SaveFrameBitmap ( _
	bitmap As Bitmap _
)
C#
protected internal abstract void SaveFrameBitmap(
	Bitmap bitmap
)

Parameters

bitmap

Type: Aurigma.GraphicsMill.Bitmap

Bitmap class instance that represents the image to save.

Remarks

If you need to get frame settings like quality, position, etc, you need to implement the SaveFrameParameters(Frame) method. In this method you will get the frame before the bitmap will be extracted and passed to the SaveFrameBitmap(Bitmap). This way you will be able to save parameters in private variables of your class or whatever else.

Examples

C#
protected override void SaveFrameBitmap(Bitmap bitmap)
{
    if (bitmap == null)
        throw new ArgumentNullException("bitmap");
        
    //_stream is a stream opened by the writer
    _stream.Seek(0, System.IO.SeekOrigin.Begin);

    //...Handle encoder options, if any
    
    //...Write a header

    //Get an access to the bitmap data
    BitmapData bmData = bitmap.LockBits();
    
    //Write pixel data into a stream
    try
    {
        //Call the base method to initialize progress notification
        base.ResetEvents(bitmap.Height);
        
        for (int i = 0; i < bitmap.Height; i++)
        {
            //...Encode a row of pixels and write it to the stream
            
            //Call the base method to update the progress state
            base.UpdateEvents();
        }
    }
    finally
    {
        bitmap.UnlockBits(bmData);
    }
}

See Also

Reference