RE: [Flashcoders] dynamically attached not smoothing using BitmapData?

2009-06-04 Thread Cor
Hi List,

I don't have a solution for this (I wish...), but a question.
I try to understand the the use of bitmaps.
If I understand correctly, it is used to edit pixels of a loaded image.
But if there is nothing to edit, what is the benefit of using Bitmap???
Or maybe I should ask: When use Bitmap and when not?

Kind regards
Cor

-Original Message-
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of allandt
bik-elliott (thefieldcomic.com)
Sent: woensdag 3 juni 2009 12:19
To: Flash Coders List
Subject: [Flashcoders] dynamically attached not smoothing using BitmapData?

Hey guys

I'm having a problem with using smoothing on my loaded bitmap images with
AS3 and I was wondering if you could help, please?

Here is my code:
[code]
private function sendImageLoadEvent(e:Event):void
{
var nCurImg:Number = _arImageArray.length;

var bmp:Bitmap = e.target.content as Bitmap;
bmp.smoothing = true;

// create scale / offset
var bmp_xscale:Number = stage.stageWidth / bmp.width;
var bmp_yscale:Number = stage.stageHeight / bmp.height;
var bmp_scale:Number = Math.min(bmp_xscale, bmp_yscale);
var bmp_scaledWidth:Number = bmp.width * bmp_scale;
var bmp_scaledHeight:Number = bmp.height * bmp_scale;
var bmp_xshift:Number = (stage.stageWidth - bmp_scaledWidth)
/ 2;
var bmp_yshift:Number = (stage.stageHeight -
bmp_scaledHeight) / 2;

var bmpMatrix:Matrix = new Matrix(bmp_scale, 0, 0,
bmp_scale, bmp_xshift, bmp_yshift);

var bmpImage:BitmapData = new BitmapData(stage.stageWidth,
stage.stageHeight, false, 0x00);
bmpImage.draw(bmp, bmpMatrix, null, null, null, true);
bmp.bitmapData = bmpImage;
bmp.smoothing = true;

_arImageArray[nCurImg] = new Sprite();
_arImageArray[nCurImg].addChild(bmp);
_sprViewingArea.addChild(_arImageArray[nCurImg]);
}
[/code]

I saw on grant skinners blog that adding a bitmapData property to a Bitmap
object will remove the smoothing property so that is why I'm re-applying the
smoothing to see if that makes a difference

It seems like this is quite a buggy thing to do (based on the amount of
unresolved forum hits in google) but i'd like to see if there's a solution.

Could it be the size of the images (ie Is there a maximum size to scale from
/ to / by)? Anything you've learned could be helpful.

Thanks for your help in advance
Alz
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] dynamically attached not smoothing using BitmapData?

2009-06-03 Thread Karl DeSaulniers
Well you could take a look at marjnivessers (prob didnt spell that  
right) ImageLoader. That class smooths a loaded image. But the one I  
have is as2. Try googling ImageLoader and see if he has an as3  
version. If anything, you could get the logistics from it and apply.

HTH

Karl

Sent from losPhone

On Jun 3, 2009, at 5:18 AM, allandt bik-elliott (thefieldcomic.com) alla...@gmail.com 
 wrote:



Hey guys

I'm having a problem with using smoothing on my loaded bitmap images  
with

AS3 and I was wondering if you could help, please?

Here is my code:
[code]
   private function sendImageLoadEvent(e:Event):void
   {
   var nCurImg:Number = _arImageArray.length;

   var bmp:Bitmap = e.target.content as Bitmap;
   bmp.smoothing = true;

   // create scale / offset
   var bmp_xscale:Number = stage.stageWidth / bmp.width;
   var bmp_yscale:Number = stage.stageHeight / bmp.height;
   var bmp_scale:Number = Math.min(bmp_xscale,  
bmp_yscale);

   var bmp_scaledWidth:Number = bmp.width * bmp_scale;
   var bmp_scaledHeight:Number = bmp.height * bmp_scale;
   var bmp_xshift:Number = (stage.stageWidth -  
bmp_scaledWidth)

/ 2;
   var bmp_yshift:Number = (stage.stageHeight -
bmp_scaledHeight) / 2;

   var bmpMatrix:Matrix = new Matrix(bmp_scale, 0, 0,
bmp_scale, bmp_xshift, bmp_yshift);

   var bmpImage:BitmapData = new BitmapData(stage.stageWidth,
stage.stageHeight, false, 0x00);
   bmpImage.draw(bmp, bmpMatrix, null, null, null, true);
   bmp.bitmapData = bmpImage;
   bmp.smoothing = true;

   _arImageArray[nCurImg] = new Sprite();
   _arImageArray[nCurImg].addChild(bmp);
   _sprViewingArea.addChild(_arImageArray[nCurImg]);
   }
[/code]

I saw on grant skinners blog that adding a bitmapData property to a  
Bitmap
object will remove the smoothing property so that is why I'm re- 
applying the

smoothing to see if that makes a difference

It seems like this is quite a buggy thing to do (based on the amount  
of
unresolved forum hits in google) but i'd like to see if there's a  
solution.


Could it be the size of the images (ie Is there a maximum size to  
scale from

/ to / by)? Anything you've learned could be helpful.

Thanks for your help in advance
Alz
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] dynamically attached not smoothing using BitmapData?

2009-06-03 Thread allandt bik-elliott (thefieldcomic.com)
could be good - thanks a lot Karl

On Wed, Jun 3, 2009 at 12:37 PM, Karl DeSaulniers k...@designdrumm.comwrote:

 Well you could take a look at marjnivessers (prob didnt spell that right)
 ImageLoader. That class smooths a loaded image. But the one I have is as2.
 Try googling ImageLoader and see if he has an as3 version. If anything, you
 could get the logistics from it and apply.
 HTH

 Karl

 Sent from losPhone


 On Jun 3, 2009, at 5:18 AM, allandt bik-elliott (thefieldcomic.com) 
 alla...@gmail.com wrote:

  Hey guys

 I'm having a problem with using smoothing on my loaded bitmap images with
 AS3 and I was wondering if you could help, please?

 Here is my code:
 [code]
   private function sendImageLoadEvent(e:Event):void
   {
   var nCurImg:Number = _arImageArray.length;

   var bmp:Bitmap = e.target.content as Bitmap;
   bmp.smoothing = true;

   // create scale / offset
   var bmp_xscale:Number = stage.stageWidth / bmp.width;
   var bmp_yscale:Number = stage.stageHeight / bmp.height;
   var bmp_scale:Number = Math.min(bmp_xscale, bmp_yscale);
   var bmp_scaledWidth:Number = bmp.width * bmp_scale;
   var bmp_scaledHeight:Number = bmp.height * bmp_scale;
   var bmp_xshift:Number = (stage.stageWidth - bmp_scaledWidth)
 / 2;
   var bmp_yshift:Number = (stage.stageHeight -
 bmp_scaledHeight) / 2;

   var bmpMatrix:Matrix = new Matrix(bmp_scale, 0, 0,
 bmp_scale, bmp_xshift, bmp_yshift);

   var bmpImage:BitmapData = new BitmapData(stage.stageWidth,
 stage.stageHeight, false, 0x00);
   bmpImage.draw(bmp, bmpMatrix, null, null, null, true);
   bmp.bitmapData = bmpImage;
   bmp.smoothing = true;

   _arImageArray[nCurImg] = new Sprite();
   _arImageArray[nCurImg].addChild(bmp);
   _sprViewingArea.addChild(_arImageArray[nCurImg]);
   }
 [/code]

 I saw on grant skinners blog that adding a bitmapData property to a Bitmap
 object will remove the smoothing property so that is why I'm re-applying
 the
 smoothing to see if that makes a difference

 It seems like this is quite a buggy thing to do (based on the amount of
 unresolved forum hits in google) but i'd like to see if there's a
 solution.

 Could it be the size of the images (ie Is there a maximum size to scale
 from
 / to / by)? Anything you've learned could be helpful.

 Thanks for your help in advance
 Alz
 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 ___
 Flashcoders mailing list
 Flashcoders@chattyfig.figleaf.com
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders