There are several ways to add photo effects to images in Delphi FMX. Here are a few options:
- Using the FMX.Filter.Effects unit: The FMX.Filter.Effects unit provides a set of predefined image filters that you can use to apply various effects to images. You can use the
TFilter
component to apply these effects to an image.
1 2 3 4 |
procedure TForm1.ApplyEffect(const Image: TBitmap; const Effect: TFilterEffect); begin TFilter.Filter(Image, Effect); end; |
- Using the FMX.ImgList unit: The FMX.ImgList unit provides the ability to apply image effects, such as Grayscale, Sharpen, and Emboss. You can use the
TImageList
component to apply these effects to an image.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
procedure TForm1.ApplyEffect(const Image: TBitmap; const Effect: TImageListFilter); var ImgList: TImageList; begin ImgList := TImageList.Create(nil); try ImgList.AddBitmap(Image); ImgList.Filter(0, Effect); Image.Assign(ImgList.Bitmap(0)); finally ImgList.Free; end; end; |
- Using the FMX.Objects unit: The FMX.Objects unit provides the TBlurEffect, TShadowEffect, TGlowEffect and TCellShadingEffect that you can use to apply blur, shadow, glow and cell shading effects to an image. You can drop the effect component on the image object and set the properties of the effect to get the desired effect.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
procedure TForm1.ApplyEffect(const Image: TImage); var GlowEffect: TGlowEffect; begin GlowEffect := TGlowEffect.Create(nil); try GlowEffect.GlowColor := TAlphaColorRec.Yellow; GlowEffect.Opacity := 0.8; GlowEffect.Enabled := True; Image.AddEffect(GlowEffect); finally GlowEffect.Free; end; end; |
- Using a third-party component: There are also third-party components and libraries available for Delphi that you can use to add photo effects to images. Such as, Imagic and ImageEn, these libraries provide a wide range of image processing and manipulation functionality, including the ability to apply various photo effects.
It’s important to note that each of these options have their own advantages and disadvantages, and you should choose the one that best fits your needs, also you can combine these options to get the desired effect.
Leave a Reply