2 Replies Latest reply on Feb 10, 2018 3:26 PM by itlancer

    AdjustColor incorrect work with brightness or hue 0 values

    itlancer Level 2

      Bug tracker link: Tracker


      Problem Description:

      When you use AdjustColor and set all it properties then set again brightness or hue to 0 value in result you get that AdjustColor::CalculateFinalFlatArray() method don't change it result.

      It's very old bug described even there in 2012 (4 years ago!): http://stackoverflow.com/questions/10172393/as3-adjust-image-colors

      It has been tested with many different Flash Player and AIR versions from 10.3 to 22 beta. The same problem in all cases.

      It's a big problem for work with filters.


      Steps to Reproduce:

      1) Create AdjustColor object

      2) Set it properties (brightness, contrast, hue and saturation) with values

      3) Set again (change) brightness or hue value to 0.

      4) get AdjustColor::CalculateFinalFlatArray() method result

      Launch code below. Application example with sources attached.


      ActionScript 3.0 code:

      var adjustColor:AdjustColor = new AdjustColor();

      adjustColor.brightness = 50;

      adjustColor.contrast = 0;

      adjustColor.hue = 0;

      adjustColor.saturation = 0;

      trace("Before changes:", adjustColor.CalculateFinalFlatArray());//Before changes: 1,0,0,0,50,0,1,0,0,50,0,0,1,0,50,0,0,0,1,0

      adjustColor.brightness = 0;

      trace("Actual result:", adjustColor.CalculateFinalFlatArray());//Actual result: 1,0,0,0,50,0,1,0,0,50,0,0,1,0,50,0,0,0,1,0


      adjustColor = new AdjustColor();

      adjustColor.brightness = 0;

      adjustColor.contrast = 0;

      adjustColor.hue = 0;

      adjustColor.saturation = 0;

      trace("Expected result:", adjustColor.CalculateFinalFlatArray());//Expected result: 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0



      Actual Result:



      Expected Result:



      Any Workarounds: recreate AdjustColor instead of reuse it:

      var adjustColor:AdjustColor = new AdjustColor();