本文整理匯總了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);
}
}