@Test public void testRenderForwardsRenderCallToRenderStrategyWithAreaProvidedByAreaProvider() { RenderImage image = createMock(RenderImage.class); RenderDevice renderDevice = createMock(RenderDevice.class); AreaProvider areaProvider = createMock(AreaProvider.class); expect(areaProvider.getSourceArea(image)).andReturn(new Box(1, 2, 3, 4)); replay(areaProvider); RenderStrategy renderStrategy = createMock(RenderStrategy.class); renderStrategy.render(renderDevice, image, new Box(1, 2, 3, 4), 1, 2, 3, 4, Color.NONE, 5); replay(renderStrategy); CompoundImageMode compoundImageMode = new CompoundImageMode(areaProvider, renderStrategy); compoundImageMode.render(renderDevice, image, 1, 2, 3, 4, Color.NONE, 5); verify(renderStrategy); verify(areaProvider); }
@Override public void render( @Nonnull RenderDevice renderDevice, RenderImage renderImage, int x, int y, int width, int height, Color color, float scale) { m_renderStrategy.render(renderDevice, renderImage, m_areaProvider.getSourceArea(renderImage), x, y, width, height, color, scale); }
CompoundImageMode implements ImageMode { @Override public void render( @Nonnull RenderDevice renderDevice, RenderImage renderImage, int x, int y, int width, int height, Color color, float scale) { m_renderStrategy.render(renderDevice, renderImage, m_areaProvider.getSourceArea(renderImage), x, y, width, height, color, scale); } }
CompoundImageMode implements ImageMode { @Override public void render( @Nonnull RenderDevice renderDevice, RenderImage renderImage, int x, int y, int width, int height, Color color, float scale) { m_renderStrategy.render(renderDevice, renderImage, m_areaProvider.getSourceArea(renderImage), x, y, width, height, color, scale); } CompoundImageMode(AreaProvider areaProvider, RenderStrategy renderStrategy); }
CompoundImageMode implements ImageMode { @Override public void render( @Nonnull RenderDevice renderDevice, RenderImage renderImage, int x, int y, int width, int height, Color color, float scale) { m_renderStrategy.render(renderDevice, renderImage, m_areaProvider.getSourceArea(renderImage), x, y, width, height, color, scale); } CompoundImageMode(AreaProvider areaProvider, RenderStrategy renderStrategy); @Override void setParameters(final String parameters); @Override void render(
      @Nonnull RenderDevice renderDevice,
      RenderImage renderImage,
      int x,
      int y,
      int width,
      int height,
      Color color,
      float scale); @Override Size getImageNativeSize(NiftyImage image); }
CompoundImageMode implements ImageMode { @Override public void render( @Nonnull RenderDevice renderDevice, RenderImage renderImage, int x, int y, int width, int height, Color color, float scale) { m_renderStrategy.render(renderDevice, renderImage, m_areaProvider.getSourceArea(renderImage), x, y, width, height, color, scale); } CompoundImageMode(AreaProvider areaProvider, RenderStrategy renderStrategy); @Override void setParameters(final String parameters); @Override void render(
      @Nonnull RenderDevice renderDevice,
      RenderImage renderImage,
      int x,
      int y,
      int width,
      int height,
      Color color,
      float scale); @Override Size getImageNativeSize(NiftyImage image);  }