Marblecore Imaging Library Documentation

Documentation Introduction
Documentation / Marblecore Imaging / Methods / SaveToHBitmapPreMultiplied

SaveToHBitmapPreMultiplied method

Returns a HBITMAP for the current image where the RGB values are pre multiplied. Use this method to draw the image with high speed to a canvas like a Windows Form. This method is not available in the ATL version of the image component.


HBITMAP SaveToHBitmapPreMultiplied(nLeft As Number, nTop As Number, nWidth As Number, nHeight As Number)

Return value

Returns a HBITMAP if the function succeeded or NULL if the function failed.


nLeftNumberNoOptional parameter which specifies the left coordinate of the rectangle to return.
nTopNumberNoOptional parameter which specifies the top coordinate of the rectangle to return.
nWidthNumberNoOptional parameter which specifies the width of the rectangle to return.
nHeightNumberNoOptional parameter which specifies the height of the rectangle to return.


The SaveToHBitmapPreMultiplied method can be used to display an image in a .NET PictureBox or to create a System.Drawing.Bitmap of the image. In the example below we convert the image to a .NET bitmap and display it in a PictureBox with name pictureBox1. The example is written in C#.
1 // Create a new image class
2 MarblecoreImaging Imaging = new MarblecoreImaging();
4 // Create a new image and draw a red rectangle on it
5 if (Imaging.Create(200, 200))
6 {
7     Imaging.DrawRectangleFilled(0, 0, 200, 200, Imaging.GetColorFromHTML("#ff0000"));
9     // Create a bitmap of the image and attach it to the PictureBox
10    pictureBox1.Image = Image.FromHbitmap(Imaging.SaveToHBitmapPreMultiplied());
11 }


Basic operations

See also

Create | Deserialize | LoadFromBase64 | LoadFromFile | LoadFromSerializedStream | LoadFromStream | LoadFromURL | Reset | SaveToBase64 | SaveToFile | SaveToHBitmap | SaveToStream | Serialize