diff --git a/bin/lab13_streams/13-streams-FR.pdf b/bin/lab13_streams/13-streams-FR.pdf
new file mode 100644
index 0000000..effaff4
Binary files /dev/null and b/bin/lab13_streams/13-streams-FR.pdf differ
diff --git a/bin/lab13_streams/BMPWriter.class b/bin/lab13_streams/BMPWriter.class
new file mode 100644
index 0000000..f452af1
Binary files /dev/null and b/bin/lab13_streams/BMPWriter.class differ
diff --git a/bin/lab13_streams/GarageManager.class b/bin/lab13_streams/GarageManager.class
new file mode 100644
index 0000000..3e50b5d
Binary files /dev/null and b/bin/lab13_streams/GarageManager.class differ
diff --git a/bin/lab13_streams/Line.class b/bin/lab13_streams/Line.class
new file mode 100644
index 0000000..7e4ffa0
Binary files /dev/null and b/bin/lab13_streams/Line.class differ
diff --git a/bin/lab13_streams/ReadFileApplication.class b/bin/lab13_streams/ReadFileApplication.class
new file mode 100644
index 0000000..c867d9b
Binary files /dev/null and b/bin/lab13_streams/ReadFileApplication.class differ
diff --git a/bin/lab13_streams/SVGWriter.class b/bin/lab13_streams/SVGWriter.class
new file mode 100644
index 0000000..17dd36c
Binary files /dev/null and b/bin/lab13_streams/SVGWriter.class differ
diff --git a/bin/lab13_streams/SimpleGraphics$DisplayFrame.class b/bin/lab13_streams/SimpleGraphics$DisplayFrame.class
new file mode 100644
index 0000000..f9d2c11
Binary files /dev/null and b/bin/lab13_streams/SimpleGraphics$DisplayFrame.class differ
diff --git a/bin/lab13_streams/SimpleGraphics.class b/bin/lab13_streams/SimpleGraphics.class
new file mode 100644
index 0000000..42f68ea
Binary files /dev/null and b/bin/lab13_streams/SimpleGraphics.class differ
diff --git a/bin/lab13_streams/SimpleGraphicsBitmap.class b/bin/lab13_streams/SimpleGraphicsBitmap.class
new file mode 100644
index 0000000..bcdc1f8
Binary files /dev/null and b/bin/lab13_streams/SimpleGraphicsBitmap.class differ
diff --git a/bin/lab13_streams/data/drawingTest.csv b/bin/lab13_streams/data/drawingTest.csv
new file mode 100644
index 0000000..9672a3f
--- /dev/null
+++ b/bin/lab13_streams/data/drawingTest.csv
@@ -0,0 +1,16 @@
+50;250;50;650;20;20;20
+50;650;450;650;20;20;20
+450;650;450;250;20;20;20
+50;250;250;50;255;0;0
+250;50;320;130;255;0;0
+380;170;450;250;255;0;0
+320;130;320;80;0;255;0
+320;80;380;80;0;255;0
+380;80;380;170;0;255;0
+150;650;150;450;0;0;255
+150;450;230;450;0;0;255
+230;450;230;650;0;0;255
+280;550;280;450;0;0;255
+280;450;420;450;0;0;255
+420;450;420;550;0;0;255
+280;550;420;550;0;0;255
diff --git a/src/lab13_streams/13-streams-FR.pdf b/src/lab13_streams/13-streams-FR.pdf
new file mode 100644
index 0000000..effaff4
Binary files /dev/null and b/src/lab13_streams/13-streams-FR.pdf differ
diff --git a/src/lab13_streams/BMPWriter.java b/src/lab13_streams/BMPWriter.java
new file mode 100644
index 0000000..869b0cd
--- /dev/null
+++ b/src/lab13_streams/BMPWriter.java
@@ -0,0 +1,167 @@
+package lab13_streams;
+
+import java.io.BufferedOutputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+/**
+ * This class allows to save a BMP file
+ *
+ * @author Pierre Roduit (pierre.roduit@hevs.ch)
+ * @version 1.0
+ */
+public class BMPWriter {
+ // Data writer
+ private DataOutputStream out = null;
+ // Image dimensions
+ private int width;
+ private int height;
+ private final int headerSize = 54;
+
+ /**
+ * Constructor
+ *
+ * @param fileName
+ * Name of the BMP file to save
+ * @param width
+ * Width of the image
+ * @param height
+ * Height of the image
+ * @throws FileNotFoundException
+ */
+ BMPWriter(File file, int height, int width) throws FileNotFoundException {
+ this.width = width;
+ this.height = height;
+ out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(file)));
+ }
+
+ /**
+ * Close the file when the class is destroyed
+ */
+ protected void finalize() throws Throwable {
+ this.close();
+
+ }
+
+ /**
+ * Close the file
+ *
+ * @throws IOException
+ */
+ public void close() throws IOException {
+ if (out != null) {
+ out.flush();
+ out.close();
+ }
+ }
+
+ /**
+ * Write the BMP header
+ *
+ * @throws IOException
+ */
+ public void writeHeader() throws IOException {
+ // Write header
+ // You can refer to this web site
+ // (http://www.fastgraph.com/help/bmp_header_format.html) to
+ // understand the use of each value
+ // Signature
+ out.write(0x42);
+ out.write(0x4D);
+ // FileSize (Byte 3-6)
+ out.writeInt(convertToLED(width * height * 3 + headerSize));
+ // Reserved (Byte 7-10)
+ out.writeInt(0);
+ // Header Size (Byte 11-14)
+ out.writeInt(convertToLED(headerSize));
+
+ // TODO Complete header
+
+ out.flush();
+ }
+
+ /**
+ * Write a pixel data in the BMP file
+ *
+ * @param color
+ * @throws IOException
+ */
+ public void writePixel(int color) throws IOException {
+
+ // TODO Complete here
+
+ }
+
+ /**
+ * Fill the image with a color gradient
+ *
+ * @throws IOException
+ */
+ public void fillImage() throws IOException {
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < width; j++) {
+ // Each pixel is written one after the other
+ // Blue
+ out.write(j % 256);
+ // Green
+ out.write(0);
+ // Red
+ out.write(i % 256);
+ }
+ insertPadding();
+ }
+ out.flush();
+ }
+
+ /**
+ * Write the pixel values of a graphic to the file
+ *
+ * @param display
+ * Graphic
+ * @throws IOException
+ */
+ public void writeImage(SimpleGraphics display) throws IOException {
+ // TODO complete here
+ }
+
+ /**
+ * Insert the padding needed at the end of each line in a BMP file, to a end
+ * a line in a multiple of 4 (in byte)
+ *
+ * @throws IOException
+ */
+ public void insertPadding() throws IOException {
+ // Padding for the end of line
+ for (int j = 0; j < (4 - ((3 * width) % 4)) % 4; j++)
+ out.write(0);
+ }
+
+ /**
+ * Convert an integer into a Little Endian integer
+ *
+ * @param input
+ * @return
+ */
+ static private int convertToLED(int input) {
+ int result = 0;
+ for (int shiftBy = 24; shiftBy >= 0; shiftBy -= 8) {
+ result |= (input & 0xff) << shiftBy;
+ input >>= 8;
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert a short number into a Little Endian short
+ *
+ * @param input
+ * @return
+ */
+ static private short convertToLED(short input) {
+ return (short) (((input & 0xff) << 8) | ((input & 0xff00) >> 8));
+ }
+}
diff --git a/src/lab13_streams/GarageManager.java b/src/lab13_streams/GarageManager.java
new file mode 100644
index 0000000..31c61ac
--- /dev/null
+++ b/src/lab13_streams/GarageManager.java
@@ -0,0 +1,75 @@
+package lab13_streams;
+
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+import java.util.HashMap;
+
+/**
+ * A sample garage application for demonstrating text file output
+ * @author Pierre-André Mudry, HES-SO Valais 2010
+ */
+public class GarageManager {
+ HashMap This class is a simple interface to draw figures and graphics. It is based on
+ * the Swing framework and uses a {@link JFrame} as a drawing billboard. Several methods are provided to paint things on the screen.
+ * Revision notes :
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * repaint
calls have
+ * been replaced by invalidate
calls).
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * display()
method
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
(centerX, centerY)
+ * @param posX X top-left position of the circle
+ * @param posY Y top-left position of the circle
+ * @param diameter Diameter of the drawn circle
+ */
+ public void drawCircle(int posX, int posY, int diameter){
+ display.g2d.drawOval(posX, posY, diameter, diameter);
+ display.invalidate();
+ }
+
+ /**
+ * Write a given string at (posX, posY)
+ * @param posX X position of string
+ * @param posY Y position of string
+ * @param str the string to write
+ */
+ public void drawString(int posX, int posY, String str)
+ {
+ display.g2d.drawString(str, posX, posY);
+ display.invalidate();
+ }
+
+ public void drawString(int posX, int posY, String str, Color color, int size)
+ {
+ Font oldFont = display.g2d.getFont();
+ Color oldColor = display.g2d.getColor();
+
+ Font font = new Font("SansSerif", Font.PLAIN, size);
+ display.g2d.setFont(font);
+ display.g2d.setColor(color);
+ display.g2d.drawString(str, posX, posY);
+
+ display.g2d.setFont(oldFont);
+ display.g2d.setColor(oldColor);
+
+ display.invalidate();
+ }
+
+ /**
+ * Draw a centered picture from a file (gif, jpg, png) to (posX, posY)
+ * @param posX X position of the image
+ * @param posY Y position of the image
+ * @param filename path of the image file
+ */
+ public void drawPicture(int posX, int posY, SimpleGraphicsBitmap bitmap)
+ {
+ display.g2d.drawImage(bitmap.mBitmap,posX-bitmap.getWidth()/2,posY-bitmap.getHeight()/2,null);
+ display.invalidate();
+ }
+
+ /**
+ * Draw a centered picture from a file (gif, jpg, png) to (posX, posY)
+ * @param posX X position of the image
+ * @param posY Y position of the image
+ * @param angle The rotation angle of the image to be drawn
+ * @param imageName path of the image file
+ */
+ public void drawTransformedPicture(int posX, int posY, double angle, double scale, String imageName)
+ {
+ drawTransformedPicture(posX, posY, angle, scale, new SimpleGraphicsBitmap(imageName));
+ }
+
+ /**
+ * Draw a centered picture from a file (gif, jpg, png) to (posX, posY)
+ * @param posX X position of the image
+ * @param posY Y position of the image
+ * @param angle The rotation angle of the image to be drawn
+ * @param bitmap A {@link #SimpleGraphicsBitmap()} bitmap
+ */
+ public void drawTransformedPicture(int posX, int posY, double angle, double scale, SimpleGraphicsBitmap bitmap)
+ {
+ AffineTransform t = new AffineTransform();
+
+ t.rotate(angle, posX, posY);
+ t.translate(posX-bitmap.getWidth()/2, posY-bitmap.getHeight()/2);
+ t.scale(scale, scale);
+ display.g2d.drawImage(bitmap.mBitmap, t, null);
+ display.invalidate();
+ }
+
+ /**
+ * Draw a filled rectangle in the color selected with setColor.
+ *
+ * @param posX
+ * X coordinate of the top left corner of the rectangle
+ * @param posY
+ * Y coordinate of the top left corner of the rectangle
+ * @param width
+ * Width of the rectangle
+ * @param height
+ * Height of the rectangle
+ */
+ public void drawFillRect(int posX, int posY, int width, int height) {
+ display.g2d.fillRect(posX, posY, width, height);
+ display.invalidate();
+ }
+
+ /**
+ * Getters and setters
+ */
+ public void setFrameWidth(int frameWidth) {
+ this.frameWidth = frameWidth;
+ }
+
+ public int getFrameWidth() {
+ return frameWidth;
+ }
+
+ public void setFrameHeight(int frameHeight) {
+ this.frameHeight = frameHeight;
+ }
+
+ public int getFrameHeight() {
+ return frameHeight;
+ }
+
+ public Graphics2D getGraphics(){
+ return display.g2d;
+ }
+
+ /**
+ * Subclass which extends JFrame, to create the windows and keep all the
+ * frame stuff hidden from the end user.
+ */
+ protected class DisplayFrame extends JFrame {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ /**
+ * 2D graphic used to draw
+ */
+ public Graphics2D g2d;
+
+ /**
+ * Buffered image used to draw g2d into and to set pixels.
+ */
+ public BufferedImage img;
+
+ /**
+ * Color used to draw objects and pixels
+ */
+ private int imageWidth, imageHeight;
+
+ /**
+ * Default constructor
+ *
+ * @param width
+ * Number of pixels for the window's width
+ * @param height
+ * Number of pixels for the window's height
+ * @param title
+ * Displayed title of the window
+ */
+ public DisplayFrame(int width, int height, String title) {
+ super(title);
+
+ if(title == null){
+ this.setTitle("Informatics 1 - SimpleGraphics window");
+ }
+
+ imageWidth = width;
+ imageHeight = height;
+ this.setSize(this.imageWidth, this.imageHeight);
+ this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+ // Prevent resizing
+ this.setResizable(false);
+
+ // Display the windows at the center of the screen
+ this.setLocationRelativeTo(null);
+
+ // The frame must be set to visible, if we want to access the
+ // corresponding Graphics to draw into.
+ this.setVisible(true);
+
+ // Fixes the bug with the invalid buffer strategies
+ while(!this.isVisible() && !this.isValid())
+ {}
+
+ // Create a double buffer strategy
+ this.createBufferStrategy(2);
+
+ this.setBackground(Color.white);
+
+ // Create graphics and image
+ img = new BufferedImage(this.imageWidth, this.imageHeight, BufferedImage.TYPE_INT_ARGB);
+ g2d = img.createGraphics();
+
+ // Set rendering hints for nicer display (if speed allows)
+ if (enableRenderingHints) {
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
+ RenderingHints.VALUE_RENDER_QUALITY);
+ }
+
+ this.setIgnoreRepaint(true);
+
+ Font font = new Font("SansSerif", Font.PLAIN, 12);
+ g2d.setFont(font);
+
+ // Set drawing color to black
+ g2d.setColor(Color.black);
+ g2d.setBackground(new Color(backgroundColor));
+ }
+
+ /**
+ * Override the paint method.
+ */
+ public void myPaint() {
+ BufferStrategy bf = this.getBufferStrategy();
+
+ while(bf == null)
+ bf = this.getBufferStrategy();
+
+ do {
+ do {
+ Graphics2D g1 = (Graphics2D) bf.getDrawGraphics();
+ g1.drawImage(img, 0, 0, this);
+
+ // We don't need that anymore
+ g1.dispose();
+ } while (bf.contentsRestored());
+
+ // Shows the contents of the backbuffer on the screen.
+ bf.show();
+
+ // Tell the system to draw, otherwise it can take a few extra ms
+ // until it does
+ Toolkit.getDefaultToolkit().sync();
+
+ // Repeat the rendering if the drawing buffer was lost
+ } while (bf.contentsLost());
+ }
+ }
+
+
+ static {
+ System.setProperty("sun.java2d.transaccel", "True");
+ // System.setProperty("sun.java2d.trace", "timestamp,log,count");
+ // System.setProperty("sun.java2d.opengl", "True");
+ //System.setProperty("sun.java2d.d3d", "True");
+ System.setProperty("sun.java2d.ddforcevram", "True");
+ }
+}
\ No newline at end of file
diff --git a/src/lab13_streams/SimpleGraphicsBitmap.java b/src/lab13_streams/SimpleGraphicsBitmap.java
new file mode 100644
index 0000000..8ae3079
--- /dev/null
+++ b/src/lab13_streams/SimpleGraphicsBitmap.java
@@ -0,0 +1,43 @@
+package lab13_streams;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.ImageIO;
+
+/**
+ * An implementation of the {@link CommonBitmap} interface that is intended to
+ * be used on an operating systems that provides the {@link java.awt.BufferedImage} classes
+ *
+ * @version 1.0, April 2010
+ * @author Pierre-André Mudry
+ */
+public class SimpleGraphicsBitmap {
+ protected BufferedImage mBitmap;
+
+ public SimpleGraphicsBitmap(String imageName)
+ {
+ try {
+ mBitmap = ImageIO.read(SimpleGraphicsBitmap.class.getResource(imageName));
+ } catch (Exception e) {
+ System.out.println("Could not find image " + imageName + ", exiting !");
+ e.printStackTrace();
+ System.exit(-1);
+ }
+ }
+
+ public int getWidth()
+ {
+ return mBitmap.getWidth();
+ }
+
+ public int getHeight()
+ {
+ return mBitmap.getHeight();
+ }
+
+ public BufferedImage getImage(){
+ return this.mBitmap;
+ }
+}
diff --git a/src/lab13_streams/data/drawingTest.csv b/src/lab13_streams/data/drawingTest.csv
new file mode 100644
index 0000000..9672a3f
--- /dev/null
+++ b/src/lab13_streams/data/drawingTest.csv
@@ -0,0 +1,16 @@
+50;250;50;650;20;20;20
+50;650;450;650;20;20;20
+450;650;450;250;20;20;20
+50;250;250;50;255;0;0
+250;50;320;130;255;0;0
+380;170;450;250;255;0;0
+320;130;320;80;0;255;0
+320;80;380;80;0;255;0
+380;80;380;170;0;255;0
+150;650;150;450;0;0;255
+150;450;230;450;0;0;255
+230;450;230;650;0;0;255
+280;550;280;450;0;0;255
+280;450;420;450;0;0;255
+420;450;420;550;0;0;255
+280;550;420;550;0;0;255