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

Notification

Icon
Error

Options
Go to last post Go to first unread
krekeg  
#1 Posted : Monday, April 11, 2005 11:17:00 PM(UTC)
krekeg

Rank: Member

Groups: Member
Joined: 3/2/2005(UTC)
Posts: 13

I'm trying to create a blank, white, grayscale bitmap 'canvas' on which to draw several other grayscale bitmaps. By default the background is created as black. What is the correct way of creating a white bitmap? I have tried seveal methods but each time I draw a grayscale bitmap on top of it they don't appear.
Dmitry  
#2 Posted : Tuesday, April 12, 2005 2:35:00 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. I think that sample listed below will help you.
Code:
// Loading the source bitmap.
Aurigma.GraphicsMill.Bitmap image = new Aurigma.GraphicsMill.Bitmap(@"c:/gray.jpg");

// Creating empty grayscale bitmap with white background.
Aurigma.GraphicsMill.Bitmap canvasBitmap = new Aurigma.GraphicsMill.Bitmap(Aurigma.GraphicsMill.RgbColor.White, 
                300, 300, Aurigma.GraphicsMill.PixelFormat.Format8bppGrayScale);

// Obtaining canvas instance created on the bitmap.
Aurigma.GraphicsMill.Drawing.GdiGraphics canvas = canvasBitmap.GetGdiGraphics();

// Drawing the loaded grayscale image on the canvas.
canvas.DrawImage(image, 100, 100, 100, 0, 
                Aurigma.GraphicsMill.Transforms.CombineMode.Copy, 1.0f,  
                Aurigma.GraphicsMill.Transforms.InterpolationMode.MediumQuality);

// Disposing canvas instance.
canvas.Dispose();

// Saving canvas bitmap.
canvasBitmap.Save(@"c:/1.png");

Edited by user Monday, December 24, 2007 3:55:21 PM(UTC)  | Reason: Not specified

Sincerely yours, Dmitry Sevostyanov UserPostedImage Follow Aurigma on Twitter!
krekeg  
#3 Posted : Tuesday, April 12, 2005 5:16:00 PM(UTC)
krekeg

Rank: Member

Groups: Member
Joined: 3/2/2005(UTC)
Posts: 13

Thanks for that. I think the problem lies with my settings for DrawImage. I was using CombineMode.Add rather than CombineMode.Copy. Cheers
Users browsing this topic
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.