ImageEn, unit imageenproc

TImageEnProc.PerspectiveDraw

TImageEnProc.PerspectiveDraw


Declaration

procedure PerspectiveDraw(Source: TIEBitmap; x0, y0, x1, y1, x2, y2, x3, y3: Integer; alphaMin: Integer=-1; alphaMax: Integer=-1; mergeAlpha: Boolean);


Description

Draw the source bitmap over current layer, stretching bitmap inside four points.

Parameter Description
x0, y0 Top-Left point
x1, y1 Top-Right point
x2, y2 Bottom-Right point
x3, y3 Bottom-Left point
alphaMin, alphaMax If alphaMin>-1 and alphaMax>-1 then alpha (transparency) will be limited to the specified range (useful for "cover-flow" like reflection). alphaMin (0..255) specifies minimum transparency. alphaMax (0..255) specifies maximum transparency
mergeAlpha If image alpha channel is merged with the background image

It is possible to invert the image by making lesser coordinates exceed greater ones, for example, (x0, y0) > (x1, y1).

Note:
Check your parameters carefully as the coordinates are ordered differently from common designations
If the image PixelFormat is not ie24RGB, it will be converted


Demo

Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Example

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Perspective drawing image offset on left
yOffset := 50;
ImageEnView1.IEBitmap.Allocate( 300, 300, clBlack );
ImageEnView1.Proc.PerspectiveDraw( srcBMP,                                       // Source image
                                   0, yOffset,                                   // Top-left
                                   ImageEnView1.IEBitmap.Width - 1, 0,           // top-Right
                                   ImageEnView1.IEBitmap.Width - 1, ImageEnView1.IEBitmap.Height - 1, // Bottom-right
                                   0, ImageEnView1.IEBitmap.Height - yOffset,    // Bottom-left
                                   -1, -1, true);