@Test
  public void motionBlurTest() {
    setupTest();

    effect = new MotionBlur();

    drc.deriveWithNewRegions(new RectBounds[] {new RectBounds(50, 50, 60, 60)});
    g1bn.setEffect(effect);
    g1bn.applyEffect(g1bn.getEffectFilter(), drc, drp);
    drcExpected.deriveWithNewRegions(new RectBounds[] {new RectBounds(40, 50, 70, 60)});
    compareResult(drcExpected, drc);

    ((MotionBlur) effect).setAngle((float) Math.toRadians(90));
    drc.addDirtyRegion(new RectBounds(70, 70, 80, 80));
    gbn.setEffect(effect);
    gbn.applyEffect(gbn.getEffectFilter(), drc, drp);
    drcExpected.deriveWithNewRegions(
        new RectBounds[] {new RectBounds(39, 40, 71, 70), new RectBounds(69, 60, 81, 90)});
    compareResult(drcExpected, drc);
  }
Ejemplo n.º 2
0
 /**
  * Constructs a new {@code MotionBlur} effect with the given radius and angle.
  *
  * @param radius the radius of the Gaussian kernel
  * @param angle the angle of the motion effect, in radians
  * @param input the single input {@code Effect}
  * @throws IllegalArgumentException if {@code radius} is outside the allowable range
  */
 public MotionBlur(float radius, float angle, Effect input) {
   super(input);
   setRadius(radius);
   setAngle(angle);
 }