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.
|
|
|
|
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 |
|
|
|
|
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
|
|
|
|
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.