<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.newlc.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>NewLC - scale a bitmap - Comments</title>
 <link>http://www.newlc.com/topic-2024</link>
 <description>Comments for &quot;scale a bitmap&quot;</description>
 <language>en</language>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-42228</link>
 <description>&lt;p&gt;-&lt;/p&gt;</description>
 <pubDate>Thu, 11 Oct 2007 11:11:53 +0200</pubDate>
 <dc:creator>alh</dc:creator>
 <guid isPermaLink="false">comment 42228 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-42196</link>
 <description>&lt;p&gt;I just realized you could use CFbsBitGc::DrawBitmap() to scale it, if you use CFbsBitmapDevice with CFbsBitmap.&lt;/p&gt;

&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;CFbsBitmap *scaledBitmap = new (ELeave) CFbsBitmap();&lt;br /&gt;scaledBitmap-&amp;gt;Create(scaledRect,originalBitmap-&amp;gt;DisplayMode());&lt;br /&gt;CFbsBitmapDevice *bitmapDevice = CFbsBitmapDevice::NewL(scaledBitmap);&lt;br /&gt;CleanupStack::PushL(bitmapDevice);&lt;br /&gt;CFbsBitGc * bitmapGc = CFbsBitGc::NewL();&lt;br /&gt;CleanupStack::PushL(bitmapGc);&lt;br /&gt;bitmapGc-&amp;gt;Activate(bitmapDevice);&lt;br /&gt;bitmapGc-&amp;gt;DrawBitmap(scaledRect,originalBitmap);&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;

&lt;p&gt;Cheers&lt;/p&gt;</description>
 <pubDate>Wed, 10 Oct 2007 09:30:48 +0200</pubDate>
 <dc:creator>Werries</dc:creator>
 <guid isPermaLink="false">comment 42196 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-42194</link>
 <description>&lt;p&gt;Hi I also used CBitmapScaler previously. Yes, if I remember correctly you need to use an Active Object, I also wanted to do it synchronously, so I employed CActiveSchedulerWait. &lt;/p&gt;

&lt;p&gt;I found that CBitmapScaler was extremely slow. On EMediumQuality and after calling  DisablePostProcessing(), It still took in the order of 3 seconds to scale, down from 7 seconds. OK it was large bitmaps 1280x1024, which I halved. &lt;/p&gt;

&lt;p&gt;I then decided to halve the size using these articles, &lt;a href=&quot;http://&quot; class=&quot;bb-url&quot;&gt;&lt;a href=&quot;http://www.ddj.com/184405045&quot;&gt;http://www.ddj.com/184405045&lt;/a&gt;&lt;/a&gt; and &lt;a href=&quot;http://&quot; class=&quot;bb-url&quot;&gt;www.compuphase.com/graphic/scale.htm&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course if you want to keep it simple use CBitmapScaler::Scale() and an ActveObject.&lt;/p&gt;

&lt;p&gt;O yes the time required to scale was something like 0.2 sec&lt;/p&gt;</description>
 <pubDate>Wed, 10 Oct 2007 09:11:37 +0200</pubDate>
 <dc:creator>Werries</dc:creator>
 <guid isPermaLink="false">comment 42194 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-42169</link>
 <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;I am also trying to scale a bitmap using the CBitmapScaler::Scale() method.  However, i do not want to draw the result to the screen, or any device, I want the scaled data to be in the CFbsBitmap object which also holds the original unscaled data.  So according to this, it seems that CFbsBitGc::DrawBitmap() will not work for me, and CBitmapScaler is the API I am interested in.  (am I correct in assuming this?)  Is it really necessary to implement this as an active object, or is there some way around this??  I am trying to keep my code as simple as possible, as it is nothing more than test code.&lt;/p&gt;</description>
 <pubDate>Tue, 09 Oct 2007 18:40:04 +0200</pubDate>
 <dc:creator>rajveer</dc:creator>
 <guid isPermaLink="false">comment 42169 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-41747</link>
 <description>&lt;p&gt;Note though, that with CBitmapScaler you can scale with filtering, which will produce a much better end result then just a DrawBitmap call.&lt;/p&gt;</description>
 <pubDate>Mon, 24 Sep 2007 10:34:41 +0200</pubDate>
 <dc:creator>alh</dc:creator>
 <guid isPermaLink="false">comment 41747 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-41615</link>
 <description>&lt;p&gt;DrawBitmap is a good idear!!&lt;br /&gt;
Thank you!&lt;/p&gt;</description>
 <pubDate>Wed, 19 Sep 2007 13:12:04 +0200</pubDate>
 <dc:creator>chen_l</dc:creator>
 <guid isPermaLink="false">comment 41615 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7768</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;You can use DrawBitmap or CBitmapScaler to scale bitmaps. DrawBitmap is synchronous and CBitmapScaler is asynchronous.&lt;br /&gt;&lt;br /&gt;Your code is single-threaded so you can&#039;t simply wait on a request (with only one thread running the request will never complete)&lt;br /&gt;&lt;br /&gt;The CImageImageDecoder code works because you gave it the always thread option. The always thread option tells the image decoder to do the conversion in a seperate thread. Remove this option and, just like your scaler code, it won&#039;t work.&lt;br /&gt;&lt;br /&gt;Use an active object and a callback function instead. (Use an M class for the callback)&lt;br /&gt;&lt;br /&gt;Also don&#039;t use Always thread for image conversion unless you really have to - the decoding will require a higher system overhead and will probably take longer as a result.&lt;/div&gt;</description>
 <pubDate>Sat, 17 Jul 2004 16:26:18 +0200</pubDate>
 <dc:creator>fig7</dc:creator>
 <guid isPermaLink="false">comment 7768 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7767</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Thanks! I knew there was an easier way of doing it. Remember doing it a year back, but just could&#039;nt remember how. Thanks again!&lt;br /&gt;&lt;br /&gt;Ash&lt;/div&gt;</description>
 <pubDate>Mon, 12 Jul 2004 11:29:38 +0200</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 7767 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7766</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&lt;div class=&quot;quoteheader&quot;&gt;Quote from: Ash&lt;/div&gt;&lt;div class=&quot;quote&quot;&gt;Thanks Lucian,&lt;br /&gt;&lt;br /&gt;I was just trying to keep the code as simple as possible. But, I guess, theres no alternative to using CActive.&lt;/div&gt;&lt;br /&gt;it looks like you want to perform Bitmap Scaling in Sync, since using User::WaitForRequest()&lt;br /&gt;&lt;br /&gt;an alternative would be to use Appropriate DrawBitmap(...) method of CFbsBitGc&lt;br /&gt;hope this helps &amp;nbsp;&lt;img src=&quot;/sites/all/modules/smf_filter/smf_smileys/evil.gif&quot; alt=&quot;Evil&quot; border=&quot;0&quot; /&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 12 Jul 2004 07:07:12 +0200</pubDate>
 <dc:creator>hack_tick</dc:creator>
 <guid isPermaLink="false">comment 7766 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7765</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Hi,&lt;br /&gt;maybe it will sound strange, but try to set the iRequestStatus to KRequestPending before invoking the scale operation. I had the same problem with the CMdaBitmapScaler and this solved it. Ever before I expected that the asynchronous method itself is responsible for this, but maybe there is a bug in it.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;&lt;br /&gt;Jan Vorlicek&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;quoteheader&quot;&gt;Quote from: Ash&lt;/div&gt;&lt;div class=&quot;quote&quot;&gt;Hi,&lt;br /&gt;&lt;br /&gt;I am trying to scale a bitmap to fit to screen, but the below code hangs at&lt;br /&gt;User::WaitForRequest().&lt;br /&gt;Any clues what I am doing wrong?&lt;br /&gt;&lt;br /&gt;Ta,&lt;br /&gt;Ash&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;// Bitmap zoomer&lt;br /&gt;&amp;nbsp;CBitmapScaler* iBitmapScaler;&lt;br /&gt;&amp;nbsp;iBitmapScaler = CBitmapScaler::NewL();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;TRequestStatus iRequestStatus;&lt;br /&gt;&amp;nbsp;iBitmapScaler-&amp;gt;Scale(&amp;amp;iRequestStatus, *iBitmap, TSize(176,208)); &amp;nbsp; &amp;nbsp;// fit&lt;br /&gt;screen&lt;br /&gt;&lt;br /&gt;&amp;nbsp;// wait for the conversion to complete&lt;br /&gt;&amp;nbsp; User::WaitForRequest(iRequestStatus); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/**** &amp;nbsp;hangs here!!! */&lt;br /&gt;&amp;nbsp;// clean up&lt;br /&gt;&amp;nbsp;delete iBitmapScaler;&lt;/div&gt;&lt;/div&gt;</description>
 <pubDate>Mon, 12 Jul 2004 02:04:58 +0200</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 7765 at http://www.newlc.com</guid>
</item>
<item>
 <title>scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7764</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Alternativly you can create empty bitmap, get bitmap adresses for new and old bitmaps and scale bitmap manually.&lt;/div&gt;</description>
 <pubDate>Sun, 11 Jul 2004 10:31:16 +0200</pubDate>
 <dc:creator>serg3d</dc:creator>
 <guid isPermaLink="false">comment 7764 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7763</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Thanks Lucian,&lt;br /&gt;&lt;br /&gt;I was just trying to keep the code as simple as possible. But, I guess, theres no alternative to using CActive.&lt;/div&gt;</description>
 <pubDate>Thu, 08 Jul 2004 10:17:59 +0200</pubDate>
 <dc:creator>ash</dc:creator>
 <guid isPermaLink="false">comment 7763 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7762</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;Because the operation has to be asynchronous to use User::WaitForRequest(iConvStatus). That was my question: Are you sure that Scale operation from CBitmapScaler is asynchronous?&lt;br /&gt;If not User::WaitForRequest(iConvStatus) will wait forever for smb to notify it&#039;s semaphore.&lt;br /&gt;&lt;br /&gt;Lucian&lt;/div&gt;</description>
 <pubDate>Wed, 07 Jul 2004 19:53:58 +0200</pubDate>
 <dc:creator>pirosl</dc:creator>
 <guid isPermaLink="false">comment 7762 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7761</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&lt;div class=&quot;quoteheader&quot;&gt;Quote from: pirosl&lt;/div&gt;&lt;div class=&quot;quote&quot;&gt;Are you sure &amp;nbsp;that Scale operation from CBitmapScaler is asynchronous?&lt;br /&gt;&lt;br /&gt;You can use instead CMdaBitmapScaler::Scale() operation&lt;br /&gt;&lt;br /&gt;Lucian&lt;/div&gt;&lt;br /&gt;Why is it that I can use &amp;nbsp;User::WaitForRequest(iConvStatus) when converting an image and not use the same when scaling an image. Both the methods are being part of my Container class, and both CImageDecoder and CBitmapScaler classes dont seem to inherit the CActive class.&lt;br /&gt;&amp;nbsp;&lt;br /&gt;TInt Error;&lt;br /&gt;&amp;nbsp;CImageDecoder* iConverter = NULL;&lt;br /&gt;&amp;nbsp;//initialise&lt;br /&gt;&amp;nbsp;TRAPD(Error,iConverter = CImageDecoder::FileNewL(CEikonEnv::Static()-&amp;gt;FsSession(),aImageFile,CImageDecoder::EOptionAlwaysThread));&lt;br /&gt;&amp;nbsp;&lt;br /&gt;if(Error == KErrNone)&lt;br /&gt;&amp;nbsp;{&lt;br /&gt;&amp;nbsp; //Get the frame info&lt;br /&gt;&amp;nbsp; TFrameInfo frameInfo = iConverter-&amp;gt;FrameInfo();&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; // create a blank bitmap to copy the image into&lt;br /&gt;&amp;nbsp; Err = iBitmap-&amp;gt;Create(frameInfo.iOverallSizeInPixels,EColor4K);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; if(Err == KErrNone)&lt;br /&gt;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp;// Convert the image into a bitmap&lt;br /&gt;&amp;nbsp; &amp;nbsp;iConverter-&amp;gt;Convert(&amp;amp;iConvStatus,*iBitmap);&lt;br /&gt;&amp;nbsp; &amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp;// wait for conversion to complete&lt;br /&gt;&amp;nbsp; &amp;nbsp;TRequestStatus iConvStatus;&lt;br /&gt;&amp;nbsp; &amp;nbsp;User::WaitForRequest(iConvStatus);&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp;// clean up&lt;br /&gt;&amp;nbsp; &amp;nbsp;iConverter-&amp;gt;Cancel();&lt;br /&gt;&amp;nbsp; &amp;nbsp;delete iConverter;&lt;br /&gt;}&lt;br /&gt;}&lt;/div&gt;</description>
 <pubDate>Wed, 07 Jul 2004 17:01:52 +0200</pubDate>
 <dc:creator>ash</dc:creator>
 <guid isPermaLink="false">comment 7761 at http://www.newlc.com</guid>
</item>
<item>
 <title>Re: scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024#comment-7760</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;The SDK says...&lt;br /&gt;&lt;br /&gt;This class has been deprecated in 7.0s, it&#039;s functionality is now part of Bitmap Transform. For more information see CBitmapScaler.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Ash&lt;/div&gt;</description>
 <pubDate>Wed, 07 Jul 2004 14:38:30 +0200</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 7760 at http://www.newlc.com</guid>
</item>
<item>
 <title>scale a bitmap</title>
 <link>http://www.newlc.com/topic-2024</link>
 <description>&lt;div class=&quot;smf-content&quot;&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&quot;http://www.newlc.com/topic-2024&quot;&gt;read more&lt;/a&gt;&lt;/p&gt;</description>
 <comments>http://www.newlc.com/topic-2024#comments</comments>
 <category domain="http://www.newlc.com/forums/2d-3d-graphics">Bitmaps and Graphics</category>
 <pubDate>Wed, 07 Jul 2004 13:52:57 +0200</pubDate>
 <dc:creator>ash</dc:creator>
 <guid isPermaLink="false">3041 at http://www.newlc.com</guid>
</item>
</channel>
</rss>
