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
Parameter | Type | Required | Description |
pStream | Stream | Yes | Pointer to the serialized memory stream. |
nLeft | Number | Yes | Specifies the horizontal coordinate where the image needs to be inserted. |
nTop | Number | Yes | Specifies the vertical coordinate where the image needs to be inserted. |
nOpacity | Number | No | Optional parameter which specifies the opacity of the image. |
nCropLeft | Number | No | Optional paremeter which specifies the left cropping of the image. |
nCropTop | Number | No | Optional paremeter which specifies the top cropping of the image. |
nCropWidth | Number | No | Optional paremeter which specifies the width of the cropping area of the image. |
nCropHeight | Number | No | Optional paremeter which specifies the height of the cropping area of the image. |
nWidth | Number | No | Optional parameter which specifies the desired width of the image to insert. |
nHeight | Number | No | Optional parameter which specifies the desired height of the image to insert. |
nResize | Resize (Enumeration) | No | Optional parameter which specifies the desired resizing method which should be used if the image needs to be resized. Resizing occurs after optional cropping. |
nResample | Resample (Enumeration) | No | Optional 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
2 Imaging1.Create(200, 200);
3 Imaging1.DrawRectangleFilled(0, 0, 200, 200, Imaging1.GetColorFromHTML("#ff0000"));
4
5
6 Imaging2.Create(100, 100);
7 Imaging2.DrawEllipseFilled(0, 0, 100, 100, Imaging2.GetColorFromHTML("#0000ff"));
8
9
10 Imaging1.InsertFromSerializedStream(Imaging2.Serialize(), 50, 50, 75);
Category
Insert
See also
InsertFromBase64 |
InsertFromFile |
InsertFromStream |
InsertFromURL |
Working with streams