SplineHorzTransform

function SplineHorzTransform(img: TImage32; const leftSpline: TPathD; splineType: TSplineType; backColor: TColor32; reverseFill: Boolean; out offset: TPoint): Boolean;


Deforms an image in the horizontal plane. 'leftSpline' control points (either FlattenQSpline or FlattenCSpline points) define the left (curved) edge of the transformed image.

'backColor' and 'reverseFill' are only meaningful when the splines induce image overlap (see SplineVertTransform for an example). Normal rendering is from top to bottom unless reverseFill = true, in which case rendering will be from bottom to top. If 'backColor' = clNone32, then the image will be rendered on 'back' regions as if the image is double sided, otherwise 'back' regions will be filled with 'backColor'.

The returned 'offset', is the offset of the top-left corner of the transformed (and resized) image (using the same axes as the spline coordinates) so that the transformed image can easily be aligned with the supplied control points.

  uses Image32, Image32_PNG, Image32_Transform;
  ...
var
  leftPath: TPathD;
  pt: TPoint;
begin
  img := TImage32.Create;
  img.LoadFromFile('union_jack.png');
  leftPath := MakePathI([402,2, 336,44, 495,122, 402,174]);
  SplineHorzTransform(img, leftPath, stCubic, clNone32, false, pt);
  img.SaveToFile('wavy_flag5.png');
  img.Free;
      
Before:
After:


See Also

Image32_Layers, SplineVertTransform, FlattenCSpline, FlattenQSpline, TSplineType