java - Differences between BufferedImage pixels and Color.getRGB() pixels -
i'm trying pixel data bufferedimage contain gray scale translucent image (argb). i'm getting writableraster image , setting pixels using raster's setpixels method. using method, arrayindexoutofbounds exceptions. after doing research, found bufferedimages store 1 integer per pixel per band instead of having 1 integer per pixel. is, 8 bits each band each pixel. causes me ton of trouble try access , change types of colors. i'm @ loss. i'll post other details if need be. thank you, sina
would please share code? have note if want set rectangle (128x128) on part of image, have call set rgb method this
//start points draw int blockx=128,blocky=128; //size of target rectangle need painted int w=128,h=128; int[] colors=new int[h*w]; //....init color array //start painting x value in array int coloroffset=0; //number of value should read array 1 row int paintwidth=128; //i think exception here, because of wrong number passed drawing pixel each row out.setrgb(blockx,blocky, w, h, colors, coloroffset, paintwidth);
once again, not magician, please share code buddy :) this example you
Comments
Post a Comment