Rank: Member
Groups: Guest
Joined: 4/24/2005(UTC) Posts: 15
|
Hello, Is it possible to use all the functionnalities of this component without using the MSDN library ? For example, I want to draw a text with an effect (shadow, glow, ...) and if I don't use the System.drawing namespace, it doesn't work : either the effect is applied to the bitmap (not the text) or the text is not displayed. Thank you, Michel
|
|
|
|
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, Michel, Graphics Mill for .NET has reference to System.Drawing.dll because it imports some basic types. But you don't have to use System.Drawing.Bitmap and System.Drawing.Graphics objects to perform most of tasks. For example the following code snippet illustrates how to render text with shadow using Graphics Mill for .NET: Code:
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.White,
300, 300, Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);
Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bitmap.GetGdiGraphics();
Aurigma.GraphicsMill.Drawing.Font font = new Aurigma.GraphicsMill.Drawing.Font("Arial", 30);
Aurigma.GraphicsMill.Drawing.SolidBrush brush = new Aurigma.GraphicsMill.Drawing.SolidBrush
(Aurigma.GraphicsMill.RgbColor.Red);
graphics.DrawString("Aurigma Inc.", font, brush, 20, 20);
font.Dispose();
graphics.Dispose();
bitmap.Channels.Transparentize(Aurigma.GraphicsMill.RgbColor.White, 0.5f);
bitmap.Transforms.Shadow(Aurigma.GraphicsMill.RgbColor.Black, 10, 10);
bitmap.Channels.DiscardAlpha(Aurigma.GraphicsMill.RgbColor.Gold);
bitmap.Save(@"c:/1.png");
Edited by user 17 years ago
| Reason: Not specified |
|
|
|
|
Rank: Member
Groups: Guest
Joined: 4/24/2005(UTC) Posts: 15
|
heu... maybe I was not explicit enough ^_^! I don't want the effect to be applied on the image I have loaded. I want to convert this code into 100% Aurigma code : Code: Private Sub Page_Load()
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\InetPub\wwwroot\Graphics\WebMatrix\data\jack2.bmp")
Dim BitmapHeight = bitmap.height
Dim BitmapWidth = bitmap.width
Dim bitmapText As New Aurigma.GraphicsMill.Bitmap(BitmapWidth, BitmapHeight, Aurigma.GraphicsMill.PixelFormat.Format32bppArgb)
Dim graphics As System.Drawing.Graphics = bitmapText.GetGdiplusGraphics()
Dim font As New System.Drawing.Font("Arial", 22, FontStyle.Italic)
Dim brush As New System.Drawing.SolidBrush(System.Drawing.Color.Blue)
graphics.DrawString("Merci jack", font, brush, 5, 5)
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)
Dim encoderOptions As New JpegEncoderOptions
Response.Clear()
Response.ContentType="image/jpeg"
bitmap.Save(Response.OutputStream, encoderOptions)
Response.End()
End Sub
but it seems that the alpha property is not processed the same way. Edited by user 17 years ago
| Reason: Not specified
|
|
|
|
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, 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:
Dim bitmap As New Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.Yellow, 200, 200, Aurigma.GraphicsMill.PixelFormat.Format24bppRgb)
Dim BitmapHeight = bitmap.Height
Dim BitmapWidth = bitmap.Width
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()
Dim font As New Aurigma.GraphicsMill.Drawing.Font("Arial", 22, True, False)
Dim brush As New Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.Blue)
graphics.DrawString("Merci jack", font, brush, 5, 5)
graphics.Dispose()
bitmapText.Channels.Transparentize(Aurigma.GraphicsMill.RgbColor.White, 0.2)
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.jpg")
Edited by user 17 years ago
| Reason: Not specified |
|
|
|
|
Rank: Member
Groups: Guest
Joined: 4/24/2005(UTC) Posts: 15
|
greeaaaaaat!! \\ ^_^ // thank you very much!!
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.