如何:旋转颜色

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/16 00:19:52
如何:旋转颜色

如何:旋转颜色
如何:旋转颜色

如何:旋转颜色
下面的示例将一个使用一种颜色 (1, 0, 0.6) 的图像围绕蓝色轴旋转 60 度.
旋转角度在与红色-绿色平面平行的平面上扫出.
下面的插图在左侧显示原来的图像,在右侧显示颜色旋转后的图像.
下面的插图形象地显示利用下面的代码进行的颜色旋转.C#VBPrivateSubRotateColors(ByValeAsPaintEventArgs)DimimageAsBitmap =NewBitmap("RotationInput.bmp")DimimageAttributesAsNewImageAttributes()DimwidthAsInteger= image.WidthDimheightAsInteger= image.HeightDimdegreesAsSingle= 60.0FDimrAsDouble= degrees * System.Math.PI / 180
' degrees to radiansDimcolorMatrixElementsAsSingle()() = { _NewSingle() {CSng(System.Math.Cos(r)), _CSng(System.Math.Sin(r)), 0, 0, 0}, _NewSingle() {CSng(-System.Math.Sin(r)), _CSng(-System.Math.Cos(r)), 0, 0, 0}, _NewSingle() {0, 0, 2, 0, 0}, _NewSingle() {0, 0, 0, 1, 0}, _NewSingle() {0, 0, 0, 0, 1}}DimcolorMatrixAsNewColorMatrix(colorMatrixElements)
imageAttributes.SetColorMatrix( _
colorMatrix, _
ColorMatrixFlag.
Default