Re: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Jeroen Beckers

var n:Number = -16777216
trace(n.toString(16));

Gives me:

-100 ?



Claus Wahlers wrote:



pixel = -16777216


-16777216 is 0xff00 (solid black)

Try to trace pixel.toString(16)

Cheers,
Claus.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Merrill, Jason
 -16777216 is 0xff00 (solid black)

I thought solid black was 

0xff
16777215

?

Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 
 
 
 
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Claus Wahlers

Number.toString() is a little borked.

Meister Skinner explains it here:
http://www.gskinner.com/blog/archives/2005/12/source_code_tra.html

Cheers,
Claus.


Jeroen Beckers wrote:


var n:Number = -16777216
trace(n.toString(16));

Gives me:

-100 ?



Claus Wahlers wrote:



pixel = -16777216


-16777216 is 0xff00 (solid black)

Try to trace pixel.toString(16)

Cheers,
Claus.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Claus Wahlers

Merrill, Jason wrote:


-16777216 is 0xff00 (solid black)


I thought solid black was 


0xff
16777215


That'd be white. 0 is black. The additional 'ff' in the highest byte is 
the alpha value (returned by getPixel32).


--
claus wahlers
côdeazur brasil
http://codeazur.com.br
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Merrill, Jason
Oooops, you are right, I meant 0x00

Nevertheless, you had said, 0xff00 (solid black) ??

Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 
 
 
 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Claus Wahlers
Sent: Friday, September 15, 2006 11:09 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] BitmapData.getPixel() - negative value ?

Merrill, Jason wrote:

 -16777216 is 0xff00 (solid black)

 I thought solid black was

 0xff
 16777215

That'd be white. 0 is black. The additional 'ff' in the highest byte is
the alpha value (returned by getPixel32).

--
claus wahlers
côdeazur brasil
http://codeazur.com.br
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Claus Wahlers



Oooops, you are right, I meant 0x00
Nevertheless, you had said, 0xff00 (solid black) ??


Yeah. Read the rest of my mail. ;)


-16777216 is 0xff00 (solid black)

I thought solid black was

0xff
16777215

That'd be white. 0 is black. The additional 'ff' in the highest byte is
the alpha value (returned by getPixel32).


--
claus wahlers
côdeazur brasil
http://codeazur.com.br
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Zeh Fernando

Oooops, you are right, I meant 0x00
Nevertheless, you had said, 0xff00 (solid black) ??


It's because it has the alpha value on it (ARGB) with a opacity of 255 (100% 
opaque, or 0% transparent).


0x00 (or just 0) *IS* solid black, but if you're painting on a bitmap 
with an alpha channel, you have to be sure to also set its alpha value or 
else you'll be painting transparent black pixels.



Zeh 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Jeroen Beckers

Thank you for the link, I will surely read it!

Since I don't need the alpha, I changed getPixel32 to getPixel (oh, 
sorry for wrong topic-title) and it works fine now. Thanks for all the 
input :-).


(Oh, and I also noticed that I was dividing by 0x0, which is off 
course '0' and dividing by 0 gives 'Infinity').


Cheers!

Claus Wahlers wrote:

Number.toString() is a little borked.

Meister Skinner explains it here:
http://www.gskinner.com/blog/archives/2005/12/source_code_tra.html

Cheers,
Claus.


Jeroen Beckers wrote:


var n:Number = -16777216
trace(n.toString(16));

Gives me:

-100 ?



Claus Wahlers wrote:



pixel = -16777216


-16777216 is 0xff00 (solid black)

Try to trace pixel.toString(16)

Cheers,
Claus.

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Merrill, Jason
Sorry - :) 

Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 
 
 
 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Claus Wahlers
Sent: Friday, September 15, 2006 11:37 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] BitmapData.getPixel() - negative value ?


 Oooops, you are right, I meant 0x00
 Nevertheless, you had said, 0xff00 (solid black) ??

Yeah. Read the rest of my mail. ;)

 -16777216 is 0xff00 (solid black)
 I thought solid black was

 0xff
 16777215
 That'd be white. 0 is black. The additional 'ff' in the highest byte is
 the alpha value (returned by getPixel32).

--
claus wahlers
côdeazur brasil
http://codeazur.com.br
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


RE: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-15 Thread Merrill, Jason
Good to know, thanks - I can see now I still have a lot to learn about
color and the new BitmapData class.  :) 

Jason Merrill
Bank of America 
Learning  Organization Effectiveness - Technology Solutions 
 
 
 
 
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:flashcoders-
[EMAIL PROTECTED] On Behalf Of Zeh Fernando
Sent: Friday, September 15, 2006 11:42 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] BitmapData.getPixel() - negative value ?

 Oooops, you are right, I meant 0x00
 Nevertheless, you had said, 0xff00 (solid black) ??

It's because it has the alpha value on it (ARGB) with a opacity of 255
(100%
opaque, or 0% transparent).

0x00 (or just 0) *IS* solid black, but if you're painting on a
bitmap
with an alpha channel, you have to be sure to also set its alpha value
or
else you'll be painting transparent black pixels.


Zeh

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


[Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-14 Thread Jeroen Beckers

Hi list!

I was trying to create a little class that generates a 2d grid from a 
perlinNoise-bitmap image. Now, when I perform the getPixel32(), it 
returns a negative value. I did some research and it appears you can get 
'-1' when the indexes are out of bounds, but that's as negative as it 
goes... And I am getting results as:


pixel = -16777216

pixel = -16119286

pixel = -15724528

pixel = -15658735

Here is my (relevant) code:

   private function createBitmap():Void
   {
   bmd = new BitmapData(this.width, this.height);
   bmd.perlinNoise(this.width, this.height, 6, 1, false, false, 1, 
true);

   _root.holder.attachBitmap(bmd, 1);
  
   createGrid();

   }
  
   private function createGrid():Void

   {
   grid = new Array();
   for(var y:Number = 0; ythis.height; y++)
   {
   grid[y] = new Array();
   for(var x:Number = 0; xthis.width; x++)
   {
   //create a new point
   var myPoint:Point3D = grid[y][x] = new Point3D();
  
   //x and z depend on position (orientate around center 
(0,0,0))

   var xp:Number = x;
   var zp:Number = y;
  
   //y depends on the the greyscale value in percentage, 
going from 'min' to 'max'

   var pixel:Number = bmd.getPixel32(x, y);
   trace(pixel = +pixel);
   trace();
   var percentage:Number = pixel / 0x00;
   var yp:Number = percentage * (max - min) + min;
  
   myPoint.setPosition(xp, yp, zp);
  
   }

   }
   }


The trace(pixel=...); traces a negative value, which I find very 
strange... Any suggestions ?



Greets,

Jeroen Beckers
[EMAIL PROTECTED]
http://www.dauntless.be
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] BitmapData.getPixel() - negative value ?

2006-09-14 Thread Claus Wahlers



pixel = -16777216


-16777216 is 0xff00 (solid black)

Try to trace pixel.toString(16)

Cheers,
Claus.
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com