ImageEn, unit iexBitmaps

TIEBitmap.MergeAlphaRectTo

TIEBitmap.MergeAlphaRectTo


Declaration

procedure MergeAlphaRectTo(Dest: TIEBitmap; SrcX, SrcY, DstX, DstY: integer; RectWidth, RectHeight: integer
                           MergeMethod: TIEMergeMethod = iemMax; MergePercent: Double = 1);


Description

Merges the alpha channel to the Dest bitmap alpha channel using the specified method.

Merge Method Effect
iemmMax Maximum alpha of source and dest is used
iemmMin Minimum alpha of source and dest is used
iemmAdd Alpha of dest is increased by that in source (effect can be reduced by specifying a lower value for MergePercent)
iemmSubtract Alpha of dest is reduced by that in source (effect can be reduced by specifying a lower value for MergePercent)
iemmReplaceWithSrc Replaces alpha of dest, with that of source pixels where alpha > 0

Note:
Dest must be the same PixelFormat as the image
This method only affects the alpha channel (transparency) of the two images, it does not affect the color channels


TIEBitmap Assignment and Drawing Methods

TIEBitmap Methods
Method Mode Purpose
Assign From TIEBitmap/TBitmap/TGraphic/TIcon Copy whole image
AssignImage From TIEBitmap Like assign, but does not copy the alpha channel
AssignRect From TIEBitmap/TBitmap Copy a specified rect
CopyAndConvertFormat From TIEBitmap Copy whole image
CopyRectTo To TIEBitmap Copy rect to another image (without scaling)
CopyWithMask1 To TIEBitmap Copy image using a mask to specify what is copied from the source
CopyWithMask2 To TIEBitmap Copy image using a mask to specify what is replaced in the destintation
DrawToTIEBitmap To TIEBitmap Copies all or part of the image to a specified position and/or size
JoinBitmaps From two TIEBitmaps Draws two bitmaps to a single bitmap
MergeAlphaRectTo With TIEBitmap Merges the alpha channels of two TIEBitmaps using merge rules
MergeWithAlpha With TIEBitmap Merges all or part of two TIEBitmaps with alpha channels to a specified position
RenderToTIEBitmapEx To TIEBitmap Extended drawing of content to a TIEBitmap
StretchRectTo To TIEBitmap Copy rect to dest rect in another image (with scaling)
SwitchTo To TIEBitmap Move content from one TIEBitmap to another

TBitmap Methods
Method Mode Purpose
Assign From TIEBitmap/TBitmap/TGraphic/TIcon Copy whole image
AssignTo To TIEBitmap/TBitmap Copy whole image with optional scaling
AssignRect From TIEBitmap/TBitmap Copy a specified rect
CopyFromTBitmap From TBitmap Copy whole image
CopyToTBitmap To TBitmap Copy whole image
RenderToTBitmapEx To TBitmap Extended drawing of content to a TBitmap

TCanvas Methods
Method Mode Purpose
DrawToCanvas To TCanvas Copies whole image to canvas at specified position (ignoring the alpha channel)
DrawToCanvasWithAlpha To TCanvas Copies whole image to canvas at specified position (honoring the alpha channel)
RenderToCanvas To TCanvas Extended drawing of content to a TCanvas (ignoring the alpha channel)
RenderToCanvasWithAlpha To TCanvas Extended drawing of content to a TCanvas (honoring the alpha channel)


Example

// 50% merge of alpha in Source to dest alpha
bmp.MergeAlphaRectTo( ImageEnView1.IEBitmap, 0, 0, 0, 0, bmp.Width, bmp.Height, iemmSubtract, 0.50 );
ImageEnView1.IEBitmap.SyncFull();