Marblecore Imaging Library Documentation

Documentation Introduction
Documentation / Marblecore Imaging / Methods / InsertFromSerializedStream

InsertFromSerializedStream method

Inserts a image from a serialized stream into the current loaded image at the specified position. You have to supply a stream which is created using the Serialize method.

Syntax

Boolean InsertFromSerializedStream(pStream As Stream, nLeft As Number, nTop As Number, nOpacity As Number, nCropLeft As Number, nCropTop As Number, nCropWidth As Number, nCropHeight As Number, nWidth As Number, nHeight As Number, nResize As Resize, nResample As Resample)

Return value

Returns true if the function succeeded.

Parameters

ParameterTypeRequiredDescription
pStreamStreamYesPointer to the serialized memory stream.
nLeftNumberYesSpecifies the horizontal coordinate where the image needs to be inserted.
nTopNumberYesSpecifies the vertical coordinate where the image needs to be inserted.
nOpacityNumberNoOptional parameter which specifies the opacity of the image.
nCropLeftNumberNoOptional paremeter which specifies the left cropping of the image.
nCropTopNumberNoOptional paremeter which specifies the top cropping of the image.
nCropWidthNumberNoOptional paremeter which specifies the width of the cropping area of the image.
nCropHeightNumberNoOptional paremeter which specifies the height of the cropping area of the image.
nWidthNumberNoOptional parameter which specifies the desired width of the image to insert.
nHeightNumberNoOptional parameter which specifies the desired height of the image to insert.
nResizeResize (Enumeration)NoOptional parameter which specifies the desired resizing method which should be used if the image needs to be resized. Resizing occurs after optional cropping.
nResampleResample (Enumeration)NoOptional parameter which specifies the desired resample method which should be used if the image needs to be resized.

Example

The Serialize method is a great way to combine image objects. It can be used to insert an image object into another image object with high speed. The example below shows you how to do this. The example consists of two separate images which are blended together using the InsertFromSerializedStream method.
 
1 // Create the first image and draw a red rectangle on it
2 Imaging1.Create(200, 200);
3 Imaging1.DrawRectangleFilled(0, 0, 200, 200, Imaging1.GetColorFromHTML("#ff0000"));
4 
5 // Create the second image and draw a blue circle on it
6 Imaging2.Create(100, 100);
7 Imaging2.DrawEllipseFilled(0, 0, 100, 100, Imaging2.GetColorFromHTML("#0000ff"));
8 
9 // Insert the second image into the first image with 75% opacity
10 Imaging1.InsertFromSerializedStream(Imaging2.Serialize(), 50, 50, 75);

Category

Insert

See also

InsertFromBase64 | InsertFromFile | InsertFromStream | InsertFromURL | Working with streams