Re: [Flashcoders] Get the average of 2 colors

2006-03-10 Thread Wille Frankenhaeuser
Average the components or various colorchannels (red, green and blue) as 
stated earlier.


Wille


varcolor1:Number = 0xFF
varcolor2:Number = 0xFF

t_iBlend = blendComponents(color1, color2);
showComponents(t_iBlend);

function blendComponents(a_iColor1, a_iColor2){
   t_ar_Color1 = toComponents(a_iColor1);
   t_ar_Color2 = toComponents(a_iColor2);
   tr = (t_ar_Color1[0] + t_ar_Color2[0])/2;
   tg = (t_ar_Color1[1] + t_ar_Color2[1])/2;
   tb = (t_ar_Color1[2] + t_ar_Color2[2])/2;
   return tr  16 | tg  8 | tb;
}

function toComponents(a_iColor){
   t_ar_Color = Array();
   t_ar_Color.push(a_iColor16  0xFF); // red
   t_ar_Color.push(a_iColor8  0xFF); // green
   t_ar_Color.push(a_iColor  0xFF); // blue
   return t_ar_Color;
}

function showComponents(a_iColor){
   trace(r: + (a_iColor16  0xFF) ) ;
   trace(g: + (a_iColor8   0xFF) ) ;
   trace(b: + (a_iColor  0xFF) ) ;
}



Joakim Carlgren wrote:

Whats the easiest way to calculate the average of two colors?

 

 


varcolor1:Number = 0xFF

varcolor2:Number = 0xFF

 


varmyColor:Color = new Color(my_mc)

myColor.setRGB((color1 + color2) / 2)

I know its not this simple and probably I need to play with bitwise
operators..

Any easy way to solve this? 

 


Joakim Carlgren



 


___
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] flash 8 Masking blurred BitmapData

2006-01-05 Thread Wille Frankenhaeuser

Hi,

have you tried:
maskee.cacheAsBitmap = true;
maskMC.cacheAsBitmap = true;

http://www.kaourantin.net/2005/08/alpha-masking-goodness-in-flash- 
player.html


Wille

On Jan 5, 2006, at 18: 35, _jan Guichelaar [woedend] wrote:


Hi All
(I'm not new to the list but was away for over a year, so hi to you  
all again)


I am working with some new flash 8 features in actionscript, but  
ran into a problem (bug?)


I am taking a snapshot from a mc wtih :

snapshot = new BitmapData(200, 200);

Then draw this into an emty mc with :

mc.draw(snapshot ,new Matrix())

And apply a blur to the new mc with :

mc.filters=[new flash.filters.BlurFilter(80,0,30)];

This all works fine but when i want to mask this blurred mc with :

mc.setMask(_root.maskMc)
There is no mask applied to the mc

If i leave out the blur, the mask will show perfectly

Anybody any ideas?
Flash will be very limited when we can only use the one or two new  
methods etc. at the same time :-(


grtz
jan

--
Jan Guichelaar
---
[EMAIL PROTECTED]
http://www.woedend.nl
---
Woedend!
Magna Plaza
Spuistraat 139 J
1012 SV Amsterdam
---
tel +31 [0]20 6764999
fax +31 [0]20 4714446
---



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


Wille Frankenhaeuser
[EMAIL PROTECTED]


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