PC Review Forums Newsgroups Microsoft DotNet Microsoft Dot NET Compact Framework how to do bitmap scaling in compactframework

Reply

how to do bitmap scaling in compactframework

 
Thread Tools Rate Thread
Old 04-10-2005, 10:08 AM   #1
=?Utf-8?B?TmF2ZWVuIGtvdWw=?=
Guest
 
Posts: n/a
Default how to do bitmap scaling in compactframework


hi,

i am facing acertian problem in scaling an image in compactframework.
i have got a certain piece of code written below which i have written for
..net framework and need to convert it for compactframework.
************************************************************
scaledImg = new Bitmap(img,(int)(img.Width*scale),(int)(img.Height*scale));

************************************************************
i tried just could found only this alternative

**********************************************************
scaledImg = new Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale));

**********************************************************

But due to this i am getting wrong results .

Can anyone please help in converting the above function in compactframe work.

waiting for reply eagerly.

Regards

Naveen




  Reply With Quote
Old 04-10-2005, 10:15 AM   #2
Christian Schwarz
Guest
 
Posts: n/a
Default Re: how to do bitmap scaling in compactframework

> scaledImg = new
> Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale));


Try the following:

Bitmap scaledImg = new Bitmap((int)(img.Width*scale),
(int)(img.Height*scale));

using (Graphics gfx = Graphics.FromImage(scaledImg))
{
gfx.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0,
img.Width, img.Height, GraphicsUnit.Pixel, new Imaging.ImageAttributes());
}

Christian


  Reply With Quote
Old 04-10-2005, 10:39 AM   #3
=?Utf-8?B?TmF2ZWVuIGtvdWw=?=
Guest
 
Posts: n/a
Default Re: how to do bitmap scaling in compactframework


Sir,

what is this new Imaging.ImageAttributes(); as it is giving me error.

regards

Naveen
"Christian Schwarz" wrote:

> > scaledImg = new
> > Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale));

>
> Try the following:
>
> Bitmap scaledImg = new Bitmap((int)(img.Width*scale),
> (int)(img.Height*scale));
>
> using (Graphics gfx = Graphics.FromImage(scaledImg))
> {
> gfx.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0,
> img.Width, img.Height, GraphicsUnit.Pixel, new Imaging.ImageAttributes());
> }
>
> Christian
>
>
>

  Reply With Quote
Old 04-10-2005, 10:56 AM   #4
=?Utf-8?B?TmF2ZWVuIGtvdWw=?=
Guest
 
Posts: n/a
Default Re: how to do bitmap scaling in compactframework


Sir
( new Imaging.ImageAttributes())
it is giving me this sort of error
: "The type or namespace name 'Imaging' could not be found (are you missing
a using directive or an assembly reference?)"

"Christian Schwarz" wrote:

> > scaledImg = new
> > Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale));

>
> Try the following:
>
> Bitmap scaledImg = new Bitmap((int)(img.Width*scale),
> (int)(img.Height*scale));
>
> using (Graphics gfx = Graphics.FromImage(scaledImg))
> {
> gfx.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0,
> img.Width, img.Height, GraphicsUnit.Pixel, new Imaging.ImageAttributes());
> }
>
> Christian
>
>
>

  Reply With Quote
Old 04-10-2005, 11:17 AM   #5
=?Utf-8?B?TmF2ZWVuIGtvdWw=?=
Guest
 
Posts: n/a
Default I want to assign a scaled bitmap into another bit map


Sir,

I want to assign a scaled bitmap into another bit map
how to do it.i have got a.net framework function which is working fime and i
need an alternative for it to make it working for .net compactframework.
************************************************************
scaledImg = new Bitmap(img,(int)(img.Width*scale),(int)(img.Height*scale));

************************************************************

How can this be done.

regards

Naveem
"Naveen koul" wrote:

>
> Sir
> ( new Imaging.ImageAttributes())
> it is giving me this sort of error
> : "The type or namespace name 'Imaging' could not be found (are you missing
> a using directive or an assembly reference?)"
>
> "Christian Schwarz" wrote:
>
> > > scaledImg = new
> > > Bitmap(img);//(int)(img.Width*scale),(int)(img.Height*scale));

> >
> > Try the following:
> >
> > Bitmap scaledImg = new Bitmap((int)(img.Width*scale),
> > (int)(img.Height*scale));
> >
> > using (Graphics gfx = Graphics.FromImage(scaledImg))
> > {
> > gfx.DrawImage(img, new Rectangle(0, 0, img.Width, img.Height), 0, 0,
> > img.Width, img.Height, GraphicsUnit.Pixel, new Imaging.ImageAttributes());
> > }
> >
> > Christian
> >
> >
> >

  Reply With Quote
Old 04-10-2005, 11:55 AM   #6
Christian Schwarz
Guest
 
Posts: n/a
Default Re: how to do bitmap scaling in compactframework

> Sir,

I'm not a Sir

> what is this new Imaging.ImageAttributes(); as it is giving me error.


ImageAttributes class resides in the "System.Drawing.Imaging" namespace.

Christian


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off