Rank: Advanced Member
Groups: Member, Administration, Moderator Joined: 8/3/2003(UTC) Posts: 1,070
Thanks: 1 times Was thanked: 12 time(s) in 12 post(s)
|
Hello, Michel. Aurigma.GraphicsMill.Drawing.GdiGraphics class works through Windows GDI which unfortunately doesn't operate with alpha. The following sample is written on pure Graphics Mill for .NET and solves this problem: Code:'Create bitmap object which contains image on which we want to draw text
Dim bitmap As New Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.Yellow, 200, 200, Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)
'Get width and height of the loaded image
Dim BitmapHeight = bitmap.Height
Dim BitmapWidth = bitmap.Width
'Create bitmap with transparent background
Dim bitmapText As New Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.White, BitmapWidth, BitmapHeight, _
Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)
Dim graphics As Aurigma.GraphicsMill.Drawing.GdiGraphics = bitmapText.GetGdiGraphics()
'Set text output properties
Dim font As New Aurigma.GraphicsMill.Drawing.Font("Arial", 22, True, False)
Dim brush As New Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.Blue)
'Draw text
graphics.DrawString("Merci jack", font, brush, 5, 5)
'Dispose graphics
graphics.Dispose()
'Make white background tranparent
bitmapText.Channels.Transparentize(Aurigma.GraphicsMill.RgbColor.White, 0.2)
'Apply shadow effect on text
bitmapText.Transforms.Shadow(Aurigma.GraphicsMill.RgbColor.Black, 8, 8, 4, False)
'Draw text on bitmap
bitmapText.Draw(bitmap, 0, 0, bitmapText.Width, bitmapText.Height, Aurigma.GraphicsMill.Transforms.CombineMode.Alpha, _
1, Aurigma.GraphicsMill.Transforms.InterpolationMode.LowQuality)
bitmap.Save("c:\1.jpg")
Edited by user Monday, December 24, 2007 3:37:48 PM(UTC)
| Reason: Not specified |
|