Win a copy of Penetration Testing Basics this week in the Security forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

bufferd Image!

Maha Pratap
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey folks!
I am creating a buffered image with the help of an
indexcolormodel,databuffer(having data of ints ). I am creating
this databuffer with :-
DataBuffer db = new DataBufferInt(buf,buf.length);
//buf is an array having all the data//.
then with this databufer i am creating a
writbleraster r = Raster.createBandedRaster(db,w,h,int
scalinestride,int[] bankIndices,in[] bandoffsets,null).

here i am unable to understand what does
those scanlinestride,bankindices,bandoffsets mean. I
am creating indexcolormodel with following code:-

byte[] r = new byte[CMAP_SIZE];
byte[] g = new byte[CMAP_SIZE];
byte[] b = new byte[CMAP_SIZE];
int[] Ired = {0,82,221,53,255};
int[] Igreen = {0,149,73,45,255};
int[] Iblue = {0,54,63,87,255};
for(int i=0;i<CMAP_SIZE;i++){>
r = (byte)Ired;
g = (byte)Igreen;
b = (byte)Iblue;
cm = new IndexColorModel(4,5,r,g,b);

and then bufferedimage is formed by
orBimage = new BufferedImage( cm, raster,false,null);
pls help me out in drawing this image , ofcourse this code now is giving me errors. thanks in advance............
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic