> A better optimized solution would be to look up for > the right color in setRGB depending on the angle of > the currently drawn pixel - this way you draw the > circle only once, altering the color is bascially > free :) >
I modified the setRGB() method of your program as follows to get my optimized coloured concentrics arcs. Is there an alternate, faster way to do the maths? Thanks very much Ig for you input. [code] void setRGB(int x, int y, Color[] colors) { double angleInRadians = Math.atan2(y-cy, x-cx); double angle = angleInRadians < 0 ? Math.toDegrees(angleInRadians + (2*Math.PI)) : Math.toDegrees(angleInRadians); angle = Math.round(angle); angle = angle == 360 ? 0 : angle; int rgb = colors[(int)angle].getRGB(); int index = y * bimg.getWidth() + x; if (index < data.length) { data[index] = rgb; } } [/code] [Message sent by forum member 'ser207' (ser207)] http://forums.java.net/jive/thread.jspa?messageID=301499 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".