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

Notification

Icon
Error

Options
Go to last post Go to first unread
Zatlite  
#1 Posted : Tuesday, January 9, 2007 9:55:57 AM(UTC)
Zatlite

Rank: Member

Groups: Member
Joined: 1/9/2007(UTC)
Posts: 7

Hi,

I'm a total newbie with manipulating Images. I have this multipage tiff document where I need to add some annotations like a footnote. I've read the Topic Drawing Text with Effects in the online help that comes with the control. I've tried it out using a sample image and it worked great for me.

I tried with the tiff image I am supposed to use and that part failed. Something about pixelFormats.
This is because the sample image I used was in color and the tiff I'm trying to work with is not.

I'm not familiar with the jargon yet but I'll try to explain...

I found out that the image is Format1bppIndexed whatever that means.

I don't have any code to show you as I've only tried out the sample in the online help.
I've searched the forum and found topics but they don't exactly match my situation and I still don't have enough knowhow to adapt the code here to what I need. Shameless as this may sound, I need someone to spoon-feed me this time round as I'm really pressed for time on this project.

I'd appreciate any help.
Thanks.
Dmitry  
#2 Posted : Tuesday, January 9, 2007 6:44:22 PM(UTC)
Dmitry

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,

Could you explain what exactly you try to do when you recieve "unsupported pixel format" exception?
To draw text string on bitmap you should use code like this (it works for 1bpp indexed bitmaps):
Code:
Aurigma.GraphicsMill.Drawing.SolidBrush brush = new   Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.White);
Aurigma.GraphicsMill.Drawing.Font font = new Aurigma.GraphicsMill.Drawing.Font("Arial", 14);
	
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"d:/Temp/1.wbmp");
Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bitmap.GetGdiGraphics();
graphics.DrawString("Aurigma", font, brush, 0, 0);
graphics.Dispose();
	
bitmap.Save(@"d:/Temp/result.wbmp");

Edited by user Tuesday, December 18, 2007 5:34:09 PM(UTC)  | Reason: Not specified

Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
Zatlite  
#3 Posted : Tuesday, January 9, 2007 10:14:31 PM(UTC)
Zatlite

Rank: Member

Groups: Member
Joined: 1/9/2007(UTC)
Posts: 7

Thanks Dmitry,

That looks much more simple and I've finally figured it out. Just one more issue though, do you have anything that does a proper multiline? I've tried the multiline text sample in the help file and that requires you to use a rectangle and fill up the rectangle width until you get a new line. I'm looking for something that will let me add a new line character to separate the strings.

Appreciate all your help.
Dmitry  
#4 Posted : Wednesday, January 10, 2007 2:07:57 PM(UTC)
Dmitry

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,

Graphics Mill for .NET has support of simple multiline text strings (without paragraph settings). To write multiline text into specified rectangle you should use GdiGraphics.DrawString method which supports bounded rectangle argument (like this GdiGraphics.DrawString). Here is small code sample which illustrates this functionality:
Code:
Aurigma.GraphicsMill.Drawing.SolidBrush brush = new Aurigma.GraphicsMill.Drawing.SolidBrush(
    Aurigma.GraphicsMill.RgbColor.White);
Aurigma.GraphicsMill.Drawing.Font font = new Aurigma.GraphicsMill.Drawing.Font("Arial", 14);
	
String str = "Aurigma" + "\n" + "Graphics Mill for .NET";
	
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"d:/Temp/1.wbmp");
Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bitmap.GetGdiGraphics();
graphics.DrawString(str, font, brush, 0, 0, bitmap.Width, 100, 
    Aurigma.GraphicsMill.Drawing.TextTrimmingMode.None, false, true, true);
graphics.Dispose();
	
bitmap.Save(@"d:/Temp/result.wbmp");

Edited by user Tuesday, January 1, 2008 4:48:32 AM(UTC)  | Reason: Not specified

Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
Zatlite  
#5 Posted : Wednesday, January 10, 2007 9:37:20 PM(UTC)
Zatlite

Rank: Member

Groups: Member
Joined: 1/9/2007(UTC)
Posts: 7

Alright! It does what I need. Thank you very much.
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.