thegrinch
December 23rd, 2005, 04:40 AM
Hi!
I would like to have a method:
static Bitmap * scale (Bitmap * b, int width, int height)
It shall do the following transformation:
Assume b has Dimensions (1280,1024) and width and height are equal to 512.
Ok. Then, the Method shall take the centered quadratic part of b (which is 1024x1024 px in size, starting at Point ( (1280-1024)/2 , 0) ), and scale it to 512 x 512. Finally a new Bitmap containing this scaled image shall be returned.
My searches lead to this code up to now, but I could not find a way how to convert the Graphics into a Bitmap:
Graphics * gfx = Graphics::FromImage(new Bitmap(512,512);
gfx->DrawImage(b,0,0,512,512);
Big thanks for your Help!
so long
I would like to have a method:
static Bitmap * scale (Bitmap * b, int width, int height)
It shall do the following transformation:
Assume b has Dimensions (1280,1024) and width and height are equal to 512.
Ok. Then, the Method shall take the centered quadratic part of b (which is 1024x1024 px in size, starting at Point ( (1280-1024)/2 , 0) ), and scale it to 512 x 512. Finally a new Bitmap containing this scaled image shall be returned.
My searches lead to this code up to now, but I could not find a way how to convert the Graphics into a Bitmap:
Graphics * gfx = Graphics::FromImage(new Bitmap(512,512);
gfx->DrawImage(b,0,0,512,512);
Big thanks for your Help!
so long