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