ImageEn, unit iexUserInteractions



TIEBrushToolInteraction = class(TIECursorToolInteraction);


A class of TIEUserInteraction that controls interaction for the Paint tool (when MouseInteractGeneral is miBrushTool).
This tool allows the user to paint onto the image with a variety of brushes. When used with a tablet/pen, then pressure will affect the brush size and/or opacity.

 You can hold down the Shift key to snap the brush position to the axes
 If you encounter cursor flickering, you should set ImageEnView1.DoubleBuffered := True;


Demo  Demos\ImageEditing\BrushTool\PaintBrush.dpr
Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr

Methods and Properties

General Properties
Public Property  AlphaTextureMin
Public Property  AlphaTextureMax
Public Property  AntiAlias
Public Property  BrushStep
Public Property  BrushColor
Public Property  BrushColor2
Public Property  BrushFill
Public Property  BrushGradient
Public Property  BrushHeight
Public Property  BrushImage
Public Property  BrushRotate
Public Property  BrushShape
Public Property  BrushSize
Public Property  BrushPreview
Public Property  BrushWidth
Public Property  EraserColor
Public Property  EraserOpacity
Public Property  Feathering
Public Property  Operation
Public Property  PenEffects
Public Property  PaintMode
Public Property  RightButtonEraser
Public Property  SprayDensity
Public Property  Transparency
Public Property  TransparencyMode

Programmatic Brush Methods
Public Method  StartPainting
Public Method  AddToPainting
Public Method  EndPainting

Public Method  GetBrushPreview


// Enable painting with a circular spray can brush
ImageEnView1.BrushTool.BrushShape := iecsCircle;
ImageEnView1.BrushTool.BrushFill  := iebfSpray;
ImageEnView1.BrushTool.BrushSize  := 50;
ImageEnView1.BrushTool.BrushColor := clRed;
ImageEnView1.MouseInteractGeneral := [ miBrushTool ];

// Enable painting with a red/yellow gradient
ImageEnView1.BrushTool.BrushShape  := iecsRectangle;
ImageEnView1.BrushTool.BrushFill   := iebfGradient;
ImageEnView1.BrushTool.BrushSize   := 50;
ImageEnView1.BrushTool.BrushColor  := clRed;
ImageEnView1.BrushTool.BrushColor2 := clYellow;
ImageEnView1.MouseInteractGeneral  := [ miBrushTool ];

// Set cursor as a square eraser
ImageEnView1.BrushTool.BrushFill     := iebfEraser;
ImageEnView1.BrushTool.EraserOpacity := 1.0;
ImageEnView1.BrushTool.BrushShape    := iecsRectangle;
ImageEnView1.MouseInteractGeneral    := [ miBrushTool ];

// Partially erase the image
ImageEnView1.BrushTool.BrushFill     := iebfEraser;
ImageEnView1.BrushTool.BrushSize     := 50;
ImageEnView1.BrushTool.EraserOpacity := 0.5;
ImageEnView1.BrushTool.BrushShape    := iecsCircle;
ImageEnView1.MouseInteractGeneral    := [ miBrushTool ];

// Use Smart Eraser Brush tool
ImageEnView1.ChromaKeyOptions.Tolerance := 0.15;
ImageEnView1.BrushTool.BrushFill := iebfSmartEraser;
ImageEnView1.MouseInteractGeneral := [ miBrushTool ];

// Enable painting with a custom brush
ImageEnView1.BrushTool.BrushImage.Read( 'Golden-Brush.png' );
ImageEnView1.BrushTool.BrushFill  := iebfImage;
ImageEnView1.BrushTool.BrushShape := iecsRectangle;
ImageEnView1.MouseInteractGeneral := [ miBrushTool ];

// Show brush properties dialog
ImageEnView1.MouseInteractGeneral := [miBrushTool];

See Also

 TImageEnView Actions