Hi Urgent help needed can anyone plz solve this simple program for me?????
Thanxs alot..
from the tortured soul
write a program to decode and display an image. The file picture.txt contains numerical data that encodes an image. The first few lines (and the last) are as follows: 174 199 63 3 55 3 6 0 50 3 63 3 53 3 4 0 3 1 1 0 50 3 63 3 52 3 2 0 2 1 1 0 3 1 1 0 50 3
-1 The first line contains a pair of numbers that are the images width and height respectively. Each subsequent line, except the last, consists of a set of (count, color) pairs. Each distinct color value stands for a particular pixel color within the image. The count value specifies how many consecutive pixels of the associated color should be plotted. So the example above specifies that the first line of the image consists of 63 pixels of color 3, followed by a further 55 pixels of color 3, then 6 pixels of color 0, and 50 more of color 3. The sum of the count values in each line of the input file is equal to the width of the image. The first count on the final line of the file is negative (out of bounds) value, indicating the end of the image. The PicturePlotter class defines the following constructor: public PicturePlotter (int width, int height) Creating a PicturePlotter object causes a window to appear on the screen, whose drawing area matches the given dimensions. The class also defines the following method: public void plot(int x, int y, int count, int color) which can be used to plot count lots of color starting at position (x, y) within the image area. The class already defines associations between the color values in the data file and the screen colors that they represent. Write a program to read the contents of the file picture.txt and display the image it represents on a PicturePlotter object. The main method outline is provided in PictureMain.java to get you started. When you have read and plotted the full image, send the PicturePlotter object a repaint message public void repaint() to ensure the image is not broken up.