コード例 #1
0
  private static void testConvertData(
      AffineTransformationStep transformer,
      TransformationStepInput input,
      ImagePointTransformer expectedPointTransformer) {

    TransformedImage transformedImage =
        transformer.render(Cancellation.UNCANCELABLE_TOKEN, input, null);

    assertEquals(input.getDestinationWidth(), transformedImage.getImage().getWidth());
    assertEquals(input.getDestinationHeight(), transformedImage.getImage().getHeight());

    ImagePointTransformer actualPointTransformer = transformedImage.getPointTransformer();
    PointTransformerChecks.checkEqualPointTransformers(
        expectedPointTransformer, actualPointTransformer);
  }
コード例 #2
0
  public void testRenderNotUsingOffered(BufferedImage offered, int width, int height, int type) {
    for (InterpolationType interpolation : InterpolationType.values()) {
      AffineTransformationStep transformer =
          new AffineTransformationStep(
              BasicImageTransformations.identityTransformation(), Color.GRAY, interpolation);

      TransformedImage inputImage = blankTransformedImage(Color.BLUE, width, height, type);

      TransformationStepInput input = new TransformationStepInput(null, width, height, inputImage);
      TransformedImage result = transformer.render(Cancellation.UNCANCELABLE_TOKEN, input, offered);
      assertNotSame(offered, result.getImage());

      ImageTestUtils.checkBlankImage(result.getImage(), Color.BLUE);

      PointTransformerChecks.checkEqualPointTransformers(
          AffineImagePointTransformer.IDENTITY, result.getPointTransformer());
    }
  }
コード例 #3
0
  @Test
  public void testRenderNullInputProperties() {
    for (InterpolationType interpolation : InterpolationType.values()) {
      AffineTransformationStep transformer =
          new AffineTransformationStep(
              BasicImageTransformations.newZoomTransformation(100.0, 100.0),
              Color.GRAY,
              interpolation);

      TransformationStepInput input =
          new TransformationStepInput(null, 100, 100, TransformedImage.NULL_IMAGE);
      TransformedImage result = transformer.render(Cancellation.UNCANCELABLE_TOKEN, input, null);

      assertNull(result.getImage());
      PointTransformerChecks.checkEqualPointTransformers(
          AffineImagePointTransformer.IDENTITY, result.getPointTransformer());
    }
  }