This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Load from system.Drawing.Bitmap

ChristianGad#605
How can I load an image from System.Drwaing.Bitmap
Fedor#3746
Hello,

There are 2 ways to load System.Drawing.Bitmap image into Aurigma.GraphicsMill.Bitmap one:

1. You can pass System.Drawing.Bitmap in Aurigma.GraphicsMill.Bitmap constructor.

Dim gdiPlusBitmap As System.Drawing.Bitmap

'some other code...

Dim gmBitmap As Aurigma.GraphicsMill.Bitmap = _
    New Aurigma.GraphicsMill.Bitmap(gdiPlusBitmap)


System.Drawing.Bitmap gdiPlusBitmap;

//some other code...

Aurigma.GraphicsMill.Bitmap gmBitmap = 
    new Aurigma.GraphicsMill.Bitmap(gdiPlusBitmap);


2. You can cast System.Drawing.Bitmap to Aurigma.GraphicsMill.Bitmap as implicit type casting is supported:

Dim gdiPlusBitmap As System.Drawing.Bitmap

'some other code...

Dim gmBitmap As Aurigma.GraphicsMill.Bitmap = gdiPlusBitmap


System.Drawing.Bitmap gdiPlusBitmap;

//some other code...

Aurigma.GraphicsMill.Bitmap gmBitmap = gdiPlusBitmap;


Please note that in both cases image memory is copied.
Fedor#3747
I just want to add that in order to convert Aurigma.GraphicsMill.Bitmap to System.Drawing.Bitmap you can use the same way implicit type casting or use ToGdiplusBitmap and ToGdiplusBitmapDirectly methods.

When you use ToGdiplusBitmapDirectly method, returned System.Drawing.Bitmap references to the same bitmap data as the current Aurigma.GraphicsMill.Bitmap class instance.