pixel « Icon Image « Java Swing Q&A





1. Java sampling pixel color in swing    stackoverflow.com

I have to create a special TextFieldUI that draws an image as the background. That image contains some alpha components. However, whenever a character is written in that text ...

2. Accessing the pixels of an image    stackoverflow.com

Could someone show me here how to access all the pixels of an image in order to be able to build a histogram of that image ?

3. Java making a 'dot/pixel' In swing/awt    stackoverflow.com

I just want to know how to make a dot/pixel at a certain x,y co-ordinate on my JFrame. Anyone know some simple code for this? Thanks,

4. Java fast pixel operations    stackoverflow.com

I would like to know how I would handle pixel operations best in Java. I'm using swing and drawing a rectangle of 1 by 1 pixel is terribly slow. I need ...

5. Added BufferedImage is only 2x2 pixels    stackoverflow.com

I have a script that cycles (almost like a slideshow) through a Vector object (flipBook), using a Thread (animationThread), and adds them to a JPanel. However, the added image is only ...

6. How to add 20 pixels of white at the top of an existing image file?    stackoverflow.com

I have an image of size w by h. In Java, I need to create an image that is size w by h+20 where the top w by 20 pixels is ...

7. Painting pixels images in Java    stackoverflow.com

Which method is the best way to create a pixel image with java. Say, I want to create a pixel image with the dimensions 200x200 which are 40.000 pixels in total. How ...

8. How to make pixel perfect Line2D in - Graphics2D    stackoverflow.com

G'day, I have JPanel with some Line2D objects on it. Issue is when I draw this line it doesn't appear as I want them to. Lines are not smooth, It's hard ...

9. How can i find the color of the pixel    coderanch.com

Pooja, All the MouseEvent gives you is the x and y location of the place where the event happened. To get the color of the pixel that this event happened on, you would have to have a component that keeps track of ( or can find ) the color of a certain x,y location on itself. None of the components provided ...





10. Simple Pixel Question    coderanch.com

Hi James, Presumably you have an image on your panel... if not all the pixels are the same color. So you could use a java.awt.image.pixelGrabber and call getColorModel() on it - and then the getRed(), getGreen() getBlue() getAlpha() on each of the pixels in the array.... I haven't actually tried any code so there might be a better way to do ...

11. How to find Pixels info from a text String    coderanch.com

HI Everybody, I am in a fix and would like to take some help from you, if possible. I am working on a project which has a canvas of 100x100 pixel size.I am putting Text using drawString method of graphics to put some text on the canvas. Now after putting this text on canvas I am trying to find follwoing info. ...

12. Grabbing pixels    coderanch.com

Hi Im developing a distributed application with RMI. The client will send an Images URL address to server, the server will load this image and grabs its pixels to an array, afterward the server will send the data array to the client, the client will create an image from this data array. I tried to write piece of code that demonstrate ...

13. How do i find out what color a certain pixel is?    coderanch.com

I'm writing a little applet using awt that draws a number of line of the screen. The lines are drawn as single points and move around the screen using velocity vectors. When they hit the edge they bounce at random. I need to detect when a line hits another line. I thought that if i look ahead of the line to ...

14. Creating an Image by Plotting Pixels?    coderanch.com

I want to plot a 256 x 256 pixel grayscale image from an array of bytes. Does anyone have any suggestions as to how to do this? I've looked through the discussion group, and I haven't been able to find anything that helps me out. My gut feeling is to use a Canvas, but I can't figure out how to set ...

15. Getting pixels from a Graphics instance    coderanch.com

My question is motivated by animation in full-screen exclusive mode, typically with page flipping. If an animation involves relatively few scene changes between frames, I might render the pages incrementally. Each page would receive only the necessary updates before being displayed. Now consider the implementation of a sprite under these circumstances. Just before a sprite is rendered, it would be useful ...

16. Convert mm to Pixels and vice versa    coderanch.com

Hi I`m coding a little Tool, for a manufacturer of glasses, which draws some specific points calculated by the parameters given. These parameters are in millimeter-format, parsed to double-values. All calculations are done in mm. Now i want to draw a preview using these calculations onto a canvas-screen (800*550). What is now the best method to convert these double`s to coordinates? ...





17. Set Pixel(x, y) to color c    coderanch.com

Ok, thanks. I have one problem with it though, it works when I call it on an hard-coded integer, but when I try to use it in a for/while-loop it doesn't work. (I am making a fractal-painter, so there are quite a few times when it will try to paint a pixel) Right now it looks like this public void paintComponent(Graphics ...

18. Number of characters per number of pixels    coderanch.com

You can only work out how many characters can by occupied in a certain number of pixels if you are using a monospaced font. This is because an x and an i in a non-monospaced font take up a different number of pixels per character whereas a monospaced font takes up a defined number of pixels per character. So for monospaced ...

19. BufferedImage 1-bit-per-pixel    coderanch.com

I am trying to create the application with "compact" BufferedImage which uses just 1 bit per pixel. But it does not work properly - it looks like it still uses a byte per pixel. Any thoughts? class BWBufImagePanel extends JPanel{ BufferedImage fBufferedImage = null; int fWidth = 10, fHeight = 10; byte [] data = null; /** Build a BufferedImage from ...

20. Finding pixel colour    coderanch.com

Hi, I've built a mini rubiks cube, but to spin it, you can click anywhere and drag it and to twist it you have to use the JButtons below: Rubiks Cube I would like it so... if you press the mouse on an area OUTSIDE of the cube, you can SPIN, and pressing the mouse on an area INSIDE the cube ...

21. BufferedImage and scanning pixels    coderanch.com

what i want to do is get a bufferedImage of a certain screenshot, which if you use. Robot.createSreenCapture(), that returns a buffered image... then i could use: bufferedImage.getXTiles(); and bufferedimage.getYTiles(); but i want to "look" at each tile to look for a specific color. how would i do that? .getRGB(int x, int y) returns an int.. I thought that RGB values ...

23. How to create image from array of pixels?    coderanch.com

Well i am creating array of pixels from image. Now i want to create image back from that array of pixels. I want to remove few pixels from it, so i can reduce the size of the image. Actually i want to reduce either the size (disk size) of image or resolution (height and width) of image. I used different ways ...

25. Random pixels from a BufferedImage...    coderanch.com

By "random", do you mean actually random x and y values, or just that they could be any x and y values? For the latter, check out the getRGB(int, int) method. The former could be implemented by feeding random values into the two parameters of that method, although that wouldn't address the equidistant constraint.

26. pixel difference    coderanch.com

27. Hi, I want to color byte array of image pixels with any color say Color(25,25,50). please help.    coderanch.com

Hi All, I want to color byte array of image pixels with any color say Color(25,25,50) preserving intensity of the original color. Formula to calculate intensity of color: 0.3*R + 0.59*G + 0.11*B Suppose current color of a image pixel is Color(50,25,23). i.e. current color - Red part - 50, Green part - 25 & blue part - 23. apply color ...

28. Writing a pixel mapping program    coderanch.com

Hi, I want to write a pixel mapping program which performs like this (the image below is just so you know what the grid should look like): (image from ladyada's SpokePOV project: www.ladyada.net/make/spokepov) 1. The home screen is a blank grid of segments. The segments are made by dividing a circle into sections 2. The user loads a monochrome (black and ...

29. swing & awt: drawing based on pixels?    coderanch.com

Hi all: This is a simplified question about some gui details in Java. The background design pattern is mvc. Assume that I need to draw a circle: public class MyCircle { // Please look at the data members private MyPoint center; // MyPoint is just a simple class representing a 2-D point (x,y) private int radius; private String color; // everything ...

30. How to set a bunch of pixels to a color with IndexColorModel    coderanch.com

I have read in an image and would like to change some of its pixels to a certain color. To make it easier I was just trying to change all of its pixels to a certain color. Color color = ....; IndexColorModel colorModel = (IndexColorModel) image.getColorModel(); // HELP how do I get the index for my color int sample = ??????? ...

31. [SOLVED] manipulating the pixel values of an image and constructinf a new image from    java-forums.org

Hello everyone! I want to access the pixels of an image, manipulate them and construct a new image from these manipulated pixels. I have already grabbed the pixels using the PixelGrabber class. But I am unable to construct an image from pixels. I tried using MemoryImageSource class. With all the different interfaces and classes for reading and writing images, I am ...

32. Decimal Pixels?    java-forums.org