本文整理汇总了VB.NET中System.Drawing.Imaging.ColorMatrix.ColorMatrix构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET ColorMatrix构造函数的具体用法?VB.NET ColorMatrix怎么用?VB.NET ColorMatrix使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Drawing.Imaging.ColorMatrix
的用法示例。
在下文中一共展示了ColorMatrix构造函数的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: RotateColors
Private Sub RotateColors(ByVal e As PaintEventArgs)
Dim image As Bitmap = New Bitmap("RotationInput.bmp")
Dim imageAttributes As New ImageAttributes()
Dim width As Integer = image.Width
Dim height As Integer = image.Height
Dim degrees As Single = 60.0F
Dim r As Double = degrees * System.Math.PI / 180 ' degrees to radians
Dim colorMatrixElements As Single()() = { _
New Single() {CSng(System.Math.Cos(r)), _
CSng(System.Math.Sin(r)), 0, 0, 0}, _
New Single() {CSng(-System.Math.Sin(r)), _
CSng(-System.Math.Cos(r)), 0, 0, 0}, _
New Single() {0, 0, 2, 0, 0}, _
New Single() {0, 0, 0, 1, 0}, _
New Single() {0, 0, 0, 0, 1}}
Dim colorMatrix As New ColorMatrix(colorMatrixElements)
imageAttributes.SetColorMatrix( _
colorMatrix, _
ColorMatrixFlag.Default, _
ColorAdjustType.Bitmap)
e.Graphics.DrawImage(image, 10, 10, width, height)
' Pass in the destination rectangle (2nd argument), the upper-left corner
' (3rd and 4th arguments), width (5th argument), and height (6th
' argument) of the source rectangle.
e.Graphics.DrawImage( _
image, _
New Rectangle(150, 10, width, height), _
0, 0, _
width, _
height, _
GraphicsUnit.Pixel, _
imageAttributes)
End Sub