Rank: Advanced Member
Groups: Guest
Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, I offer you to try another way to draw antialiased text without transparentize transformation. The main idea of this method is to separately prepare alpha channel of the temporary image on which shadow is applied. Code:
Dim bitmap As New Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.Green, 200, 200, Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)
bitmap.ColorManagement.ConvertToContinuous(Aurigma.GraphicsMill.ColorSpace.Rgb, False, False)
Dim BitmapHeight = bitmap.Height
Dim BitmapWidth = bitmap.Width
Dim font As New Aurigma.GraphicsMill.Drawing.Font("Arial", 12, True, False)
Dim bitmapText As New Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.Green, BitmapWidth, BitmapHeight, _
Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)
Dim graphics As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmapText.GetGdiGraphics()
Dim brush As New Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.Blue)
graphics.DrawString("Merci jack", font, brush, 5, 5)
graphics.Dispose()
Dim bitmapAlphaText As New Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.Black, BitmapWidth, BitmapHeight, _
Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)
graphics = bitmapAlphaText.GetGdiGraphics()
brush = New Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.White)
graphics.DrawString("Merci jack", font, brush, 5, 5)
graphics.Dispose()
bitmapAlphaText.ColorManagement.ConvertToContinuous(Aurigma.GraphicsMill.ColorSpace.GrayScale, False, False)
bitmapText.Channels.AddAlpha(0)
bitmapText.Channels(Aurigma.GraphicsMill.ColorChannel.Alpha) = bitmapAlphaText
bitmapText.Transforms.Shadow(Aurigma.GraphicsMill.RgbColor.Black, 8, 8, 4, False)
bitmapText.Draw(bitmap, 0, 0, bitmapText.Width, bitmapText.Height, Aurigma.GraphicsMill.Transforms.CombineMode.Alpha, _
1, Aurigma.GraphicsMill.Transforms.InterpolationMode.LowQuality)
bitmap.Save("c:\1.png")
If quality of generated images is not appropriate, unfortunately we have to use GDI+ graphics to render text on image with alpha channel. Edited by user 17 years ago
| Reason: Not specified |
|