Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
ktola  
#1 Posted : Wednesday, May 12, 2004 12:11:00 AM(UTC)
ktola

Rank: Member

Groups:
Joined: 5/12/2004(UTC)
Posts: 6

Good Morning -

I am attempting to dynamically write semi-transparent text on an image and then resize the images to multiple smaller sizes. I have the resizing part down, however I cannot figure out how to - using the Interop in C# - write semi-transparent text on the image. You do it for the trial version of this product so I know it can be done. Can you please help?

Thanks.

Fedor  
#2 Posted : Wednesday, May 12, 2004 2:05:00 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
In ASP.NET you can use following code for it:

Code:
<%@ Page Language="c#"%>
<script language="c#" runat="server">
private void Page_Load(object sender, System.EventArgs e) {
	//Create Bitmap object
	Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap();
	bitmap.LoadFromFile(Server.MapPath("mountain.jpg"));

	bitmap.Graphics.Engine = Aurigma.GraphicsMill.DrawingEngine.DrawingEngineGdiplus;
	bitmap.Graphics.Antialiasing = true;

	//Adjust font settings
	bitmap.Graphics.TextFormat.FontSize = 40;
	bitmap.Graphics.TextFormat.FontName = "Verdana";
	bitmap.Graphics.TextFormat.IsBold = true;
	bitmap.Graphics.TextFormat.IsItalic = false;
	bitmap.Graphics.TextFormat.IsUnderlined = true;
	
	//Create semi-transparent red color using System.Drawing
	//bitmap.Graphics.TextFormat.FontColor = 
	//	System.Drawing.Color.FromArgb(60, System.Drawing.Color.Red).ToArgb();
	
	//Create semi-transparent red color using Graphics Mill
	bitmap.Graphics.TextFormat.FontColor = 
		bitmap.color.CreateArgb(60, 255, 0, 0);

		
	bitmap.Graphics.TextFormat.HorizontalAlignment = 
		Aurigma.GraphicsMill.HorizontalAlignment.HorizontalAlignmentCenter;

	bitmap.Graphics.DrawText("Aurigma", 150, 0, 0); 

	bitmap.Formats.SelectCurrent("PNG");

	//bitmap.SaveToFile(Server.MapPath("temp/result.png"));
	Response.ContentType = "image/jpeg";
	Response.BinaryWrite((byte[])bitmap.SaveToMemory());
}

Sure don't forget to put GraphicsMill20.Interop.dll in bin folder.

Edited by user Monday, December 24, 2007 5:49:29 PM(UTC)  | Reason: Not specified

Best regards,

Fedor Skvortsov

ktola  
#3 Posted : Thursday, May 13, 2004 3:00:00 AM(UTC)
ktola

Rank: Member

Groups:
Joined: 5/12/2004(UTC)
Posts: 6

Thank you very much for your help! (H)
Fedor  
#4 Posted : Thursday, May 13, 2004 3:11:00 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
I just wanted to add that you can set transparent color and directly via its hex ARGB value.

bitmap.Graphics.TextFormat.FontColor = 0x50FF0000;

50 - specifies transparency.

FF - speifies red channel value.

If you have any questions feel free to ask me. :)

Best regards,

Fedor Skvortsov

Users browsing this topic
Guest
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.