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


Java ReplicateScaleFilter类代码示例

本文整理汇总了Java中java.awt.image.ReplicateScaleFilter的典型用法代码示例。如果您正苦于以下问题:Java ReplicateScaleFilter类的具体用法?Java ReplicateScaleFilter怎么用?Java ReplicateScaleFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ReplicateScaleFilter类属于java.awt.image包,在下文中一共展示了ReplicateScaleFilter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paint

import java.awt.image.ReplicateScaleFilter; //导入依赖的package包/类
@Override
public void paint(Graphics g){
    super.paint(g);
    // Have the extending class draw on an image so that it can be resized as needed
    Image bufferImage = createImage(DRAW_WIDTH, DRAW_HEIGHT);
    // Give control to visualization to draw on buffer
    paintVisualization((Graphics2D)bufferImage.getGraphics());
    int width = getWidth();
    int height = getHeight(); 
    // Scale and resize the image
    ReplicateScaleFilter scale = new ReplicateScaleFilter(width, height);
    FilteredImageSource fis = new FilteredImageSource(bufferImage.getSource(), scale);
    Image croppedImage = createImage(fis);
    g.drawImage(croppedImage, 0, 0, null);
    Toolkit.getDefaultToolkit().sync();
}
 
开发者ID:kurtlewis,项目名称:Visualizer,代码行数:17,代码来源:Visualizer.java

示例2: prepareImage

import java.awt.image.ReplicateScaleFilter; //导入依赖的package包/类
/**
 * Scales an image to the specified width and height. This should also
 * be used to implement
 * {@link Toolkit#prepareImage(Image, int, int, ImageObserver)}.
 * This uses {@link Toolkit#createImage(ImageProducer)} to create the actual
 * image.
 *
 * @param image the image to prepare
 * @param w the width
 * @param h the height
 *
 * @return the scaled image
 */
public static Image prepareImage(Image image, int w, int h)
{
  // Try to find cached scaled image.
  HashMap<Dimension,Image> scaledTable = imageCache.get(image);
  Dimension size = new Dimension(w, h);
  Image scaled = null;
  if (scaledTable != null)
    {
      scaled = scaledTable.get(size);
    }
  if (scaled == null)
    {
      // No cached scaled image. Start scaling image now.
      ImageProducer source = image.getSource();
      ReplicateScaleFilter scaler = new ReplicateScaleFilter(w, h);
      FilteredImageSource filteredSource =
        new FilteredImageSource(source, scaler);
      // Ideally, this should asynchronously scale the image.
      Image scaledImage =
        Toolkit.getDefaultToolkit().createImage(filteredSource);
      scaled = scaledImage;
      // Put scaled image in cache.
      if (scaledTable == null)
        {
          scaledTable = new HashMap<Dimension,Image>();
          imageCache.put(image, scaledTable);
        }
      scaledTable.put(size, scaledImage);
    }
  return scaled;
}
 
开发者ID:vilie,项目名称:javify,代码行数:45,代码来源:AbstractGraphics2D.java

示例3: scaleImage

import java.awt.image.ReplicateScaleFilter; //导入依赖的package包/类
public static BufferedImage scaleImage(Image sourceImage, int width, int height)
{
	if (sourceImage == null)
		return null;
    ImageFilter filter = new ReplicateScaleFilter(width,height);
    ImageProducer producer = new FilteredImageSource(sourceImage.getSource(),filter);
    Image resizedImage = Toolkit.getDefaultToolkit().createImage(producer);

    return toBufferedImage(resizedImage);
}
 
开发者ID:michellemulkey,项目名称:aTunes,代码行数:11,代码来源:ImageUtils.java

示例4: scaleImage

import java.awt.image.ReplicateScaleFilter; //导入依赖的package包/类
private BufferedImage scaleImage(Image sourceImage, int width, int height, int typeRGB) {
	ImageFilter filter = new ReplicateScaleFilter(width, height);
	ImageProducer producer = new FilteredImageSource(sourceImage
			.getSource(), filter);
	Image resizedImage = Toolkit.getDefaultToolkit().createImage(producer);

	return this.toBufferedImage(resizedImage, typeRGB);
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:9,代码来源:FileUploadHandler.java

示例5: zoomSet

import java.awt.image.ReplicateScaleFilter; //导入依赖的package包/类
/** Zoom the image, preparing for new display. */
protected void zoomSet(float zoom) {
    this.zoom = zoom;
    if (spectrogram != null) {
        int width = spectrogram.getWidth();
        int height = spectrogram.getHeight();

        ImageFilter scaleFilter =
                new ReplicateScaleFilter((int) (zoom * width), height);
        scaledSpectrogram =
                createImage(new FilteredImageSource(spectrogram.getSource(),
                        scaleFilter));
        repaint();
    }
}
 
开发者ID:juanma2268,项目名称:jumbertoTeia2600,代码行数:16,代码来源:SpectrogramPanel.java

示例6: main

import java.awt.image.ReplicateScaleFilter; //导入依赖的package包/类
public static void main(String args[]) {
    new ReplicateScaleFilter(100, 100).clone();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:4,代码来源:HeadlessReplicateScaleFilter.java

示例7: scaleCompanyImage

import java.awt.image.ReplicateScaleFilter; //导入依赖的package包/类
private static BufferedImage scaleCompanyImage(Image sourceImage, int width, int height) {
	ImageFilter filter = new ReplicateScaleFilter(width, height);
	ImageProducer producer = new FilteredImageSource(sourceImage.getSource(), filter);
	Image rImage = Toolkit.getDefaultToolkit().createImage(producer);
	return toBufferedCompanyImage(rImage);
}
 
开发者ID:mobilipia,项目名称:Deskera-HRMS,代码行数:7,代码来源:Snap.java


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