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

ImageView converting fitWidth and fitHeight to integer when applying transforms

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: fx1.0
    • Fix Version/s: fx2.0
    • Component/s: javafx
    • Environment:

      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

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

              Dates

              • Created:
                Updated:
                Resolved:
                Imported: