-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPixelWriting.java
More file actions
86 lines (62 loc) · 2.36 KB
/
Copy pathPixelWriting.java
File metadata and controls
86 lines (62 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
import java.util.Random;
import java.applet.*;
public class PixelWriting extends Applet
{
Image buffer;
Graphics bufferG;
Color[] myColors = { Color.red, Color.white, Color.blue };
int myPicture [][] = {
{ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
{ 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1 },
{ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
{ 2, 1, 2, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1 },
{ 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
};
AudioClip loadingMusic;
Image bustaImage;
public void init()
{
this.resize(1300, 700);
buffer = createImage(this.getWidth(), this.getHeight());
bufferG = buffer.getGraphics();
loadingMusic = this.getAudioClip(this.getCodeBase(), "./america.wav");
loadingMusic.play();
loadingMusic.loop();
bustaImage = this.getImage(this.getCodeBase(), "eagle.jpg");
}
public void update(Graphics g)
{
paint(g);
}
public void drawPicMult(int pic[][], int x, int y, int mult)
{
for (int r = 0; r < pic.length; r++)
for (int c = 0; c < pic[0].length; c++)
{
for (int i = 1; i <= mult; i++)
for (int z = 1; z <= mult; z++)
{
bufferG.setColor(myColors[pic[r][c]]);
bufferG.drawLine(x + i + mult * c, y + z + mult * r, x + i + mult * c, y + z + mult * r);
}
}
}
public void paint(Graphics g)
{
bufferG.setColor(Color.black);
bufferG.fillRect(0, 0, 1300, 700);
bufferG.drawImage(bustaImage, 700, 250, 600, 300, this);
drawPicMult(myPicture, 100, 150, 50);
bufferG.setColor(Color.white);
bufferG.setFont(new Font("Ariel", 1, 20));
bufferG.drawString("AMERICA AMERICA AMERICA AMERICA AMERICA AMERICA AMERICA AMERICA AMERICA", 100, 100);
g.drawImage(buffer, 0, 0, this);
}
}