public void notifyMoreDataReady(float[] bins) { // an array of floats if (recursion) System.err.println(" RECURSION "); nBins = bins.length; if (nBins == 0) return; recursion = true; if (size == null || nBins != size.height || nChunks != size.width) // || this is the or operator createGraphics(); // Returns a Graphics2D object for rendering into the specified // BufferedImage. int width = size.width; for (int i = 0; i < nBins; i++) { // this is recursing over all the rows (nbins is the number of rows) int bin = nBins - i - 1; // I think this makes it start from the top float val = mapper.eval(bins[bin]); // if (val < 0) val = 0.0f; if (val > 1.0) // I think this next section colours the pixels in the spectrum val = 1.0f; // display int c_r = (int) (255 * val); int c_g = c_r; int c_b = 255 - c_r; int color = (c_b) + (c_g << 8) + (c_r << 16) + (0xFF << 24); // << operator means signed left shift-- it shifts the bits in the binary // code to the left creating a bigger number the operand on the right // specifies the amount of shift screenBuffer[i * width + ptr] = (255 << 24) + color; // I think loads the screenBuffer array. the index[i*width+ptr] is filled // with the right operand // rgbarray[i] = color; } if (ptr % 1 == 0) { // ptr remainder(%) 1 screenConverter.newPixels( ptr, 0, 1, nBins); // newPixels is method inside the MemoryImageSource i think it does this----Sends // a rectangular region of the buffer of pixels to any ImageConsumers that are // currently interested in the data for this image and notify them that an // animation frame is complete. screenRepaint = true; repaint(); } ptr = (ptr + 1) % size.width; // i think this may help in changing the co-ordinates ptr may be the x // coordinate recursion = false; }