import java.awt.image.BufferedImage;
import java.awt.*;
import java.io.File;
import javax.imageio.ImageIO;
public class Raster{
static void drawFlag(Graphics2D g)
{
g.setRenderingHint(
RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
for (int i=0;i<13;i++)
{
g.setColor((i%2==0)?Color.black:Color.white);
g.fillRect(0,i*16,300,208);
}
{
g.setColor(new Color(222,24,24));
g.fillRect(0,0,115,80);
}
int[] ods;
{
Polygon brazil = new Polygon(
ods=new int[]{
281,144,288,143,287,152,295,158,297,166,292,177,
291,188,296,203,307,211,322,208,341,199,362,203,
360,193,372,191,376,187,391,196,401,193,415,194,
425,183,426,174,440,161,451,173,452,189,460,204,
468,208,461,222,448,234,443,241,445,252,452,252,
457,237,473,237,492,238,492,247,488,256,480,262,
492,259,498,248,512,246,542,257,550,264,558,262,
563,272,563,281,567,284,581,279,596,284,616,289,
638,288,665,306,677,317,693,329,715,336,725,349,
728,371,723,393,706,413,695,424,680,442,668,461,
656,466,648,476,650,489,650,508,646,531,640,551,
630,566,631,578,617,594,607,609,607,622,592,629,
588,634,588,637,576,638,558,634,550,639,541,641,
533,646,530,651,520,651,501,664,491,674,481,681,
477,698,480,711,476,727,463,739,455,757,438,782,
425,789,415,804,408,817,402,818,400,807,407,799,
400,792,395,787,375,774,372,767,365,772,352,757,
342,757,346,749,365,728,386,711,397,703,400,687,
395,678,386,676,391,657,386,646,373,649,367,621,
353,617,332,618,333,598,327,581,337,551,332,538,
322,531,322,517,291,517,286,498,290,494,287,477,
232,451,201,406,177,412,166,426,155,426,143,436,
123,432,117,434,110,427,111,407,101,417, 83,417,
81,408, 67,407, 71,399, 51,376, 55,363, 67,358,
65,349, 67,333,100,314,115,318,128,262,123,248,
113,243,116,231,131,228,126,221,120,221,120,212,
148,204,152,211,162,201,168,214,180,223,196,219,
220,208,231,198,226,192,215,177,208,163,225,168,
240,172,248,162,268,156,281,144},ods, 14);
int len = ods.length;
int[] x = new int [len/2];
int[] y = new int [len/2];
int cx = 0, cy = 0; // counters for x- and y-co-ordinates
for (int i = 0; i<len; i++) {
if (i%2==0) {
x[cx++] = ods[i];
} else {
y[cy++] = ods[i];
}
}
{
g.translate(-68,-40);
g.setColor(Color.white);
g.fillOval(100,50,60,60);
g.setColor(new Color(8,8,107));
g.scale(0.08,0.08);
g.translate(1200,595);
g.fillPolygon(brazil);
{
Polygon star = new Polygon(
new int[]{0,22,95,36,59,0,-59,-36,-95,-22},
new int[]{-100,-31,-31,12,81,38,81,12,-31,-31},10);
g.setColor(Color.yellow);
g.translate(-150,150);
g.scale(1.25,1.25);
g.fillPolygon(star);
g.translate(850,0);
g.fillPolygon(star);
g.translate(0,520);
g.fillPolygon(star);
g.translate(-850,0);
g.fillPolygon(star);
}
}
}
}
public static void main(String argv []){
BufferedImage image = new BufferedImage(300,208, BufferedImage.TYPE_INT_ARGB);
Graphics2D g = image.createGraphics();
drawFlag(g);
g.dispose();
try {
File out = new File("flag.png");
ImageIO.write(image, "png", out);
}catch(Exception e){
System.err.println(e);
}
}
}