本文整理汇总了Java中org.jdesktop.swingx.graphics.GraphicsUtilities.setPixels方法的典型用法代码示例。如果您正苦于以下问题:Java GraphicsUtilities.setPixels方法的具体用法?Java GraphicsUtilities.setPixels怎么用?Java GraphicsUtilities.setPixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jdesktop.swingx.graphics.GraphicsUtilities
的用法示例。
在下文中一共展示了GraphicsUtilities.setPixels方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: filter
import org.jdesktop.swingx.graphics.GraphicsUtilities; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public BufferedImage filter(BufferedImage src, BufferedImage dst) {
if (dst == null) {
dst = createCompatibleDestImage(src, null);
}
int width = src.getWidth();
int height = src.getHeight();
int[] pixels = new int[width * height];
GraphicsUtilities.getPixels(src, 0, 0, width, height, pixels);
mixColor(pixels);
GraphicsUtilities.setPixels(dst, 0, 0, width, height, pixels);
return dst;
}
示例2: filter
import org.jdesktop.swingx.graphics.GraphicsUtilities; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public BufferedImage filter(BufferedImage src, BufferedImage dst) {
int width = src.getWidth();
int height = src.getHeight();
if (dst == null) {
dst = createCompatibleDestImage(src, null);
}
int[] srcPixels = new int[width * height];
int[] dstPixels = new int[width * height];
GraphicsUtilities.getPixels(src, 0, 0, width, height, srcPixels);
// horizontal pass
blur(srcPixels, dstPixels, width, height, radius);
// vertical pass
//noinspection SuspiciousNameCombination
blur(dstPixels, srcPixels, height, width, radius);
// the result is now stored in srcPixels due to the 2nd pass
GraphicsUtilities.setPixels(dst, 0, 0, width, height, srcPixels);
return dst;
}
示例3: filter
import org.jdesktop.swingx.graphics.GraphicsUtilities; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public BufferedImage filter(BufferedImage src, BufferedImage dst) {
int width = src.getWidth();
int height = src.getHeight();
if (dst == null) {
dst = createCompatibleDestImage(src, null);
}
int[] srcPixels = new int[width * height];
int[] dstPixels = new int[width * height];
GraphicsUtilities.getPixels(src, 0, 0, width, height, srcPixels);
for (int i = 0; i < iterations; i++) {
// horizontal pass
FastBlurFilter.blur(srcPixels, dstPixels, width, height, radius);
// vertical pass
FastBlurFilter.blur(dstPixels, srcPixels, height, width, radius);
}
// the result is now stored in srcPixels due to the 2nd pass
GraphicsUtilities.setPixels(dst, 0, 0, width, height, srcPixels);
return dst;
}
示例4: filter
import org.jdesktop.swingx.graphics.GraphicsUtilities; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@SuppressWarnings({ "SuspiciousNameCombination" })
@Override
public BufferedImage filter(BufferedImage src, BufferedImage dst) {
int width = src.getWidth();
int height = src.getHeight();
if (dst == null) {
dst = createCompatibleDestImage(src, null);
}
int[] srcPixels = new int[width * height];
int[] dstPixels = new int[width * height];
float[] kernel = createGaussianKernel(radius);
GraphicsUtilities.getPixels(src, 0, 0, width, height, srcPixels);
// horizontal pass
blur(srcPixels, dstPixels, width, height, kernel, radius);
// vertical pass
blur(dstPixels, srcPixels, height, width, kernel, radius);
// the result is now stored in srcPixels due to the 2nd pass
GraphicsUtilities.setPixels(dst, 0, 0, width, height, srcPixels);
return dst;
}