├── BotDrawing.pde ├── BotLine.pde ├── Bresenham.pde ├── CHANGELOG.md ├── Copic.pde ├── Drawbot_image_to_gcode_v2.pde ├── GClip.java ├── Gcode.pde ├── Image_Tools.pde ├── LICENSE ├── Misc.pde ├── PFM_original.pde ├── PFM_spiral.pde ├── PFM_squares.pde ├── README.md ├── boarder ├── b1.png ├── b10.png ├── b11.png ├── b12.png ├── b13.png ├── b2.png ├── b3.png ├── b4.png ├── b5.png ├── b6.png ├── b7.png ├── b8.png ├── b9.png └── credits.txt └── pics ├── 17 - ADqOZu5_crop.jpg ├── 24NB5_Gearheads_-HowtoChoosetheRightHeadphones_Muchai_V2.jpg ├── A (5).jpg ├── A_big_old_brick_building_on_the_east_side_of_Ontario_Street_-j.jpg ├── DPAI-Carolyn_Gray-WEB_pshop.jpg ├── building18.jpg ├── cat1.jpg ├── dfa700c1256b5a8abbae0b7d353be371.jpg ├── girl-face-blue-eyes-makeup.jpg ├── github1.png └── weirdmnesss.jpg /BotDrawing.pde: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // A class to describe all the line segments 3 | class botDrawing { 4 | private int line_count = 0; 5 | botLine[] lines = new botLine[10000000]; 6 | String gcode_comment = ""; 7 | 8 | void botDrawing() { 9 | } 10 | 11 | void render_last () { 12 | lines[line_count].render_with_copic(); 13 | } 14 | 15 | void render_all () { 16 | for (int i=1; i1; i--) { 32 | if (lines[i].pen_number == pen) { 33 | lines[i].render_with_copic(); 34 | } 35 | } 36 | } 37 | 38 | void render_to_pdf (int line_count) { 39 | String pdfname = "gcode\\gcode_" + basefile_selected + ".pdf"; 40 | PGraphics pdf = createGraphics(img.width, img.height, PDF, pdfname); 41 | pdf.beginDraw(); 42 | pdf.background(255, 255, 255); 43 | for(int i=line_count; i>0; i--) { 44 | if(lines[i].pen_down) { 45 | color c = copic.get_original_color(copic_sets[current_copic_set][lines[i].pen_number]); 46 | pdf.stroke(c, 255); 47 | pdf.line(lines[i].x1, lines[i].y1, lines[i].x2, lines[i].y2); 48 | } 49 | } 50 | pdf.dispose(); 51 | pdf.endDraw(); 52 | println("PDF created: " + pdfname); 53 | } 54 | 55 | void render_each_pen_to_pdf (int line_count) { 56 | for (int p=0; p<=pen_count-1; p++) { 57 | String pdfname = "gcode\\gcode_" + basefile_selected + "_pen" + p + "_" + copic_sets[current_copic_set][p] + ".pdf"; 58 | PGraphics pdf = createGraphics(img.width, img.height, PDF, pdfname); 59 | pdf.beginDraw(); 60 | pdf.background(255, 255, 255); 61 | for (int i=line_count; i>0; i--) { 62 | if (lines[i].pen_down & lines[i].pen_number == p) { 63 | color c = copic.get_original_color(copic_sets[current_copic_set][lines[i].pen_number]); 64 | pdf.stroke(c, 255); 65 | pdf.line(lines[i].x1, lines[i].y1, lines[i].x2, lines[i].y2); 66 | } 67 | } 68 | pdf.dispose(); 69 | pdf.endDraw(); 70 | println("PDF created: " + pdfname); 71 | } 72 | } 73 | 74 | void set_pen_continuation_flags () { 75 | float prev_x = 123456.0; 76 | float prev_y = 654321.0; 77 | boolean prev_pen_down = false; 78 | int prev_pen_number = 123456; 79 | 80 | for (int i=1; i pen_distribution[p] + p_total) { 120 | p_total = p_total + pen_distribution[p]; 121 | p++; 122 | } 123 | if (p > total_pens - 1) { 124 | // Hacky fix for off by one error 125 | println("ERROR: distribute_pen_changes_according_to_percentages, p: ", p); 126 | p = total_pens - 1; 127 | } 128 | lines[i].pen_number = p; 129 | //println (i + " " + lines[i].pen_number); 130 | } 131 | } 132 | 133 | } -------------------------------------------------------------------------------- /BotLine.pde: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // A class to describe one line segment 3 | // 4 | // Because of a bug in processing.org the MULTIPLY blendMode does not take into account the alpha of 5 | // either source or destination. If this gets corrected, tweaks to the stroke alpha might be more 6 | // representative of a Copic marker. Right now it over emphasizes the darkening when overlaps 7 | // of the same pen occur. 8 | 9 | class botLine { 10 | int pen_number; 11 | boolean pen_down; 12 | boolean pen_continuation; 13 | float x1; 14 | float y1; 15 | float x2; 16 | float y2; 17 | 18 | botLine(boolean pen_down_, int pen_number_, float x1_, float y1_, float x2_, float y2_) { 19 | pen_down = pen_down_; 20 | pen_continuation = false; 21 | pen_number = pen_number_; 22 | x1 = x1_; 23 | y1 = y1_; 24 | x2 = x2_; 25 | y2 = y2_; 26 | } 27 | 28 | void render_with_copic() { 29 | if (pen_down) { 30 | color c = copic.get_original_color(copic_sets[current_copic_set][pen_number]); 31 | //stroke(c, 255-brightness(c)); 32 | stroke(c); 33 | //strokeWeight(2); 34 | //blendMode(BLEND); 35 | blendMode(MULTIPLY); 36 | line(x1, y1, x2, y2); 37 | } 38 | } 39 | 40 | } 41 | 42 | /////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /Bresenham.pde: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | class intPoint { 3 | int x, y; 4 | 5 | intPoint(int x_, int y_) { 6 | x = x_; 7 | y = y_; 8 | } 9 | } 10 | 11 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 12 | // Algorithm was developed by Jack Elton Bresenham in 1962 13 | // http://en.wikipedia.org/wiki/Bresenham's_line_algorithm 14 | // Traslated from pseudocode labled "Simplification" from the link above. 15 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 16 | ArrayList bresenham(int x0, int y0, int x1, int y1) { 17 | int sx, sy; 18 | int err; 19 | int e2; 20 | ArrayList pnts = new ArrayList (); 21 | 22 | int dx = abs(x1-x0); 23 | int dy = abs(y1-y0); 24 | if (x0 < x1) { sx = 1; } else { sx = -1; } 25 | if (y0 < y1) { sy = 1; } else { sy = -1; } 26 | err = dx-dy; 27 | while (true) { 28 | pnts.add(new intPoint(x0, y0)); 29 | if ((x0 == x1) && (y0 == y1)) { 30 | return pnts; 31 | } 32 | e2 = 2*err; 33 | if (e2 > -dy) { 34 | err = err - dy; 35 | x0 = x0 + sx; 36 | } 37 | if (e2 < dx) { 38 | err = err + dx; 39 | y0 = y0 + sy; 40 | } 41 | } 42 | } 43 | 44 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 45 | // Midpoint circle algorithm 46 | // https://en.wikipedia.org/wiki/Midpoint_circle_algorithm 47 | // I had to create 8 arrays of points then append them, because normaly order is not important. 48 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 49 | ArrayList midpoint_circle(int x0, int y0, int radius) { 50 | ArrayList pnts = new ArrayList (); 51 | 52 | ArrayList p1 = new ArrayList (); 53 | ArrayList p2 = new ArrayList (); 54 | ArrayList p3 = new ArrayList (); 55 | ArrayList p4 = new ArrayList (); 56 | ArrayList p5 = new ArrayList (); 57 | ArrayList p6 = new ArrayList (); 58 | ArrayList p7 = new ArrayList (); 59 | ArrayList p8 = new ArrayList (); 60 | 61 | int x = radius; 62 | int y = 0; 63 | int err = 0; 64 | 65 | while (x >= y) { 66 | p1.add(new intPoint(x0 + x, y0 + y)); 67 | p2.add(new intPoint(x0 + y, y0 + x)); 68 | p3.add(new intPoint(x0 - y, y0 + x)); 69 | p4.add(new intPoint(x0 - x, y0 + y)); 70 | p5.add(new intPoint(x0 - x, y0 - y)); 71 | p6.add(new intPoint(x0 - y, y0 - x)); 72 | p7.add(new intPoint(x0 + y, y0 - x)); 73 | p8.add(new intPoint(x0 + x, y0 - y)); 74 | 75 | if (err <= 0) { 76 | y += 1; 77 | err += 2*y + 1; 78 | } 79 | if (err > 0) { 80 | x -= 1; 81 | err -= 2*x + 1; 82 | } 83 | } 84 | 85 | for (intPoint p : p1) { pnts.add(p); } 86 | for (intPoint p : p2) { pnts.add(p); } 87 | for (intPoint p : p3) { pnts.add(p); } 88 | for (intPoint p : p4) { pnts.add(p); } 89 | for (intPoint p : p5) { pnts.add(p); } 90 | for (intPoint p : p6) { pnts.add(p); } 91 | for (intPoint p : p7) { pnts.add(p); } 92 | for (intPoint p : p8) { pnts.add(p); } 93 | return pnts; 94 | } 95 | 96 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 97 | public void bresenham_lighten(int x0, int y0, int x1, int y1, int adjustbrightness) { 98 | ArrayList pnts; 99 | 100 | pnts = bresenham(x0, y0, x1, y1); 101 | for (intPoint p : pnts) { 102 | lighten_one_pixel(adjustbrightness * 5, p.x, p.y); 103 | } 104 | } 105 | 106 | /////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # CHANGELOG 2 | All notable changes to this project will be documented in this file. 3 | 4 | 5 | ## [3.75] - 2018-05-28 6 | ### Changed 7 | - Fixed [Issue 11], Scrolling through Pen Sets 8 | 9 | ## [3.74] - 2018-05-28 10 | ### Added 11 | - mouse_point(), displays corrdinates of mouse location in console. Useful for locating vanishing points 12 | - key binding to mouse_point() 13 | 14 | ### Changed 15 | - grid() moved to Misc and cleaned up 16 | - save_jpg() moved to Image_Tools 17 | - CHANGELOG, changed extension to md 18 | 19 | ## [3.73] - 2018-02-03 20 | ### Added 21 | - Dynamic "Path Finding Modules". PFMs allow multiple artisic looks to be contained in its own file. 22 | - PDF exports for individual pens 23 | - Factor and bias support for convolution function 24 | - Scaling and printing of convolution kernels 25 | - Un-sharpen convolution kernel 26 | - Links to latest released version and previous versions 27 | - CHANGELOG 28 | 29 | ### Changed 30 | - Boarders can now be stacked 31 | - Allow for key combinations 32 | - Remapped keyboard for displaying individual pens 33 | - Most keyboard shortcuts now support up to 10 pens 34 | - Log messages are now more verbose 35 | 36 | ## [3.72] - 2017-12-29 37 | ### Added 38 | - Globals to overide the gcode decimal seperator 39 | - Globals to set default digits to the right of the decimal point 40 | 41 | ## [3.71] - 2017-12-18 42 | ### Changed 43 | - Fixed broken SVG code 44 | 45 | ## [3.7] - 2017-07-06 46 | ### Added 47 | - SVG output 48 | - Convolution kernels 49 | 50 | 51 | [3.75]: https://github.com/Scott-Cooper/Drawbot_image_to_gcode_v2 52 | [3.74]: https://github.com/Scott-Cooper/Drawbot_image_to_gcode_v2/commit/84f89ac1054614d241441854ea3942132c8431d0 53 | [3.73]: https://github.com/Scott-Cooper/Drawbot_image_to_gcode_v2/commit/cea99bc4cd202536dc673f24f5344cc2b33f9265 54 | [3.72]: https://github.com/Scott-Cooper/Drawbot_image_to_gcode_v2/commit/7741fda62995b3497900286f0296238262a57900 55 | [3.71]: https://github.com/Scott-Cooper/Drawbot_image_to_gcode_v2/commit/a6339b3f1348de656c0e866cfe2e9a3ed121a58c 56 | [3.7]: https://github.com/Scott-Cooper/Drawbot_image_to_gcode_v2/commit/6361bc68d49ddc13d31e605b74a9163f98086a66 57 | 58 | [Issue 11]: https://github.com/Scott-Cooper/Drawbot_image_to_gcode_v2/issues/11 -------------------------------------------------------------------------------- /Copic.pde: -------------------------------------------------------------------------------- 1 | // Regex used in sublime to clean up html from: 2 | // Source data: https://imaginationinternationalinc.com/copic/store/color-picker/ 3 | // 4 | // ^.*color: 5 | // ; cursor.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*
6 | //
\n.*

7 | //

\n.*clearfix.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n.*\n 8 | // ^(.*?),(.*?),(.*) 9 | // sketch_color.put("$2"), color($1)); sketch_name.put("$2"), "$3"); 10 | 11 | 12 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 13 | void copic_alpha_simulator() { 14 | color[] p = new color[5]; 15 | p[0] = copic.get_original_color("N1"); 16 | p[1] = copic.get_original_color("N3"); 17 | p[2] = copic.get_original_color("N5"); 18 | p[3] = copic.get_original_color("N7"); 19 | p[4] = copic.get_original_color("100"); 20 | 21 | int alpha = 210; 22 | int pen_off=200; 23 | int off=30; 24 | 25 | for (int pen=0; pen<5; pen++) { 26 | for (int x=0; x<5; x++) { 27 | //fill(p[pen], alpha); rect(pen*150+10, pen*off+x*pen_off, 500, 80); 28 | stroke(p[pen], alpha); 29 | strokeWeight(50); 30 | fill(p[4], 50); 31 | line(pen*150+10, pen*off+x*pen_off, pen*150+10+500, pen*off+x*pen_off); 32 | } 33 | } 34 | } 35 | 36 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 37 | void test_draw_closest_copic_color() { 38 | noStroke(); 39 | 40 | for (int i = 0; i < 255; i++) { 41 | colorMode(HSB, 255); 42 | color c1 = color(i, mouseX, mouseY); 43 | //color c1 = color(mouseX, i, mouseY); 44 | //color c1 = color(mouseX, mouseY, i); 45 | fill(c1); 46 | rect(i*5, 0, 5, 100); 47 | 48 | String p = copic.get_closest_original(c1); 49 | //println(p + " " + c.get_original_name(p)); 50 | color c2 = copic.get_original_color(p); 51 | fill(c2); 52 | rect(i*5, 105, 5, 100); 53 | } 54 | } 55 | 56 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 57 | class Copix { 58 | HashMap sketch_color; 59 | HashMap sketch_name; 60 | HashMap original_color; 61 | HashMap original_name; 62 | 63 | Copix() { 64 | sketch_color = new HashMap (); 65 | sketch_name = new HashMap (); 66 | original_color = new HashMap (); 67 | original_name = new HashMap (); 68 | 69 | sketch_color.put("0", color(#ffffff)); sketch_name.put("0", "Colorless Blender"); 70 | sketch_color.put("100", color(#312b2b)); sketch_name.put("100", "Black"); 71 | sketch_color.put("110", color(#030708)); sketch_name.put("110", "Special Black"); 72 | sketch_color.put("B0000", color(#f0f9fe)); sketch_name.put("B0000", "Pale Celestine"); 73 | sketch_color.put("B000", color(#e6f4f5)); sketch_name.put("B000", "Pale Porcelain Blue"); 74 | sketch_color.put("B00", color(#ddf0f4)); sketch_name.put("B00", "Frost Blue"); 75 | sketch_color.put("B01", color(#d6eef2)); sketch_name.put("B01", "Mint Blue"); 76 | sketch_color.put("B02", color(#b3e3f1)); sketch_name.put("B02", "Robin's Egg Blue"); 77 | sketch_color.put("B04", color(#73cfe6)); sketch_name.put("B04", "Tahitian Blue"); 78 | sketch_color.put("B05", color(#40c5e6)); sketch_name.put("B05", "Process Blue"); 79 | sketch_color.put("B06", color(#00b3e6)); sketch_name.put("B06", "Peacok Blue"); 80 | sketch_color.put("B12", color(#c8e6f0)); sketch_name.put("B12", "Ice Blue"); 81 | sketch_color.put("B14", color(#71cfeb)); sketch_name.put("B14", "Light Blue"); 82 | sketch_color.put("B16", color(#00bcea)); sketch_name.put("B16", "Cyanine Blue"); 83 | sketch_color.put("B18", color(#1d8acb)); sketch_name.put("B18", "Lapis Lazuli"); 84 | sketch_color.put("B21", color(#dbedf9)); sketch_name.put("B21", "Baby Blue"); 85 | sketch_color.put("B23", color(#92c2e8)); sketch_name.put("B23", "Phthalo Blue"); 86 | sketch_color.put("B24", color(#8acef3)); sketch_name.put("B24", "Sky"); 87 | sketch_color.put("B26", color(#65b3e3)); sketch_name.put("B26", "Cobalt Blue"); 88 | sketch_color.put("B28", color(#196db6)); sketch_name.put("B28", "Royal Blue"); 89 | sketch_color.put("B29", color(#0177c1)); sketch_name.put("B29", "Ultramarine"); 90 | sketch_color.put("B32", color(#e2eff7)); sketch_name.put("B32", "Pale Blue"); 91 | sketch_color.put("B34", color(#82c3ed)); sketch_name.put("B34", "Manganese Blue"); 92 | sketch_color.put("B37", color(#156fa4)); sketch_name.put("B37", "Antwerp Blue"); 93 | sketch_color.put("B39", color(#2b64a9)); sketch_name.put("B39", "Prussian Blue"); 94 | sketch_color.put("B41", color(#e2f0fb)); sketch_name.put("B41", "Powder Blue"); 95 | sketch_color.put("B45", color(#75c0ea)); sketch_name.put("B45", "Smoky Blue"); 96 | sketch_color.put("B52", color(#adcddc)); sketch_name.put("B52", "Soft Greenish Blue"); 97 | sketch_color.put("B60", color(#dae1f3)); sketch_name.put("B60", "Pale Blue Gray"); 98 | sketch_color.put("B63", color(#a7bbe0)); sketch_name.put("B63", "Light Hydrangea"); 99 | sketch_color.put("B66", color(#6888c5)); sketch_name.put("B66", "Clematis"); 100 | sketch_color.put("B69", color(#2165ae)); sketch_name.put("B69", "Stratospheric Blue"); 101 | sketch_color.put("B79", color(#3b479d)); sketch_name.put("B79", "Iris"); 102 | sketch_color.put("B91", color(#d5e2eb)); sketch_name.put("B91", "Pale Grayish Blue"); 103 | sketch_color.put("B93", color(#95c1da)); sketch_name.put("B93", "Light Crockery Blue"); 104 | sketch_color.put("B95", color(#74a7c6)); sketch_name.put("B95", "Light Grayish Cobalt"); 105 | sketch_color.put("B97", color(#457a9a)); sketch_name.put("B97", "Night Blue"); 106 | sketch_color.put("B99", color(#0f547e)); sketch_name.put("B99", "Agate"); 107 | sketch_color.put("BG0000", color(#eff8f3)); sketch_name.put("BG0000", "Snow Green"); 108 | sketch_color.put("BG000", color(#e5f4ed)); sketch_name.put("BG000", "Pale Aqua"); 109 | sketch_color.put("BG01", color(#c7e6fa)); sketch_name.put("BG01", "Aqua Blue"); 110 | sketch_color.put("BG02", color(#c6e8ea)); sketch_name.put("BG02", "New Blue"); 111 | sketch_color.put("BG05", color(#83d2e1)); sketch_name.put("BG05", "Holiday Blue"); 112 | sketch_color.put("BG07", color(#1db8ce)); sketch_name.put("BG07", "Petroleum Blue"); 113 | sketch_color.put("BG09", color(#01b1c9)); sketch_name.put("BG09", "Blue Green"); 114 | sketch_color.put("BG10", color(#dcf0ef)); sketch_name.put("BG10", "Cool Shadow"); 115 | sketch_color.put("BG11", color(#ceebf1)); sketch_name.put("BG11", "Moon White"); 116 | sketch_color.put("BG13", color(#c4e7e9)); sketch_name.put("BG13", "Mint Green"); 117 | sketch_color.put("BG15", color(#a0d9d2)); sketch_name.put("BG15", "Aqua"); 118 | sketch_color.put("BG18", color(#37c0b0)); sketch_name.put("BG18", "Teal Blue"); 119 | sketch_color.put("BG23", color(#bde5dd)); sketch_name.put("BG23", "Coral Sea"); 120 | sketch_color.put("BG32", color(#bce2d7)); sketch_name.put("BG32", "Aqua Mint"); 121 | sketch_color.put("BG34", color(#a3dad7)); sketch_name.put("BG34", "Horizon Green"); 122 | sketch_color.put("BG45", color(#afdfdf)); sketch_name.put("BG45", "Nile Blue"); 123 | sketch_color.put("BG49", color(#00b6b9)); sketch_name.put("BG49", "Duck Blue"); 124 | sketch_color.put("BG53", color(#accfd1)); sketch_name.put("BG53", "Ice Mint"); 125 | sketch_color.put("BG57", color(#64bebe)); sketch_name.put("BG57", "Sketch Jasper"); 126 | sketch_color.put("BG70", color(#daecee)); sketch_name.put("BG70", "Ocean Mist"); 127 | sketch_color.put("BG72", color(#74b8bb)); sketch_name.put("BG72", "Ice Ocean"); 128 | sketch_color.put("BG75", color(#59918e)); sketch_name.put("BG75", "Abyss Green"); 129 | sketch_color.put("BG78", color(#49706b)); sketch_name.put("BG78", "Bronze"); 130 | sketch_color.put("BG90", color(#e8ede7)); sketch_name.put("BG90", "Sketch Gray Sky"); 131 | sketch_color.put("BG93", color(#bac1b9)); sketch_name.put("BG93", "Green Gray"); 132 | sketch_color.put("BG96", color(#81a291)); sketch_name.put("BG96", "Bush"); 133 | sketch_color.put("BG99", color(#6e9b87)); sketch_name.put("BG99", "Flagstone Blue"); 134 | sketch_color.put("BV0000", color(#eae7f2)); sketch_name.put("BV0000", "Sketch Pale Thistle"); 135 | sketch_color.put("BV000", color(#eae7f2)); sketch_name.put("BV000", "Iridescent Mauve"); 136 | sketch_color.put("BV00", color(#e0dced)); sketch_name.put("BV00", "Mauve Shadow"); 137 | sketch_color.put("BV01", color(#c4c9e6)); sketch_name.put("BV01", "Viola"); 138 | sketch_color.put("BV02", color(#aab8db)); sketch_name.put("BV02", "Prune"); 139 | sketch_color.put("BV04", color(#7c97ce)); sketch_name.put("BV04", "Blue Berry"); 140 | sketch_color.put("BV08", color(#9d7eb9)); sketch_name.put("BV08", "Blue Violet"); 141 | sketch_color.put("BV11", color(#d4d2e8)); sketch_name.put("BV11", "Soft Violet"); 142 | sketch_color.put("BV13", color(#8491c8)); sketch_name.put("BV13", "Hydrangea Blue"); 143 | sketch_color.put("BV17", color(#6e84bd)); sketch_name.put("BV17", "Deep Reddish Blue"); 144 | sketch_color.put("BV20", color(#cfdbf1)); sketch_name.put("BV20", "Dull Lavender"); 145 | sketch_color.put("BV23", color(#b1c0dd)); sketch_name.put("BV23", "Grayish Lavender"); 146 | sketch_color.put("BV25", color(#8184a7)); sketch_name.put("BV25", "Grayish Violet"); 147 | sketch_color.put("BV29", color(#384558)); sketch_name.put("BV29", "Slate"); 148 | sketch_color.put("BV31", color(#eae7f2)); sketch_name.put("BV31", "Pale Lavender"); 149 | sketch_color.put("BV34", color(#9fa7bc)); sketch_name.put("BV34", "Sketch Bluebell"); 150 | sketch_color.put("C00", color(#e8f0f3)); sketch_name.put("C00", "Cool Gray"); 151 | sketch_color.put("C0", color(#e0e7ed)); sketch_name.put("C0", "Cool Gray"); 152 | sketch_color.put("C10", color(#202b31)); sketch_name.put("C10", "Cool Gray"); 153 | sketch_color.put("C1", color(#dae3e8)); sketch_name.put("C1", "Cool Gray No. 1"); 154 | sketch_color.put("C2", color(#ccd7dd)); sketch_name.put("C2", "Cool Gray"); 155 | sketch_color.put("C3", color(#c1ccd2)); sketch_name.put("C3", "Cool Gray No. 3"); 156 | sketch_color.put("C4", color(#a6b4bd)); sketch_name.put("C4", "Cool Gray"); 157 | sketch_color.put("C5", color(#92a0ab)); sketch_name.put("C5", "Cool Gray No. 5"); 158 | sketch_color.put("C6", color(#7b8c96)); sketch_name.put("C6", "Cool Gray"); 159 | sketch_color.put("C7", color(#637079)); sketch_name.put("C7", "Cool Gray No. 7"); 160 | sketch_color.put("C8", color(#535d66)); sketch_name.put("C8", "Cool Gray"); 161 | sketch_color.put("C9", color(#3c474d)); sketch_name.put("C9", "Cool Gray"); 162 | sketch_color.put("E0000", color(#fffaf4)); sketch_name.put("E0000", "Floral White"); 163 | sketch_color.put("E000", color(#fef5ee)); sketch_name.put("E000", "Pale Fruit Pink"); 164 | sketch_color.put("E00", color(#fdf3ea)); sketch_name.put("E00", "Cotton Pearl"); 165 | sketch_color.put("E01", color(#ffeee4)); sketch_name.put("E01", "Pink Flamingo"); 166 | sketch_color.put("E02", color(#feece0)); sketch_name.put("E02", "Fruit Pink"); 167 | sketch_color.put("E04", color(#e4bcc4)); sketch_name.put("E04", "Lipstick Natural"); 168 | sketch_color.put("E07", color(#cc816a)); sketch_name.put("E07", "Light Mahogany"); 169 | sketch_color.put("E08", color(#ca6553)); sketch_name.put("E08", "Brown"); 170 | sketch_color.put("E09", color(#d96a4f)); sketch_name.put("E09", "Burnt Sienna"); 171 | sketch_color.put("E11", color(#fee9d6)); sketch_name.put("E11", "Barley Beige"); 172 | sketch_color.put("E13", color(#e9c5af)); sketch_name.put("E13", "Light Suntan"); 173 | sketch_color.put("E15", color(#fbbb8d)); sketch_name.put("E15", "Dark Suntan"); 174 | sketch_color.put("E17", color(#b85f57)); sketch_name.put("E17", "Reddish Brass"); 175 | sketch_color.put("E18", color(#88534d)); sketch_name.put("E18", "Copper"); 176 | sketch_color.put("E19", color(#c45238)); sketch_name.put("E19", "Redwood"); 177 | sketch_color.put("E21", color(#fde2c7)); sketch_name.put("E21", "Soft Sun"); 178 | sketch_color.put("E23", color(#eccab1)); sketch_name.put("E23", "Hazelnut"); 179 | sketch_color.put("E25", color(#d2a482)); sketch_name.put("E25", "Caribe Cocoa"); 180 | sketch_color.put("E27", color(#997663)); sketch_name.put("E27", "Milk Chocolate"); 181 | sketch_color.put("E29", color(#884636)); sketch_name.put("E29", "Burnt Umber"); 182 | sketch_color.put("E30", color(#f7f0d6)); sketch_name.put("E30", "Bisque"); 183 | sketch_color.put("E31", color(#f2e6ce)); sketch_name.put("E31", "Brick Beige"); 184 | sketch_color.put("E33", color(#f3d2b1)); sketch_name.put("E33", "Sand"); 185 | sketch_color.put("E34", color(#f0caa6)); sketch_name.put("E34", "Toast"); 186 | sketch_color.put("E35", color(#e6c3a3)); sketch_name.put("E35", "Chamois"); 187 | sketch_color.put("E37", color(#cc9159)); sketch_name.put("E37", "Sepia"); 188 | sketch_color.put("E39", color(#c5743f)); sketch_name.put("E39", "Leather"); 189 | sketch_color.put("E40", color(#f2e8dc)); sketch_name.put("E40", "Brick White"); 190 | sketch_color.put("E41", color(#fef1e1)); sketch_name.put("E41", "Pearl White"); 191 | sketch_color.put("E42", color(#f3ead9)); sketch_name.put("E42", "Sand White"); 192 | sketch_color.put("E43", color(#e8dabd)); sketch_name.put("E43", "Dull Ivory"); 193 | sketch_color.put("E44", color(#c5b9a9)); sketch_name.put("E44", "Clay"); 194 | sketch_color.put("E47", color(#8a6e59)); sketch_name.put("E47", "Dark Brown"); 195 | sketch_color.put("E49", color(#634c3c)); sketch_name.put("E49", "Dark Bark"); 196 | sketch_color.put("E50", color(#f4ebf0)); sketch_name.put("E50", "Egg Shell"); 197 | sketch_color.put("E51", color(#feecd6)); sketch_name.put("E51", "Milky White"); 198 | sketch_color.put("E53", color(#f3e6c3)); sketch_name.put("E53", "Raw Silk"); 199 | sketch_color.put("E55", color(#f1dfb9)); sketch_name.put("E55", "Light Camel"); 200 | sketch_color.put("E57", color(#b18558)); sketch_name.put("E57", "Light Walnut"); 201 | sketch_color.put("E59", color(#9a7f6c)); sketch_name.put("E59", "Walnut"); 202 | sketch_color.put("E70", color(#efeae6)); sketch_name.put("E70", "Ash Rose"); 203 | sketch_color.put("E71", color(#e2d7d3)); sketch_name.put("E71", "Champagne"); 204 | sketch_color.put("E74", color(#a1847c)); sketch_name.put("E74", "Cocoa Brown"); 205 | sketch_color.put("E77", color(#7f604e)); sketch_name.put("E77", "Maroon"); 206 | sketch_color.put("E79", color(#4a2c22)); sketch_name.put("E79", "Cashew"); 207 | sketch_color.put("E81", color(#f0e6c2)); sketch_name.put("E81", "Ivory"); 208 | sketch_color.put("E84", color(#ae9f80)); sketch_name.put("E84", "- Sketch Khaki"); 209 | sketch_color.put("E87", color(#6f604d)); sketch_name.put("E87", "Fig"); 210 | sketch_color.put("E89", color(#5a4939)); sketch_name.put("E89", "- Sketch Pecan"); 211 | sketch_color.put("E93", color(#fed2b9)); sketch_name.put("E93", "Tea Rose"); 212 | sketch_color.put("E95", color(#fcbc7e)); sketch_name.put("E95", "Tea Orange"); 213 | sketch_color.put("E97", color(#ed9c5d)); sketch_name.put("E97", "Deep Orange"); 214 | sketch_color.put("E99", color(#b46034)); sketch_name.put("E99", "Baked Clay"); 215 | sketch_color.put("FB2", color(#058fd0)); sketch_name.put("FB2", "Fluorescent Dull Blue"); 216 | sketch_color.put("FBG2", color(#62cbe8)); sketch_name.put("FBG2", "Fluorescent Dull Blue Green"); 217 | sketch_color.put("FRV1", color(#f5a3c7)); sketch_name.put("FRV1", "Fluorescent Pink"); 218 | sketch_color.put("FV2", color(#7f74b6)); sketch_name.put("FV2", "Fluorescent Dull Violet"); 219 | sketch_color.put("FY1", color(#fff697)); sketch_name.put("FY1", "Fluorescent Yellow Orange"); 220 | sketch_color.put("FYG1", color(#9ecd43)); sketch_name.put("FYG1", "Fluorescent Yellow"); 221 | sketch_color.put("FYG2", color(#9ecd43)); sketch_name.put("FYG2", "Fluorescent Dull Yellow Green"); 222 | sketch_color.put("FYR1", color(#fecc99)); sketch_name.put("FYR1", "Fluorescent Orange"); 223 | sketch_color.put("G0000", color(#f1f7f3)); sketch_name.put("G0000", "Crystal Opal"); 224 | sketch_color.put("G000", color(#eaf5ed)); sketch_name.put("G000", "Pale Green"); 225 | sketch_color.put("G00", color(#e3f2ed)); sketch_name.put("G00", "Jade Green"); 226 | sketch_color.put("G02", color(#cfe8d3)); sketch_name.put("G02", "Spectrum Green"); 227 | sketch_color.put("G03", color(#b6da9c)); sketch_name.put("G03", "Meadow Green"); 228 | sketch_color.put("G05", color(#69c07b)); sketch_name.put("G05", "Emerald Green"); 229 | sketch_color.put("G07", color(#7bc576)); sketch_name.put("G07", "Nile Green"); 230 | sketch_color.put("G09", color(#7ac465)); sketch_name.put("G09", "Veronese Green"); 231 | sketch_color.put("G12", color(#d2e8c4)); sketch_name.put("G12", "Sea Green"); 232 | sketch_color.put("G14", color(#97cf90)); sketch_name.put("G14", "Apple Green"); 233 | sketch_color.put("G16", color(#60c198)); sketch_name.put("G16", "Malachite"); 234 | sketch_color.put("G17", color(#14b37d)); sketch_name.put("G17", "Forest Green"); 235 | sketch_color.put("G19", color(#2db98a)); sketch_name.put("G19", "Bright Parrot Green"); 236 | sketch_color.put("G20", color(#edf6db)); sketch_name.put("G20", "Wax White"); 237 | sketch_color.put("G21", color(#c4e4cd)); sketch_name.put("G21", "Lime Green"); 238 | sketch_color.put("G24", color(#c3e0b4)); sketch_name.put("G24", "Willow"); 239 | sketch_color.put("G28", color(#119462)); sketch_name.put("G28", "Ocean Green"); 240 | sketch_color.put("G29", color(#197c5d)); sketch_name.put("G29", "Pine Tree Green"); 241 | sketch_color.put("G40", color(#e4f1df)); sketch_name.put("G40", "Dim Green"); 242 | sketch_color.put("G43", color(#d7e7a8)); sketch_name.put("G43", "Various Pistachio"); 243 | sketch_color.put("G46", color(#579e74)); sketch_name.put("G46", "Sketch Mistletoe"); 244 | sketch_color.put("G82", color(#ccdab9)); sketch_name.put("G82", "Spring Dim Green"); 245 | sketch_color.put("G85", color(#9dc3aa)); sketch_name.put("G85", "Verdigris"); 246 | sketch_color.put("G94", color(#98a786)); sketch_name.put("G94", "Grayish Olive"); 247 | sketch_color.put("G99", color(#5f7e3a)); sketch_name.put("G99", "Olive"); 248 | sketch_color.put("N0", color(#eceeed)); sketch_name.put("N0", "Neutral Gray"); 249 | sketch_color.put("N10", color(#312f30)); sketch_name.put("N10", "Neutral Gray"); 250 | sketch_color.put("N1", color(#e2e3e5)); sketch_name.put("N1", "Neutral Gray"); 251 | sketch_color.put("N2", color(#dadbdd)); sketch_name.put("N2", "Neutral Gray"); 252 | sketch_color.put("N3", color(#d1d2d4)); sketch_name.put("N3", "Neutral Gray"); 253 | sketch_color.put("N4", color(#bcbdc1)); sketch_name.put("N4", "Neutral Gray"); 254 | sketch_color.put("N5", color(#a8a9ad)); sketch_name.put("N5", "Neutral Gray"); 255 | sketch_color.put("N6", color(#949599)); sketch_name.put("N6", "Neutral Gray"); 256 | sketch_color.put("N7", color(#77787c)); sketch_name.put("N7", "Neutral Gray"); 257 | sketch_color.put("N8", color(#636466)); sketch_name.put("N8", "Neutral Gray"); 258 | sketch_color.put("N9", color(#4c4d4f)); sketch_name.put("N9", "Neutral Gray"); 259 | sketch_color.put("R0000", color(#fef3ef)); sketch_name.put("R0000", "Pink Beryl"); 260 | sketch_color.put("R000", color(#fef0e7)); sketch_name.put("R000", "Cherry White"); 261 | sketch_color.put("R00", color(#feeae1)); sketch_name.put("R00", "Pinkish White"); 262 | sketch_color.put("R01", color(#fde0d8)); sketch_name.put("R01", "Pinkish Vanilla"); 263 | sketch_color.put("R02", color(#fdd3c7)); sketch_name.put("R02", "Rose Salmon"); 264 | sketch_color.put("R05", color(#f6927b)); sketch_name.put("R05", "Salmon Red"); 265 | sketch_color.put("R08", color(#f26754)); sketch_name.put("R08", "Vermilion"); 266 | sketch_color.put("R11", color(#fde1d5)); sketch_name.put("R11", "Pale Cherry Pink"); 267 | sketch_color.put("R12", color(#fcd3c1)); sketch_name.put("R12", "Light Tea Rose"); 268 | sketch_color.put("R14", color(#f59b92)); sketch_name.put("R14", "Light Rouge"); 269 | sketch_color.put("R17", color(#f4846c)); sketch_name.put("R17", "Lipstick Orange"); 270 | sketch_color.put("R20", color(#fcd7cf)); sketch_name.put("R20", "Blush"); 271 | sketch_color.put("R21", color(#fac1b6)); sketch_name.put("R21", "Sardonyx"); 272 | sketch_color.put("R22", color(#f8b7b1)); sketch_name.put("R22", "Light Prawn"); 273 | sketch_color.put("R24", color(#f27579)); sketch_name.put("R24", "Prawn"); 274 | sketch_color.put("R27", color(#f15062)); sketch_name.put("R27", "Cadmium Red"); 275 | sketch_color.put("R29", color(#ed174b)); sketch_name.put("R29", "Lipstick Red"); 276 | sketch_color.put("R30", color(#fce3df)); sketch_name.put("R30", "Pale Yellowish Pink"); 277 | sketch_color.put("R32", color(#fac1ba)); sketch_name.put("R32", "Peach"); 278 | sketch_color.put("R35", color(#f27185)); sketch_name.put("R35", "Coral"); 279 | sketch_color.put("R37", color(#e86c74)); sketch_name.put("R37", "Carmine"); 280 | sketch_color.put("R39", color(#cb487a)); sketch_name.put("R39", "Garnet"); 281 | sketch_color.put("R43", color(#ee848e)); sketch_name.put("R43", "Bougainvillaea"); 282 | sketch_color.put("R46", color(#e04d69)); sketch_name.put("R46", "Strong Red"); 283 | sketch_color.put("R56", color(#d27c95)); sketch_name.put("R56", "Currant"); 284 | sketch_color.put("R59", color(#b74f70)); sketch_name.put("R59", "Cardinal"); 285 | sketch_color.put("R81", color(#f1c8d6)); sketch_name.put("R81", "Rose Pink"); 286 | sketch_color.put("R83", color(#f19cb9)); sketch_name.put("R83", "Rose Mist"); 287 | sketch_color.put("R85", color(#d36a93)); sketch_name.put("R85", "Rose Red"); 288 | sketch_color.put("R89", color(#7d2b42)); sketch_name.put("R89", "Dark Red"); 289 | sketch_color.put("RV0000", color(#f2eaf5)); sketch_name.put("RV0000", "Evening Primrose"); 290 | sketch_color.put("RV000", color(#f4e2ee)); sketch_name.put("RV000", "Pale Purple"); 291 | sketch_color.put("RV00", color(#f1daea)); sketch_name.put("RV00", "Water Lily"); 292 | sketch_color.put("RV02", color(#fad5e6)); sketch_name.put("RV02", "Sugared Almond Pink"); 293 | sketch_color.put("RV04", color(#f6a3bf)); sketch_name.put("RV04", "Shock Pink"); 294 | sketch_color.put("RV06", color(#f386af)); sketch_name.put("RV06", "Cerise"); 295 | sketch_color.put("RV09", color(#e171ac)); sketch_name.put("RV09", "Fuchsia"); 296 | sketch_color.put("RV10", color(#fdecf4)); sketch_name.put("RV10", "Pale Pink"); 297 | sketch_color.put("RV11", color(#fbd6dd)); sketch_name.put("RV11", "Pink"); 298 | sketch_color.put("RV13", color(#f9c9d7)); sketch_name.put("RV13", "Tender Pink"); 299 | sketch_color.put("RV14", color(#f495b7)); sketch_name.put("RV14", "Begonia Pink"); 300 | sketch_color.put("RV17", color(#db7eb3)); sketch_name.put("RV17", "Deep Magenta"); 301 | sketch_color.put("RV19", color(#d268aa)); sketch_name.put("RV19", "Red Violet"); 302 | sketch_color.put("RV21", color(#fde8e7)); sketch_name.put("RV21", "Light Pink"); 303 | sketch_color.put("RV23", color(#f8bac9)); sketch_name.put("RV23", "Pure Pink"); 304 | sketch_color.put("RV25", color(#f493be)); sketch_name.put("RV25", "Dog Rose Flower"); 305 | sketch_color.put("RV29", color(#ef4880)); sketch_name.put("RV29", "Crimson"); 306 | sketch_color.put("RV32", color(#fad3ce)); sketch_name.put("RV32", "Shadow Pink"); 307 | sketch_color.put("RV34", color(#f9afae)); sketch_name.put("RV34", "Dark Pink"); 308 | sketch_color.put("RV42", color(#f8bbb6)); sketch_name.put("RV42", "Salmon Pink"); 309 | sketch_color.put("RV52", color(#f9cade)); sketch_name.put("RV52", "Various Cotton Candy"); 310 | sketch_color.put("RV55", color(#e9a5ca)); sketch_name.put("RV55", "Hollyhock"); 311 | sketch_color.put("RV63", color(#d09dae)); sketch_name.put("RV63", "Begonia"); 312 | sketch_color.put("RV66", color(#b86a84)); sketch_name.put("RV66", "Raspberry"); 313 | sketch_color.put("RV69", color(#8b576e)); sketch_name.put("RV69", "Peony"); 314 | sketch_color.put("RV91", color(#e6d4e2)); sketch_name.put("RV91", "Garyish Cherry"); 315 | sketch_color.put("RV93", color(#e7b6cc)); sketch_name.put("RV93", "Smokey Purple"); 316 | sketch_color.put("RV95", color(#b684a1)); sketch_name.put("RV95", "Baby Blossoms"); 317 | sketch_color.put("RV99", color(#5a4858)); sketch_name.put("RV99", "Argyle Purple"); 318 | sketch_color.put("T0", color(#eceeed)); sketch_name.put("T0", "Toner Gray"); 319 | sketch_color.put("T10", color(#322e2d)); sketch_name.put("T10", "Toner Gray"); 320 | sketch_color.put("T1", color(#eaeae8)); sketch_name.put("T1", "Toner Gray"); 321 | sketch_color.put("T2", color(#e0e0de)); sketch_name.put("T2", "Toner Gray"); 322 | sketch_color.put("T3", color(#d1d2cc)); sketch_name.put("T3", "Toner Gray"); 323 | sketch_color.put("T4", color(#bcbbb9)); sketch_name.put("T4", "Toner Gray"); 324 | sketch_color.put("T5", color(#a8a7a3)); sketch_name.put("T5", "Toner Gray"); 325 | sketch_color.put("T6", color(#949590)); sketch_name.put("T6", "Toner Gray"); 326 | sketch_color.put("T7", color(#777674)); sketch_name.put("T7", "Toner Gray"); 327 | sketch_color.put("T8", color(#63645f)); sketch_name.put("T8", "Toner Gray"); 328 | sketch_color.put("T9", color(#4c4b49)); sketch_name.put("T9", "Toner Gray"); 329 | sketch_color.put("V0000", color(#f0edf6)); sketch_name.put("V0000", "Rose Quartz"); 330 | sketch_color.put("V000", color(#e9e5f3)); sketch_name.put("V000", "Pale Heath"); 331 | sketch_color.put("V01", color(#e4c1d9)); sketch_name.put("V01", "Heath"); 332 | sketch_color.put("V04", color(#e6aace)); sketch_name.put("V04", "Lilac"); 333 | sketch_color.put("V05", color(#e2a6ca)); sketch_name.put("V05", "Azalea"); 334 | sketch_color.put("V06", color(#ce95c2)); sketch_name.put("V06", "Lavender"); 335 | sketch_color.put("V09", color(#8754a1)); sketch_name.put("V09", "Violet"); 336 | sketch_color.put("V12", color(#eed7e9)); sketch_name.put("V12", "Pale Lilac"); 337 | sketch_color.put("V15", color(#d3a6cd)); sketch_name.put("V15", "Mallow"); 338 | sketch_color.put("V17", color(#a092c7)); sketch_name.put("V17", "Amethyst"); 339 | sketch_color.put("V20", color(#e2e0ed)); sketch_name.put("V20", "Wisteria"); 340 | sketch_color.put("V22", color(#b2b1d0)); sketch_name.put("V22", "Sketch Ash Lavender"); 341 | sketch_color.put("V25", color(#857fad)); sketch_name.put("V25", "Pale Blackberry"); 342 | sketch_color.put("V28", color(#6b668e)); sketch_name.put("V28", "Sketch Eggplant"); 343 | sketch_color.put("V91", color(#e8c4d0)); sketch_name.put("V91", "Pale Grape"); 344 | sketch_color.put("V93", color(#e5c1db)); sketch_name.put("V93", "Early Grape"); 345 | sketch_color.put("V95", color(#b77ca8)); sketch_name.put("V95", "Light Grape"); 346 | sketch_color.put("V99", color(#524358)); sketch_name.put("V99", "Aubergine"); 347 | sketch_color.put("W00", color(#f3f3eb)); sketch_name.put("W00", "Warm Gray"); 348 | sketch_color.put("W0", color(#ecece4)); sketch_name.put("W0", "Warm Gray"); 349 | sketch_color.put("W10", color(#302f2b)); sketch_name.put("W10", "Warm Gray"); 350 | sketch_color.put("W1", color(#e7e7df)); sketch_name.put("W1", "Warm Gray No. 1"); 351 | sketch_color.put("W2", color(#ddddd5)); sketch_name.put("W2", "Warm Gray"); 352 | sketch_color.put("W3", color(#d2d2ca)); sketch_name.put("W3", "Warm Gray No. 3"); 353 | sketch_color.put("W4", color(#bcbdb7)); sketch_name.put("W4", "Warm Gray"); 354 | sketch_color.put("W5", color(#a8a9a4)); sketch_name.put("W5", "Warm Gray No. 5"); 355 | sketch_color.put("W6", color(#94958f)); sketch_name.put("W6", "Warm Gray"); 356 | sketch_color.put("W7", color(#777873)); sketch_name.put("W7", "Warm Gray No. 7"); 357 | sketch_color.put("W8", color(#63645f)); sketch_name.put("W8", "Warm Gray"); 358 | sketch_color.put("W9", color(#4c4d48)); sketch_name.put("W9", "Warm Gray"); 359 | sketch_color.put("Y0000", color(#fefef4)); sketch_name.put("Y0000", "Yellow Fluorite"); 360 | sketch_color.put("Y000", color(#fffce9)); sketch_name.put("Y000", "Pale Lemon"); 361 | sketch_color.put("Y00", color(#fefddf)); sketch_name.put("Y00", "Barium Yellow"); 362 | sketch_color.put("Y02", color(#f6f396)); sketch_name.put("Y02", "Canary Yellow"); 363 | sketch_color.put("Y04", color(#ede556)); sketch_name.put("Y04", "Acacia"); 364 | sketch_color.put("Y06", color(#fef56c)); sketch_name.put("Y06", "Yellow"); 365 | sketch_color.put("Y08", color(#fef200)); sketch_name.put("Y08", "Acid Yellow"); 366 | sketch_color.put("Y11", color(#fffbcc)); sketch_name.put("Y11", "Pale Yellow"); 367 | sketch_color.put("Y13", color(#fbf7ae)); sketch_name.put("Y13", "Lemon Yellow"); 368 | sketch_color.put("Y15", color(#fee96c)); sketch_name.put("Y15", "Cadmium Yellow"); 369 | sketch_color.put("Y17", color(#ffe455)); sketch_name.put("Y17", "Golden Yellow"); 370 | sketch_color.put("Y18", color(#feed55)); sketch_name.put("Y18", "Lightning Yellow"); 371 | sketch_color.put("Y19", color(#ffe93e)); sketch_name.put("Y19", "Napoli Yellow"); 372 | sketch_color.put("Y21", color(#ffeec2)); sketch_name.put("Y21", "Buttercup Yellow"); 373 | sketch_color.put("Y23", color(#fbe3b3)); sketch_name.put("Y23", "Yellowish Beige"); 374 | sketch_color.put("Y26", color(#f0dd67)); sketch_name.put("Y26", "Mustard"); 375 | sketch_color.put("Y28", color(#caa869)); sketch_name.put("Y28", "Lionet Gold"); 376 | sketch_color.put("Y32", color(#f9dec0)); sketch_name.put("Y32", "Cashmere"); 377 | sketch_color.put("Y35", color(#ffd879)); sketch_name.put("Y35", "Maize"); 378 | sketch_color.put("Y38", color(#ffd374)); sketch_name.put("Y38", "Honey"); 379 | sketch_color.put("YG0000", color(#f2f7e0)); sketch_name.put("YG0000", "Lily White"); 380 | sketch_color.put("YG00", color(#e6e69e)); sketch_name.put("YG00", "Mimosa Yellow"); 381 | sketch_color.put("YG01", color(#e2ebb2)); sketch_name.put("YG01", "Green Bice"); 382 | sketch_color.put("YG03", color(#deeaaa)); sketch_name.put("YG03", "Yellow Green"); 383 | sketch_color.put("YG05", color(#d6e592)); sketch_name.put("YG05", "Salad"); 384 | sketch_color.put("YG06", color(#c4df92)); sketch_name.put("YG06", "Yellowish Green"); 385 | sketch_color.put("YG07", color(#a5cf4f)); sketch_name.put("YG07", "Acid Green"); 386 | sketch_color.put("YG09", color(#82c566)); sketch_name.put("YG09", "Lettuce Green"); 387 | sketch_color.put("YG11", color(#e5f0d0)); sketch_name.put("YG11", "Mignonette"); 388 | sketch_color.put("YG13", color(#d4e59f)); sketch_name.put("YG13", "Chartreuse"); 389 | sketch_color.put("YG17", color(#72c156)); sketch_name.put("YG17", "Grass Green"); 390 | sketch_color.put("YG21", color(#f7f6be)); sketch_name.put("YG21", "Anise"); 391 | sketch_color.put("YG23", color(#e6eb8f)); sketch_name.put("YG23", "New Leaf"); 392 | sketch_color.put("YG25", color(#d0e17b)); sketch_name.put("YG25", "Celadon Green"); 393 | sketch_color.put("YG41", color(#d5ebd4)); sketch_name.put("YG41", "Pale Cobalt Green"); 394 | sketch_color.put("YG45", color(#b4dcb7)); sketch_name.put("YG45", "Cobalt Green"); 395 | sketch_color.put("YG61", color(#d6e9d6)); sketch_name.put("YG61", "Pale Moss"); 396 | sketch_color.put("YG63", color(#a0caa2)); sketch_name.put("YG63", "Pea Green"); 397 | sketch_color.put("YG67", color(#81bf8c)); sketch_name.put("YG67", "Moss"); 398 | sketch_color.put("YG91", color(#dad7ae)); sketch_name.put("YG91", "Putty"); 399 | sketch_color.put("YG93", color(#d2d29c)); sketch_name.put("YG93", "Grayish Yellow"); 400 | sketch_color.put("YG95", color(#cbc65e)); sketch_name.put("YG95", "Pale Olive"); 401 | sketch_color.put("YG97", color(#958f03)); sketch_name.put("YG97", "Spanish Olive"); 402 | sketch_color.put("YG99", color(#4e6a15)); sketch_name.put("YG99", "Marine Green"); 403 | sketch_color.put("YR0000", color(#fff3e5)); sketch_name.put("YR0000", "Pale Chiffon"); 404 | sketch_color.put("YR000", color(#feecd8)); sketch_name.put("YR000", "Silk"); 405 | sketch_color.put("YR00", color(#fed6bd)); sketch_name.put("YR00", "Powder Pink"); 406 | sketch_color.put("YR01", color(#fedac2)); sketch_name.put("YR01", "Peach Puff"); 407 | sketch_color.put("YR02", color(#fcdcc5)); sketch_name.put("YR02", "Light Orange"); 408 | sketch_color.put("YR04", color(#fec369)); sketch_name.put("YR04", "Chrome Orange"); 409 | sketch_color.put("YR07", color(#f26f39)); sketch_name.put("YR07", "Cadmium Orange"); 410 | sketch_color.put("YR09", color(#f15524)); sketch_name.put("YR09", "Chinese Orange"); 411 | sketch_color.put("YR12", color(#ffe2a6)); sketch_name.put("YR12", "Loquat"); 412 | sketch_color.put("YR14", color(#fec84e)); sketch_name.put("YR14", "Caramel"); 413 | sketch_color.put("YR15", color(#fbb884)); sketch_name.put("YR15", "Pumpkin Yellow"); 414 | sketch_color.put("YR16", color(#feb729)); sketch_name.put("YR16", "Apricot"); 415 | sketch_color.put("YR18", color(#f26b3c)); sketch_name.put("YR18", "Sanguine"); 416 | sketch_color.put("YR20", color(#ffe1bf)); sketch_name.put("YR20", "Yellowish Shade"); 417 | sketch_color.put("YR21", color(#f5ddb1)); sketch_name.put("YR21", "Cream"); 418 | sketch_color.put("YR23", color(#eccf8b)); sketch_name.put("YR23", "Yellow Ochre"); 419 | sketch_color.put("YR24", color(#f0cf64)); sketch_name.put("YR24", "Pale Sepia"); 420 | sketch_color.put("YR27", color(#d56638)); sketch_name.put("YR27", "Tuscan Orange"); 421 | sketch_color.put("YR30", color(#fef2da)); sketch_name.put("YR30", "Macadamia Nut"); 422 | sketch_color.put("YR31", color(#ffdea8)); sketch_name.put("YR31", "Light Reddish Yellow"); 423 | sketch_color.put("YR61", color(#fddac4)); sketch_name.put("YR61", "Spring Orange"); 424 | sketch_color.put("YR65", color(#faae60)); sketch_name.put("YR65", "Atoll"); 425 | sketch_color.put("YR68", color(#f37022)); sketch_name.put("YR68", "Orange"); 426 | sketch_color.put("YR82", color(#fdc68d)); sketch_name.put("YR82", "Mellow Peach"); 427 | 428 | original_color.put("0", color(#ffffff)); original_name.put("0", "Colorless Blender"); 429 | original_color.put("100", color(#312b2b)); original_name.put("100", "Black"); 430 | original_color.put("110", color(#030708)); original_name.put("110", "Special Black"); 431 | original_color.put("B00", color(#ddf0f4)); original_name.put("B00", "Frost Blue"); 432 | original_color.put("B01", color(#d6eef2)); original_name.put("B01", "Mint Blue"); 433 | original_color.put("B02", color(#b3e3f1)); original_name.put("B02", "Robin's Egg Blue"); 434 | original_color.put("B04", color(#73cfe6)); original_name.put("B04", "Tahitian Blue"); 435 | original_color.put("B05", color(#40c5e6)); original_name.put("B05", "Process Blue"); 436 | original_color.put("B06", color(#00b3e6)); original_name.put("B06", "Peacok Blue"); 437 | original_color.put("B12", color(#c8e6f0)); original_name.put("B12", "Ice Blue"); 438 | original_color.put("B14", color(#71cfeb)); original_name.put("B14", "Light Blue"); 439 | original_color.put("B16", color(#00bcea)); original_name.put("B16", "Cyanine Blue"); 440 | original_color.put("B18", color(#1d8acb)); original_name.put("B18", "Lapis Lazuli"); 441 | original_color.put("B21", color(#dbedf9)); original_name.put("B21", "Baby Blue"); 442 | original_color.put("B23", color(#92c2e8)); original_name.put("B23", "Phthalo Blue"); 443 | original_color.put("B24", color(#8acef3)); original_name.put("B24", "Sky"); 444 | original_color.put("B26", color(#65b3e3)); original_name.put("B26", "Cobalt Blue"); 445 | original_color.put("B29", color(#0177c1)); original_name.put("B29", "Ultramarine"); 446 | original_color.put("B32", color(#e2eff7)); original_name.put("B32", "Pale Blue"); 447 | original_color.put("B34", color(#82c3ed)); original_name.put("B34", "Manganese Blue"); 448 | original_color.put("B37", color(#156fa4)); original_name.put("B37", "Antwerp Blue"); 449 | original_color.put("B39", color(#2b64a9)); original_name.put("B39", "Prussian Blue"); 450 | original_color.put("B41", color(#e2f0fb)); original_name.put("B41", "Powder Blue"); 451 | original_color.put("B45", color(#75c0ea)); original_name.put("B45", "Smoky Blue"); 452 | original_color.put("BG02", color(#c6e8ea)); original_name.put("BG02", "New Blue"); 453 | original_color.put("BG05", color(#83d2e1)); original_name.put("BG05", "Holiday Blue"); 454 | original_color.put("BG09", color(#01b1c9)); original_name.put("BG09", "Blue Green"); 455 | original_color.put("BG10", color(#dcf0ef)); original_name.put("BG10", "Cool Shadow"); 456 | original_color.put("BG11", color(#ceebf1)); original_name.put("BG11", "Moon White"); 457 | original_color.put("BG13", color(#c4e7e9)); original_name.put("BG13", "Mint Green"); 458 | original_color.put("BG15", color(#a0d9d2)); original_name.put("BG15", "Aqua"); 459 | original_color.put("BG18", color(#37c0b0)); original_name.put("BG18", "Teal Blue"); 460 | original_color.put("BG32", color(#bce2d7)); original_name.put("BG32", "Aqua Mint"); 461 | original_color.put("BG34", color(#a3dad7)); original_name.put("BG34", "Horizon Green"); 462 | original_color.put("BG45", color(#afdfdf)); original_name.put("BG45", "Nile Blue"); 463 | original_color.put("BG49", color(#00b6b9)); original_name.put("BG49", "Duck Blue"); 464 | original_color.put("BG99", color(#6e9b87)); original_name.put("BG99", "Flagstone Blue"); 465 | original_color.put("BV00", color(#e0dced)); original_name.put("BV00", "Mauve Shadow"); 466 | original_color.put("BV04", color(#7c97ce)); original_name.put("BV04", "Blue Berry"); 467 | original_color.put("BV08", color(#9d7eb9)); original_name.put("BV08", "Blue Violet"); 468 | original_color.put("BV23", color(#b1c0dd)); original_name.put("BV23", "Grayish Lavender"); 469 | original_color.put("BV31", color(#eae7f2)); original_name.put("BV31", "Pale Lavender"); 470 | original_color.put("C0", color(#e0e7ed)); original_name.put("C0", "Cool Gray"); 471 | original_color.put("C10", color(#202b31)); original_name.put("C10", "Cool Gray"); 472 | original_color.put("C1", color(#dae3e8)); original_name.put("C1", "Cool Gray No. 1"); 473 | original_color.put("C2", color(#ccd7dd)); original_name.put("C2", "Cool Gray"); 474 | original_color.put("C3", color(#c1ccd2)); original_name.put("C3", "Cool Gray No. 3"); 475 | original_color.put("C4", color(#a6b4bd)); original_name.put("C4", "Cool Gray"); 476 | original_color.put("C5", color(#92a0ab)); original_name.put("C5", "Cool Gray No. 5"); 477 | original_color.put("C6", color(#7b8c96)); original_name.put("C6", "Cool Gray"); 478 | original_color.put("C7", color(#637079)); original_name.put("C7", "Cool Gray No. 7"); 479 | original_color.put("C8", color(#535d66)); original_name.put("C8", "Cool Gray"); 480 | original_color.put("C9", color(#3c474d)); original_name.put("C9", "Cool Gray"); 481 | original_color.put("E00", color(#fdf3ea)); original_name.put("E00", "Cotton Pearl"); 482 | original_color.put("E02", color(#feece0)); original_name.put("E02", "Fruit Pink"); 483 | original_color.put("E04", color(#e4bcc4)); original_name.put("E04", "Lipstick Natural"); 484 | original_color.put("E07", color(#cc816a)); original_name.put("E07", "Light Mahogany"); 485 | original_color.put("E09", color(#d96a4f)); original_name.put("E09", "Burnt Sienna"); 486 | original_color.put("E11", color(#fee9d6)); original_name.put("E11", "Barley Beige"); 487 | original_color.put("E13", color(#e9c5af)); original_name.put("E13", "Light Suntan"); 488 | original_color.put("E15", color(#fbbb8d)); original_name.put("E15", "Dark Suntan"); 489 | original_color.put("E19", color(#c45238)); original_name.put("E19", "Redwood"); 490 | original_color.put("E21", color(#fde2c7)); original_name.put("E21", "Soft Sun"); 491 | original_color.put("E25", color(#d2a482)); original_name.put("E25", "Caribe Cocoa"); 492 | original_color.put("E27", color(#997663)); original_name.put("E27", "Milk Chocolate"); 493 | original_color.put("E29", color(#884636)); original_name.put("E29", "Burnt Umber"); 494 | original_color.put("E31", color(#f2e6ce)); original_name.put("E31", "Brick Beige"); 495 | original_color.put("E33", color(#f3d2b1)); original_name.put("E33", "Sand"); 496 | original_color.put("E34", color(#f0caa6)); original_name.put("E34", "Toast"); 497 | original_color.put("E35", color(#e6c3a3)); original_name.put("E35", "Chamois"); 498 | original_color.put("E37", color(#cc9159)); original_name.put("E37", "Sepia"); 499 | original_color.put("E39", color(#c5743f)); original_name.put("E39", "Leather"); 500 | original_color.put("E40", color(#f2e8dc)); original_name.put("E40", "Brick White"); 501 | original_color.put("E41", color(#fef1e1)); original_name.put("E41", "Pearl White"); 502 | original_color.put("E43", color(#e8dabd)); original_name.put("E43", "Dull Ivory"); 503 | original_color.put("E44", color(#c5b9a9)); original_name.put("E44", "Clay"); 504 | original_color.put("E49", color(#634c3c)); original_name.put("E49", "Dark Bark"); 505 | original_color.put("E51", color(#feecd6)); original_name.put("E51", "Milky White"); 506 | original_color.put("E53", color(#f3e6c3)); original_name.put("E53", "Raw Silk"); 507 | original_color.put("E55", color(#f1dfb9)); original_name.put("E55", "Light Camel"); 508 | original_color.put("E57", color(#b18558)); original_name.put("E57", "Light Walnut"); 509 | original_color.put("E59", color(#9a7f6c)); original_name.put("E59", "Walnut"); 510 | original_color.put("E77", color(#7f604e)); original_name.put("E77", "Maroon"); 511 | original_color.put("G00", color(#e3f2ed)); original_name.put("G00", "Jade Green"); 512 | original_color.put("G02", color(#cfe8d3)); original_name.put("G02", "Spectrum Green"); 513 | original_color.put("G05", color(#69c07b)); original_name.put("G05", "Emerald Green"); 514 | original_color.put("G07", color(#7bc576)); original_name.put("G07", "Nile Green"); 515 | original_color.put("G09", color(#7ac465)); original_name.put("G09", "Veronese Green"); 516 | original_color.put("G12", color(#d2e8c4)); original_name.put("G12", "Sea Green"); 517 | original_color.put("G14", color(#97cf90)); original_name.put("G14", "Apple Green"); 518 | original_color.put("G16", color(#60c198)); original_name.put("G16", "Malachite"); 519 | original_color.put("G17", color(#14b37d)); original_name.put("G17", "Forest Green"); 520 | original_color.put("G19", color(#2db98a)); original_name.put("G19", "Bright Parrot Green"); 521 | original_color.put("G20", color(#edf6db)); original_name.put("G20", "Wax White"); 522 | original_color.put("G21", color(#c4e4cd)); original_name.put("G21", "Lime Green"); 523 | original_color.put("G24", color(#c3e0b4)); original_name.put("G24", "Willow"); 524 | original_color.put("G28", color(#119462)); original_name.put("G28", "Ocean Green"); 525 | original_color.put("G29", color(#197c5d)); original_name.put("G29", "Pine Tree Green"); 526 | original_color.put("G40", color(#e4f1df)); original_name.put("G40", "Dim Green"); 527 | original_color.put("G82", color(#ccdab9)); original_name.put("G82", "Spring Dim Green"); 528 | original_color.put("G85", color(#9dc3aa)); original_name.put("G85", "Verdigris"); 529 | original_color.put("G99", color(#5f7e3a)); original_name.put("G99", "Olive"); 530 | original_color.put("N0", color(#eceeed)); original_name.put("N0", "Neutral Gray"); 531 | original_color.put("N10", color(#312f30)); original_name.put("N10", "Neutral Gray"); 532 | original_color.put("N1", color(#e2e3e5)); original_name.put("N1", "Neutral Gray"); 533 | original_color.put("N2", color(#dadbdd)); original_name.put("N2", "Neutral Gray"); 534 | original_color.put("N3", color(#d1d2d4)); original_name.put("N3", "Neutral Gray"); 535 | original_color.put("N4", color(#bcbdc1)); original_name.put("N4", "Neutral Gray"); 536 | original_color.put("N5", color(#a8a9ad)); original_name.put("N5", "Neutral Gray"); 537 | original_color.put("N6", color(#949599)); original_name.put("N6", "Neutral Gray"); 538 | original_color.put("N7", color(#77787c)); original_name.put("N7", "Neutral Gray"); 539 | original_color.put("N8", color(#636466)); original_name.put("N8", "Neutral Gray"); 540 | original_color.put("N9", color(#4c4d4f)); original_name.put("N9", "Neutral Gray"); 541 | original_color.put("R00", color(#feeae1)); original_name.put("R00", "Pinkish White"); 542 | original_color.put("R02", color(#fdd3c7)); original_name.put("R02", "Rose Salmon"); 543 | original_color.put("R05", color(#f6927b)); original_name.put("R05", "Salmon Red"); 544 | original_color.put("R08", color(#f26754)); original_name.put("R08", "Vermilion"); 545 | original_color.put("R11", color(#fde1d5)); original_name.put("R11", "Pale Cherry Pink"); 546 | original_color.put("R17", color(#f4846c)); original_name.put("R17", "Lipstick Orange"); 547 | original_color.put("R20", color(#fcd7cf)); original_name.put("R20", "Blush"); 548 | original_color.put("R24", color(#f27579)); original_name.put("R24", "Prawn"); 549 | original_color.put("R27", color(#f15062)); original_name.put("R27", "Cadmium Red"); 550 | original_color.put("R29", color(#ed174b)); original_name.put("R29", "Lipstick Red"); 551 | original_color.put("R32", color(#fac1ba)); original_name.put("R32", "Peach"); 552 | original_color.put("R35", color(#f27185)); original_name.put("R35", "Coral"); 553 | original_color.put("R37", color(#e86c74)); original_name.put("R37", "Carmine"); 554 | original_color.put("R39", color(#cb487a)); original_name.put("R39", "Garnet"); 555 | original_color.put("R59", color(#b74f70)); original_name.put("R59", "Cardinal"); 556 | original_color.put("RV02", color(#fad5e6)); original_name.put("RV02", "Sugared Almond Pink"); 557 | original_color.put("RV04", color(#f6a3bf)); original_name.put("RV04", "Shock Pink"); 558 | original_color.put("RV06", color(#f386af)); original_name.put("RV06", "Cerise"); 559 | original_color.put("RV09", color(#e171ac)); original_name.put("RV09", "Fuchsia"); 560 | original_color.put("RV10", color(#fdecf4)); original_name.put("RV10", "Pale Pink"); 561 | original_color.put("RV11", color(#fbd6dd)); original_name.put("RV11", "Pink"); 562 | original_color.put("RV13", color(#f9c9d7)); original_name.put("RV13", "Tender Pink"); 563 | original_color.put("RV14", color(#f495b7)); original_name.put("RV14", "Begonia Pink"); 564 | original_color.put("RV17", color(#db7eb3)); original_name.put("RV17", "Deep Magenta"); 565 | original_color.put("RV19", color(#d268aa)); original_name.put("RV19", "Red Violet"); 566 | original_color.put("RV21", color(#fde8e7)); original_name.put("RV21", "Light Pink"); 567 | original_color.put("RV25", color(#f493be)); original_name.put("RV25", "Dog Rose Flower"); 568 | original_color.put("RV29", color(#ef4880)); original_name.put("RV29", "Crimson"); 569 | original_color.put("RV32", color(#fad3ce)); original_name.put("RV32", "Shadow Pink"); 570 | original_color.put("RV34", color(#f9afae)); original_name.put("RV34", "Dark Pink"); 571 | original_color.put("T0", color(#eceeed)); original_name.put("T0", "Toner Gray"); 572 | original_color.put("T10", color(#322e2d)); original_name.put("T10", "Toner Gray"); 573 | original_color.put("T1", color(#eaeae8)); original_name.put("T1", "Toner Gray"); 574 | original_color.put("T2", color(#e0e0de)); original_name.put("T2", "Toner Gray"); 575 | original_color.put("T3", color(#d1d2cc)); original_name.put("T3", "Toner Gray"); 576 | original_color.put("T4", color(#bcbbb9)); original_name.put("T4", "Toner Gray"); 577 | original_color.put("T5", color(#a8a7a3)); original_name.put("T5", "Toner Gray"); 578 | original_color.put("T6", color(#949590)); original_name.put("T6", "Toner Gray"); 579 | original_color.put("T7", color(#777674)); original_name.put("T7", "Toner Gray"); 580 | original_color.put("T8", color(#63645f)); original_name.put("T8", "Toner Gray"); 581 | original_color.put("T9", color(#4c4b49)); original_name.put("T9", "Toner Gray"); 582 | original_color.put("V04", color(#e6aace)); original_name.put("V04", "Lilac"); 583 | original_color.put("V06", color(#ce95c2)); original_name.put("V06", "Lavender"); 584 | original_color.put("V09", color(#8754a1)); original_name.put("V09", "Violet"); 585 | original_color.put("V12", color(#eed7e9)); original_name.put("V12", "Pale Lilac"); 586 | original_color.put("V15", color(#d3a6cd)); original_name.put("V15", "Mallow"); 587 | original_color.put("V17", color(#a092c7)); original_name.put("V17", "Amethyst"); 588 | original_color.put("W0", color(#ecece4)); original_name.put("W0", "Warm Gray"); 589 | original_color.put("W10", color(#302f2b)); original_name.put("W10", "Warm Gray"); 590 | original_color.put("W1", color(#e7e7df)); original_name.put("W1", "Warm Gray No. 1"); 591 | original_color.put("W2", color(#ddddd5)); original_name.put("W2", "Warm Gray"); 592 | original_color.put("W3", color(#d2d2ca)); original_name.put("W3", "Warm Gray No. 3"); 593 | original_color.put("W4", color(#bcbdb7)); original_name.put("W4", "Warm Gray"); 594 | original_color.put("W5", color(#a8a9a4)); original_name.put("W5", "Warm Gray No. 5"); 595 | original_color.put("W6", color(#94958f)); original_name.put("W6", "Warm Gray"); 596 | original_color.put("W7", color(#777873)); original_name.put("W7", "Warm Gray No. 7"); 597 | original_color.put("W8", color(#63645f)); original_name.put("W8", "Warm Gray"); 598 | original_color.put("W9", color(#4c4d48)); original_name.put("W9", "Warm Gray"); 599 | original_color.put("Y00", color(#fefddf)); original_name.put("Y00", "Barium Yellow"); 600 | original_color.put("Y02", color(#f6f396)); original_name.put("Y02", "Canary Yellow"); 601 | original_color.put("Y06", color(#fef56c)); original_name.put("Y06", "Yellow"); 602 | original_color.put("Y08", color(#fef200)); original_name.put("Y08", "Acid Yellow"); 603 | original_color.put("Y11", color(#fffbcc)); original_name.put("Y11", "Pale Yellow"); 604 | original_color.put("Y13", color(#fbf7ae)); original_name.put("Y13", "Lemon Yellow"); 605 | original_color.put("Y15", color(#fee96c)); original_name.put("Y15", "Cadmium Yellow"); 606 | original_color.put("Y17", color(#ffe455)); original_name.put("Y17", "Golden Yellow"); 607 | original_color.put("Y19", color(#ffe93e)); original_name.put("Y19", "Napoli Yellow"); 608 | original_color.put("Y21", color(#ffeec2)); original_name.put("Y21", "Buttercup Yellow"); 609 | original_color.put("Y23", color(#fbe3b3)); original_name.put("Y23", "Yellowish Beige"); 610 | original_color.put("Y26", color(#f0dd67)); original_name.put("Y26", "Mustard"); 611 | original_color.put("Y38", color(#ffd374)); original_name.put("Y38", "Honey"); 612 | original_color.put("YG01", color(#e2ebb2)); original_name.put("YG01", "Green Bice"); 613 | original_color.put("YG03", color(#deeaaa)); original_name.put("YG03", "Yellow Green"); 614 | original_color.put("YG05", color(#d6e592)); original_name.put("YG05", "Salad"); 615 | original_color.put("YG07", color(#a5cf4f)); original_name.put("YG07", "Acid Green"); 616 | original_color.put("YG09", color(#82c566)); original_name.put("YG09", "Lettuce Green"); 617 | original_color.put("YG11", color(#e5f0d0)); original_name.put("YG11", "Mignonette"); 618 | original_color.put("YG13", color(#d4e59f)); original_name.put("YG13", "Chartreuse"); 619 | original_color.put("YG17", color(#72c156)); original_name.put("YG17", "Grass Green"); 620 | original_color.put("YG21", color(#f7f6be)); original_name.put("YG21", "Anise"); 621 | original_color.put("YG23", color(#e6eb8f)); original_name.put("YG23", "New Leaf"); 622 | original_color.put("YG25", color(#d0e17b)); original_name.put("YG25", "Celadon Green"); 623 | original_color.put("YG41", color(#d5ebd4)); original_name.put("YG41", "Pale Cobalt Green"); 624 | original_color.put("YG45", color(#b4dcb7)); original_name.put("YG45", "Cobalt Green"); 625 | original_color.put("YG63", color(#a0caa2)); original_name.put("YG63", "Pea Green"); 626 | original_color.put("YG67", color(#81bf8c)); original_name.put("YG67", "Moss"); 627 | original_color.put("YG91", color(#dad7ae)); original_name.put("YG91", "Putty"); 628 | original_color.put("YG95", color(#cbc65e)); original_name.put("YG95", "Pale Olive"); 629 | original_color.put("YG97", color(#958f03)); original_name.put("YG97", "Spanish Olive"); 630 | original_color.put("YG99", color(#4e6a15)); original_name.put("YG99", "Marine Green"); 631 | original_color.put("YR00", color(#fed6bd)); original_name.put("YR00", "Powder Pink"); 632 | original_color.put("YR02", color(#fcdcc5)); original_name.put("YR02", "Light Orange"); 633 | original_color.put("YR04", color(#fec369)); original_name.put("YR04", "Chrome Orange"); 634 | original_color.put("YR07", color(#f26f39)); original_name.put("YR07", "Cadmium Orange"); 635 | original_color.put("YR09", color(#f15524)); original_name.put("YR09", "Chinese Orange"); 636 | original_color.put("YR14", color(#fec84e)); original_name.put("YR14", "Caramel"); 637 | original_color.put("YR16", color(#feb729)); original_name.put("YR16", "Apricot"); 638 | original_color.put("YR18", color(#f26b3c)); original_name.put("YR18", "Sanguine"); 639 | original_color.put("YR21", color(#f5ddb1)); original_name.put("YR21", "Cream"); 640 | original_color.put("YR23", color(#eccf8b)); original_name.put("YR23", "Yellow Ochre"); 641 | original_color.put("YR24", color(#f0cf64)); original_name.put("YR24", "Pale Sepia"); 642 | } 643 | 644 | color get_sketch_color(String pen) { 645 | return sketch_color.get(pen); 646 | } 647 | 648 | color get_original_color(String pen) { 649 | return original_color.get(pen); 650 | } 651 | 652 | String get_sketch_name(String pen) { 653 | return sketch_name.get(pen); 654 | } 655 | 656 | String get_original_name(String pen) { 657 | return original_name.get(pen); 658 | } 659 | 660 | String get_closest_original(color c1) { 661 | //http://stackoverflow.com/questions/1847092/given-an-rgb-value-what-would-be-the-best-way-to-find-the-closest-match-in-the-d 662 | //https://en.wikipedia.org/wiki/Color_difference 663 | 664 | float r1 = red(c1); 665 | float g1 = green(c1); 666 | float b1 = blue(c1); 667 | 668 | float closest_value = 99999999999999999999999999.0; 669 | String closest_pen = ""; 670 | 671 | for (Map.Entry me : original_color.entrySet()) { 672 | //println(me.getKey() + " is " + me.getValue()); 673 | 674 | color c2 = (color)me.getValue(); 675 | float r2 = red(c2); 676 | float g2 = green(c2); 677 | float b2 = blue(c2); 678 | 679 | float d = sq((r2-r1)*0.30) + sq((g2-g1)*0.59) + sq((b2-b1)*0.11); 680 | if (d 6 | // 7 | // Open creative GPL source commons with some BSD public GNU foundation stuff sprinkled in... 8 | // If anything here is remotely useable, please give me a shout. 9 | // 10 | // Useful math: http://members.chello.at/~easyfilter/bresenham.html 11 | // GClip: https://forum.processing.org/two/discussion/6179/why-does-not-it-run-clipboard 12 | // Dynamic class: https://processing.org/discourse/beta/num_1262759715.html 13 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 14 | import java.util.Map; 15 | import processing.pdf.*; 16 | 17 | 18 | // Constants 19 | final float paper_size_x = 32 * 25.4; 20 | final float paper_size_y = 40 * 25.4; 21 | final float image_size_x = 28 * 25.4; 22 | final float image_size_y = 36 * 25.4; 23 | final float paper_top_to_origin = 285; //mm, make smaller to move drawing down on paper 24 | final float pen_width = 0.65; //mm, determines image_scale, reduce, if solid black areas are speckled with white holes. 25 | final int pen_count = 6; 26 | final char gcode_decimal_seperator = '.'; 27 | final int gcode_decimals = 2; // Number of digits right of the decimal point in the gcode files. 28 | final int svg_decimals = 2; // Number of digits right of the decimal point in the SVG file. 29 | final float grid_scale = 25.4; // Use 10.0 for centimeters, 25.4 for inches, and between 444 and 529.2 for cubits. 30 | 31 | 32 | // Every good program should have a shit pile of badly named globals. 33 | Class cl = null; 34 | pfm ocl; 35 | int current_pfm = 0; 36 | String[] pfms = {"PFM_original", "PFM_spiral", "PFM_squares"}; 37 | 38 | int state = 1; 39 | int pen_selected = 0; 40 | int current_copic_set = 0; 41 | int display_line_count; 42 | String display_mode = "drawing"; 43 | PImage img_orginal; // The original image 44 | PImage img_reference; // After pre_processing, croped, scaled, boarder, etc. This is what we will try to draw. 45 | PImage img; // Used during drawing for current brightness levels. Gets damaged during drawing. 46 | float gcode_offset_x; 47 | float gcode_offset_y; 48 | float gcode_scale; 49 | float screen_scale; 50 | float screen_scale_org; 51 | int screen_rotate = 0; 52 | float old_x = 0; 53 | float old_y = 0; 54 | int mx = 0; 55 | int my = 0; 56 | int morgx = 0; 57 | int morgy = 0; 58 | int pen_color = 0; 59 | boolean is_pen_down; 60 | boolean is_grid_on = false; 61 | String path_selected = ""; 62 | String file_selected = ""; 63 | String basefile_selected = ""; 64 | String gcode_comments = ""; 65 | int startTime = 0; 66 | boolean ctrl_down = false; 67 | 68 | Limit dx, dy; 69 | Copix copic; 70 | PrintWriter OUTPUT; 71 | botDrawing d1; 72 | 73 | float[] pen_distribution = new float[pen_count]; 74 | 75 | String[][] copic_sets = { 76 | {"100", "N10", "N8", "N6", "N4", "N2"}, // Dark Greys 77 | {"100", "100", "N7", "N5", "N3", "N2"}, // Light Greys 78 | {"100", "W10", "W8", "W6", "W4", "W2"}, // Warm Greys 79 | {"100", "C10", "C8", "C6", "C4", "C2"}, // Cool Greys 80 | {"100", "100", "C7", "W5", "C3", "W2"}, // Mixed Greys 81 | {"100", "100", "W7", "C5", "W3", "C2"}, // Mixed Greys 82 | {"100", "100", "E49", "E27", "E13", "E00"}, // Browns 83 | {"100", "100", "E49", "E27", "E13", "N2"}, // Dark Grey Browns 84 | {"100", "100", "E49", "E27", "N4", "N2"}, // Browns 85 | {"100", "100", "E49", "N6", "N4", "N2"}, // Dark Grey Browns 86 | {"100", "100", "B37", "N6", "N4", "N2"}, // Dark Grey Blues 87 | {"100", "100", "R59", "N6", "N4", "N2"}, // Dark Grey Red 88 | {"100", "100", "G29", "N6", "N4", "N2"}, // Dark Grey Violet 89 | {"100", "100", "YR09", "N6", "N4", "N2"}, // Dark Grey Orange 90 | {"100", "100", "B39", "G28", "B26", "G14"}, // Blue Green 91 | {"100", "100", "B39", "V09", "B02", "V04"}, // Purples 92 | {"100", "100", "R29", "R27", "R24", "R20"}, // Reds 93 | {"100", "E29", "YG99", "Y17", "YG03", "Y11"} // Yellow, green 94 | }; 95 | 96 | 97 | 98 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 99 | void setup() { 100 | size(1415, 900, P3D); 101 | frame.setLocation(200, 200); 102 | surface.setResizable(true); 103 | surface.setTitle("Drawbot_image_to_gcode_v2, version 3.75"); 104 | colorMode(RGB); 105 | frameRate(999); 106 | //randomSeed(millis()); 107 | randomSeed(3); 108 | d1 = new botDrawing(); 109 | dx = new Limit(); 110 | dy = new Limit(); 111 | copic = new Copix(); 112 | loadInClass(pfms[current_pfm]); 113 | 114 | // If the clipboard contains a URL, try to download the picture instead of using local storage. 115 | String url = GClip.paste(); 116 | if (match(url.toLowerCase(), "^https?:...*(jpg|png)") != null) { 117 | println("Image URL found on clipboard: "+ url); 118 | path_selected = url; 119 | state++; 120 | } else { 121 | println("image URL not found on clipboard"); 122 | selectInput("Select an image to process:", "fileSelected"); 123 | } 124 | } 125 | 126 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 127 | void draw() { 128 | if (state != 3) { background(255, 255, 255); } 129 | scale(screen_scale); 130 | translate(mx, my); 131 | rotate(HALF_PI*screen_rotate); 132 | 133 | switch(state) { 134 | case 1: 135 | //println("State=1, Waiting for filename selection"); 136 | break; 137 | case 2: 138 | //println("State=2, Setup squiggles"); 139 | loop(); 140 | setup_squiggles(); 141 | startTime = millis(); 142 | break; 143 | case 3: 144 | //println("State=3, Drawing image"); 145 | if (display_line_count <= 1) { 146 | background(255); 147 | } 148 | ocl.find_path(); 149 | display_line_count = d1.line_count; 150 | break; 151 | case 4: 152 | println("State=4, pfm.post_processing"); 153 | ocl.post_processing(); 154 | 155 | set_even_distribution(); 156 | normalize_distribution(); 157 | d1.evenly_distribute_pen_changes(d1.get_line_count(), pen_count); 158 | d1.distribute_pen_changes_according_to_percentages(display_line_count, pen_count); 159 | 160 | println("elapsed time: " + (millis() - startTime) / 1000.0 + " seconds"); 161 | display_line_count = d1.line_count; 162 | 163 | gcode_comment ("extreams of X: " + dx.min + " thru " + dx.max); 164 | gcode_comment ("extreams of Y: " + dy.min + " thru " + dy.max); 165 | state++; 166 | break; 167 | case 5: 168 | render_all(); 169 | noLoop(); 170 | break; 171 | default: 172 | println("invalid state: " + state); 173 | break; 174 | } 175 | } 176 | 177 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 178 | void fileSelected(File selection) { 179 | if (selection == null) { 180 | println("no image file selected, exiting program."); 181 | exit(); 182 | } else { 183 | path_selected = selection.getAbsolutePath(); 184 | file_selected = selection.getName(); 185 | String[] fileparts = split(file_selected, '.'); 186 | basefile_selected = fileparts[0]; 187 | println("user selected: " + path_selected); 188 | //println("user selected: " + file_selected); 189 | //println("user selected: " + basefile_selected); 190 | state++; 191 | } 192 | } 193 | 194 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 195 | void setup_squiggles() { 196 | float gcode_scale_x; 197 | float gcode_scale_y; 198 | float screen_scale_x; 199 | float screen_scale_y; 200 | 201 | //println("setup_squiggles..."); 202 | 203 | d1.line_count = 0; 204 | //randomSeed(millis()); 205 | img = loadImage(path_selected, "jpeg"); // Load the image into the program 206 | gcode_comment("loaded image: " + path_selected); 207 | 208 | image_rotate(); 209 | 210 | img_orginal = createImage(img.width, img.height, RGB); 211 | img_orginal.copy(img, 0, 0, img.width, img.height, 0, 0, img.width, img.height); 212 | 213 | ocl.pre_processing(); 214 | img.loadPixels(); 215 | img_reference = createImage(img.width, img.height, RGB); 216 | img_reference.copy(img, 0, 0, img.width, img.height, 0, 0, img.width, img.height); 217 | 218 | gcode_scale_x = image_size_x / img.width; 219 | gcode_scale_y = image_size_y / img.height; 220 | gcode_scale = min(gcode_scale_x, gcode_scale_y); 221 | gcode_offset_x = - (img.width * gcode_scale / 2.0); 222 | gcode_offset_y = - (paper_top_to_origin - (paper_size_y - (img.height * gcode_scale)) / 2.0); 223 | 224 | screen_scale_x = width / (float)img.width; 225 | screen_scale_y = height / (float)img.height; 226 | screen_scale = min(screen_scale_x, screen_scale_y); 227 | screen_scale_org = screen_scale; 228 | 229 | gcode_comment("final dimensions: " + img.width + " by " + img.height); 230 | gcode_comment("paper_size: " + nf(paper_size_x,0,2) + " by " + nf(paper_size_y,0,2) + " " + nf(paper_size_x/25.4,0,2) + " by " + nf(paper_size_y/25.4,0,2)); 231 | gcode_comment("drawing size max: " + nf(image_size_x,0,2) + " by " + nf(image_size_y,0,2) + " " + nf(image_size_x/25.4,0,2) + " by " + nf(image_size_y/25.4,0,2)); 232 | gcode_comment("drawing size calculated " + nf(img.width * gcode_scale,0,2) + " by " + nf(img.height * gcode_scale,0,2) + " " + nf(img.width * gcode_scale/25.4,0,2) + " by " + nf(img.height * gcode_scale/25.4,0,2)); 233 | gcode_comment("gcode_scale X: " + nf(gcode_scale_x,0,2)); 234 | gcode_comment("gcode_scale Y: " + nf(gcode_scale_y,0,2)); 235 | gcode_comment("gcode_scale: " + nf(gcode_scale,0,2)); 236 | //gcode_comment("screen_scale X: " + nf(screen_scale_x,0,2)); 237 | //gcode_comment("screen_scale Y: " + nf(screen_scale_y,0,2)); 238 | //gcode_comment("screen_scale: " + nf(screen_scale,0,2)); 239 | ocl.output_parameters(); 240 | 241 | state++; 242 | } 243 | 244 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 245 | void render_all() { 246 | println("render_all: " + display_mode + ", " + display_line_count + " lines, with pen set " + current_copic_set); 247 | 248 | if (display_mode == "drawing") { 249 | //= pfms.length) { current_pfm = 0; } 284 | //display_line_count = 0; 285 | loadInClass(pfms[current_pfm]); 286 | state = 2; 287 | } 288 | 289 | if (key == 'd') { display_mode = "drawing"; } 290 | if (key == 'O') { display_mode = "original"; } 291 | if (key == 'o') { display_mode = "reference"; } 292 | if (key == 'l') { display_mode = "lightened"; } 293 | if (keyCode == 49 && ctrl_down && pen_count > 0) { display_mode = "pen"; pen_selected = 0; } // ctrl 1 294 | if (keyCode == 50 && ctrl_down && pen_count > 1) { display_mode = "pen"; pen_selected = 1; } // ctrl 2 295 | if (keyCode == 51 && ctrl_down && pen_count > 2) { display_mode = "pen"; pen_selected = 2; } // ctrl 3 296 | if (keyCode == 52 && ctrl_down && pen_count > 3) { display_mode = "pen"; pen_selected = 3; } // ctrl 4 297 | if (keyCode == 53 && ctrl_down && pen_count > 4) { display_mode = "pen"; pen_selected = 4; } // ctrl 5 298 | if (keyCode == 54 && ctrl_down && pen_count > 5) { display_mode = "pen"; pen_selected = 5; } // ctrl 6 299 | if (keyCode == 55 && ctrl_down && pen_count > 6) { display_mode = "pen"; pen_selected = 6; } // ctrl 7 300 | if (keyCode == 56 && ctrl_down && pen_count > 7) { display_mode = "pen"; pen_selected = 7; } // ctrl 8 301 | if (keyCode == 57 && ctrl_down && pen_count > 8) { display_mode = "pen"; pen_selected = 8; } // ctrl 9 302 | if (keyCode == 48 && ctrl_down && pen_count > 9) { display_mode = "pen"; pen_selected = 9; } // ctrl 0 303 | if (key == 'G') { is_grid_on = ! is_grid_on; } 304 | if (key == ']') { screen_scale *= 1.05; } 305 | if (key == '[') { screen_scale *= 1 / 1.05; } 306 | if (key == '1' && pen_count > 0) { pen_distribution[0] *= 1.1; } 307 | if (key == '2' && pen_count > 1) { pen_distribution[1] *= 1.1; } 308 | if (key == '3' && pen_count > 2) { pen_distribution[2] *= 1.1; } 309 | if (key == '4' && pen_count > 3) { pen_distribution[3] *= 1.1; } 310 | if (key == '5' && pen_count > 4) { pen_distribution[4] *= 1.1; } 311 | if (key == '6' && pen_count > 5) { pen_distribution[5] *= 1.1; } 312 | if (key == '7' && pen_count > 6) { pen_distribution[6] *= 1.1; } 313 | if (key == '8' && pen_count > 7) { pen_distribution[7] *= 1.1; } 314 | if (key == '9' && pen_count > 8) { pen_distribution[8] *= 1.1; } 315 | if (key == '0' && pen_count > 9) { pen_distribution[9] *= 1.1; } 316 | if (key == '!' && pen_count > 0) { pen_distribution[0] *= 0.9; } 317 | if (key == '@' && pen_count > 1) { pen_distribution[1] *= 0.9; } 318 | if (key == '#' && pen_count > 2) { pen_distribution[2] *= 0.9; } 319 | if (key == '$' && pen_count > 3) { pen_distribution[3] *= 0.9; } 320 | if (key == '%' && pen_count > 4) { pen_distribution[4] *= 0.9; } 321 | if (key == '^' && pen_count > 5) { pen_distribution[5] *= 0.9; } 322 | if (key == '&' && pen_count > 6) { pen_distribution[6] *= 0.9; } 323 | if (key == '*' && pen_count > 7) { pen_distribution[7] *= 0.9; } 324 | if (key == '(' && pen_count > 8) { pen_distribution[8] *= 0.9; } 325 | if (key == ')' && pen_count > 9) { pen_distribution[9] *= 0.9; } 326 | if (key == 't') { set_even_distribution(); } 327 | if (key == 'y') { set_black_distribution(); } 328 | if (key == 'x') { mouse_point(); } 329 | if (key == '}' && current_copic_set < copic_sets.length -1) { current_copic_set++; } 330 | if (key == '{' && current_copic_set >= 1) { current_copic_set--; } 331 | 332 | if (key == 's') { if (state == 3) { state++; } } 333 | if (keyCode == 65 && ctrl_down) { 334 | println("Holly freak, Ctrl-A was pressed!"); 335 | } 336 | if (key == '9') { 337 | if (pen_count > 0) { pen_distribution[0] *= 1.00; } 338 | if (pen_count > 1) { pen_distribution[1] *= 1.05; } 339 | if (pen_count > 2) { pen_distribution[2] *= 1.10; } 340 | if (pen_count > 3) { pen_distribution[3] *= 1.15; } 341 | if (pen_count > 4) { pen_distribution[4] *= 1.20; } 342 | if (pen_count > 5) { pen_distribution[5] *= 1.25; } 343 | if (pen_count > 6) { pen_distribution[6] *= 1.30; } 344 | if (pen_count > 7) { pen_distribution[7] *= 1.35; } 345 | if (pen_count > 8) { pen_distribution[8] *= 1.40; } 346 | if (pen_count > 9) { pen_distribution[9] *= 1.45; } 347 | } 348 | if (key == '0') { 349 | if (pen_count > 0) { pen_distribution[0] *= 1.00; } 350 | if (pen_count > 1) { pen_distribution[1] *= 0.95; } 351 | if (pen_count > 2) { pen_distribution[2] *= 0.90; } 352 | if (pen_count > 3) { pen_distribution[3] *= 0.85; } 353 | if (pen_count > 4) { pen_distribution[4] *= 0.80; } 354 | if (pen_count > 5) { pen_distribution[5] *= 0.75; } 355 | if (pen_count > 6) { pen_distribution[6] *= 0.70; } 356 | if (pen_count > 7) { pen_distribution[7] *= 0.65; } 357 | if (pen_count > 8) { pen_distribution[8] *= 0.60; } 358 | if (pen_count > 9) { pen_distribution[9] *= 0.55; } 359 | } 360 | if (key == 'g') { 361 | create_gcode_files(display_line_count); 362 | create_gcode_test_file (); 363 | create_svg_file(display_line_count); 364 | d1.render_to_pdf(display_line_count); 365 | d1.render_each_pen_to_pdf(display_line_count); 366 | } 367 | 368 | if (key == '\\') { screen_scale = screen_scale_org; screen_rotate=0; mx=0; my=0; } 369 | if (key == '<') { 370 | int delta = -10000; 371 | display_line_count = int(display_line_count + delta); 372 | display_line_count = constrain(display_line_count, 0, d1.line_count); 373 | //println("display_line_count: " + display_line_count); 374 | } 375 | if (key == '>') { 376 | int delta = 10000; 377 | display_line_count = int(display_line_count + delta); 378 | display_line_count = constrain(display_line_count, 0, d1.line_count); 379 | //println("display_line_count: " + display_line_count); 380 | } 381 | if (key == CODED) { 382 | int delta = 15; 383 | if (keyCode == UP) { my+= delta; }; 384 | if (keyCode == DOWN) { my-= delta; }; 385 | if (keyCode == RIGHT) { mx-= delta; }; 386 | if (keyCode == LEFT) { mx+= delta; }; 387 | } 388 | if (key == 'r') { 389 | screen_rotate ++; 390 | if (screen_rotate == 4) { screen_rotate = 0; } 391 | 392 | switch(screen_rotate) { 393 | case 0: 394 | my -= img.height; 395 | break; 396 | case 1: 397 | mx += img.height; 398 | break; 399 | case 2: 400 | my += img.height; 401 | break; 402 | case 3: 403 | mx -= img.height; 404 | break; 405 | } 406 | } 407 | 408 | normalize_distribution(); 409 | d1.distribute_pen_changes_according_to_percentages(display_line_count, pen_count); 410 | //surface.setSize(img.width, img.height); 411 | redraw(); 412 | } 413 | 414 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 415 | void set_even_distribution() { 416 | println("set_even_distribution"); 417 | for (int p = 0; p@param chars 20 | */ 21 | public static boolean copy(String chars) { 22 | if (gclip == null) 23 | gclip = new GClip(); 24 | return gclip.copyString(chars); 25 | } 26 | 27 | /** 28 | * Get a string from the clipboard 29 | * @return the string on the clipboard 30 | */ 31 | public static String paste() { 32 | if (gclip == null) 33 | gclip = new GClip(); 34 | return gclip.pasteString(); 35 | } 36 | 37 | /** 38 | * Ctor is private so clipboard is only created when a copy or paste is 39 | * attempted and one does not exist already. 40 | */ 41 | private GClip() { 42 | if (clipboard == null) { 43 | makeClipboardObject(); 44 | } 45 | } 46 | 47 | /** 48 | * If security permits use the system clipboard otherwise create 49 | * our own application clipboard. 50 | */ 51 | private void makeClipboardObject() { 52 | SecurityManager security = System.getSecurityManager(); 53 | if (security != null) { 54 | try { 55 | security.checkSystemClipboardAccess(); 56 | clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); 57 | } 58 | catch (SecurityException e) { 59 | clipboard = new Clipboard("Application Clipboard"); 60 | } 61 | } else { 62 | try { 63 | clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); 64 | } 65 | catch (Exception e) { 66 | } 67 | } 68 | } 69 | 70 | /** 71 | * Copy a string to the clipboard. If the Clipboard has not been created 72 | * then create it. 73 | * @return true for a successful copy to clipboard 74 | */ 75 | private boolean copyString(String chars) { 76 | if (clipboard == null) 77 | makeClipboardObject(); 78 | if (clipboard != null) { 79 | StringSelection fieldContent = new StringSelection (chars); 80 | clipboard.setContents (fieldContent, this); 81 | return true; 82 | } 83 | return false; 84 | } 85 | 86 | /** 87 | * Gets a string from the clipboard. If there is no Clipboard 88 | * then create it. 89 | * @return if possible the string on the clipboard else an empty string 90 | */ 91 | private String pasteString() { 92 | // If there is no clipboard then there is nothing to paste 93 | if (clipboard == null) { 94 | makeClipboardObject(); 95 | return ""; 96 | } 97 | // We have a clipboard so get the string if we can 98 | Transferable clipboardContent = clipboard.getContents(this); 99 | 100 | if ((clipboardContent != null) && 101 | (clipboardContent.isDataFlavorSupported(DataFlavor.stringFlavor))) { 102 | try { 103 | String tempString; 104 | tempString = (String) clipboardContent.getTransferData(DataFlavor.stringFlavor); 105 | return tempString; 106 | } 107 | catch (Exception e) { 108 | e.printStackTrace (); 109 | } 110 | } 111 | return ""; 112 | } 113 | 114 | /** 115 | * Reqd by ClipboardOwner interface 116 | */ 117 | public void lostOwnership(Clipboard clipboard, Transferable contents) { 118 | } 119 | } -------------------------------------------------------------------------------- /Gcode.pde: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // No, it's not a fancy dancy class like the snot nosed kids are doing these days. 3 | // Now get the hell off my lawn. 4 | 5 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 6 | void gcode_header() { 7 | OUTPUT.println("G21"); 8 | OUTPUT.println("G90"); 9 | OUTPUT.println("G1 Z0"); 10 | } 11 | 12 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 13 | void gcode_trailer() { 14 | OUTPUT.println("G1 Z0"); 15 | OUTPUT.println("G1 X" + gcode_format(0.1) + " Y" + gcode_format(0.1)); 16 | OUTPUT.println("G1 X0 y0"); 17 | } 18 | 19 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 20 | void gcode_comment(String comment) { 21 | gcode_comments += ("(" + comment + ")") + "\n"; 22 | println(comment); 23 | } 24 | 25 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 26 | void pen_up() { 27 | is_pen_down = false; 28 | } 29 | 30 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 31 | void pen_down() { 32 | is_pen_down = true; 33 | } 34 | 35 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 36 | void move_abs(int pen_number, float x, float y) { 37 | 38 | d1.addline(pen_number, is_pen_down, old_x, old_y, x, y); 39 | if (is_pen_down) { 40 | d1.render_last(); 41 | } 42 | 43 | old_x = x; 44 | old_y = y; 45 | } 46 | 47 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 48 | String gcode_format (Float n) { 49 | String s = nf(n, 0, gcode_decimals); 50 | s = s.replace('.', gcode_decimal_seperator); 51 | s = s.replace(',', gcode_decimal_seperator); 52 | return s; 53 | } 54 | 55 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 56 | void create_gcode_files (int line_count) { 57 | boolean is_pen_down; 58 | int pen_lifts; 59 | float pen_movement; 60 | float pen_drawing; 61 | int lines_drawn; 62 | float x; 63 | float y; 64 | float distance; 65 | 66 | // Loop over all lines for every pen. 67 | for (int p=0; p"); 208 | OUTPUT.println(""); 209 | d1.set_pen_continuation_flags(); 210 | 211 | // Loop over pens backwards to display dark lines last. 212 | // Then loop over all displayed lines. 213 | for (int p=pen_count-1; p>=0; p--) { 214 | OUTPUT.println(""); 215 | for (int i=1; i"); 231 | drawing_polyline = false; 232 | } 233 | 234 | if (d1.lines[i].pen_down) { 235 | if (d1.lines[i].pen_continuation) { 236 | String buf = svg_format(gcode_scaled_x2) + "," + svg_format(gcode_scaled_y2); 237 | OUTPUT.println(buf); 238 | drawing_polyline = true; 239 | } else { 240 | color c = copic.get_original_color(copic_sets[current_copic_set][p]); 241 | OUTPUT.println(""); 251 | drawing_polyline = false; 252 | } 253 | OUTPUT.println(""); 254 | } 255 | OUTPUT.println(""); 256 | OUTPUT.flush(); 257 | OUTPUT.close(); 258 | println("SVG created: " + gname); 259 | } 260 | 261 | /////////////////////////////////////////////////////////////////////////////////////////////////////// -------------------------------------------------------------------------------- /Image_Tools.pde: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | void image_threshold() { 3 | gcode_comment("Thresholed"); 4 | img.filter(THRESHOLD); 5 | } 6 | 7 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 8 | void image_desaturate() { 9 | gcode_comment("image_desaturate"); 10 | img.filter(GRAY); 11 | } 12 | 13 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 14 | void image_invert() { 15 | gcode_comment("image_invert"); 16 | img.filter(INVERT); 17 | } 18 | 19 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 20 | void image_posterize(int amount) { 21 | gcode_comment("image_posterize"); 22 | img.filter(POSTERIZE, amount); 23 | } 24 | 25 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 26 | void image_blur(int amount) { 27 | gcode_comment("image_blur"); 28 | img.filter(BLUR, amount); 29 | } 30 | 31 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 32 | void image_erode() { 33 | gcode_comment("image_erode"); 34 | img.filter(ERODE); 35 | } 36 | 37 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 38 | void image_dilate() { 39 | gcode_comment("image_dilate"); 40 | img.filter(DILATE); 41 | } 42 | 43 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 44 | void save_jpg() { 45 | // Currently disabled. 46 | // Must not be called from event handling functions such as keyPressed() 47 | PImage img_drawing; 48 | PImage img_drawing2; 49 | 50 | //img_drawing = createImage(img.width, img.height, RGB); 51 | //img_drawing.copy(0, 0, img.width, img.height, 0, 0, img.width, img.height); 52 | //img_drawing.save("what the duce.jpg"); 53 | 54 | // Save resuling image 55 | save("tmptif.tif"); 56 | img_drawing = loadImage("tmptif.tif"); 57 | img_drawing2 = createImage(img.width, img.height, RGB); 58 | img_drawing2.copy(img_drawing, 0, 0, img.width, img.height, 0, 0, img.width, img.height); 59 | img_drawing2.save("gcode\\gcode_" + basefile_selected + ".jpg"); 60 | } 61 | 62 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 63 | void image_rotate() { 64 | //image[y][x] // assuming this is the original orientation 65 | //image[x][original_width - y] // rotated 90 degrees ccw 66 | //image[original_height - x][y] // 90 degrees cw 67 | //image[original_height - y][original_width - x] // 180 degrees 68 | 69 | if (img.width > img.height) { 70 | PImage img2 = createImage(img.height, img.width, RGB); 71 | img.loadPixels(); 72 | for (int x=1; x 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | {one line to give the program's name and a brief idea of what it does.} 635 | Copyright (C) {year} {name of author} 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | {project} Copyright (C) {year} {fullname} 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /Misc.pde: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // A class to check the upper and lower limits of a value 3 | class Limit { 4 | float min = 2147483647; 5 | float max = -2147483648; 6 | 7 | Limit() { } 8 | 9 | void update_limit(float value_) { 10 | if (value_ < min) { min = value_; } 11 | if (value_ > max) { max = value_; } 12 | } 13 | } 14 | 15 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 16 | void grid() { 17 | // This will give you a rough idea of the size of the printed image, in "grid_scale" units. 18 | // Some screen scales smaller than 1.0 will sometimes display every other line 19 | // It looks like a big logic bug, but it just can't display a one pixel line scaled down well. 20 | 21 | blendMode(BLEND); 22 | if (is_grid_on) { 23 | int image_center_x = int(img.width / 2); 24 | int image_center_y = int(img.height / 2); 25 | int gridlines = 100; 26 | 27 | // Give everything outside the paper area a light grey color 28 | noStroke(); 29 | fill(0, 0, 0, 32); 30 | float border_x = (paper_size_x - image_size_x) / 2; 31 | float border_y = (paper_size_y - image_size_y) / 2; 32 | rect(-border_x/gcode_scale, -border_y/gcode_scale, 999999, -999999); 33 | rect((image_size_x+border_x)/gcode_scale, -border_y/gcode_scale, 999999, 999999); 34 | rect((image_size_x+border_x)/gcode_scale, (image_size_y+border_y)/gcode_scale, -999999, 999999); 35 | rect(-border_x/gcode_scale, (image_size_y+border_y)/gcode_scale, -999999, -999999); 36 | 37 | // Vertical lines 38 | strokeWeight(1); 39 | stroke(255, 64, 64, 80); 40 | noFill(); 41 | for (int x = -gridlines; x <= gridlines; x++) { 42 | int x0 = int(x * grid_scale / gcode_scale); 43 | line(x0 + image_center_x, -999999, x0 + image_center_x, 999999); 44 | } 45 | 46 | // Horizontal lines 47 | for (int y = -gridlines; y <= gridlines; y++) { 48 | int y0 = int(y * grid_scale / gcode_scale); 49 | line(-999999, y0 + image_center_y, 999999, y0 + image_center_y); 50 | } 51 | 52 | // Screen center line 53 | stroke(255, 64, 64, 80); 54 | strokeWeight(4); 55 | line(image_center_x, -999999, image_center_x, 999999); 56 | line(-999999, image_center_y, 999999, image_center_y); 57 | strokeWeight(1); 58 | 59 | hint(DISABLE_DEPTH_TEST); // Allow fills to be shown on top. 60 | 61 | // Mark the edge of the drawing/image area in blue 62 | stroke(64, 64, 255, 92); 63 | noFill(); 64 | strokeWeight(2); 65 | rect(0, 0, img.width, img.height); 66 | 67 | // Green pen origin (home position) dot. 68 | stroke(0, 255, 0, 255); 69 | fill(0, 255, 0, 255); 70 | ellipse(-gcode_offset_x / gcode_scale, -gcode_offset_y / gcode_scale, 10, 10); 71 | 72 | // Red center of image dot 73 | stroke(255, 0, 0, 255); 74 | fill(255, 0, 0, 255); 75 | ellipse(image_center_x, image_center_y, 10, 10); 76 | 77 | // Blue dot at image 0,0 78 | stroke(0, 0, 255, 255); 79 | fill(0, 0, 255, 255); 80 | ellipse(0, 0, 10, 10); 81 | 82 | hint(ENABLE_DEPTH_TEST); 83 | } 84 | } 85 | 86 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 87 | // Experimental, mark coordinates of mouse locations to console. 88 | // Useful for locating vanishing points etc. 89 | // Currently works correctly with screen_scale, translation and rotation. 90 | void mouse_point() { 91 | 92 | print("Mouse point: "); 93 | switch(screen_rotate) { 94 | case 0: 95 | println( (mouseX/screen_scale - mx) + ", " + (mouseY/screen_scale - my) ); 96 | break; 97 | case 1: 98 | println( (mouseY/screen_scale - my) + ", " + -(mouseX/screen_scale - mx) ); 99 | break; 100 | case 2: 101 | println( -(mouseX/screen_scale - mx) + ", " + -(mouseY/screen_scale - my) ); 102 | break; 103 | case 3: 104 | println( -(mouseY/screen_scale - my) + ", " + (mouseX/screen_scale - mx) ); 105 | break; 106 | } 107 | } 108 | 109 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 110 | -------------------------------------------------------------------------------- /PFM_original.pde: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // This path finding module is the basis for nearly all my drawings. 3 | // Find the darkest average line away from my current location and move there. 4 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 5 | 6 | class PFM_original implements pfm { 7 | 8 | final int squiggle_length = 500; // How often to lift the pen 9 | final int adjustbrightness = 10; // How fast it moves from dark to light, over-draw 10 | final float desired_brightness = 250; // How long to process. You can always stop early with "s" key 11 | final int squiggles_till_first_change = 190; 12 | 13 | int tests = 13; // Reasonable values: 13 for development, 720 for final 14 | int line_length = int(random(3, 40)); // Reasonable values: 3 through 100 15 | 16 | int squiggle_count; 17 | int darkest_x; 18 | int darkest_y; 19 | float darkest_value; 20 | float darkest_neighbor = 256; 21 | 22 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 23 | public void pre_processing() { 24 | image_crop(); 25 | image_scale(int(image_size_x / pen_width)); 26 | //image_sharpen(img); 27 | //image_blurr(img); 28 | //image_unsharpen(img, 5); 29 | image_unsharpen(img, 4); 30 | image_unsharpen(img, 3); 31 | //image_unsharpen(img, 2); 32 | //image_unsharpen(img, 1); 33 | //image_motion_blur(img); 34 | //image_outline(img); 35 | //image_edge_detect(img); 36 | //image_sobel(img, 1.0, 0); 37 | //image_posterize(6); 38 | //image_erode(); 39 | //image_dilate(); 40 | //image_invert(); 41 | //image_blur(2); 42 | image_boarder("b1.png", 0, 0); 43 | image_boarder("b11.png", 0, 0); 44 | image_desaturate(); 45 | } 46 | 47 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 48 | public void find_path() { 49 | find_squiggle(); 50 | if (avg_imgage_brightness() > desired_brightness ) { 51 | state++; 52 | } 53 | } 54 | 55 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 56 | private void find_squiggle() { 57 | int x, y; 58 | 59 | //find_darkest(); 60 | find_darkest_area(); 61 | x = darkest_x; 62 | y = darkest_y; 63 | squiggle_count++; 64 | pen_color = 0; 65 | 66 | find_darkest_neighbor(x, y); 67 | move_abs(0, darkest_x, darkest_y); 68 | pen_down(); 69 | 70 | for (int s = 0; s < squiggle_length; s++) { 71 | find_darkest_neighbor(x, y); 72 | bresenham_lighten(x, y, darkest_x, darkest_y, adjustbrightness); 73 | move_abs(0, darkest_x, darkest_y); 74 | x = darkest_x; 75 | y = darkest_y; 76 | } 77 | pen_up(); 78 | } 79 | 80 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 81 | private void find_darkest() { 82 | darkest_value = 257; 83 | int darkest_loc = 0; 84 | 85 | for (int loc=0; loc < img.width * img.height; loc++) { 86 | float r = brightness(img.pixels[loc]); 87 | if (r < darkest_value) { 88 | darkest_value = r + random(1); 89 | darkest_loc = loc; 90 | } 91 | } 92 | darkest_x = darkest_loc % img.width; 93 | darkest_y = (darkest_loc-darkest_x) / img.width; 94 | } 95 | 96 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 97 | private void find_darkest_area() { 98 | // Warning, Experimental: 99 | // Finds the darkest square area by down sampling the img into a much smaller area then finding 100 | // the darkest pixel within that. It returns a random pixel within that darkest area. 101 | 102 | int area_size = 10; 103 | darkest_value = 999; 104 | int darkest_loc = 1; 105 | 106 | PImage img2; 107 | img2 = createImage(img.width / area_size, img.height / area_size, RGB); 108 | img2.copy(img, 0, 0, img.width, img.height, 0, 0, img2.width, img2.height); 109 | 110 | for (int loc=0; loc < img2.width * img2.height; loc++) { 111 | float r = brightness(img2.pixels[loc]); 112 | 113 | if (r < darkest_value) { 114 | darkest_value = r + random(1); 115 | darkest_loc = loc; 116 | } 117 | } 118 | darkest_x = darkest_loc % img2.width; 119 | darkest_y = (darkest_loc - darkest_x) / img2.width; 120 | darkest_x = darkest_x * area_size + int(random(area_size)); 121 | darkest_y = darkest_y * area_size + int(random(area_size)); 122 | } 123 | 124 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 125 | private void find_darkest_neighbor(int start_x, int start_y) { 126 | darkest_neighbor = 257; 127 | float delta_angle; 128 | float start_angle; 129 | 130 | //start_angle = random(-35, -15) + cos(radians(start_x/4+(start_y/6)))*30; 131 | //start_angle = random(-95, -75) + cos(radians(start_y/15))*90; 132 | //start_angle = 36 + degrees( ( sin(radians(start_x/9+46)) + cos(radians(start_y/26+26)) )); 133 | //start_angle = 34 + degrees( ( sin(radians(start_x/9+46)) + cos(radians(start_y/-7+26)) )); 134 | //if (squiggle_count <220) { tests = 20; } else { tests = 2; } 135 | //start_angle = random(20, 1); // Cuba 1 136 | start_angle = random(-72, -52); // Spitfire 137 | //start_angle = random(-120, -140); // skier 138 | //start_angle = random(-360, -1); // gradiant magic 139 | //start_angle = squiggle_count % 360; 140 | //start_angle += squiggle_count/4; 141 | //start_angle = -45; 142 | //start_angle = (squiggle_count * 37) % 360; 143 | 144 | //delta_angle = 180 + 10 / (float)tests; 145 | //delta_angle = 360.0 / (float)tests; 146 | 147 | if (squiggle_count < squiggles_till_first_change) { 148 | //line_length = int(random(3, 60)); 149 | delta_angle = 360.0 / (float)tests; 150 | } else { 151 | //start_angle = degrees(atan2(img.height/2.0 - start_y -470, img.width/2.0 - start_x+130) )-10+90; // wierd spiral 152 | //start_angle = degrees(atan2(img.height/2.0 - start_y +145, img.width/2.0 - start_x+45) )-10+90; //cuba car 153 | //start_angle = degrees(atan2(img.height/2.0 - start_y +210, img.width/2.0 - start_x-100) )-10; // italy 154 | delta_angle = 180 + 7 / (float)tests; 155 | } 156 | 157 | for (int d=0; d pnts; 168 | 169 | x1 = int(cos(radians(degree))*distance) + x0; 170 | y1 = int(sin(radians(degree))*distance) + y0; 171 | x0 = constrain(x0, 0, img.width-1); 172 | y0 = constrain(y0, 0, img.height-1); 173 | x1 = constrain(x1, 0, img.width-1); 174 | y1 = constrain(y1, 0, img.height-1); 175 | 176 | pnts = bresenham(x0, y0, x1, y1); 177 | for (intPoint p : pnts) { 178 | int loc = p.x + p.y*img.width; 179 | sum_brightness += brightness(img.pixels[loc]); 180 | count_brightness++; 181 | if (sum_brightness / count_brightness < darkest_neighbor) { 182 | darkest_x = p.x; 183 | darkest_y = p.y; 184 | darkest_neighbor = (float)sum_brightness / (float)count_brightness; 185 | } 186 | //println(x0+","+y0+" "+p.x+","+p.y+" brightness:"+sum_brightness / count_brightness+" darkest:"+darkest_neighbor+" "+darkest_x+","+darkest_y); 187 | } 188 | //println(); 189 | return( sum_brightness / count_brightness ); 190 | } 191 | 192 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 193 | public void post_processing() { 194 | } 195 | 196 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 197 | public void output_parameters() { 198 | gcode_comment("adjustbrightness: " + adjustbrightness); 199 | gcode_comment("squiggle_length: " + squiggle_length); 200 | } 201 | 202 | } -------------------------------------------------------------------------------- /PFM_spiral.pde: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 2 | // Path finding module: https://github.com/krummrey/SpiralFromImage 3 | // 4 | // Issues: 5 | // Transparencys currently do not work as a mask colour 6 | /////////////////////////////////////////////////////////////////////////////////////////////////////// 7 | 8 | class PFM_spiral implements pfm { 9 | 10 | 11 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 12 | public void pre_processing() { 13 | image_crop(); 14 | image_scale(1000); 15 | image_unsharpen(img, 3); 16 | image_boarder("b6.png", 0, 0); 17 | image_desaturate(); 18 | } 19 | 20 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 21 | public void find_path() { 22 | color c = 0; // Sampled color 23 | float b; // Sampled brightness 24 | float dist = 7; // Distance between rings 25 | float radius = dist/2; // Current radius 26 | float aradius = 1; // Radius with brighness applied up 27 | float bradius = 1; // Radius with brighness applied down 28 | float alpha; // Initial rotation 29 | float density = 75; // Density 30 | float ampScale = 4.5; // Controls the amplitude 31 | float x, y, xa, ya, xb, yb; // Current X and Y + jittered X and Y 32 | float k; // Current radius 33 | float endRadius; // Largest value the spiral needs to cover the image 34 | color mask = color (240, 240, 240); // This color will not be drawn (WHITE) 35 | 36 | k = density/radius; 37 | alpha = k; 38 | radius += dist/(360/k); 39 | 40 | // When have we reached the far corner of the image? 41 | // TODO: this will have to change if not centered 42 | endRadius = sqrt(pow((img.width/2), 2)+pow((img.height/2), 2)); 43 | 44 | // Calculates the first point. Currently just the center. 45 | // TODO: Allow for ajustable center 46 | pen_up(); 47 | x = radius*cos(radians(alpha))+img.width/2; 48 | y = -radius*sin(radians(alpha))+img.height/2; 49 | move_abs(0, x, y); 50 | xa = 0; 51 | xb = 0; 52 | ya = 0; 53 | yb = 0; 54 | 55 | // Have we reached the far corner of the image? 56 | while (radius < endRadius) { 57 | k = (density/2)/radius; 58 | alpha += k; 59 | radius += dist/(360/k); 60 | x = radius*cos(radians(alpha))+img.width/2; 61 | y = -radius*sin(radians(alpha))+img.height/2; 62 | 63 | // Are we within the the image? 64 | // If so check if the shape is open. If not, open it 65 | if ((x>=0) && (x0) && (y desired_brightness ) { 33 | state++; 34 | } 35 | } 36 | 37 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 38 | private void find_squiggle() { 39 | int x, y; 40 | 41 | //find_darkest(); 42 | find_darkest_area(); 43 | x = darkest_x; 44 | y = darkest_y; 45 | squiggle_count++; 46 | pen_color = 0; 47 | 48 | find_darkest_neighbor(x, y); 49 | move_abs(0, darkest_x, darkest_y); 50 | pen_down(); 51 | 52 | for (int s = 0; s < squiggle_length; s++) { 53 | find_darkest_neighbor(x, y); 54 | bresenham_lighten(x, y, darkest_x, darkest_y, adjustbrightness); 55 | move_abs(0, darkest_x, darkest_y); 56 | x = darkest_x; 57 | y = darkest_y; 58 | } 59 | pen_up(); 60 | } 61 | 62 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 63 | private void find_darkest() { 64 | darkest_value = 257; 65 | int darkest_loc = 0; 66 | 67 | for (int loc=0; loc < img.width * img.height; loc++) { 68 | float r = brightness(img.pixels[loc]); 69 | if (r < darkest_value) { 70 | darkest_value = r + random(1); 71 | darkest_loc = loc; 72 | } 73 | } 74 | darkest_x = darkest_loc % img.width; 75 | darkest_y = (darkest_loc-darkest_x) / img.width; 76 | } 77 | 78 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 79 | private void find_darkest_area() { 80 | // Warning, Experimental: 81 | // Finds the darkest square area by down sampling the img into a much smaller area then finding 82 | // the darkest pixel within that. It returns a random pixel within that darkest area. 83 | 84 | int area_size = 10; 85 | darkest_value = 999; 86 | int darkest_loc = 1; 87 | 88 | PImage img2; 89 | img2 = createImage(img.width / area_size, img.height / area_size, RGB); 90 | img2.copy(img, 0, 0, img.width, img.height, 0, 0, img2.width, img2.height); 91 | 92 | for (int loc=0; loc < img2.width * img2.height; loc++) { 93 | float r = brightness(img2.pixels[loc]); 94 | 95 | if (r < darkest_value) { 96 | darkest_value = r + random(1); 97 | darkest_loc = loc; 98 | } 99 | } 100 | darkest_x = darkest_loc % img2.width; 101 | darkest_y = (darkest_loc - darkest_x) / img2.width; 102 | darkest_x = darkest_x * area_size + int(random(area_size)); 103 | darkest_y = darkest_y * area_size + int(random(area_size)); 104 | } 105 | 106 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 107 | private void find_darkest_neighbor(int start_x, int start_y) { 108 | darkest_neighbor = 257; 109 | float start_angle; 110 | float delta_angle; 111 | 112 | start_angle = 36 + degrees( ( sin(radians(start_x/9+46)) + cos(radians(start_y/26+26)) )); 113 | delta_angle = 360.0 / (float)tests; 114 | 115 | for (int d=0; d pnts; 126 | 127 | x1 = int(cos(radians(degree))*distance) + x0; 128 | y1 = int(sin(radians(degree))*distance) + y0; 129 | x0 = constrain(x0, 0, img.width-1); 130 | y0 = constrain(y0, 0, img.height-1); 131 | x1 = constrain(x1, 0, img.width-1); 132 | y1 = constrain(y1, 0, img.height-1); 133 | 134 | pnts = bresenham(x0, y0, x1, y1); 135 | for (intPoint p : pnts) { 136 | int loc = p.x + p.y*img.width; 137 | sum_brightness += brightness(img.pixels[loc]); 138 | count_brightness++; 139 | if (sum_brightness / count_brightness < darkest_neighbor) { 140 | darkest_x = p.x; 141 | darkest_y = p.y; 142 | darkest_neighbor = (float)sum_brightness / (float)count_brightness; 143 | } 144 | //println(x0+","+y0+" "+p.x+","+p.y+" brightness:"+sum_brightness / count_brightness+" darkest:"+darkest_neighbor+" "+darkest_x+","+darkest_y); 145 | } 146 | //println(); 147 | return( sum_brightness / count_brightness ); 148 | } 149 | 150 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 151 | public void post_processing() { 152 | } 153 | 154 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 155 | public void output_parameters() { 156 | gcode_comment("adjustbrightness: " + adjustbrightness); 157 | gcode_comment("squiggle_length: " + squiggle_length); 158 | } 159 | 160 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Drawbot_image_to_gcode_v2 2 | Drawbot_image_to_gcode_v2 example output 3 | 4 | This code is used to generate gcode for drawbots, polargraphs or other vertical drawing machines. \ 5 | It takes an original image, manipulates it and generates a drawing path that kinda sorta looks like the original image. \ 6 | This code was specifically written to work with multiple Copic markers. \ 7 | The code was intended to be heavily modified to generate different and unique drawing styles. 8 | 9 | If your clipboard contains a URL to an image, the code will download it. This makes finding usable images easy and straight forword. 10 | If your clipboard contains a URL to a web site, the code will crash and burn in a spectacular fashion. 11 | 12 | ## Key Bindings: 13 | | Key | Description | 14 | | ------------- |:-------------| 15 | | p | Load next "Path Finding Module" (PFM) | 16 | | r | Rotate drawing | 17 | | [ | Zoom in | 18 | | ] | Zoom out | 19 | | \ | Reset drawing zoom, offset and rotation | 20 | | O | Display original image (capital letter) | 21 | | o | Display image to be drawn after pre-processing (lower case letter) | 22 | | l | Display image after the path finding module has manipulated it | 23 | | d | Display drawing with all pens | 24 | | 1 | Display drawing, pen 0 only | 25 | | 2 | Display drawing, pen 1 only | 26 | | 3 | Display drawing, pen 2 only | 27 | | 4 | Display drawing, pen 3 only | 28 | | 5 | Display drawing, pen 4 only | 29 | | 6 | Display drawing, pen 5 only | 30 | | 7 | Display drawing, pen 6 only | 31 | | 8 | Display drawing, pen 7 only | 32 | | 9 | Display drawing, pen 8 only | 33 | | 0 | Display drawing, pen 9 only | 34 | | S | Stop path finding prematurely | 35 | | Esc | Exit running program | 36 | | < | Decrease the total number of lines drawn | 37 | | > | Increase the total number of lines drawn | 38 | | g | Generate all gcode, SVGs, and PDFs with lines as displayed | 39 | | G | Toggle grid | 40 | | t | Redistribute percentage of lines drawn by each pen evenly | 41 | | y | Redistribute 100% of lines drawn to pen 0 ( Black/White/Sharpie ) | 42 | | 9 | Change distribution of lines drawn (lighten) | 43 | | 0 | Change distribution of lines drawn (darken) | 44 | | 1 | Increase percentage of lines drawn by pen 0 | 45 | | 2 | Increase percentage of lines drawn by pen 1 | 46 | | 3 | Increase percentage of lines drawn by pen 2 | 47 | | 4 | Increase percentage of lines drawn by pen 3 | 48 | | 5 | Increase percentage of lines drawn by pen 4 | 49 | | 6 | Increase percentage of lines drawn by pen 5 | 50 | | 7 | Increase percentage of lines drawn by pen 6 | 51 | | 8 | Increase percentage of lines drawn by pen 7 | 52 | | 9 | Increase percentage of lines drawn by pen 8 | 53 | | 0 | Increase percentage of lines drawn by pen 9 | 54 | | shift 0 | Decrease percentage of lines drawn by pen 0 | 55 | | shift 1 | Decrease percentage of lines drawn by pen 1 | 56 | | shift 2 | Decrease percentage of lines drawn by pen 2 | 57 | | shift 3 | Decrease percentage of lines drawn by pen 3 | 58 | | shift 4 | Decrease percentage of lines drawn by pen 4 | 59 | | shift 5 | Decrease percentage of lines drawn by pen 5 | 60 | | shift 6 | Decrease percentage of lines drawn by pen 6 | 61 | | shift 7 | Decrease percentage of lines drawn by pen 7 | 62 | | shift 8 | Decrease percentage of lines drawn by pen 8 | 63 | | shift 9 | Decrease percentage of lines drawn by pen 9 | 64 | | shift 0 | Decrease percentage of lines drawn by pen 0 | 65 | | { | Change Copic marker sets, increment | 66 | | } | Change Copic marker sets, decrement | 67 | 68 | 69 | Examples of drawings made with this software: http://dullbits.com/drawbot/gallery 70 | -------------------------------------------------------------------------------- /boarder/b1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b1.png -------------------------------------------------------------------------------- /boarder/b10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b10.png -------------------------------------------------------------------------------- /boarder/b11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b11.png -------------------------------------------------------------------------------- /boarder/b12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b12.png -------------------------------------------------------------------------------- /boarder/b13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b13.png -------------------------------------------------------------------------------- /boarder/b2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b2.png -------------------------------------------------------------------------------- /boarder/b3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b3.png -------------------------------------------------------------------------------- /boarder/b4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b4.png -------------------------------------------------------------------------------- /boarder/b5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b5.png -------------------------------------------------------------------------------- /boarder/b6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b6.png -------------------------------------------------------------------------------- /boarder/b7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b7.png -------------------------------------------------------------------------------- /boarder/b8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b8.png -------------------------------------------------------------------------------- /boarder/b9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/boarder/b9.png -------------------------------------------------------------------------------- /boarder/credits.txt: -------------------------------------------------------------------------------- 1 | Credits: 2 | 3 | Scott Cooper 4 | b1.png 5 | b2.png 6 | b3.png 7 | b4.png 8 | 9 | http://2momstalk.blogspot.com/2011_10_01_archive.html 10 | grunge frame free 1.png, renamed b5.png 11 | grunge frame free 2.png, renamed b6.png 12 | grunge frame free 3.png, renamed b7.png 13 | grunge frame free 4.png, renamed b8.png 14 | grunge frame free 5.png, renamed b9.png 15 | grunge frame free 6.png, renamed b10.png 16 | 17 | http://karma-manipulation.deviantart.com/art/Grunge-Border-156054027 18 | grunge_border_by_karma_manipulation.jpg, renamed b11.png 19 | 20 | http://struckdumb.deviantart.com/art/Border-iii-85551333 21 | border_iii_by_struckdumb.jpg, renamed b12.png, Heavily edited by Scott Cooper 22 | 23 | http://kuschelirmel-stock.deviantart.com/art/grunge-border-36100089 24 | grunge_border_by_kuschelirmel_stock.jpg, renamed b13.png 25 | -------------------------------------------------------------------------------- /pics/17 - ADqOZu5_crop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/17 - ADqOZu5_crop.jpg -------------------------------------------------------------------------------- /pics/24NB5_Gearheads_-HowtoChoosetheRightHeadphones_Muchai_V2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/24NB5_Gearheads_-HowtoChoosetheRightHeadphones_Muchai_V2.jpg -------------------------------------------------------------------------------- /pics/A (5).jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/A (5).jpg -------------------------------------------------------------------------------- /pics/A_big_old_brick_building_on_the_east_side_of_Ontario_Street_-j.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/A_big_old_brick_building_on_the_east_side_of_Ontario_Street_-j.jpg -------------------------------------------------------------------------------- /pics/DPAI-Carolyn_Gray-WEB_pshop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/DPAI-Carolyn_Gray-WEB_pshop.jpg -------------------------------------------------------------------------------- /pics/building18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/building18.jpg -------------------------------------------------------------------------------- /pics/cat1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/cat1.jpg -------------------------------------------------------------------------------- /pics/dfa700c1256b5a8abbae0b7d353be371.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/dfa700c1256b5a8abbae0b7d353be371.jpg -------------------------------------------------------------------------------- /pics/girl-face-blue-eyes-makeup.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/girl-face-blue-eyes-makeup.jpg -------------------------------------------------------------------------------- /pics/github1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/github1.png -------------------------------------------------------------------------------- /pics/weirdmnesss.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Scott-Cooper/Drawbot_image_to_gcode_v2/34fa3472e3e1093129032de62230beaa817b2084/pics/weirdmnesss.jpg --------------------------------------------------------------------------------