proce55or

Untitled

Feb 4th, 2014
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.46 KB | None | 0 0
  1. /* This program draws an image for my own design
  2.  using line(); and other associated codes
  3.  Created by Olaf Keller
  4.  */
  5.  
  6. void setup() {
  7.   size(700, 700);
  8.   smooth();
  9. }
  10.  
  11. void draw() {
  12.  
  13.   background(255);
  14.  
  15.   //lines
  16.   strokeCap(SQUARE);
  17.   stroke(0);
  18.  
  19.   strokeWeight(1);
  20.   line(15, 295, 428, 9);
  21.  
  22.   strokeWeight(44);
  23.   line(126, 455, 423, 248);
  24.  
  25.   strokeWeight(1);
  26.   line(168, 516, 581, 229);
  27.  
  28.   strokeWeight(1);
  29.   line(177, 529, 395, 378);
  30.  
  31.   strokeWeight(15);
  32.   line(260, 647, 610, 404);
  33.  
  34.   strokeWeight(1);
  35.   line(281, 679, 670, 410);
  36.  
  37.   strokeWeight(10);
  38.   line(15, 295, 281, 679);
  39.  
  40.   strokeWeight(1);
  41.   line(428, 9, 581, 229);
  42.  
  43.   strokeWeight(1);
  44.   line(670, 410, 557, 246);
  45.  
  46.   strokeWeight(30);
  47.   line(313, 89, 557, 441);
  48.  
  49.   strokeWeight(30);
  50.   line(519, 272, 632, 436);
  51.  
  52.   strokeWeight(30);
  53.   line(386, 365, 477, 497);
  54.  
  55.   strokeWeight(1);
  56.   line(124, 220, 286, 453);
  57. }
  58.  
  59. /* Functions below create and save the output as a normal .png file
  60.  and high resolution .png when 's' key is pressed - code by Amnon Owed:
  61.  http://amnonp5.wordpress.com/2012/01/28/25-life-saving-tips-for-processing/
  62.  */
  63.  
  64. void keyPressed() {
  65.   if (key == 's') {
  66.     save("normal.png");
  67.     saveHiRes(5);
  68.     exit();
  69.   }
  70. }
  71.  
  72. void saveHiRes(int scaleFactor) {
  73.   PGraphics hires = createGraphics(width*scaleFactor, height*scaleFactor, JAVA2D);
  74.   beginRecord(hires);
  75.   hires.scale(scaleFactor);
  76.   draw();
  77.   endRecord();
  78.   hires.save("hires.png");
  79. }
Advertisement
Add Comment
Please, Sign In to add comment