5 Replies Latest reply on Nov 30, 2009 1:57 PM by kglad

    Offset Value - ColorMatrixFilter

    InsertGenericNameHere

      Hello all,

       

      Please excuse me if this is the wrong part of the Flash forum to post in, or if I did not correctly follow to forum guidelines.

       

      I have searched for some time now for more information on the Offset Value from the ColorMatrixFilter.

      I'm writing a paper on 'Matrices within Image Manipulation', and I'm using Adobe Photoshop and Flash as my "base".

      I have read http://www.adobe.com/devnet/flash/articles/matrix_transformations_04.html this page, but I still have some questions,

      concerning what exactly this value does?

      I have no real knowledge about Flash, or any other Adobe Products for that matter, but  it's rather important I understand what I write down in my own paper!

       

      Thank you in advance for any replies!

       

      - Wesley

        • 1. Re: Offset Value - ColorMatrixFilter
          kglad Adobe Community Professional & MVP

          the key part of the colormatrixfilter is:

           

          redResult = a[0] * srcR + a[1] * srcG + a[2] * srcB + a[3] * srcA + a[4]

           

          greenResult = a[5] * srcR + a[6] * srcG + a[7] * srcB + a[8] * srcA + a[9]

           

          blueResult = a[10] * srcR + a[11] * srcG + a[12] * srcB + a[13] * srcA + a[14]

           

          alphaResult = a[15] * srcR + a[16] * srcG + a[17] * srcB + a[18] * srcA + a[19]

           

           

          there are 4 lines of code that you need to understand.  each line can be considered independent of the other lines.  once you understand one line, you'll understand them all.

           

          the first line yields the red as a function of the starting r,g,b,a and the top row of the colormatrixfilter.   there's nothing more to understand about that first line.  the remaining lines are no different except they yield different end-colors and are a function of the same starting r,g,b,a and a different row of the colormatrixfilter.

          • 2. Re: Offset Value - ColorMatrixFilter
            InsertGenericNameHere Level 1

            Thanks for the reply!

            However I still don't see how this is related to the Offset Value (or am I missing something?)

            Judging from the formula's you gave wrote there, I guess it might be a value to more precisely select a color?

             

            - Wesley

            • 3. Re: Offset Value - ColorMatrixFilter
              kglad Adobe Community Professional & MVP

              the red offset would be a[4], green offset would be a[9] etc.

               

              but i don't remember seeing offset being used with the colormatrixfilter.  that term is used with the colortransform class which is slightly easier to understand because each r,g,b,a end-color and end-alpha is single variable linear function of the begin-color and begin-alpha as contrasted with the colormatrixfilter which is a multivariable linear function.

               

              here's the formula for the end colors using the colortransform:

               

              • New red value = (old red value * redMultiplier)redOffset
              • New green value = (old green value * greenMultiplier)greenOffset
              • New blue value = (old blue value * blueMultiplier)blueOffset
              • New alpha value = (old alpha value * alphaMultiplier)alphaOffset

               

              can you see how the colormatrixfilter and colortransform are similar but different?

              • 4. Re: Offset Value - ColorMatrixFilter
                InsertGenericNameHere Level 1

                Yes, I think I understand what you mean now, thank you for explaining!

                 

                Seems I also understood 'offset' incorrectly (English not being my primary language).

                 

                - Wesley

                • 5. Re: Offset Value - ColorMatrixFilter
                  kglad Adobe Community Professional & MVP

                  you're welcome.