VB.NET2005计算图像的颜色变化(浮雕)
日期:2008-6-27 13:54:25 来源: 作者: 浏览:次 |
|
| VB.NET2005计算图像的颜色变化(浮雕) |
Public Function TrunBlackWhite(ByVal img As Image) As Image '转黑白 Dim g As Graphics = Graphics.FromImage(img) Dim ia As New ImageAttributes() Dim colorMatrix As Single()() = {New Single() {0.3F, 0.3F, 0.3F, 0.0, 0.0}, _ New Single() {0.59F, 0.59F, 0.59F, 0.0, 0.0}, _ New Single() {0.11F, 0.11F, 0.11F, 0.0, 0.0}, _ New Single() {0.0, 0.0, 0.0, 1.0, 0.0}, _ New Single() {0.0, 0.0, 0.0, 0.0, 1.0}} Dim cm As New ColorMatrix(colorMatrix) ia.SetColorMatrix(cm, ColorMatrixFlag.Default, ColorAdjustType.Default) g.DrawImage(img, New Rectangle(0, 0, img.Width, img.Height), 0, 0, img.Width, img.Height, _ GraphicsUnit.Pixel, ia) g.Dispose() Return img End Function
Public Function GetImageLine(ByVal img As Image) As Image '浮雕 | |