Larger alpha values are more opaque (solid). You should also notice that the program seemed to execute slowly. This is because creating transparent colors requires considerably more processing than creating solid colors. Figure 15.41 // Java1520.java // This program is similar to program Java0527 which displayed 1000 random colored solid circles. // The difference now is the new 4-int parameter <setColor> method is used. // The first 3 int values still specify the amount of red, green and blue. // The fourth int parameter is the "alpha" value which determines how "transparent" the color is. // Like the color values, the alpha value is a number between 0 and 255. // Smaller alpha values are more transparent. Larger alpha values are more opaque. // NOTE: The programs seems slow because creating transparent colors takes much longer than // creating solid colors. public Java1520 extends Applet { public void g) { for (int k = 1; k <= 1000; k++) { int x = Expo.random(0,1000); int y = Expo.random(0,650); int red = Expo.random(0,255); int green = Expo.random(0,255); int blue = Expo.random(0,255); int = Expo.random(0,255); Expo.setColor(g,red,green,blue,alpha); Expo.fillCircle(g,x,y,50); } } } Deluxe Version of Expo.html As before, you are provided with the file Expo.html which documents all of the methods in the Expo class (both old and new). See Figure 15.42. Deluxe Figure 15.42 15.6 Multi-Page Output
Larger alpha values are more opaque (solid). You should also notice that the program seemed to execute slowly. This is because creating transparent colors requires considerably more processing than creating solid colors. Figure 15.41 // Java1520.java // This program is similar to program Java0527 which displayed 1000 random colored solid circles. // The difference now is the new 4-int parameter <setColor> method is used. // The first 3 int values still specify the amount of red, green and blue. // The fourth int parameter is the "alpha" value which determines how "transparent" the color is. // Like the color values, the alpha value is a number between 0 and 255. // Smaller alpha values are more transparent. Larger alpha values are more opaque. // NOTE: The programs seems slow because creating transparent colors takes much longer than // creating solid colors. public Java1520 extends Applet { public void g) { for (int k = 1; k <= 1000; k++) { int x = Expo.random(0,1000); int y = Expo.random(0,650); int red = Expo.random(0,255); int green = Expo.random(0,255); int blue = Expo.random(0,255); int = Expo.random(0,255); Expo.setColor(g,red,green,blue,alpha); Expo.fillCircle(g,x,y,50); } } } Deluxe Version of Expo.html As before, you are provided with the file Expo.html which documents all of the methods in the Deluxe Expo class (both old and new). See Figure 15.42. Figure 15.42 15.6 Multi-Page Output
Text15-IntermediateGFX.docx