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 printing, and a TImageEnProc (Proc property) for image editing and analysis (you don't need to add 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:


Debugging Visualizer

You can view the content of a TImageEnView while debugging by hovering over the object and clicking the Inspect button:



Demos

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

User Interaction
Published Property  AllowDrop
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  ApplyBitmapToSelection
Public Method  AssignSelTo
Public Method  CalcSelectionArea
Public Method  CalcSelectionCentroid
Public Method  CalcSelectionLen
Public Method  CopySelectionToBitmap
Public Method  DiscardSavedSelection
Public Property  EnableShiftKey (Multiple selections)
Public Method  GetGripAt
Public Method  IsPointInsideSelection
Public Property  PolySel
Public Property  PolySelCount
Public Property  PolySelPoints
Public Property  Selected
Public Property  SelectedRect
Public Property  SelectionAbsHeight
Public Property  SelectionAbsWidth
Public Property  SelectionLockAspectRatio
Public Property  SelectionMask
Public Property  SelectionMaskDepth
Published Property  SelectionOptions
Public Property  SelX1
Public Property  SelX2
Public Property  SelY1
Public Property  SelY2
Public Property  VisibleSelection

Selections - Editing
Public Method  AddSelBreak
Public Method  AddSelCurve
Public Method  AddSelPoint
Public Method  BeginSelect
Public Method  DelLastSelPoint
Public Method  Deselect
Public Method  EndSelect
Public Method  InvertSelection
Public Method  LoadSelectionFromFile
Public Method  LoadSelectionFromStream
Public Method  MakeSelectionAntiAliased
Public Method  MakeSelectionFeather
Public Method  MergeSelectionFromFile
Public Method  MergeSelectionFromStream
Public Method  MoveSelection (and Resize)
Public Method  RestoreSelection
Public Property  SavedSelectionsCount
Public Method  SaveSelection
Public Method  SaveSelectionToFile
Public Method  SaveSelectionToStream
Published Property  SelectionBase
Public Property  SelectionIntensity
Public Method  Select
Public Method  SelectChromaKey
Public Method  SelectColors
Public Method  SelectCustom
Public Method  SelectEllipse
Public Method  SelectNonAlpha
Public Method  SelectMagicWand
Public Method  SelectRoundRect
Public Method  SelectShape

Selections - Styling
Public Property  DelayDisplaySelection
Public Method  GetSelectionGripStyle
Public Property  SelColor1
Public Property  SelColor2
Public Property  SelectionGridHeight
Public Property  SelectionGridSize
Public Property  SelectionGridWidth
Public Property  SelectionRounding
Public Property  SelectionShape
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 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  LayersCopyToAlpha
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 Property  LayersSnapDist
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
Published Property  TransitionDuration
Published Property  TransitionEffect
Published Property  TransitionParams
Public Property  TransitionRunning
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  HighlightColor
Published Property  ImageEnVersion
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 (Polygon selections)
Event  OnPaint

User Interaction Events
Event  OnActionExecute
Event  OnBeforeSelectionChange
Event  OnButtonClick
Event  OnButtonState
Event  OnClickLink
Event  OnCustomRetouch
Event  OnDropFile
Event  OnImageEnGesture
Event  OnInteractionHint
Event  OnMeasure
Event  OnSelectionChange
Event  OnSelectionChanging
Event  OnMouseInResizingGrip
Event  OnMouseInSel
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  OnIONotify
Event  OnShowDialog
Event  OnPrintPage
Event  OnProgress
Event  OnSaveUndo
Event  OnUndoRedo