Changeset 1426 for trunk/src/org/expeditee/gio/ImageManager.java
- Timestamp:
- 07/31/19 15:51:04 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gio/ImageManager.java
r1097 r1426 5 5 import java.net.HttpURLConnection; 6 6 import java.net.URL; 7 import java.util.Random; 7 8 8 9 import org.expeditee.core.Colour; … … 75 76 public abstract Image getImage(String filename); 76 77 78 /** Gets an image that is just noise */ 79 public Image getNoise() { 80 int width = 100; 81 int height = 100; 82 int[] pixelData = new int[width * height]; 83 Random rand = new Random(); 84 85 for (int i = 0; i < pixelData.length; i++) { 86 int alpha = rand.nextInt(256) << 24; 87 int red = rand.nextInt(256) << 16; 88 int green = rand.nextInt(256) << 8; 89 int blue = rand.nextInt(256); 90 pixelData[i] = alpha | red | green | blue; 91 } 92 93 return createImage(width, height, pixelData); 94 } 95 77 96 /** Gets image data from a HTTP connection. */ 78 97 public abstract Image getImage(HttpURLConnection connection) throws IOException; … … 125 144 126 145 /** Writes the image data to disk. Format should be png, bmp, etc. */ 127 public abstract boolean writeImageToDisk(Image image, String format, File file) throws IOException; 128 146 public abstract boolean writeImageToDisk(Image image, String format, File file) throws IOException; 129 147 }
Note:
See TracChangeset
for help on using the changeset viewer.