Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8106268

ImageView converting fitWidth and fitHeight to integer when applying transforms

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • fx2.0
    • fx1.0
    • javafx
    • Windows Vista Home Premium x32

    Description

      When applying transforms ImageView fitWidth and fitHeight are calculated based on integer values. This causes large size jumps when the applied transformations map to a smaller coordinate space. For example use the following transform to create a coordinate space mapping 1024x768 to 120x90:

      myTransform = [Scale{ x: 1024/120, y: 768/90 }, Translate{ 0, 0 }]

      In my case I have the ImageView within a custom node:

      class Custom extends CustomNode {
          public var content : Node;

          override protected function create() : Node {
              return content;
          }
      }

      Now let's create an ImageView with this:

      var myNode : Custom = Custom {
        content: ImageView {
          image: myImg
          preserveRatio: false
          fitWidth: 7.5
          fitHeight: 7.5
        }
      }

      When adding this to a scene it should produce an image with 64x64 pixel size, however, it does not as the transform seems to be calculated based on the integer value 7 not 7.5.

      The attached picture shows the too small image and a rectangle underneath it dimensioned with the proper size- using the same transform.

      Thanks
      /Chris

      Attachments

        Activity

          People

            lnerad Ľubomír Nerád (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: