本文整理汇总了Java中sun.awt.image.IntegerInterleavedRaster.getPixelStride方法的典型用法代码示例。如果您正苦于以下问题:Java IntegerInterleavedRaster.getPixelStride方法的具体用法?Java IntegerInterleavedRaster.getPixelStride怎么用?Java IntegerInterleavedRaster.getPixelStride使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.awt.image.IntegerInterleavedRaster
的用法示例。
在下文中一共展示了IntegerInterleavedRaster.getPixelStride方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContext
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public static PaintContext getContext(BufferedImage bufImg,
AffineTransform xform,
RenderingHints hints,
Rectangle devBounds) {
WritableRaster raster = bufImg.getRaster();
ColorModel cm = bufImg.getColorModel();
int maxw = devBounds.width;
Object val = hints.get(RenderingHints.KEY_INTERPOLATION);
boolean filter =
(val == null
? (hints.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_QUALITY)
: (val != RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
if (raster instanceof IntegerInterleavedRaster &&
(!filter || isFilterableDCM(cm)))
{
IntegerInterleavedRaster iir = (IntegerInterleavedRaster) raster;
if (iir.getNumDataElements() == 1 && iir.getPixelStride() == 1) {
return new Int(iir, cm, xform, maxw, filter);
}
} else if (raster instanceof ByteInterleavedRaster) {
ByteInterleavedRaster bir = (ByteInterleavedRaster) raster;
if (bir.getNumDataElements() == 1 && bir.getPixelStride() == 1) {
if (filter) {
if (isFilterableICM(cm)) {
return new ByteFilter(bir, cm, xform, maxw);
}
} else {
return new Byte(bir, cm, xform, maxw);
}
}
}
return new Any(raster, cm, xform, maxw, filter);
}
示例2: getContext
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public static PaintContext getContext(BufferedImage bufImg,
AffineTransform xform,
RenderingHints hints,
Rectangle devBounds) {
WritableRaster raster = bufImg.getRaster();
ColorModel cm = bufImg.getColorModel();
int maxw = devBounds.width;
Object val = hints.get(hints.KEY_INTERPOLATION);
boolean filter =
(val == null
? (hints.get(hints.KEY_RENDERING) == hints.VALUE_RENDER_QUALITY)
: (val != hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
if (raster instanceof IntegerInterleavedRaster &&
(!filter || isFilterableDCM(cm)))
{
IntegerInterleavedRaster iir = (IntegerInterleavedRaster) raster;
if (iir.getNumDataElements() == 1 && iir.getPixelStride() == 1) {
return new Int(iir, cm, xform, maxw, filter);
}
} else if (raster instanceof ByteInterleavedRaster) {
ByteInterleavedRaster bir = (ByteInterleavedRaster) raster;
if (bir.getNumDataElements() == 1 && bir.getPixelStride() == 1) {
if (filter) {
if (isFilterableICM(cm)) {
return new ByteFilter(bir, cm, xform, maxw);
}
} else {
return new Byte(bir, cm, xform, maxw);
}
}
}
return new Any(raster, cm, xform, maxw, filter);
}
示例3: getContext
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
public static PaintContext getContext(BufferedImage bufImg,
AffineTransform xform,
RenderingHints hints,
Rectangle devBounds) {
WritableRaster raster = bufImg.getRaster();
ColorModel cm = bufImg.getColorModel();
int maxw = devBounds.width;
Object val = hints.get(hints.KEY_INTERPOLATION);
boolean filter =
(val == null
? (hints.get(hints.KEY_RENDERING) == hints.VALUE_RENDER_QUALITY)
: (val != hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR));
if (raster instanceof IntegerInterleavedRaster &&
(!filter || isFilterableDCM(cm)))
{
IntegerInterleavedRaster iir = (IntegerInterleavedRaster) raster;
if (iir.getNumDataElements() == 1 && iir.getPixelStride() == 1) {
return new Int(iir, cm, xform, maxw, filter);
}
} else if (raster instanceof ByteInterleavedRaster) {
ByteInterleavedRaster bir = (ByteInterleavedRaster) raster;
if (bir.getNumDataElements() == 1 && bir.getPixelStride() == 1) {
if (filter) {
if (isFilterableICM(cm)) {
return new ByteFilter(bir, cm, xform, maxw);
}
} else {
return new Byte(bir, cm, xform, maxw);
}
}
}
return new Any(raster, cm, xform, maxw, filter);
}
示例4: bufferedToGray
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
/**
* A faster convert that works directly with a specific raster
*/
public static void bufferedToGray(IntegerInterleavedRaster src, ImageUInt8 dst) {
int[] srcData = src.getDataStorage();
byte[] data = dst.data;
int srcStride = src.getScanlineStride();
int srcOffset = src.getDataOffset(0)-src.getPixelStride()+1;
int srcStrideDiff = srcStride-src.getPixelStride()*dst.width;
int indexSrc = srcOffset;
for (int y = 0; y < dst.height; y++) {
int indexDst = dst.startIndex + y * dst.stride;
for (int x = 0; x < dst.width; x++) {
int rgb = srcData[indexSrc++];
int r = (rgb >>> 16) & 0xFF;
int g = (rgb >>> 8) & 0xFF;
int b = rgb & 0xFF;
int ave = (r + g + b) / 3;
data[indexDst++] = (byte) ave;
}
indexSrc += srcStrideDiff;
}
}
示例5: bufferedToMulti_U8
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
/**
* A faster convert that works directly with a specific raster
*/
public static void bufferedToMulti_U8(IntegerInterleavedRaster src, MultiSpectral<ImageUInt8> dst) {
int[] srcData = src.getDataStorage();
int srcStride = src.getScanlineStride();
int srcOffset = src.getDataOffset(0)-src.getPixelStride()+1;
int srcStrideDiff = srcStride-src.getPixelStride()*dst.width;
byte[] data1 = dst.getBand(0).data;
byte[] data2 = dst.getBand(1).data;
byte[] data3 = dst.getBand(2).data;
int indexSrc = srcOffset;
for (int y = 0; y < dst.height; y++) {
int indexDst = dst.startIndex + y * dst.stride;
for (int x = 0; x < dst.width; x++, indexDst++) {
int rgb = srcData[indexSrc++];
data1[indexDst] = (byte) (rgb >>> 16);
data2[indexDst] = (byte) (rgb >>> 8);
data3[indexDst] = (byte) rgb;
}
indexSrc += srcStrideDiff;
}
}
示例6: bufferedToMulti_F32
import sun.awt.image.IntegerInterleavedRaster; //导入方法依赖的package包/类
/**
* A faster convert that works directly with a specific raster
*/
public static void bufferedToMulti_F32(IntegerInterleavedRaster src, MultiSpectral<ImageFloat32> dst) {
int[] srcData = src.getDataStorage();
int srcStride = src.getScanlineStride();
int srcOffset = src.getDataOffset(0)-src.getPixelStride()+1;
int srcStrideDiff = srcStride-src.getPixelStride()*dst.width;
float[] data1 = dst.getBand(0).data;
float[] data2 = dst.getBand(1).data;
float[] data3 = dst.getBand(2).data;
int indexSrc = srcOffset;
for (int y = 0; y < dst.height; y++) {
int indexDst = dst.startIndex + y * dst.stride;
for (int x = 0; x < dst.width; x++, indexDst++) {
int rgb = srcData[indexSrc++];
data1[indexDst] = (rgb >>> 16) & 0xFF;
data2[indexDst] = (rgb >>> 8) & 0xFF;
data3[indexDst] = rgb & 0xFF;
}
indexSrc += srcStrideDiff;
}
}