enum SmoothingMode{
SmoothingModeInvalid = QualityModeInvalid,
SmoothingModeDefault = QualityModeDefault,
SmoothingModeHighSpeed = QualityModeLow,
SmoothingModeHighQuality = QualityModeHigh,
SmoothingModeNone,
SmoothingModeAntiAlias
};
В данный момент фактически нет разницы между режимами SmoothingModeDefault, SmoothingModeHighSpeed и SmoothingModeNone: все они
выключают
антиалиасинг примитивов. Изображение при этом приобретает привычные ступенчатые края:
- Public Shared Function MakeGrayscale3(ByVal original As Bitmap) As Bitmap
- 'create a blank bitmap the same size as original
- Dim newBitmap As New Bitmap(original.Width, original.Height)
- 'get a graphics object from the new image
- Dim g As Graphics = Graphics.FromImage(newBitmap)
- 'create the grayscale ColorMatrix
- Dim colorMatrix As New ColorMatrix(New Single()() {New Single() {0.3, 0.3, 0.3, 0, 0}, New Single() {0.59, 0.59, 0.59, 0, 0}, New Single() {0.11, 0.11, 0.11, 0, 0}, New Single() {0, 0, 0, 1, 0}, New Single() {0, 0, 0, 0, 1}})
- 'create some image attributes
- Dim attributes As New ImageAttributes()
- 'set the color matrix attribute
- attributes.SetColorMatrix(colorMatrix)
- 'draw the original image on the new image
- 'using the grayscale color matrix
- g.DrawImage(original, New Rectangle(0, 0, original.Width, original.Height), 0, 0, original.Width, original.Height, _
- GraphicsUnit.Pixel, attributes)
- 'dispose the Graphics object
- g.Dispose()
- Return newBitmap
- End Function
Комментариев нет:
Отправить комментарий