本文整理汇总了Java中net.coobird.thumbnailator.resizers.ProgressiveBilinearResizer类的典型用法代码示例。如果您正苦于以下问题:Java ProgressiveBilinearResizer类的具体用法?Java ProgressiveBilinearResizer怎么用?Java ProgressiveBilinearResizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProgressiveBilinearResizer类属于net.coobird.thumbnailator.resizers包,在下文中一共展示了ProgressiveBilinearResizer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyResizerFactoryBeingCalled
import net.coobird.thumbnailator.resizers.ProgressiveBilinearResizer; //导入依赖的package包/类
/**
* Test for the {@link ScaledThumbnailMaker} class where,
* <ol>
* <li>An thumbnail is to be made</li>
* </ol>
* and the expected outcome is,
* <ol>
* <li>The ResizerFactory is used to obtain a Resizer.</li>
* </ol>
*/
@Test
public void verifyResizerFactoryBeingCalled()
{
// given
BufferedImage img = makeTestImage200x200();
Resizer spyResizer = spy(new ProgressiveBilinearResizer());
ResizerFactory resizerFactory = mock(ResizerFactory.class);
when(resizerFactory.getResizer(any(Dimension.class), any(Dimension.class)))
.thenReturn(spyResizer);
// when
new ScaledThumbnailMaker(0.5)
.resizerFactory(resizerFactory)
.make(img);
// then
verify(resizerFactory, atLeastOnce())
.getResizer(new Dimension(200, 200), new Dimension(100, 100));
verify(spyResizer).resize(eq(img), any(BufferedImage.class));
}
示例2: verifyResizerFactoryBeingCalled
import net.coobird.thumbnailator.resizers.ProgressiveBilinearResizer; //导入依赖的package包/类
/**
* Test for the {@link FixedSizeThumbnailMaker} class where,
* <ol>
* <li>An thumbnail is to be made</li>
* </ol>
* and the expected outcome is,
* <ol>
* <li>The ResizerFactory is used to obtain a Resizer.</li>
* </ol>
*/
@Test
public void verifyResizerFactoryBeingCalled()
{
// given
BufferedImage img = makeTestImage200x200();
Resizer spyResizer = spy(new ProgressiveBilinearResizer());
ResizerFactory resizerFactory = mock(ResizerFactory.class);
when(resizerFactory.getResizer(any(Dimension.class), any(Dimension.class)))
.thenReturn(spyResizer);
// when
new FixedSizeThumbnailMaker(100, 100)
.keepAspectRatio(true)
.fitWithinDimensions(true)
.resizerFactory(resizerFactory)
.make(img);
// then
verify(resizerFactory, atLeastOnce())
.getResizer(new Dimension(200, 200), new Dimension(100, 100));
verify(spyResizer).resize(eq(img), any(BufferedImage.class));
}
示例3: makeResizer
import net.coobird.thumbnailator.resizers.ProgressiveBilinearResizer; //导入依赖的package包/类
/**
* Returns a {@link Resizer} which is suitable for the current
* builder state.
*
* @param mode The scaling mode to use to create thumbnails.
* @return The {@link Resizer} which is suitable for the
* specified scaling mode and builder state.
*/
private Resizer makeResizer(ScalingMode mode)
{
Map<RenderingHints.Key, Object> hints =
new HashMap<RenderingHints.Key, Object>();
hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION, alphaInterpolation.getValue());
hints.put(RenderingHints.KEY_DITHERING, dithering.getValue());
hints.put(RenderingHints.KEY_ANTIALIASING, antialiasing.getValue());
hints.put(RenderingHints.KEY_RENDERING, rendering.getValue());
if (mode == ScalingMode.BILINEAR)
{
return new BilinearResizer(hints);
}
else if (mode == ScalingMode.BICUBIC)
{
return new BicubicResizer(hints);
}
else if (mode == ScalingMode.PROGRESSIVE_BILINEAR)
{
return new ProgressiveBilinearResizer(hints);
}
else
{
return new ProgressiveBilinearResizer(hints);
}
}