當前位置: 首頁>>代碼示例>>Java>>正文


Java WritableRaster.getPixel方法代碼示例

本文整理匯總了Java中java.awt.image.WritableRaster.getPixel方法的典型用法代碼示例。如果您正苦於以下問題:Java WritableRaster.getPixel方法的具體用法?Java WritableRaster.getPixel怎麽用?Java WritableRaster.getPixel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.image.WritableRaster的用法示例。


在下文中一共展示了WritableRaster.getPixel方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: processaAlgoritmo

import java.awt.image.WritableRaster; //導入方法依賴的package包/類
public BufferedImage processaAlgoritmo(BufferedImage img, PosicoesDTO posicoes) {
	WritableRaster raster = img.getRaster();
	BufferedImage newImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB);
	int pixels[] = new int[4];
	for (int i = posicoes.getX1(); i < posicoes.getY1() - 1; i++) {
		for (int j = posicoes.getX2(); j < posicoes.getY2() - 1; j++) {
			raster.getPixel(i, j, pixels);
			int[] novosPixels = calculaPixeis(img, i, j);
			pixels[0] = novosPixels[0];
			pixels[1] = novosPixels[1];
			pixels[2] = novosPixels[2];

			raster.setPixel(i, j, pixels);
		}
	}

	newImage.setData(raster);

	return newImage;

}
 
開發者ID:nbfontana,項目名稱:pdi,代碼行數:22,代碼來源:ProcessadorImagem.java

示例2: girar

import java.awt.image.WritableRaster; //導入方法依賴的package包/類
public BufferedImage girar(BufferedImage img, PosicoesDTO posicoes) {
	WritableRaster raster = img.getRaster();
	BufferedImage newImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB);
	WritableRaster rasterNewImage = newImage.getRaster();
	int pixels[] = new int[4];
	for (int i = posicoes.getX1(); i < posicoes.getX2(); i++) {
		for (int j = posicoes.getY1(); j < posicoes.getY2(); j++) {
			raster.getPixel(i, j, pixels);
			rasterNewImage.setPixel(i, img.getHeight() - j, pixels);
		}
	}

	newImage.setData(rasterNewImage);

	return newImage;

}
 
開發者ID:nbfontana,項目名稱:pdi,代碼行數:18,代碼來源:GiraImagem.java

示例3: girar

import java.awt.image.WritableRaster; //導入方法依賴的package包/類
public BufferedImage girar(BufferedImage img, PosicoesDTO posicoes) {
	WritableRaster raster = img.getRaster();
	BufferedImage newImage = new BufferedImage(img.getWidth(), img.getHeight(), BufferedImage.TYPE_INT_RGB);
	WritableRaster rasterNewImage = newImage.getRaster();
	int pixels[] = new int[4];
	for (int i = 1; i < img.getWidth() - 1; i++) {
		for (int j = 1; j < img.getHeight() - 1; j++) {
			raster.getPixel(i, j, pixels);
			rasterNewImage.setPixel(i, j, pixels);
		}
	}

	for (int i = posicoes.getX1(); i < posicoes.getX2(); i++) {
		int pixeisInvertidos = 0;
		for (int j = posicoes.getY1(); j < posicoes.getY2(); j++) {
			raster.getPixel(i, j, pixels);
			rasterNewImage.setPixel(i, posicoes.getY2() - pixeisInvertidos, pixels);
			pixeisInvertidos++;
		}
	}

	newImage.setData(rasterNewImage);

	return newImage;

}
 
開發者ID:nbfontana,項目名稱:pdi,代碼行數:27,代碼來源:GiraImagemParcial.java

示例4: toColorCubeMatrix

import java.awt.image.WritableRaster; //導入方法依賴的package包/類
/**
 * Converts the given image into a three-dimension matrix of color cubes.
 *
 * The first dimension is the pixel's y-coordinate
 * The second dimension is the pixel's x-coordinate
 * the third dimension is the pixel's four-value color cube, where:
 *
 * The first item is the pixel's red channel color value represented as 0..1
 * The second item is the pixel's green channel color value represented as 0..1
 * The third item is the pixel's blue channel color value represented as 0..1
 * The fourth item is the pixel's alpha channel represented as 0..255
 *
 * @param image The image to convert into a color cube matrix
 * @return A three dimensional array representing the ARGB value of each pixel in the source image.
 */
private static double[][][] toColorCubeMatrix(BufferedImage image) {

    // Source needs to be ARGB type; make a copy to assure constraint is met
    image = Transform.argbCopy(image);

    double[][][] matrix = new double[image.getHeight()][image.getWidth()][4];
    WritableRaster raster = image.getRaster();

    for (int y = 0; y < image.getHeight(); y++) {
        for (int x = 0; x < image.getWidth(); x++) {
            double[] pixel = raster.getPixel(x, y, (double[]) null);

            matrix[y][x][0] = pixel[0] / 255.0;
            matrix[y][x][1] = pixel[1] / 255.0;
            matrix[y][x][2] = pixel[2] / 255.0;
            matrix[y][x][3] = pixel[3];
        }
    }

    return matrix;
}
 
開發者ID:defano,項目名稱:jmonet,代碼行數:37,代碼來源:FloydSteinberg.java

示例5: getSplitPoint

import java.awt.image.WritableRaster; //導入方法依賴的package包/類
private static int getSplitPoint(WritableRaster raster, String name, int startX, int startY, boolean startPoint, boolean xAxis) {
    int[] rgba = new int[4];
    int next = xAxis ? startX : startY;
    int end = xAxis ? raster.getWidth() : raster.getHeight();
    int breakA = startPoint ? 255 : 0;
    int x = startX;
    int y = startY;
    while (next != end) {
        if (xAxis) {
            x = next;
        } else {
            y = next;
        }
        raster.getPixel(x, y, rgba);
        if (rgba[3] == breakA) return next;
        if (!startPoint && (rgba[0] != 0 || rgba[1] != 0 || rgba[2] != 0 || rgba[3] != 255))
            splitError(x, y, rgba, name);
        next++;
    }
    return 0;
}
 
開發者ID:dmitrykolesnikovich,項目名稱:featurea,代碼行數:22,代碼來源:ImageProcessor.java

示例6: getSplitPoint

import java.awt.image.WritableRaster; //導入方法依賴的package包/類
/** Hunts for the start or end of a sequence of split pixels. Begins searching at (startX, startY) then follows along the x or y
 * axis (depending on value of xAxis) for the first non-transparent pixel if startPoint is true, or the first transparent pixel
 * if startPoint is false. Returns 0 if none found, as 0 is considered an invalid split point being in the outer border which
 * will be stripped. */
static private int getSplitPoint (WritableRaster raster, String name, int startX, int startY, boolean startPoint, boolean xAxis) {
    int[] rgba = new int[4];

    int next = xAxis ? startX : startY;
    int end = xAxis ? raster.getWidth() : raster.getHeight();
    int breakA = startPoint ? 255 : 0;

    int x = startX;
    int y = startY;
    while (next != end) {
        if (xAxis)
            x = next;
        else
            y = next;

        raster.getPixel(x, y, rgba);
        if (rgba[3] == breakA) return next;

        if (!startPoint && (rgba[0] != 0 || rgba[1] != 0 || rgba[2] != 0 || rgba[3] != 255)) {
            // error
        }

        next++;
    }

    return 0;
}
 
開發者ID:whitecostume,項目名稱:libgdx_ui_editor,代碼行數:32,代碼來源:ImageUtils.java

示例7: getPixelValue

import java.awt.image.WritableRaster; //導入方法依賴的package包/類
private static int[] getPixelValue(WritableRaster raster, int xx, int yy) {
    return raster.getPixel(xx, yy, (int[]) null);
}
 
開發者ID:BlackCraze,項目名稱:GameResourceBot,代碼行數:4,代碼來源:Preprocessor.java

示例8: getPixel

import java.awt.image.WritableRaster; //導入方法依賴的package包/類
public static Integer getPixel(BufferedImage img, int i, int j, int tipoPixel) {
	WritableRaster raster = img.getRaster();
	int pixels[] = new int[4];
	return raster.getPixel(i, j, pixels)[tipoPixel];
}
 
開發者ID:nbfontana,項目名稱:pdi,代碼行數:6,代碼來源:PixelsUtils.java


注:本文中的java.awt.image.WritableRaster.getPixel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。