5 Replies Latest reply: Jan 27, 2011 2:54 PM by Flex harUI RSS

    Why dimensions are not integers?

    hidarikani Community Member

      Doesn't Flex just round the values before rendering?

        • 1. Re: Why dimensions are not integers?
          miguel8312 Community Member

          can you be more specific? are you talking about math? in code what exaclty are you referring to?

          • 2. Re: Why dimensions are not integers?
            _spoboyle Community Member

            I assume you are talking about displayobjects and UIcomponents. To be honest I ma not totally sure but i guess its a legacy thing from when there was no int type. also not that it should be a problem for displayobjects but numbers can hold larger values than int

            • 3. Re: Why dimensions are not integers?
              GordonSmith Adobe Employee

              Coordinates are allowed to be fractional values because the Flash Player does antialiasing when shapes aren't on pixel boundaries. For example, if you draw a 10x10 black square at (100, 100), and then another at (200.5, 200.5), I think you'll see some gray around the edges of the second square.

               

              Gordon Smith

              Adobe Flex SDK Team

              • 4. Re: Why dimensions are not integers?
                Evtim Georgiev (Adobe) Adobe Employee

                The reason is that rounding should happen after the coordinates are transformed from local DisplayObject space to global space.  The DisplayObject dimensions and coordinates undergo localToGlobal() transformation to get to the fianl pixel coordinates.  Rounding to a pixel in local space may be too restrictive, especially when doing animations in context of some transformations.  If for example the localToGlobal() scales everything by factor of 2, the ability to specify dimensions in .5 increments means the object will render in 1 pixel increments on screen.  If all coordinates were integers only, then animating the object will result in 2 pixel jumps on screen which will look jittery.

                • 5. Re: Why dimensions are not integers?
                  Flex harUI Adobe Employee

                  The player actually works in twips for rendering.  It uses that resolution

                  to determine which color to choose for an actual pixel.