Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.UI.dll
Syntax:
public class RadImageEditorElement : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadImageEditorElement...
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadImageEditorElement class.
public RadImageEditorElement()
Fields
Identifies the CommandsElementWidth dependency property.
public static RadProperty CommandsElementWidthProperty
Identifies the ZoomElementHeight dependency property.
public static RadProperty ZoomElementHeightProperty
Properties
Gets or sets the path that will be used for save operations.
public string BitmapPath { get; set; }
Gets the element that is responsible for drawing the image.
public ImageEditorCanvasElement CanvasElement { get; }
Gets the element containing the buttons with commands.
public ImageEditorCommandsElement CommandsElement { get; }
Gets or sets the width of the CommandsElement.
public int CommandsElementWidth { get; set; }
Gets or sets the current bitmap. If you want to open an image for edit use one of the OpenImage methods.
public Bitmap CurrentBitmap { get; set; }
Gets or sets a factory used for creating dialogs.
public ImageEditorDialogFactory DialogFactory { get; set; }
Gets or sets the original image when performing editing operations.
protected virtual Bitmap OriginalBitmap { get; set; }
Gets the scroll viewer controller.
public RadScrollViewer ScrollViewer { get; }
Gets the element containing the zooming controls.
public ImageEditorZoomElement ZoomElement { get; }
Gets or sets the height of the ZoomElement
public int ZoomElementHeight { get; set; }
Gets or sets the zoom factor of the editor.
public SizeF ZoomFactor { get; set; }
Methods
Blurs the current image with the specified bias.
Calculates the new offset position when zooming to maintain the zoom focal point.
protected virtual SizeF CalculateZoomOffset(SizeF oldCanvasSize, SizeF newCanvasSize, SizeF oldOffset)
The previous canvas size before zooming.
newCanvasSizeSizeFThe new canvas size after zooming.
oldOffsetSizeFThe previous offset position.
Returns:The calculated new offset position as a SizeF.
Cancels the asynchronous loading operation.
public virtual void CancelAsync()
Closes the open dialog.
public void CloseOpenDialog()
Creates the canvas element responsible for image rendering and editing operations.
protected virtual ImageEditorCanvasElement CreateCanvasElement()
A new ImageEditorCanvasElement instance.
Creates the canvas viewport for displaying the image content.
protected virtual RadCanvasViewport CreateCanvasViewport()
RadCanvasViewport
A new RadCanvasViewport instance.
Creates the child elements of this RadImageEditorElement.
protected override void CreateChildElements()
Overrides:
Creates and configures the commands element containing action buttons.
protected virtual ImageEditorCommandsElement CreateCommandsElement()
A configured ImageEditorCommandsElement instance.
Creates and configures the scroll viewer component for the image editor.
protected virtual RadScrollViewer CreateScrollViewer()
A configured RadScrollViewer instance.
Creates and configures the zoom element for controlling image zoom level.
protected virtual ImageEditorZoomElement CreateZoomElement()
A configured ImageEditorZoomElement instance.
Crops the current image to the specified rectangle.
Disposes all bitmap resources including current, original, and undo/redo stack bitmaps.
protected virtual void DisposeBitmaps()
Releases managed resources used by this RadImageEditorElement.
protected override void DisposeManagedResources()
Overrides:
Draws a shape on the current image with the specified properties.
public virtual void DrawShape(GraphicsPath shape, Color fill, Color stroke, int borderThickness, ShapeType? shapeType = null)
The shape of the object to draw.
fillColorThe fill color of the shape.
strokeColorThe stroke color of the shape.
borderThicknessintThe thickness of the border.
shapeTypeShapeType?The type of the shape.
Draws a string on the current image at the specified position, with the specified font size, color, and rotation angle.
public virtual void DrawString(string text, int fontSize, Color foreColor, int x, int y, int angle)
The text to be drawn.
fontSizeintThe size of the font.
foreColorColorThe color of the font.
xintThe x-coordinate of the string position.
yintThe y-coordinate of the string position.
angleintThe rotation angle.
Extracts the pixel data from the original bitmap as a byte array.
protected virtual byte[] GetImageArray()
byte[]
A byte array containing the bitmap's pixel data.
Calculates the number of bytes required for the bitmap data.
protected virtual int GetNumberOfBytes(BitmapData data)
The bitmap data to calculate bytes for.
Returns:The total number of bytes required.
Inverts the colors of the current image.
public virtual void InvertColors()
Loads an image asynchronously.
public virtual void LoadAsync()
Loads an image asynchronously from the specified URL.
Measures the desired size of this RadImageEditorElement.
Fires the event.
protected virtual void OnCurrentImageChanged(ImageChangedEventArgs e)
Fires the event.
protected virtual void OnImageLoadAsyncProgressChanged(ProgressChangedEventArgs e)
Fires the event.
protected virtual void OnImageLoaded(AsyncCompletedEventArgs e)
Raises the ImageSaved event.
Raises the PaintShape event.
protected virtual void OnPaintShape(PaintShapeEventArgs e)
The event arguments containing paint shape information.
Opens an image file for editing using a file dialog.
public virtual void OpenImage()
Opens a bitmap image for editing.
Opens an image file for editing.
public virtual void OpenImage(string fileName)
The name of the file to open.
protected virtual bool ProcessKeyPress(KeyPressEventArgs e)
Redo the last undone operation.
public virtual void Redo()
Resizes the canvas of the current image to the specified width and height, aligning the image according to the specified alignment and filling the background with the specified color.
public virtual void ResizeCanvas(int width, int height, ContentAlignment imageAlignment, Color background)
The desired width.
heightintThe desired height.
imageAlignmentContentAlignmentThe alignment of the image.
backgroundColorThe background color.
Rotates and flips the current image according to the specified RotateFlipType.
public virtual void RotateFlip(RotateFlipType rotateFlipType)
The desired RotateFlipType.
Rounds the corners of the current image with the specified corner radius, background color, border thickness, and border color.
Saves the current image to the default path.
public virtual void SaveImage()
Saves the current image to the specified stream with the specified format.
public virtual void SaveImage(Stream stream, ImageFormat imageFormat)
The stream to save the image to.
imageFormatImageFormatThe format in which to save the image.
Saves the current image to the specified stream.
public virtual void SaveImage(Stream stream)
The stream to save the image to.
Saves the current image to the specified path with the specified format.
public virtual void SaveImage(string path, ImageFormat imageFormat)
The path where the image will be saved.
imageFormatImageFormatThe format in which to save the image.
Saves the current image to the specified path.
public virtual void SaveImage(string path)
The path where the image will be saved.
Saves an image using a file dialog.
public virtual void SaveImageAs()
Saves the current state of the image to the undo stack for later restoration.
public virtual void SaveState()
Sets the hue of the current image to the specified value.
Sets the pixel data of the current bitmap from a byte array.
protected virtual void SetImageArray(ref byte[] rgbValues)
The byte array containing the new pixel data.
Sets the saturation of the current image to the specified value.
public virtual void SetSaturation(int saturation)
The value of the saturation.
Sharpens the current image with the specified strength.
Shows the blur filter dialog for applying blur effects.
public virtual void ShowBlurDialog()
Shows the canvas resize dialog for changing canvas dimensions and background.
public virtual void ShowCanvasResizeDialog()
Shows the contrast adjustment dialog for modifying image contrast and brightness.
public virtual void ShowContrastDialog()
Shows a modal dialog of the specified type for image editing operations.
protected virtual void ShowDialog(Type dialogType)
The type of dialog to display.
Shows the free drawing dialog for freehand drawing on the image.
public virtual void ShowDrawDialog()
Shows the shape drawing dialog for adding geometric shapes to the image.
public virtual void ShowDrawShapeDialog()
Shows the text drawing dialog for adding text to the image.
public virtual void ShowDrawTextDialog()
Shows the hue shift dialog for adjusting image hue values.
public virtual void ShowHueDialog()
Shows the resize dialog for changing image dimensions.
public virtual void ShowResizeDialog()
Shows the round corners dialog for applying rounded corner effects.
public virtual void ShowRoundCornersDialog()
Shows the saturation adjustment dialog for modifying image saturation levels.
public virtual void ShowSaturationDialog()
Shows the sharpen filter dialog for applying sharpening effects.
public virtual void ShowSharpenDialog()
Shows a non-modal top-most dialog of the specified type for interactive image editing operations.
protected virtual void ShowTopMostDialog(Type dialogType)
The type of dialog to display.
Starts the cropping operation on the current image.
public virtual void StartCrop()
Starts drawing a shape on the current image.
Starts the panning operation on the current image.
public virtual void StartPan()
Stops the cropping operation and applies the crop if commit is true.
public virtual void StopCrop(bool commit)
Determines whether to commit the crop operation.
Stops the drawing operation on the current image.
public virtual void StopDrawing()
Stops the panning operation.
public virtual void StopPan()
Undo the last operation performed on the image.
public virtual void Undo()
Updates the enabled state of the undo and redo buttons based on stack availability.
protected virtual void UpdateUndoRedoButtons()
Events
Occurs when a specific operation is performed over the current bitmap
public event ImageChangedEventHandler CurrentImageChanged
Occurs when the progress of an async load operation changes.
public event ProgressChangedEventHandler ImageLoadAsyncProgressChanged
Occurs after an image is loaded in the editor.
public event AsyncCompletedEventHandler ImageLoaded
Occurs when the image is saved.
public event EventHandler ImageSaved
Occurs when an operation results in an error or an exception.
public event ErrorEventHandler OperationError
Allows to customize the painted shape or draw a custom one.
public event PaintShapeEventHandler PaintShape