Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' ***********************************************************************
- ' Author : Elektro
- ' Created : 01-21-2014
- ' Modified : 01-21-2014
- ' ***********************************************************************
- ' <copyright file="ImageDrawHelper.vb" company="Elektro Studios">
- ' Copyright (c) Elektro Studios. All rights reserved.
- ' </copyright>
- ' ***********************************************************************
- #Region " Public Members Summary "
- ' -------
- ' Methods
- ' -------
- '
- ' Properties.Brightness
- ' Properties.Contrast
- ' Properties.Gamma
- ' Properties.HSL
- ' Properties.Hue
- ' Properties.Opacity
- '
- ' Effects.CameraView
- ' Effects.ColorSubstitution
- ' Effects.ConvertToBlackWhite
- ' Effects.ConvertToNegative
- ' Effects.ConvertToSepia
- ' Effects.Crop
- ' Effects.DistortCorners
- ' Effects.DropShadow
- ' Effects.Fade
- ' Effects.Feather
- ' Effects.Filmstrip
- ' Effects.Flip
- ' Effects.FocalGrayscale
- ' Effects.GaussianBlur
- ' Effects.GlassTable
- ' Effects.Glow
- ' Effects.MakeTransparent
- ' Effects.PerspectiveReflection
- ' Effects.PerspectiveView
- ' Effects.Pixelate
- ' Effects.RemoveColor
- ' Effects.RemoveTransparency
- ' Effects.Resize
- ' Effects.Rotate
- ' Effects.RoundCorners
- ' Effects.Scale
- ' Effects.Sharpen
- ' Effects.Silhouette
- ' Effects.Skew
- ' Effects.Solarize
- ' Effects.Stretch
- ' Effects.Tint
- #End Region
- #Region " Usage Examples "
- ' Dim [ImageElement] As ImageElement = ImageElement.FromFile("C:\Image.png")
- ' Dim [TextElement] As New TextElement With {.Text = "Hello World!"}
- ' ImageDrawHelper.Properties.Brightness([ImageElement], 50)
- ' ImageDrawHelper.Properties.Contrast([ImageElement], 50)
- ' ImageDrawHelper.Properties.Gamma([ImageElement], 50)
- ' ImageDrawHelper.Properties.HSL([ImageElement], 50, 50, 50)
- ' ImageDrawHelper.Properties.Hue([ImageElement], 50)
- ' ImageDrawHelper.Properties.Opacity([ImageElement], 50)
- ' ImageDrawHelper.Effects.CameraView([ImageElement], 30, 25)
- ' ImageDrawHelper.Effects.ColorSubstitution([ImageElement], Color.Black, Color.Fuchsia, 10)
- ' ImageDrawHelper.Effects.ConvertToBlackWhite([ImageElement], DitherMethod.Threshold, 53, False)
- ' ImageDrawHelper.Effects.ConvertToNegative([ImageElement])
- ' ImageDrawHelper.Effects.ConvertToSepia([ImageElement])
- ' ImageDrawHelper.Effects.Crop([ImageElement], 0, 10, 200, 160)
- ' ImageDrawHelper.Effects.DistortCorners([ImageElement], -20, -20, 200, 0, 250, 180, -30, 200)
- ' ImageDrawHelper.Effects.DropShadow([ImageElement], 60, Color.Lime, 270, 6, 10)
- ' ImageDrawHelper.Effects.Fade([ImageElement], FadeShape.Oval, FillType.Gradient, GradientShape.Path)
- ' ImageDrawHelper.Effects.Feather([ImageElement], 5, FeatherShape.Oval)
- ' ImageDrawHelper.Effects.Filmstrip([ImageElement], FilmstripOrientation.Vertical, 150, 180, 0, Color.Yellow, 5)
- ' ImageDrawHelper.Effects.Flip([ImageElement], FlipType.Horizontal)
- ' ImageDrawHelper.Effects.FocalGrayscale([ImageElement], FocalShape.Oval, FillType.Gradient, GradientShape.Path, Color.FromArgb(0, 255, 255, 255), Color.FromArgb(0, 0, 0))
- ' ImageDrawHelper.Effects.GaussianBlur([ImageElement], 5)
- ' ImageDrawHelper.Effects.GlassTable([ImageElement], 50, 25)
- ' ImageDrawHelper.Effects.GlassTable([ImageElement], 50, 25, ReflectionLocation.Custom, 2, 10)
- ' ImageDrawHelper.Effects.Glow([ImageElement], Color.Red, 80, 8)
- ' ImageDrawHelper.Effects.MakeTransparent([ImageElement])
- ' ImageDrawHelper.Effects.PerspectiveReflection([ImageElement], 270, 50, 50, 150, 0)
- ' ImageDrawHelper.Effects.PerspectiveView([ImageElement], 25, PerspectiveOrientation.LeftToRight)
- ' ImageDrawHelper.Effects.Pixelate([ImageElement], 20, 0)
- ' ImageDrawHelper.Effects.RemoveColor([ImageElement], Color.White, 10, ScanDirection.All)
- ' ImageDrawHelper.Effects.RemoveTransparency([ImageElement])
- ' ImageDrawHelper.Effects.Resize([ImageElement], 256, 256, LockAspectRatio.WidthBased, Drawing2D.InterpolationMode.Bicubic)
- ' ImageDrawHelper.Effects.Rotate([ImageElement], 90, Drawing2D.InterpolationMode.Bicubic)
- ' ImageDrawHelper.Effects.RoundCorners([ImageElement], Corners.All, 120)
- ' ImageDrawHelper.Effects.RoundCorners([ImageElement], Corners.All, 20, 10, Color.Red)
- ' ImageDrawHelper.Effects.Scale([ImageElement], 50, 50, Drawing2D.InterpolationMode.Bicubic)
- ' ImageDrawHelper.Effects.Sharpen([ImageElement])
- ' ImageDrawHelper.Effects.Silhouette([ImageElement], Color.RoyalBlue)
- ' ImageDrawHelper.Effects.Skew([ImageElement], SkewType.Parallelogram, -10, SkewOrientation.Horizontal, True)
- ' ImageDrawHelper.Effects.Solarize([ImageElement])
- ' ImageDrawHelper.Effects.Stretch([ImageElement], 90, 150)
- ' ImageDrawHelper.Effects.Tint([ImageElement], Color.Orange)
- ' PictureBox1.BackgroundImage = [ImageElement].GetOutputImage
- #End Region
- #Region " Imports "
- Imports Neodynamic.SDK.ImageDraw
- #End Region
- #Region " ImageDraw Helper "
- Public Class ImageDrawHelper
- #Region " Public Methods "
- ''' <summary>
- ''' Adjusts the properties of an Image Draw Element.
- ''' </summary>
- Public Class Properties
- ''' <summary>
- ''' Adjusts the brightness level of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="BrightnessLevel">
- ''' Indicates the brightness level.
- ''' Values range from -100 to 100.
- ''' </param>
- Public Shared Sub Brightness(ByRef [ImageElement] As ImageElement,
- ByVal BrightnessLevel As Integer)
- ' Create an instance of AdjustBrightness class.
- Dim Action As New AdjustBrightness()
- With Action
- ' Set the Brightness Level.
- .Level = BrightnessLevel
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Adjusts the Contrast level of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="ContrastLevel">
- ''' Indicates the Contrast level.
- ''' Values range from -100 to 100.
- ''' </param>
- Public Shared Sub Contrast(ByRef [ImageElement] As ImageElement,
- ByVal ContrastLevel As Integer)
- ' Create an instance of AdjustContrast class.
- Dim Action As New AdjustContrast
- With Action
- ' Set the Contrast Level.
- .Level = ContrastLevel
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Adjusts the gamma correction value of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="GammaCorrectionValue">
- ''' Indicates the Gamma Correction value.
- ''' Values range from -100 to 100.
- ''' </param>
- Public Shared Sub Gamma(ByRef [ImageElement] As ImageElement,
- ByVal GammaCorrectionValue As Integer)
- ' Create an instance of AdjustGamma class.
- Dim Action As New AdjustGamma
- With Action
- ' Set the Gamma Correction value.
- .Gamma = GammaCorrectionValue
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Adjusts the HUE channel of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="HUEAngle">
- ''' Indicates the HUE Angle.
- ''' Values range from -180 to 180.
- ''' </param>
- Public Shared Sub Hue(ByRef [ImageElement] As ImageElement,
- ByVal HUEAngle As Integer)
- ' Create an instance of AdjustGamma class.
- Dim Action As New AdjustHue
- With Action
- ' Set the HUE Angle.
- .Angle = HUEAngle
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Adjusts the Hue channel, saturation, and lightness levels of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="HUEAngle">
- ''' Indicates the HUE Angle.
- ''' Values range from -180 to 180.
- ''' </param>
- ''' <param name="LightnessLevel">
- ''' Indicates the Lightness level.
- ''' Values range from -100 to 100.
- ''' </param>
- ''' <param name="SaturationLevel">
- ''' Indicates the Saturation level.
- ''' Values range from -100 to 100.
- ''' </param>
- Public Shared Sub HSL(ByRef [ImageElement] As ImageElement,
- ByVal HUEAngle As Integer,
- ByVal LightnessLevel As Integer,
- ByVal SaturationLevel As Integer)
- ' Create an instance of AdjustGamma class.
- Dim Action As New AdjustHSL
- With Action
- ' Set the HUE Angle.
- .Hue = HUEAngle
- ' Set the Lightness Level.
- .Lightness = LightnessLevel
- ' Set the Saturation Level.
- .Saturation = SaturationLevel
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Adjusts the opacity level of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="OpacityLevel">
- ''' Indicates the Opacity Level.
- ''' Values range from 0 to 100.
- ''' </param>
- Public Shared Sub Opacity(ByRef [ImageElement] As ImageElement,
- ByVal OpacityLevel As Integer)
- ' Create an instance of AdjustGamma class.
- Dim Action As New AdjustOpacity
- With Action
- ' Set the Opacity Level.
- .Opacity = OpacityLevel
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- End Class
- ''' <summary>
- ''' Perform some Effects to an Image Draw Element.
- ''' </summary>
- Public Class Effects
- ''' <summary>
- ''' Simulates the camera view on an element.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="VerticalRotationAngle">
- ''' Indicates the vertical rotation angle of a camera's sight line relative
- ''' to the center point of an element.
- ''' Value range from -180 to 180.
- ''' </param>
- ''' <param name="HorizontalRotationAngle">
- ''' Indicates the horizontal rotation angle of a camera's sight line relative
- ''' to the center point of an element.
- ''' Value range from -180 to 180.
- ''' </param>
- Public Shared Sub CameraView(ByRef [ImageElement] As ImageElement,
- ByVal VerticalRotationAngle As Integer,
- ByVal HorizontalRotationAngle As Integer)
- ' Create an instance of CameraView class.
- Dim Action As New CameraView()
- With Action
- ' Set the vertical rotation angle of a camera's sight line relative to the center point of an element.
- .Elevation = VerticalRotationAngle
- ' Set the horizontal rotation angle of a camera's sight line relative to the center point of an element.
- .Azimuth = HorizontalRotationAngle
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Converts an element to black/white or monochrome.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="DitherMethod">
- ''' Indicates the dithering method to be used for Black/White conversion.
- ''' </param>
- ''' <param name="Threshold">
- ''' Indicates the threshold percentage.
- ''' Value range from 0 to 100.
- ''' </param>
- ''' <param name="ReverseEffect">
- ''' Indicates whether black/white effect should be reversed.
- ''' </param>
- Public Shared Sub ConvertToBlackWhite(ByRef [ImageElement] As ImageElement,
- ByVal DitherMethod As DitherMethod,
- ByVal Threshold As Integer,
- ByVal ReverseEffect As Boolean)
- ' Create an instance of ConvertToBlackWhite class.
- Dim Action As New ConvertToBlackWhite()
- With Action
- ' Set the dithering method to be used for Black/White conversion.
- .DitherMethod = DitherMethod
- ' Set the threshold percentage.
- .Threshold = Threshold
- ' Set whether black/white effect should be reversed.
- .ReverseEffect = ReverseEffect
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Converts an element to grayscale.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- Public Shared Sub ConvertToGrayscale(ByRef [ImageElement] As ImageElement)
- ' Create an instance of ConvertToGrayscale class.
- Dim Action As New ConvertToGrayscale
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Converts an element to negative.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- Public Shared Sub ConvertToNegative(ByRef [ImageElement] As ImageElement)
- ' Create an instance of ConvertToNegative class.
- Dim Action As New ConvertToNegative
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Converts an element to sepia.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- Public Shared Sub ConvertToSepia(ByRef [ImageElement] As ImageElement)
- ' Create an instance of ConvertToSepia class.
- Dim Action As New ConvertToSepia
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Replaces one color (old color) with another (new color) on an element.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="OldColor">
- ''' Indicates the old color to be replaced on the target element.
- ''' </param>
- ''' <param name="Newcolor">
- ''' Indicates the new color to replace the old color on the target element.
- ''' </param>
- ''' <param name="ColorTolerance">
- ''' Indicates the color tolerance for replacing pixels.
- ''' Color Tolerance represents the tonal range of colors that will be replaced by taking
- ''' the specified color as starting point.
- ''' If you enter 0, only adjacent pixels of exactly the same tone as the specified color will be replaced;
- ''' otherwise, a wider range of tones will be replaced
- ''' </param>
- Public Shared Sub ColorSubstitution(ByRef [ImageElement] As ImageElement,
- ByVal OldColor As Color,
- ByVal Newcolor As Color,
- ByVal ColorTolerance As Byte)
- ' Create an instance of ColorSubstitution class
- Dim Action As New ColorSubstitution()
- With Action
- ' Set the old color to be replaced on the target element.
- .OldColor = OldColor
- ' Set the color tolerance for replacing pixels.
- .ColorTolerance = ColorTolerance
- ' Set the new color to replace the old color on the target element.
- .NewColor = Newcolor
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Crops a rectangular section from an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="X">
- ''' Indicates the X-coordinate of the cropping rectangle.
- ''' </param>
- ''' <param name="Y">
- ''' Indicates the Y-coordinate of the cropping rectangle.</param>
- ''' <param name="Width">
- ''' Indicates the Width of the cropping rectangle.
- ''' </param>
- ''' <param name="Height">
- ''' Indicates the Height of the cropping rectangle.
- ''' </param>
- Public Shared Sub Crop(ByRef [ImageElement] As ImageElement,
- ByVal X As Integer,
- ByVal Y As Integer,
- ByVal Width As Integer,
- ByVal Height As Integer)
- ' Create an instance of Crop class.
- Dim Action As New Crop()
- With Action
- ' Set the X-coordinate of the cropping rectangle.
- .X = X
- ' Set the Y-coordinate of the cropping rectangle.
- .Y = Y
- ' Set the Width of the cropping rectangle.
- .Width = Width
- ' Set the Height of the cropping rectangle.
- .Height = Height
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Distorts an element by changing the coordinates of the four corners defined by the element's boundaries.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="X1">
- ''' Indicates the new upper-left corner x-coordinate.
- ''' </param>
- ''' <param name="Y1">
- ''' Indicates the new upper-left corner y-coordinate.
- ''' </param>
- ''' <param name="X2">
- ''' Indicates the upper-right corner x-coordinate.
- ''' </param>
- ''' <param name="Y2">
- ''' Indicates the upper-right corner y-coordinate.
- ''' </param>
- ''' <param name="X3">
- ''' Indicates the new bottom-right corner x-coordinate.
- ''' </param>
- ''' <param name="Y3">
- ''' Indicates the new bottom-right corner y-coordinate.
- ''' </param>
- ''' <param name="X4">
- ''' Indicates the new bottom-left corner x-coordinate.
- ''' </param>
- ''' <param name="Y4">
- ''' Indicates the new bottom-left corner y-coordinate.
- ''' </param>
- Public Shared Sub DistortCorners(ByRef [ImageElement] As ImageElement,
- ByVal X1 As Integer, ByVal Y1 As Integer,
- ByVal X2 As Integer, ByVal Y2 As Integer,
- ByVal X3 As Integer, ByVal Y3 As Integer,
- ByVal X4 As Integer, ByVal Y4 As Integer)
- ' Create an instance of DistortCorners class.
- Dim Action As New DistortCorners()
- With Action
- ' Set the new upper-left corner X,Y coordinates.
- .X1 = X1 : .Y1 = Y1
- ' Set the new upper-right corner X,Y coordinates.
- .X2 = X2 : .Y2 = Y2
- ' Set the new bottom-right corner X,Y coordinates.
- .X3 = X3 : .Y3 = Y3
- ' Set the new bottom-left corner X,Y coordinates.
- .X4 = X4 : .Y4 = Y4
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Adds drop shadows to an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Opacity">
- ''' Indicates the percentage of transparency in the shadow.
- ''' Value from 0 to 100.
- ''' </param>
- ''' <param name="ShadowColor">
- ''' Indicates the color of the shadow.
- ''' </param>
- ''' <param name="ShadowAngle">
- ''' Indicates the direction of the shadow.
- ''' </param>
- ''' <param name="ShadowDistance">
- ''' Indicates the distance of the shadow from the object.
- ''' </param>
- ''' <param name="ShadowSoftness">
- ''' Indicates the sharpness of the shadow.
- ''' </param>
- Public Shared Sub DropShadow(ByRef [ImageElement] As ImageElement,
- ByVal Opacity As Integer,
- ByVal ShadowColor As Color,
- ByVal ShadowAngle As Integer,
- ByVal ShadowDistance As Integer,
- ByVal ShadowSoftness As Integer)
- ' Create an instance of DropShadow class.
- Dim Action As New DropShadow
- With Action
- ' Set the percentage of transparency in the shadow.
- .Opacity = Opacity
- ' Set the color of the shadow.
- .Color = ShadowColor
- ' Set the direction of the shadow.
- .Angle = ShadowAngle
- ' Set the distance of the shadow from the object.
- .Distance = ShadowDistance
- ' Set the sharpness of the shadow.
- .Softness = ShadowSoftness
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Performs fading.
- ''' Fading action/effect gradually fades a given area/region of the target Element into the background.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="FadeShape">
- ''' Indicates the the area/region's shape used for fading.
- ''' </param>
- ''' <param name="FillType">
- ''' Indicates the fill type.
- ''' </param>
- ''' <param name="GradientShape">
- ''' Indicates the shape used for creating gradient fills.
- ''' </param>
- ''' <param name="Location">
- ''' Indicates how the area/region's shape used for fading will be positioned.
- ''' If it is FadeLocation.Center, then the area/region will be centered on the target Element;
- ''' otherwise, the area/region's location must be specified by LocationX and LocationY properties.
- ''' </param>
- ''' <param name="LocationX">
- ''' Indicates the x-coordinate of the top side of the fading shape area/region.
- ''' </param>
- ''' <param name="LocationY">
- ''' Indicates the y-coordinate of the top side of the fading shape area/region.
- ''' </param>
- ''' <param name="Sizing">
- ''' Indicates the area/region's size type used for fading.
- ''' If it is FadeSizing.Fit, then the area/region's size will automatically fit to the target Element's size;
- ''' otherwise, the area/region's size must be specified by SizingWidth and SizingHeight properties.
- ''' </param>
- ''' <param name="SizingHeight">
- ''' Indicates the height of the fading shape area/region.
- ''' </param>
- ''' <param name="SizingWidth">
- ''' Indicates the width of the fading shape area/region.
- ''' </param>
- Public Shared Sub Fade(ByRef [ImageElement] As ImageElement,
- ByVal FadeShape As FadeShape,
- ByVal FillType As FillType,
- ByVal GradientShape As GradientShape,
- Optional ByVal Location As FadeLocation = FadeLocation.Center,
- Optional ByVal LocationX As Integer = 1,
- Optional ByVal LocationY As Integer = 1,
- Optional ByVal Sizing As FadeSizing = FadeSizing.Fit,
- Optional ByVal SizingHeight As Integer = 1,
- Optional ByVal SizingWidth As Integer = 1)
- ' Create an instance of Fade class
- Dim Action As New Fade()
- With Action
- ' Set the the area/region's shape used for fading.
- .Shape = FadeShape
- ' Set the fill type.
- .ShapeFill.Type = FillType
- ' Set the shape used for creating gradient fills.
- .ShapeFill.GradientShape = GradientShape
- ' Set how the area/region's shape used for fading will be positioned.
- .Location = Location
- ' Set the x-coordinate of the left side of the fading shape area/region.
- .X = LocationX
- ' Set the y-coordinate of the top side of the fading shape area/region.
- .Y = LocationY
- ' Set the area/region's size type used for fading.
- .Sizing = Sizing
- ' Set the height of the fading shape area/region.
- .Height = SizingHeight
- ' Set the width of the fading shape area/region.
- .Width = SizingWidth
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Performs feathering.
- ''' Feathering blurs the edges of a given area/region on the target Element,
- ''' blending it into the background.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="FeatherRadius">
- ''' Indicates the amount of feathering.
- ''' Value range from 0 to 100.
- ''' </param>
- ''' <param name="FeatherShape">
- ''' Indicates the area/region's shape used for feathering.
- ''' </param>
- Public Shared Sub Feather(ByRef [ImageElement] As ImageElement,
- ByVal FeatherRadius As Integer,
- ByVal FeatherShape As FeatherShape)
- ' Create an instance of Fade class
- Dim Action As New Feather()
- With Action
- ' Set the amount of feathering.
- .FeatherRadius = FeatherRadius
- ' Set the area/region's shape used for feathering.
- .Shape = FeatherShape
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Creates a Filmstrip representation of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Orientation">
- ''' Indicates the orientation of the filmstrip.
- ''' </param>
- ''' <param name="Width">
- ''' Indicates the width of the filmstrip.
- ''' </param>
- ''' <param name="Height">
- ''' Indicates the height of the filmstrip.
- ''' </param>
- ''' <param name="Roundness">
- ''' Indicates the corner roundness of the filmstrip content.
- ''' </param>
- ''' <param name="PerforationColor">
- ''' Indicates the perforations color of the filmstrip.
- ''' </param>
- ''' <param name="PerforationWidth">
- ''' Indicates the perforations Width of the filmstrip.
- ''' </param>
- Public Shared Sub Filmstrip(ByRef [ImageElement] As ImageElement,
- ByVal Orientation As FilmstripOrientation,
- ByVal Width As Integer,
- ByVal Height As Integer,
- ByVal Roundness As Integer,
- ByVal PerforationColor As Color,
- ByVal PerforationWidth As Integer)
- ' Create an instance of Fade class
- Dim Action As New Filmstrip()
- With Action
- ' Set the orientation of the filmstrip.
- .Orientation = Orientation
- ' Set the width of the filmstrip.
- .Width = Width
- ' Set the height of the filmstrip.
- .Height = Height
- ' Set the corner roundness of the filmstrip content.
- .Roundness = Roundness
- ' Set sets the perforations color of the filmstrip.
- .PerforationColor = PerforationColor
- ' Set the perforations width of the filmstrip.
- .PerforationWidth = PerforationWidth
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Flips an image across its vertical or horizontal axis.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Direction">
- ''' Indicates the direction used to flip an image.
- ''' </param>
- Public Shared Sub Flip(ByRef [ImageElement] As ImageElement,
- ByVal Direction As FlipType)
- ' Create an instance of Fade class
- Dim Action As New Flip()
- With Action
- ' Set the direction used to flip an image.
- .Type = Direction
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Creates grayscale element with a colored focal point represented by a shape.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="FocalShape">
- ''' Indicates the area/region's shape used for creating the colored focal point.
- ''' </param>
- ''' <param name="FillType">
- ''' Indicates the fill type.
- ''' </param>
- ''' <param name="GradientShape">
- ''' Indicates the shape used for creating gradient fills.
- ''' </param>
- ''' <param name="GradientColor1">
- ''' Indicates the starting color used by Gradient fill type.
- ''' </param>
- ''' <param name="GradientColor2">
- ''' Indicates the ending color used by Gradient fill type.
- ''' </param>
- ''' <param name="Location">
- ''' Indicates how the area/region's shape used for creating the colored focal point will be positioned.
- ''' If it is FocalLocation.Center, then the area/region will be centered on the target Element;
- ''' otherwise, the area/region's location must be specified by LocationX and LocationY properties.
- ''' </param>
- ''' <param name="LocationX">
- ''' Indicates the x-coordinate of the left side of the focal shape area/region.
- ''' </param>
- ''' <param name="LocationY">
- ''' Indicates the y-coordinate of the left side of the focal shape area/region.
- ''' </param>
- ''' <param name="Sizing">
- ''' Indicates the area/region's size type used for creating the colored focal point.
- ''' If it is FocalSizing.Fit, then the area/region's size will automatically fit to the target Element's size;
- ''' otherwise, the area/region's size must be specified by SizingWidth and SizingHeight properties.
- ''' </param>
- ''' <param name="SizingHeight">
- ''' Indicates the height of the focal shape area/region.
- ''' </param>
- ''' <param name="SizingWidth">
- ''' Indicates the width of the focal shape area/region.
- ''' </param>
- Public Shared Sub FocalGrayscale(ByRef [ImageElement] As ImageElement,
- ByVal FocalShape As FocalShape,
- ByVal FillType As FillType,
- ByVal GradientShape As GradientShape,
- ByVal GradientColor1 As Color,
- ByVal GradientColor2 As Color,
- Optional ByVal Location As FocalLocation = FocalLocation.Center,
- Optional ByVal LocationX As Integer = 1,
- Optional ByVal LocationY As Integer = 1,
- Optional ByVal Sizing As FocalSizing = FocalSizing.Fit,
- Optional ByVal SizingHeight As Integer = 1,
- Optional ByVal SizingWidth As Integer = 1)
- ' Create an instance of Fade class
- Dim Action As New FocalGrayscale()
- With Action
- ' Set the area/region's shape used for creating the colored focal point.
- .Shape = FocalShape
- ' Set the fill type.
- .ShapeFill.Type = FillType
- ' Set the shape used for creating gradient fills.
- .ShapeFill.GradientShape = GradientShape
- ' Set the starting color used by Gradient fill type.
- .ShapeFill.GradientColor1 = GradientColor1
- ' Set the ending color used by Gradient fill type.
- .ShapeFill.GradientColor2 = GradientColor2
- ' Set how the area/region's shape used for creating the colored focal point will be positioned.
- .Location = Location
- ' Set the x-coordinate of the left side of the focal shape area/region.
- .X = LocationX
- ' Set the y-coordinate of the left side of the focal shape area/region.
- .Y = LocationY
- ' Set the area/region's size type used for creating the colored focal point.
- .Sizing = Sizing
- ' Set the height of the focal shape area/region.
- .Height = SizingHeight
- ' Set the width of the focal shape area/region.
- .Width = SizingWidth
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Softens the look of an element.
- ''' Gaussian Blur applies a weighted average of blur to each pixel producing a hazy effect.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Radius">
- ''' Indicates the strength of the blur effect.
- ''' Value range from 0 to 50.
- ''' </param>
- Public Shared Sub GaussianBlur(ByRef [ImageElement] As ImageElement,
- ByVal Radius As Integer)
- ' Create an instance of GaussianBlur class
- Dim Action As New GaussianBlur()
- With Action
- ' Set the strength of the blur effect.
- .Radius = Radius
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Creates a glass table effect on an image.
- ''' The glass table effect adds a reflection of an image just below it.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="ReflectionOpacity">
- ''' Indicates the percentage of transparency in the reflection.
- ''' Value range from 0 to 100.
- ''' </param>
- ''' <param name="ReflectionPercentage">
- ''' Indicates the percentage of the image height that will be reflected.
- ''' Value range from 0 to 100.
- ''' </param>
- ''' <param name="ReflectionLocation">
- ''' Indicates how the reflection of the image will be positioned.
- ''' If it is ReflectionLocation.Auto, then the reflection will be positioned just below of the image
- ''' based on its dimensions;
- ''' otherwise, the reflection position must be specified by ReflectionLocationX and ReflectionLocationY properties.
- ''' </param>
- ''' <param name="ReflectionLocationX">
- ''' Indicates the x-coordinate of the left side of the reflection image.
- ''' .</param>
- ''' <param name="ReflectionLocationY">
- ''' Indicates the y-coordinate of the top side of the reflection image.
- ''' </param>
- Public Shared Sub GlassTable(ByRef [ImageElement] As ImageElement,
- ByVal ReflectionOpacity As Integer,
- ByVal ReflectionPercentage As Integer,
- Optional ByVal ReflectionLocation As ReflectionLocation = ReflectionLocation.Auto,
- Optional ByVal ReflectionLocationX As Integer = 1,
- Optional ByVal ReflectionLocationY As Integer = 1)
- ' Create an instance of GlassTable class.
- Dim Action As New GlassTable()
- With Action
- ' Set the percentage of transparency in the reflection.
- .ReflectionOpacity = ReflectionOpacity
- ' Set the percentage of the image height that will be reflected.
- .ReflectionPercentage = ReflectionPercentage
- ' Set how the reflection of the image will be positioned.
- .ReflectionLocation = ReflectionLocation
- ' Set the x-coordinate of the left side of the reflection image.
- .ReflectionLocationX = ReflectionLocationX
- ' Set the y-coordinate of the top side of the reflection image.
- .ReflectionLocationY = ReflectionLocationY
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Adds glow effect to an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="GlowColor">
- ''' Indicates the Glow color.
- ''' </param>
- ''' <param name="Opacity">
- ''' Indicates the percentage of transparency in the glow.
- ''' Value range from 0 to 100.
- ''' </param>
- ''' <param name="Softness">
- ''' Indicates the sharpness of the glow.
- ''' </param>
- Public Shared Sub Glow(ByRef [ImageElement] As ImageElement,
- ByVal GlowColor As Color,
- ByVal Opacity As Integer,
- ByVal Softness As Integer)
- ' Create an instance of Glow class.
- Dim Action As New Glow()
- With Action
- ' Set the Glow color.
- .Color = GlowColor
- ' Set the percentage of transparency in the glow.
- .Opacity = Opacity
- ' Set the sharpness of the glow.
- .Softness = Softness
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Makes transparent color for an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- Public Shared Sub MakeTransparent(ByRef [ImageElement] As ImageElement)
- ' Create an instance of MakeTransparent class
- Dim Action As New MakeTransparent()
- With Action
- ' Set whether the first pixel color of an image will be used as the transparent color.
- .UseFirstPixel = True
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Makes transparent color for an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Color">
- ''' Indicates the transparent color.
- ''' </param>
- ''' <param name="ColorTolerance">
- ''' Indicates the color tolerance for transparency.
- ''' Color Tolerance represents the tonal range of colors that will be converted to
- ''' transparent taking the specified color as starting point.
- ''' If you enter 0, only adjacent pixels of exactly the same tone as the specified color will be
- ''' converted to transparent;
- ''' otherwise, a wider range of tones will be converted.
- ''' </param>
- ''' <param name="ScanDirection">
- ''' Indicates the direction of the pixel scanning process.
- ''' </param>
- Public Shared Sub MakeTransparent(ByRef [ImageElement] As ImageElement,
- ByVal Color As Color,
- ByVal ColorTolerance As Byte,
- ByVal ScanDirection As ScanDirection)
- ' Create an instance of MakeTransparent class
- Dim Action As New MakeTransparent()
- With Action
- ' Set whether the first pixel color of an image will be used as the transparent color.
- .UseFirstPixel = False
- ' Set the transparent color.
- .Color = Color
- ' Set the color tolerance for transparency.
- .ColorTolerance = ColorTolerance
- ' Set the direction of the pixel scanning process.
- .ScanDirection = ScanDirection
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Adds perspective reflection to an element.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Angle">
- ''' Indicates the direction of the perspective reflection.
- ''' Value range from 0 to 360.
- ''' </param>
- ''' <param name="Opacity">
- ''' Indicates the percentage of transparency in the reflection.
- ''' </param>
- ''' <param name="Length">
- ''' Indicates the length of the perspective reflection.
- ''' </param>
- ''' <param name="WidthPercentage">
- ''' Indicates the width percentage of the perspective reflection based on the element's width.
- ''' </param>
- ''' <param name="OffsetY">
- ''' Indicates the Y-axis offset value for the perspective reflection.
- ''' </param>
- Public Shared Sub PerspectiveReflection(ByRef [ImageElement] As ImageElement,
- ByVal Angle As Integer,
- ByVal Opacity As Integer,
- ByVal Length As Integer,
- ByVal WidthPercentage As Integer,
- ByVal OffsetY As Integer)
- ' Create an instance of PerspectiveView class
- Dim Action As New PerspectiveReflection()
- With Action
- ' Set the direction of the perspective reflection.
- .Angle = Angle
- ' Set the percentage of transparency in the reflection.
- .Opacity = Opacity
- ' Set the length of the perspective reflection.
- .Length = Length
- ' Set the width percentage of the perspective reflection based on the element's width.
- .WidthPercentage = WidthPercentage
- ' Set the Y-axis offset value for the perspective reflection.
- .OffsetY = OffsetY
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Simulates a perspective view of an element.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Angle">
- ''' Indicates the.
- ''' Value range from 0 to 90.
- ''' </param>
- ''' <param name="Orientation">
- ''' Indicates the perspective view orientation.
- ''' </param>
- Public Shared Sub PerspectiveView(ByRef [ImageElement] As ImageElement,
- ByVal Angle As Integer,
- ByVal Orientation As PerspectiveOrientation)
- ' Create an instance of PerspectiveView class
- Dim Action As New PerspectiveView()
- With Action
- ' Set the perspective view angle.
- .Angle = Angle
- ' Set the perspective view orientation.
- .Orientation = Orientation
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Pixelates an element.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="PixelSize">
- ''' Indicates the pixel size.
- ''' </param>
- ''' <param name="FadePercent">
- ''' Indicates the fade percentage.
- ''' Value range from 0 to 100.
- ''' </param>
- Public Shared Sub Pixelate(ByRef [ImageElement] As ImageElement,
- ByVal PixelSize As Integer,
- ByVal FadePercent As Integer)
- ' Create an instance of Pixelate class
- Dim Action As New Pixelate()
- With Action
- ' Set the pixel size.
- .PixelSize = PixelSize
- ' Set the fade percentage.
- .Fade = FadePercent
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Removes a color from an element and automatically resizes it.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Color">
- ''' Indicates the color to be removed from the target element.
- ''' </param>
- ''' <param name="ColorTolerance">
- ''' Indicates the color tolerance for removing pixels.
- ''' Color Tolerance represents the tonal range of colors that will be removed taking
- ''' the specified color as starting point.
- ''' If you enter 0, only adjacent pixels of exactly the same tone as the specified color will be removed;
- ''' otherwise, a wider range of tones will be removed.
- ''' </param>
- ''' <param name="ScanDirection">
- ''' Indicates the direction of the pixel scanning process.
- ''' </param>
- Public Shared Sub RemoveColor(ByRef [ImageElement] As ImageElement,
- ByVal Color As Color,
- ByVal ColorTolerance As Byte,
- ByVal ScanDirection As ScanDirection)
- ' Create an instance of RemovePixel class
- Dim Action As New RemovePixel()
- With Action
- ' Set the color to be removed from the target element.
- .Color = Color
- ' Set the color tolerance for removing pixels.
- .ColorTolerance = ColorTolerance
- ' Set the direction of the pixel scanning process.
- .ScanDirection = ScanDirection
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Removes transparent pixels from an element and automatically resizes it.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- Public Shared Sub RemoveTransparency(ByRef [ImageElement] As ImageElement)
- ' Create an instance of RemoveTransparency class
- Dim Action As New RemoveTransparency()
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Changes the size of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Width">
- ''' Indicates the new image Width.
- ''' </param>
- ''' <param name="Height">
- ''' Indicates the new image Height.
- ''' </param>
- ''' <param name="LockAspectRatio">
- ''' Indicates how element's proportions are maintained.
- ''' </param>
- ''' <param name="InterpolationMode">
- ''' Indicates the algorithm that is used when images are scaled or rotated.
- ''' </param>
- Public Shared Sub Resize(ByRef [ImageElement] As ImageElement,
- ByVal Width As Integer,
- ByVal Height As Integer,
- ByVal LockAspectRatio As LockAspectRatio,
- ByVal InterpolationMode As Drawing2D.InterpolationMode)
- ' Create an instance of Resize class
- Dim Action As New Resize()
- With Action
- ' Set the new image Width.
- .Width = Width
- ' Set the new image Height.
- .Height = Height
- ' Set how element's proportions are maintained.
- .LockAspectRatio = LockAspectRatio
- ' Set the algorithm that is used when images are scaled or rotated.
- .InterpolationMode = InterpolationMode
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Rotates an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Angle">
- ''' Indicates the rotation angle.
- ''' Value range from 0 to 360.
- ''' </param>
- ''' <param name="InterpolationMode">
- ''' Indicates the algorithm that is used when images are scaled or rotated.
- ''' </param>
- Public Shared Sub Rotate(ByRef [ImageElement] As ImageElement,
- ByVal Angle As Integer,
- ByVal InterpolationMode As Drawing2D.InterpolationMode)
- ' Create an instance of Rotate class
- Dim Action As New Rotate()
- With Action
- ' Set the rotation angle.
- .Angle = Angle
- ' Set the algorithm that is used when images are scaled or rotated.
- .InterpolationMode = InterpolationMode
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Rounds image corners.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Corners">
- ''' Indicates what corners will be rounded.
- ''' </param>
- ''' <param name="Roundness">
- ''' Indicates the corner roundness.
- ''' </param>
- Public Shared Sub RoundCorners(ByRef [ImageElement] As ImageElement,
- ByVal Corners As Corners,
- ByVal Roundness As Integer)
- ' Create an instance of RoundCorners class
- Dim Action As New RoundCorners()
- With Action
- ' Set what corners will be rounded.
- .Corners = Corners
- ' Set the corner roundness.
- .Roundness = Roundness
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Rounds image corners.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Corners">
- ''' Indicates what corners will be rounded.
- ''' </param>
- ''' <param name="Roundness">
- ''' Indicates the corner roundness.
- ''' </param>
- ''' <param name="BorderWidth">
- ''' Indicates the border width.
- ''' </param>
- ''' <param name="BorderColor">
- ''' Indicates the border color.
- ''' </param>
- Public Shared Sub RoundCorners(ByRef [ImageElement] As ImageElement,
- ByVal Corners As Corners,
- ByVal Roundness As Integer,
- ByVal BorderWidth As Integer,
- ByVal BorderColor As Color)
- ' Create an instance of RoundCorners class
- Dim Action As New RoundCorners()
- With Action
- ' Set what corners will be rounded.
- .Corners = Corners
- ' Set the corner roundness.
- .Roundness = Roundness
- ' Set the border width.
- .BorderWidth = BorderWidth
- ' Set the border color.
- .BorderColor = BorderColor
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Enlarges or reduces the size of an image.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="WidthPercentage">
- ''' Indicates the new element Width based on a percentage of the original Width.
- ''' </param>
- ''' <param name="HeightPercentage">
- ''' Indicates the new element Height based on a percentage of the original Height.
- ''' </param>
- ''' <param name="InterpolationMode">
- ''' Indicates the algorithm that is used when images are scaled or rotated.
- ''' </param>
- Public Shared Sub Scale(ByRef [ImageElement] As ImageElement,
- ByVal WidthPercentage As Integer,
- ByVal HeightPercentage As Integer,
- ByVal InterpolationMode As Drawing2D.InterpolationMode)
- ' Create an instance of Scale class
- Dim Action As New Scale()
- With Action
- ' Set the new element Width based on a percentage of the original Width.
- .WidthPercentage = WidthPercentage
- ' Set the new element Height based on a percentage of the original Height.
- .HeightPercentage = HeightPercentage
- ' Set the algorithm that is used when images are scaled or rotated.
- .InterpolationMode = InterpolationMode
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Sharpens an element trying to enhance the overall visual impression.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- Public Shared Sub Sharpen(ByRef [ImageElement] As ImageElement)
- ' Create an instance of Sharpen class
- Dim Action As New Sharpen()
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Creates a Silhouette of an element.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="SilhouetteColor">
- ''' Indicates the Silhouette color.
- ''' </param>
- Public Shared Sub Silhouette(ByRef [ImageElement] As ImageElement,
- ByVal SilhouetteColor As Color)
- ' Create an instance of Silhouette class
- Dim Action As New Silhouette()
- With Action
- ' Set the Silhouette color.
- .Color = SilhouetteColor
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Skews an element.
- ''' Skewing an element transforms it by slanting it along the horizontal or vertical axis.
- ''' When skewed, an element pivots on its origin point.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Type">
- ''' Indicates the skewing type.
- ''' </param>
- ''' <param name="Angle">
- ''' Indicates the skewing angle.
- ''' Value ange from -45 to 45.
- ''' </param>
- ''' <param name="Orientation">
- ''' Indicates the skewing orientation.
- ''' </param>
- ''' <param name="ConstrainProportions">
- ''' Indicates whether maintaing the same proportions as the original.
- ''' </param>
- Public Shared Sub Skew(ByRef [ImageElement] As ImageElement,
- ByVal Type As SkewType,
- ByVal Angle As Integer,
- ByVal Orientation As SkewOrientation,
- ByVal ConstrainProportions As Boolean)
- ' Create an instance of Skew class
- Dim Action As New Skew()
- With Action
- ' Set the skewing angle.
- .Angle = Angle
- ' Set the skewing type.
- .Type = Type
- ' Set the skewing orientation.
- .Orientation = Orientation
- ' Set whether maintaing the same proportions as the original.
- .ConstrainProportions = ConstrainProportions
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Solarizes an element.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- Public Shared Sub Solarize(ByRef [ImageElement] As ImageElement)
- ' Create an instance of Solarize class
- Dim Action As New Solarize()
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Stretches an image to fit a given size.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="Width">
- ''' Indicates the new element Width.
- ''' </param>
- ''' <param name="Height">
- ''' Indicates the new element Height.
- ''' </param>
- Public Shared Sub Stretch(ByRef [ImageElement] As ImageElement,
- ByVal Width As Integer,
- ByVal Height As Integer)
- ' Create an instance of Stretch class
- Dim Action As New Stretch()
- With Action
- ' Set the new image Width.
- .Width = Width
- ' Set the new image Height.
- .Height = Height
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- ''' <summary>
- ''' Creates a tinted look of an element.
- ''' </summary>
- ''' <param name="ImageElement">
- ''' Indicates the image draw element.
- ''' </param>
- ''' <param name="TintColor">
- ''' Indicates the color used for tinting.
- ''' </param>
- Public Shared Sub Tint(ByRef [ImageElement] As ImageElement,
- ByVal TintColor As Color)
- ' Create an instance of Tint class
- Dim Action As New Tint()
- With Action
- ' Set the color used for tinting.
- .Color = TintColor
- End With
- ' Apply the action on the ImageElement.
- [ImageElement].Actions.Add(Action)
- End Sub
- End Class
- #End Region
- End Class
- #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement