Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
31
Task/Bitmap/Java/bitmap-1.java
Normal file
31
Task/Bitmap/Java/bitmap-1.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class BasicBitmapStorage {
|
||||
|
||||
private final BufferedImage image;
|
||||
|
||||
public BasicBitmapStorage(int width, int height) {
|
||||
image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||
}
|
||||
|
||||
public void fill(Color c) {
|
||||
Graphics g = image.getGraphics();
|
||||
g.setColor(c);
|
||||
g.fillRect(0, 0, image.getWidth(), image.getHeight());
|
||||
}
|
||||
|
||||
public void setPixel(int x, int y, Color c) {
|
||||
image.setRGB(x, y, c.getRGB());
|
||||
}
|
||||
|
||||
public Color getPixel(int x, int y) {
|
||||
return new Color(image.getRGB(x, y));
|
||||
}
|
||||
|
||||
public Image getImage() {
|
||||
return image;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue