Re: BufferedImage



"oopson" <oopson@xxxxxxxxx> schreef in bericht
news:7294a822571df2cc3c779b3a18fae7c8@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> hi
>
> i am creating images in java using
> BufferedImage(w,h,BufferedImage.TYPE_INT_RGB )
>
> then i set the pixels values using
>
> BufferedImage.setRGB(x,y,pixelvalue)
>
> according to hava documentation
>
> TYPE_INT_RGB Represents an image with 8-bit RGB color components packed
> into integer pixels. The image has a DirectColorModel without alpha.
>
> but always the size of the result image is (4 * number of pixels) so every
> pixel uses 4 bytes instead of 3 while i am setting just the 3 bytes RGB

That is because every pixel is packed into an int, which is 4 bytes. Only 3
of the 4 bytes are used.

> anyone can help?

What is the problem?


.



Relevant Pages

  • Re: paint program
    ... Paul Lutus wrote: ... >>I am quite new to Java and thought that making a simple painting program ... and then update just those pixels back on the canvas. ...
    (comp.lang.java.gui)
  • Re: paint program
    ... Paul Lutus wrote: ... >>I am quite new to Java and thought that making a simple painting program ... and then update just those pixels back on the canvas. ...
    (comp.lang.java.programmer)
  • Re: paint program
    ... > I am quite new to Java and thought that making a simple painting program ... I'm using Swing and can see how to draw solid rectangles, ... and then update just those pixels back on the canvas. ... > struggling with the implementation in Java. ...
    (comp.lang.java.programmer)
  • Request help with "mouse dragged" event
    ... but in Java some pixels are missing from ... public class test extends JApplet { ... ContentPane contentPane; ...
    (comp.lang.java.help)
  • Re: paint program
    ... > I am quite new to Java and thought that making a simple painting program ... I'm using Swing and can see how to draw solid rectangles, ... and then update just those pixels back on the canvas. ... > struggling with the implementation in Java. ...
    (comp.lang.java.gui)