Готовая Лабораторная 4
This commit is contained in:
parent
0eeb3a421a
commit
3f1e52e587
@ -3,7 +3,7 @@ import java.awt.image.BufferedImage;
|
||||
|
||||
|
||||
public class TanksGenericCollections<T extends DrawingArmoVehicle, U extends IMoveableObject> {
|
||||
// Высота и ширина окна прорисовки
|
||||
// Высота и Ширина окна прорисовки
|
||||
private int _pictureWidth;
|
||||
private int _pictureHeight;
|
||||
|
||||
@ -14,7 +14,7 @@ public class TanksGenericCollections<T extends DrawingArmoVehicle, U extends IMo
|
||||
// Набор объектов
|
||||
private SetGeneric<T> _collection;
|
||||
|
||||
// Конструтор
|
||||
// Конструктор
|
||||
public TanksGenericCollections(int pictureWidth, int pictureHeight) {
|
||||
int width = pictureWidth / _placeSizeWidth;
|
||||
int height = pictureHeight / _placeSizeHeight;
|
||||
@ -47,18 +47,17 @@ public class TanksGenericCollections<T extends DrawingArmoVehicle, U extends IMo
|
||||
|
||||
// Вывод всего набора объектов
|
||||
public BufferedImage ShowTank() {
|
||||
BufferedImage bmp = new BufferedImage(_pictureWidth, _pictureHeight, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g = bmp.createGraphics();
|
||||
BufferedImage bitmap = new BufferedImage(_pictureWidth, _pictureHeight, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics2D g = bitmap.createGraphics();
|
||||
DrawBackground(g);
|
||||
DrawObjects(g);
|
||||
g.dispose();
|
||||
return bmp;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
// Метод отрисовки фона
|
||||
private void DrawBackground(Graphics g) {
|
||||
g.setColor(Color.BLACK);
|
||||
|
||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++) {
|
||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j) {
|
||||
// Линия разметки места
|
||||
|
Loading…
Reference in New Issue
Block a user