当前位置: 首页>>代码示例>>Java>>正文


Java ProgressiveBilinearResizer类代码示例

本文整理汇总了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));
}
 
开发者ID:coobird,项目名称:thumbnailator,代码行数:31,代码来源:ScaledThumbnailMakerTest.java

示例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));
}
 
开发者ID:coobird,项目名称:thumbnailator,代码行数:33,代码来源:FixedSizeThumbnailMakerTest.java

示例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);
	}
}
 
开发者ID:farhan,项目名称:Android-Image-Resizer-Module,代码行数:36,代码来源:Thumbnails.java


注:本文中的net.coobird.thumbnailator.resizers.ProgressiveBilinearResizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。