1 package net.sourceforge.barbecue.output; 2 3 public interface Output { 4 /** 5 * "Draws" a bar at the given coordinates. 6 * @param x the x coordinate 7 * @param y the y coordinate 8 * @param width the width 9 * @param height the height 10 * @param paintWithForegroundColor if true, use the foreground color, otherwise use the background color 11 * @return the width of the bar drawn 12 */ 13 int drawBar(int x, int y, int width, int height, boolean paintWithForegroundColor) throws OutputException; 14 15 /** 16 * Sets up the drawing environment. Called before drawing starts. 17 * Matched with call to endDraw() at the end. This allows for caching as needed. 18 */ 19 void beginDraw() throws OutputException; 20 21 /** 22 * Balanced with startDraw(), used for caching, output of epilogues. 23 * @param width The output width (in pixels) of the barcode 24 * @param height The output height (in pixels) of the barcode. 25 */ 26 void endDraw(int width, int height) throws OutputException; 27 28 /** 29 * Draw the specified text. 30 * @param text text to draw 31 * @param layout the text layout calculator 32 * @return the height of this text 33 */ 34 int drawText(String text, LabelLayout layout) throws OutputException; 35 36 /** 37 * Swaps the foreground and background colours of the output. 38 */ 39 void toggleDrawingColor(); 40 41 /** 42 * Paint the background the background colour, based on the height and the width. 43 * @param x the x coordinate 44 * @param y the y coordinate 45 * @param width the width to be painted 46 * @param height the height to be painted 47 */ 48 void paintBackground(int x, int y, int width, int height); 49 50 }