ImageEn, unit imageenview

TImageEnView


Declaration

TImageEnView = class(TIEView);


Description

TImageEnView is an image container, viewer and editor. It supports zooming, scrolling, selections and layers.
TImageEnView encapsulates a TImageEnIO (IO property) for loading/saving/acquisition and a TImageEnProc (Proc property) component for image editing/processing (you do not need to add extra TImageEnIO and TImageEnProc components to your form).




For rapid UI development a full set of actions is also available.





Overview




Recommended Defaults

For compatibility, some of the default options of TImageEnView are not the recommended ones. Here are some suggested changes:

By default, TImageEnView is initially filled with a white image the size of the control, to start it completely empty call Blank:
  ImageEnView1.Blank();

Specify a ZoomFilter to improve the quality when the zoom is not 100%
  ZoomFilter := rfFastLinear;

Specify UndoLimit to enable multiple levels of Undo/Redo:
  ImageEnView1.Proc.UndoLimit := 30;

Enable AutoSetBitDepth so that setting TImageEnView.IEBitmap.PixelFormat automatically updates SamplesPerPixel and BitsPerSample
  IEGlobalSettings().AutoSetBitDepth := True;

If you are updating an older project, ensure that LegacyBitmap is false for better performance and memory usage:
  ImageEnView1.LegacyBitmap := False;


Demos

Demo Description Demo Project Folder Compiled Demo
Complete Editor Complete image editing application showing many key features \Demos\ImageEditing\CompleteEditor\PhotoEn.dpr   
Mouse Interaction Options Demo the interaction options available with MouseInteractGeneral and MouseInteractLayers \Demos\Other\MouseInteract\MouseInteract.dpr   
ImageEnView Rulers Display of rulers within a TImageEnView \Demos\Other\ImageEnViewRulers\ImageEnViewRulers.dpr   
Mouse Wheel Params The effect of the TImageEnView and TImageEnMView MouseWheelParams properties \Demos\Other\MouseWheel\MouseWheelParams.dpr   
Pointer Events Demo of the OnPointer event of TImageEnView to handle tablet/pen usage, and enable pressure sensitive painting. \Demos\Other\PointerEvent\PointerEvent.dpr   
Toolbars Use of TImageEnView viewing, editing, selection and layer toolbars \Demos\Other\ImageEnViewToolbars\IEToolbar.dpr   
ImageEnView Actions Image application built using only ImageEnView actions \Demos\Actions\Actions_Viewer\Actions.dpr   
Measurement Accurate measurement of lengths and areas within images (using miMeasureLength, miMeasureRect, miMeasureEllipse, miMeasurePath and miMeasureAngle of MouseInteractGeneral) \Demos\ImageAnalysis\MeasureIt\MeasureIt.dpr   
Brush Tool Using the in-built Brush Tool to paint onto an image \Demos\ImageEditing\BrushTool\PaintBrush.dpr   
Copy Transparent Selection Copying and pasting transparent selections \Demos\ImageEditing\CopySel\CopySel.dpr   
Clone Brush Tool Using the in-built Clone Brush Tool to copy content within an image \Demos\ImageEditing\CloneTool\CloneBrush.dpr   
Cropping Tool Using the in-built Crop Tool to rotate and crop images, and perform perspective corrections \Demos\ImageEditing\CropTool\CropTool.dpr   
Flood Fill Tool Using the Fill Tool to replace the color within an image with a new color or transparency \Demos\ImageEditing\FillTool\FillTool.dpr   
Replace Parts Working with selections in TImageEnView \Demos\ImageEditing\ReplaceParts\ReplaceParts.dpr   
Retouch Tools Using the in-built Retouch Tools to fix an image: smudge, blur, inpaint, smooth, etc. \Demos\ImageEditing\RetouchTool\RetouchTool.dpr   
Rotate Tool Using the in-built Rotate Tool to freely rotate and flip images with the mouse and keyboard \Demos\ImageEditing\RotateTool\RotateTool.dpr   
Select and Crop How to select and crop an image regardless of zoom level \Demos\ImageEditing\SelectAndCrop\ImageEn_Crop.dpr   
Soft Selections Feathering a selection (to give it a soft edge) \Demos\ImageEditing\SoftSelections\SoftSel.dpr   
Soft-Pan Navigation Navigate an image with the cursor (using MouseInteractGeneral = miMovingScroll) \Demos\Display\SoftPan\SoftPan.dpr   
Transition Effects Use of transition effects to smooth the changing of images during a slideshow \Demos\Display\Transitions\Transitions.dpr   
Pan-Zoom Effects Adding interest to static image with Pan-Zoom ("Ken Burns") effects \Demos\Display\PanZoomEffects\PanZoom.dpr   
Zoom Filter Comparison Display of all the available ZoomFilter effects for image smoothing \Demos\Display\ZoomFilter\ZoomFilter.dpr   
External Bitmap Using an external bitmap as the source display for TImageEnView \Demos\Display\ExternalBitmap\ExternalBMP.dpr   
Photosphere Viewer Interactive display of "Equirectangular" images (Google Android PhotoSphere 360 panoramic images) \Demos\Display\Photosphere\Photosphere.dpr   
Project Draw Effect Use of ProjectDraw for advanced image display effects \Demos\Display\ProjectDraw\ProjectDraw.dpr   
Image Loading Performance Options to improve loading performance with TImageEnView \Demos\InputOutput\IEViewPerformance\Performance.dpr   
Print Selection Print only the selected area of an image \Demos\InputOutput\PrintSelected\PrintSelected.dpr   
Touch Screen Gestures Using gestures on a touch screen to pan, zoom and manipulate images \Demos\Other\Gestures\Gestures.dpr   


Examples

procedure TForm1.FormCreate(Sender: TObject);
begin
  // Setup TImageEnView
  ImageEnView1.AutoShrink := True; // Make the image fit within the window
  ImageEnView1.BorderStyle := bsNone; // Normally don't require a 3D border
  ImageEnView1.ZoomFilter := rfFastLinear; // Use better quality drawing when the image is not 100%, Use rfFastLinear for best speed or rfLanczos3 for best quality
  ImageEnView1.MouseInteractGeneral := [miSelect]; // What action should the mouse do?
  ImageEnView1.Proc.UndoLimit := 30; // Allow 30 levels of undo/redo
  IEGlobalSettings().AutoSetBitDepth := True; // Enabling makes any changes to the TImageEnView.IEBitmap.PixelFormat automatically update the SamplesPerPixel/BitsPerSample properties

  ImageEnView1.Blank(); // Initialize state of TImageEnView as empty (instead of defaulting to blank image the size of the control)
end;

// Display an image
ImageEnView1.IO.LoadFromFile('C:\MyImage.jpg');

// Rotate the image
ImageEnView1.Proc.Rotate(270, True);


Methods and Properties

Embedded Components
Public Property  IO (Loading, saving, acquisition and printing)
Public Property  Proc (Image editing and analysis methods)
Public Property  PdfViewer (PDF viewing and manipulation)

Image Display
Published Property  AutoShrink
Published Property  AutoStretch
Published Property  Center
Public Method  CenterImage
Published Property  DelayZoomFilter
Public Property  ExtentX
Public Property  ExtentY
Public Method  Fit
Public Property  FitCropping
Public Method  FitToHeight
Public Method  FitToWidth
Public Method  GetIdealZoom
Public Method  GetMaxViewXY
Public Property  IdealComponentHeight
Public Property  IdealComponentWidth
Public Property  IdealImageHeight
Public Property  IdealImageWidth
Public Property  ImageHorizAlignment
Public Property  ImageVertAlignment
Public Property  OffsetX
Public Property  OffsetY
Public Method  SetViewXY
Public Method  SetViewXYSmooth
Public Method  SetZoomSmooth
Public Property  SmoothScrollValue
Public Property  SmoothZoomValue
Public Method  Stretch
Public Property  ViewX
Public Property  ViewY
Public Method  VisibleBitmapRect
Public Property  Zoom
Public Method  ZoomAt
Public Method  ZoomIn
Published Property  ZoomFilter
Public Method  ZoomOut
Public Method  ZoomSelection
Public Property  ZoomX
Public Property  ZoomY

General Display
Published Property  DisplayGridKind
Public Property  DisplayGridLyr
Public Method  LockPaint
Public Property  LockPaintCount
Public Method  LockUpdate
Public Property  LockUpdateCount
Public Method  PaintRect
Public Method  UnlockPaint
Public Method  UnlockUpdate
Public Method  UnlockUpdateEx
Public Method  Update
Public Method  UpdateNoPaint
Public Method  UpdateRect
Public Method  XBmp2Scr
Public Method  XScr2Bmp
Public Method  YBmp2Scr
Public Method  YScr2Bmp

Background
Published Property  Background
Published Property  BackgroundColor2
Published Property  BackgroundStyle
Published Property  GradientEndColor
Public Method  SetChessboardStyle
Published Property  WallpaperStyle
Published Property  Wallpaper

Scrollbars
Public Property  CurrentScrollBars
Public Property  HScrollBarParams
Published Property  ScrollBars
Public Property  ScrollBarsAlwaysVisible
Public Property  VScrollBarParams

Bitmap
Public Property  Bitmap
Public Method  Blank
Public Method  ChangeResolution
Public Method  Clear
Public Method  ClearAll
Public Method  CopyFromPolygon
Public Method  CopyToPolygon
Public Method  DrawTo
Public Property  IEBitmap
Public Method  IsEmpty
Published Property  LegacyBitmap
Public Method  SetExternalBitmap
Public Method  SetSelectedPixelsColor

Interactive Image Editing
Public Method  BrushShowPropertiesDialog
Public Property  BrushTool
Public Method  CancelTools
Public Property  CloneTool
Public Property  CropTool
Public Method  EnactCurrentTool
Public Property  FillTool
Public Property  KeyboardShortcuts
Public Property  RetouchTool
Public Property  RotateTool

User Interaction
Published Property  AutoToolbars
Public Property  ChromaKeyOptions
Published Property  Cursor
Published Property  EnableInteractionHints
Public Property  Gestures
Public Property  MagicWandMaxFilter
Public Property  MagicWandMode
Public Property  MagicWandSize
Public Property  MagicWandTolerance
Published Property  MouseInteractGeneral
Published Property  MouseInteractLayers
Public Property  MouseScrollRate
Published Property  MouseWheelParams (Default)
Published Property  MouseWheelParamsAlt (Ctrl Key)
Published Property  PopupMenus
Public Method  SetInteractionHint
Public Property  ShiftKeyLock (Lock ssShift, ssCtrl or ssAlt)
Published Property  ShowButtons
Public Property  ZoneCursor
Public Property  ZoneCursorSize

Selections - General
Public Method  AddSelBreak
Public Method  AddSelCurve
Public Method  AddSelPoint
Public Method  ApplyBitmapToSelection
Public Method  AssignSelTo
Public Method  CalcSelectionArea
Public Method  CalcSelectionCentroid
Public Method  CalcSelectionLen
Public Method  CopySelectionToBitmap
Public Method  DelLastSelPoint
Public Method  Deselect
Public Method  DiscardSavedSelection
Public Property  EnableShiftKey (Multiple selections)
Public Method  EndSelect
Public Method  GetGripAt
Public Method  InvertSelection
Public Method  IsPointInsideSelection
Public Method  LoadSelectionFromFile
Public Method  LoadSelectionFromStream
Public Method  MakeSelectionAntiAliased
Public Method  MakeSelectionFeather
Public Method  MergeSelectionFromFile
Public Method  MergeSelectionFromStream
Public Method  MoveSelection (and Resize)
Public Property  PolySel
Public Property  PolySelCount
Public Property  PolySelPoints
Public Method  RestoreSelection
Public Property  SavedSelectionsCount
Public Method  SaveSelection
Public Method  SaveSelectionToFile
Public Method  SaveSelectionToStream
Public Method  Select
Public Method  SelectChromaKey
Public Method  SelectColors
Public Method  SelectCustom
Public Method  SelectNonAlpha
Public Property  Selected
Public Property  SelectedRect
Public Method  SelectEllipse
Public Property  SelectionAbsHeight
Public Property  SelectionAbsWidth
Public Property  SelectionAspectRatio
Published Property  SelectionBase
Public Property  SelectionIntensity
Public Property  SelectionMask
Public Property  SelectionMaskDepth
Published Property  SelectionOptions
Public Method  SelectMagicWand
Public Method  SelectRoundRect
Public Property  SelX1
Public Property  SelX2
Public Property  SelY1
Public Property  SelY2
Public Property  VisibleSelection

Selections - Styling
Public Property  DelayDisplaySelection
Public Method  GetSelectionGripStyle
Public Property  SelColor1
Public Property  SelColor2
Public Property  SelectionGridHeight
Public Property  SelectionGridSize
Public Property  SelectionGridWidth
Public Method  SetSelectionGripStyle
Public Method  SetSelectionMarkOuterStyle

Alpha Channel (Transparency)
Public Property  AlphaChannel
Public Method  CopyToBitmapWithAlpha
Published Property  EnableAlphaChannel
Public Property  HasAlphaChannel
Public Method  RemoveAlphaChannel
Public Method  SetAlphaRangePixelsColor
Public Method  SetSelectedAreaAlpha

Layers - General
Public Property  CurrentLayer
Public Method  FindLayerAt
Public Method  LayersDeselectAll
Published Property  LayerOptions
Public Property  Layers
Public Method  LayersCopyToAlpha
Public Property  LayersCount
Public Property  LayersCurrent
Public Method  LayersDrawTo
Public Method  LayersImport
Public Method  LayersRect
Public Method  LayersSelCount
Public Method  LayersSaveMergedTo
Public Method  LayersSelectAll
Public Property  LayersSelectConstrains
Public Method  MaxLayerHeight
Public Method  MaxLayerWidth

Layers - Display
Public Method  GetLayersGripStyle
Public Method  LayersCaching
Public Property  LayersCropped
Public Property  LayersDrawBox
Published Property  LayersFastDrawing
Public Method  SetLayersBoxStyle
Public Method  SetLayersGripStyle
Public Property  SoftCrop
Public Property  SoftCropValue

Layers - Editing
Public Property  LayerDefaults
Public Method  LayersAdd
Public Method  LayersInsert
Public Method  LayersAlign
Public Method  LayersArrange
Public Property  LayersAutoClosePolylines
Public Method  LayersClear
Public Method  LayersCancelEditor
Public Method  LayersConvertToImageLayers
Public Method  LayersCreateFromAlpha
Public Method  LayersCreateFromClipboard
Public Method  LayersCreateFromEdge
Public Method  LayersCreateFromFile
Public Method  LayersCreateFromSelection
Public Method  LayersCreatePolylineFromSelection
Public Method  LayersCropBackground
Public Property  LayersCurvePoints
Public Property  LayersEditingLayer
Public Method  LayersFixBorders
Public Method  LayersFixRotations
Public Method  LayersFixSizes
Public Method  LayersGroup
Public Method  LayersMerge
Public Method  LayersMergeAll
Public Property  LayersMergeFilter
Public Method  LayersMergeTo
Public Method  LayersNameToIndex
Public Method  LayersNewLayerDialog
Public Method  LayersRepositionAll
Public Method  LayersRemove
Public Property  LayersResizeAspectRatio
Public Method  LayersRotateAll
Public Property  LayersRotateStep
Public Property  LayersRotationFilter
Public Property  LayersRotationUseFilterOnPreview
Public Method  LayersSetProperties
Public Method  LayersShowPropertiesDialog
Public Method  LayersSizeAll
Public Property  LayersTextRotateMode
Public Method  LayersUngroup
Also: Layer Loading and Layer Saving


Animations and Transitions
Public Method  AbortTransition
Public Method  PrepareTransition
Public Method  RunTransition
Public Property  TransitionRunning
Public Property  TransitionTiming
Published Property  Playing
Published Property  PlayLoop
Public Property  PlaySpeed

Rulers and Measurement
Public Property  RulerParams
Public Property  ScaleX
Public Property  ScaleY
Public Method  SetScale
Published Property  ShowRulers

Other
Public Method  Assign
Published Property  AsyncLoading
Published Property  AutoCursors
Public Property  BackBuffer
Public Method  BeginPostFrames
Public Property  DelayTimer
Public Property  DelayZoomTime
Published Property  DesignTimeView
Published Property  DrawVersion
Public Method  EndPostFrames
Public Method  GetCanvas
Public Method  GetRenderRectangles
Public Property  HighlightedPixel
Public Property  IsNavigator
Public Method  LoadProperties
Public Method  LoadState
Public Property  Modified
Public Method  MoveContentTo
Public Property  ProgressTask
Public Method  ResetState
Public Method  SaveProperties
Public Method  SaveState
Public Method  SetNavigator


Events

Display Events
Event  OnSetCursor
Event  OnViewChange
Event  OnViewChanging
Event  OnZoomIn
Event  OnZoomOut

Paint Events
Event  OnDrawBackBuffer
Event  OnDrawBackground
Event  OnDrawCanvas
Event  OnDrawPolygon
Event  OnPaint

User Interaction Events
Event  OnActionExecute
Event  OnBeforeSelectionChange
Event  OnButtonClick
Event  OnButtonState
Event  OnClickLink
Event  OnCustomRetouch
Event  OnImageEnGesture
Event  OnInteractionHint
Event  OnMeasure
Event  OnSelectionChange
Event  OnSelectionChanging
Event  OnMouseEnter
Event  OnMouseInResizingGrip
Event  OnMouseInSel
Event  OnMouseLeave
Event  OnPointer
Event  OnPointerEx
Event  OnSpecialKey
Event  OnUserInteraction
Event  OnVirtualKey

Layer Events
Event  OnActivateTextEditor
Event  OnBeforeDrawLayer
Event  OnDeactivateTextEditor
Event  OnDrawLayer
Event  OnDrawLayerBox
Event  OnDrawLayerGrip
Event  OnLayerNotify
Event  OnLayerNotifyEx
Event  OnLayerMoveSize
Event  OnLayerSelectionChange
Event  OnNewLayer
Event  OnTextEditorKeyDown

Media Events
Event  OnDShowEvent
Event  OnDShowNewFrame
Event  OnMediaFoundationNotify

Ruler Events
Event  OnRulerClick
Event  OnRulerGetText
Event  OnRulerGripClick
Event  OnRulerGripDblClick
Event  OnRulerGripPosChange

Transition Effects
Event  OnTransitionPaint
Event  OnTransitionStep
Event  OnTransitionStop

Other Events
Event  OnAcquireBitmap
Event  OnFinishSmoothTask
Event  OnFinishWork
Event  OnImageChange
Event  OnImageChangeEx
Event  OnImageLoaded
Event  OnImageSeek
Event  OnShowDialog
Event  OnPrintPage
Event  OnProgress
Event  OnSaveUndo
Event  OnUndoRedo