Alpha of Graphics is not affected by container alpha

Bug #714361 reported by brettPeriscopic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
jeash
Fix Released
Undecided
Unassigned

Bug Description

Currently the alpha of Graphics is not adjusted by a container's alpha. This precise scenario could be fixed fairly simply by multiplying the current DisplayObject's alpha with the parent cumulative alpha. However, the larger strategy for handling masking, cacheAsBitmap, and BlendMode.LAYER should be taken into account when fixing this.

package ;

 import flash.display.Sprite;
 import flash.display.Shape;
 import flash.Lib;

class Main extends Sprite{

 public static function main() {
         Lib.current.stage.addChild(new Main());
 }

 public function new(){
  super();
  var s:Sprite = new Sprite();
  s.graphics.beginFill(0x0099FF);
  s.graphics.drawRect(0,0,50,50);
  s.graphics.endFill();

  var inset:Shape = new Shape();
  inset.graphics.beginFill(0xFF0000);
  inset.graphics.drawRect(10,10,30,30);
  inset.graphics.endFill();

  s.x=s.y=100;
  s.alpha=0.1;
  s.addChild(inset);
  addChild(s);
 }
}

Revision history for this message
Niel Drummond (niel-drummond) wrote :

hmm.. do you have an example for masking ?

BlendMode is tricky... I am unsure how to support it in a clean and fast way. Possibly, this is only for GL-contexts.

Revision history for this message
Niel Drummond (niel-drummond) wrote :

So this is fixed from cached and non-cached rendering passes.

Caveat: For some reason the alpha in a cached cycle is not pre-multiplied with a white background.

About the BlendMode - I noticed BitmapData.js has some ways of implementing this, so it's on my plan to check whether the code can be integrated into jeash.

Changed in jeash:
status: New → Fix Committed
Changed in jeash:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.