picrate 0.3.0-java → 0.4.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/.mvn/extensions.xml +1 -1
 - data/CHANGELOG.md +1 -2
 - data/README.md +1 -1
 - data/Rakefile +2 -2
 - data/lib/picrate.rb +1 -0
 - data/lib/picrate/app.rb +4 -4
 - data/lib/picrate/helper_methods.rb +0 -4
 - data/lib/picrate/version.rb +1 -1
 - data/library/color_group/color_group.rb +27 -0
 - data/picrate.gemspec +1 -1
 - data/pom.rb +5 -5
 - data/pom.xml +5 -5
 - data/src/main/java/monkstone/ColorUtil.java +57 -32
 - data/src/main/java/processing/awt/PShapeJava2D.java +33 -9
 - data/src/main/java/processing/awt/PSurfaceAWT.java +169 -76
 - data/src/main/java/processing/core/PApplet.java +15921 -13981
 - data/src/main/java/processing/core/PConstants.java +981 -475
 - data/src/main/java/processing/core/PFont.java +202 -50
 - data/src/main/java/processing/core/PGraphics.java +8470 -7323
 - data/src/main/java/processing/core/PImage.java +212 -42
 - data/src/main/java/processing/core/PMatrix.java +160 -21
 - data/src/main/java/processing/core/PMatrix2D.java +178 -18
 - data/src/main/java/processing/core/PMatrix3D.java +324 -48
 - data/src/main/java/processing/core/PShape.java +42 -20
 - data/src/main/java/processing/core/PShapeOBJ.java +91 -16
 - data/src/main/java/processing/core/PShapeSVG.java +253 -53
 - data/src/main/java/processing/core/PStyle.java +179 -34
 - data/src/main/java/processing/core/PSurface.java +94 -13
 - data/src/main/java/processing/core/PSurfaceNone.java +140 -35
 - data/src/main/java/processing/core/PVector.java +87 -10
 - data/src/main/java/processing/data/JSONObject.java +2 -2
 - data/src/main/java/processing/event/Event.java +69 -86
 - data/src/main/java/processing/event/MouseEvent.java +102 -102
 - data/src/main/java/processing/opengl/PJOGL.java +3 -0
 - data/test/color_group_test.rb +33 -0
 - data/vendors/Rakefile +1 -1
 - metadata +7 -4
 
| 
         @@ -151,7 +151,11 @@ public class PFont implements PConstants { 
     | 
|
| 
       151 
151 
     | 
    
         
             
               * bug that they can't be bothered to fix.
         
     | 
| 
       152 
152 
     | 
    
         
             
               */
         
     | 
| 
       153 
153 
     | 
    
         
             
              static protected Font[] fonts;
         
     | 
| 
       154 
     | 
    
         
            -
             
     | 
| 
      
 154 
     | 
    
         
            +
             
     | 
| 
      
 155 
     | 
    
         
            +
                /**
         
     | 
| 
      
 156 
     | 
    
         
            +
                 *
         
     | 
| 
      
 157 
     | 
    
         
            +
                 */
         
     | 
| 
      
 158 
     | 
    
         
            +
                static protected HashMap<String,Font> fontDifferent;
         
     | 
| 
       155 
159 
     | 
    
         | 
| 
       156 
160 
     | 
    
         
             
            //  /**
         
     | 
| 
       157 
161 
     | 
    
         
             
            //   * If not null, this font is set to load dynamically. This is the default
         
     | 
| 
         @@ -159,10 +163,26 @@ public class PFont implements PConstants { 
     | 
|
| 
       159 
163 
     | 
    
         
             
            //   * versions of characters are only created when prompted by an index() call.
         
     | 
| 
       160 
164 
     | 
    
         
             
            //   */
         
     | 
| 
       161 
165 
     | 
    
         
             
            //  protected Font lazyFont;
         
     | 
| 
      
 166 
     | 
    
         
            +
             
     | 
| 
      
 167 
     | 
    
         
            +
                /**
         
     | 
| 
      
 168 
     | 
    
         
            +
                 *
         
     | 
| 
      
 169 
     | 
    
         
            +
                 */
         
     | 
| 
       162 
170 
     | 
    
         
             
              protected BufferedImage lazyImage;
         
     | 
| 
       163 
     | 
    
         
            -
             
     | 
| 
       164 
     | 
    
         
            -
             
     | 
| 
       165 
     | 
    
         
            -
             
     | 
| 
      
 171 
     | 
    
         
            +
             
     | 
| 
      
 172 
     | 
    
         
            +
                /**
         
     | 
| 
      
 173 
     | 
    
         
            +
                 *
         
     | 
| 
      
 174 
     | 
    
         
            +
                 */
         
     | 
| 
      
 175 
     | 
    
         
            +
                protected Graphics2D lazyGraphics;
         
     | 
| 
      
 176 
     | 
    
         
            +
             
     | 
| 
      
 177 
     | 
    
         
            +
                /**
         
     | 
| 
      
 178 
     | 
    
         
            +
                 *
         
     | 
| 
      
 179 
     | 
    
         
            +
                 */
         
     | 
| 
      
 180 
     | 
    
         
            +
                protected FontMetrics lazyMetrics;
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
      
 182 
     | 
    
         
            +
                /**
         
     | 
| 
      
 183 
     | 
    
         
            +
                 *
         
     | 
| 
      
 184 
     | 
    
         
            +
                 */
         
     | 
| 
      
 185 
     | 
    
         
            +
                protected int[] lazySamples;
         
     | 
| 
       166 
186 
     | 
    
         | 
| 
       167 
187 
     | 
    
         | 
| 
       168 
188 
     | 
    
         
             
              /** for subclasses that need to store metadata about the font */
         
     | 
| 
         @@ -204,6 +224,8 @@ public class PFont implements PConstants { 
     | 
|
| 
       204 
224 
     | 
    
         
             
               * Create a new image-based font on the fly. If charset is set to null,
         
     | 
| 
       205 
225 
     | 
    
         
             
               * the characters will only be created as bitmaps when they're drawn.
         
     | 
| 
       206 
226 
     | 
    
         
             
               *
         
     | 
| 
      
 227 
     | 
    
         
            +
                 * @param font
         
     | 
| 
      
 228 
     | 
    
         
            +
                 * @param smooth
         
     | 
| 
       207 
229 
     | 
    
         
             
               * @nowebref
         
     | 
| 
       208 
230 
     | 
    
         
             
               * @param charset array of all unicode chars that should be included
         
     | 
| 
       209 
231 
     | 
    
         
             
               */
         
     | 
| 
         @@ -330,6 +352,11 @@ public class PFont implements PConstants { 
     | 
|
| 
       330 
352 
     | 
    
         
             
               * Adds an additional parameter that indicates the font came from a file,
         
     | 
| 
       331 
353 
     | 
    
         
             
               * not a built-in OS font.
         
     | 
| 
       332 
354 
     | 
    
         
             
               *
         
     | 
| 
      
 355 
     | 
    
         
            +
                 * @param font
         
     | 
| 
      
 356 
     | 
    
         
            +
                 * @param smooth
         
     | 
| 
      
 357 
     | 
    
         
            +
                 * @param charset
         
     | 
| 
      
 358 
     | 
    
         
            +
                 * @param stream
         
     | 
| 
      
 359 
     | 
    
         
            +
                 * @param density
         
     | 
| 
       333 
360 
     | 
    
         
             
               * @nowebref
         
     | 
| 
       334 
361 
     | 
    
         
             
               */
         
     | 
| 
       335 
362 
     | 
    
         
             
              public PFont(Font font, boolean smooth, char charset[],
         
     | 
| 
         @@ -340,6 +367,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       340 
367 
     | 
    
         
             
              }
         
     | 
| 
       341 
368 
     | 
    
         | 
| 
       342 
369 
     | 
    
         
             
              /**
         
     | 
| 
      
 370 
     | 
    
         
            +
                 * @throws java.io.IOException
         
     | 
| 
       343 
371 
     | 
    
         
             
               * @nowebref
         
     | 
| 
       344 
372 
     | 
    
         
             
               * @param input InputStream
         
     | 
| 
       345 
373 
     | 
    
         
             
               */
         
     | 
| 
         @@ -414,6 +442,8 @@ public class PFont implements PConstants { 
     | 
|
| 
       414 
442 
     | 
    
         
             
               * <p>
         
     | 
| 
       415 
443 
     | 
    
         
             
               * It is assumed that the calling class will handle closing
         
     | 
| 
       416 
444 
     | 
    
         
             
               * the stream when finished.
         
     | 
| 
      
 445 
     | 
    
         
            +
                 * @param output
         
     | 
| 
      
 446 
     | 
    
         
            +
                 * @throws java.io.IOException
         
     | 
| 
       417 
447 
     | 
    
         
             
               */
         
     | 
| 
       418 
448 
     | 
    
         
             
              public void save(OutputStream output) throws IOException {
         
     | 
| 
       419 
449 
     | 
    
         
             
                DataOutputStream os = new DataOutputStream(output);
         
     | 
| 
         @@ -491,13 +521,19 @@ public class PFont implements PConstants { 
     | 
|
| 
       491 
521 
     | 
    
         
             
                glyphCount++;
         
     | 
| 
       492 
522 
     | 
    
         
             
              }
         
     | 
| 
       493 
523 
     | 
    
         | 
| 
       494 
     | 
    
         
            -
             
     | 
| 
       495 
     | 
    
         
            -
             
     | 
| 
      
 524 
     | 
    
         
            +
                /**
         
     | 
| 
      
 525 
     | 
    
         
            +
                 *
         
     | 
| 
      
 526 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 527 
     | 
    
         
            +
                 */
         
     | 
| 
      
 528 
     | 
    
         
            +
                public String getName() {
         
     | 
| 
       496 
529 
     | 
    
         
             
                return name;
         
     | 
| 
       497 
530 
     | 
    
         
             
              }
         
     | 
| 
       498 
531 
     | 
    
         | 
| 
       499 
     | 
    
         
            -
             
     | 
| 
       500 
     | 
    
         
            -
             
     | 
| 
      
 532 
     | 
    
         
            +
                /**
         
     | 
| 
      
 533 
     | 
    
         
            +
                 *
         
     | 
| 
      
 534 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 535 
     | 
    
         
            +
                 */
         
     | 
| 
      
 536 
     | 
    
         
            +
                public String getPostScriptName() {
         
     | 
| 
       501 
537 
     | 
    
         
             
                return psname;
         
     | 
| 
       502 
538 
     | 
    
         
             
              }
         
     | 
| 
       503 
539 
     | 
    
         | 
| 
         @@ -506,6 +542,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       506 
542 
     | 
    
         
             
               * Set the native complement of this font. Might be set internally via the
         
     | 
| 
       507 
543 
     | 
    
         
             
               * findFont() function, or externally by a deriveFont() call if the font
         
     | 
| 
       508 
544 
     | 
    
         
             
               * is resized by PGraphicsJava2D.
         
     | 
| 
      
 545 
     | 
    
         
            +
                 * @param font
         
     | 
| 
       509 
546 
     | 
    
         
             
               */
         
     | 
| 
       510 
547 
     | 
    
         
             
              public void setNative(Object font) {
         
     | 
| 
       511 
548 
     | 
    
         
             
                this.font = (Font) font;
         
     | 
| 
         @@ -515,6 +552,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       515 
552 
     | 
    
         
             
              /**
         
     | 
| 
       516 
553 
     | 
    
         
             
               * Use the getNative() method instead, which allows library interfaces to be
         
     | 
| 
       517 
554 
     | 
    
         
             
               * written in a cross-platform fashion for desktop, Android, and others.
         
     | 
| 
      
 555 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       518 
556 
     | 
    
         
             
               */
         
     | 
| 
       519 
557 
     | 
    
         
             
              @Deprecated
         
     | 
| 
       520 
558 
     | 
    
         
             
              public Font getFont() {
         
     | 
| 
         @@ -524,6 +562,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       524 
562 
     | 
    
         | 
| 
       525 
563 
     | 
    
         
             
              /**
         
     | 
| 
       526 
564 
     | 
    
         
             
               * Return the native java.awt.Font associated with this PFont (if any).
         
     | 
| 
      
 565 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       527 
566 
     | 
    
         
             
               */
         
     | 
| 
       528 
567 
     | 
    
         
             
              public Object getNative() {
         
     | 
| 
       529 
568 
     | 
    
         
             
                if (subsetting) {
         
     | 
| 
         @@ -535,6 +574,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       535 
574 
     | 
    
         | 
| 
       536 
575 
     | 
    
         
             
              /**
         
     | 
| 
       537 
576 
     | 
    
         
             
               * Return size of this font.
         
     | 
| 
      
 577 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       538 
578 
     | 
    
         
             
               */
         
     | 
| 
       539 
579 
     | 
    
         
             
              public int getSize() {
         
     | 
| 
       540 
580 
     | 
    
         
             
                return size;
         
     | 
| 
         @@ -552,24 +592,33 @@ public class PFont implements PConstants { 
     | 
|
| 
       552 
592 
     | 
    
         
             
               * created (behind the scenes) at double the requested size. This ensures
         
     | 
| 
       553 
593 
     | 
    
         
             
               * that they're shown at half on displays (so folks don't have to change
         
     | 
| 
       554 
594 
     | 
    
         
             
               * their sketch code).
         
     | 
| 
      
 595 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       555 
596 
     | 
    
         
             
               */
         
     | 
| 
       556 
597 
     | 
    
         
             
              public int getDefaultSize() {
         
     | 
| 
       557 
598 
     | 
    
         
             
                //return defaultSize;
         
     | 
| 
       558 
599 
     | 
    
         
             
                return size / density;
         
     | 
| 
       559 
600 
     | 
    
         
             
              }
         
     | 
| 
       560 
601 
     | 
    
         | 
| 
       561 
     | 
    
         
            -
             
     | 
| 
       562 
     | 
    
         
            -
             
     | 
| 
      
 602 
     | 
    
         
            +
                /**
         
     | 
| 
      
 603 
     | 
    
         
            +
                 *
         
     | 
| 
      
 604 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 605 
     | 
    
         
            +
                 */
         
     | 
| 
      
 606 
     | 
    
         
            +
                public boolean isSmooth() {
         
     | 
| 
       563 
607 
     | 
    
         
             
                return smooth;
         
     | 
| 
       564 
608 
     | 
    
         
             
              }
         
     | 
| 
       565 
609 
     | 
    
         | 
| 
       566 
     | 
    
         
            -
             
     | 
| 
       567 
     | 
    
         
            -
             
     | 
| 
      
 610 
     | 
    
         
            +
                /**
         
     | 
| 
      
 611 
     | 
    
         
            +
                 *
         
     | 
| 
      
 612 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 613 
     | 
    
         
            +
                 */
         
     | 
| 
      
 614 
     | 
    
         
            +
                public boolean isStream() {
         
     | 
| 
       568 
615 
     | 
    
         
             
                return stream;
         
     | 
| 
       569 
616 
     | 
    
         
             
              }
         
     | 
| 
       570 
617 
     | 
    
         | 
| 
       571 
     | 
    
         
            -
             
     | 
| 
       572 
     | 
    
         
            -
             
     | 
| 
      
 618 
     | 
    
         
            +
                /**
         
     | 
| 
      
 619 
     | 
    
         
            +
                 *
         
     | 
| 
      
 620 
     | 
    
         
            +
                 */
         
     | 
| 
      
 621 
     | 
    
         
            +
                public void setSubsetting() {
         
     | 
| 
       573 
622 
     | 
    
         
             
                subsetting = true;
         
     | 
| 
       574 
623 
     | 
    
         
             
              }
         
     | 
| 
       575 
624 
     | 
    
         | 
| 
         @@ -577,6 +626,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       577 
626 
     | 
    
         
             
              /**
         
     | 
| 
       578 
627 
     | 
    
         
             
               * Attempt to find the native version of this font.
         
     | 
| 
       579 
628 
     | 
    
         
             
               * (Public so that it can be used by OpenGL or other renderers.)
         
     | 
| 
      
 629 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       580 
630 
     | 
    
         
             
               */
         
     | 
| 
       581 
631 
     | 
    
         
             
              public Object findNative() {
         
     | 
| 
       582 
632 
     | 
    
         
             
                if (font == null) {
         
     | 
| 
         @@ -601,8 +651,12 @@ public class PFont implements PConstants { 
     | 
|
| 
       601 
651 
     | 
    
         
             
                return font;
         
     | 
| 
       602 
652 
     | 
    
         
             
              }
         
     | 
| 
       603 
653 
     | 
    
         | 
| 
       604 
     | 
    
         
            -
             
     | 
| 
       605 
     | 
    
         
            -
             
     | 
| 
      
 654 
     | 
    
         
            +
                /**
         
     | 
| 
      
 655 
     | 
    
         
            +
                 *
         
     | 
| 
      
 656 
     | 
    
         
            +
                 * @param c
         
     | 
| 
      
 657 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 658 
     | 
    
         
            +
                 */
         
     | 
| 
      
 659 
     | 
    
         
            +
                public Glyph getGlyph(char c) {
         
     | 
| 
       606 
660 
     | 
    
         
             
                int index = index(c);
         
     | 
| 
       607 
661 
     | 
    
         
             
                return (index == -1) ? null : glyphs[index];
         
     | 
| 
       608 
662 
     | 
    
         
             
              }
         
     | 
| 
         @@ -610,6 +664,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       610 
664 
     | 
    
         | 
| 
       611 
665 
     | 
    
         
             
              /**
         
     | 
| 
       612 
666 
     | 
    
         
             
               * Get index for the character.
         
     | 
| 
      
 667 
     | 
    
         
            +
                 * @param c
         
     | 
| 
       613 
668 
     | 
    
         
             
               * @return index into arrays or -1 if not found
         
     | 
| 
       614 
669 
     | 
    
         
             
               */
         
     | 
| 
       615 
670 
     | 
    
         
             
              protected int index(char c) {
         
     | 
| 
         @@ -633,8 +688,12 @@ public class PFont implements PConstants { 
     | 
|
| 
       633 
688 
     | 
    
         
             
                }
         
     | 
| 
       634 
689 
     | 
    
         
             
              }
         
     | 
| 
       635 
690 
     | 
    
         | 
| 
       636 
     | 
    
         
            -
             
     | 
| 
       637 
     | 
    
         
            -
             
     | 
| 
      
 691 
     | 
    
         
            +
                /**
         
     | 
| 
      
 692 
     | 
    
         
            +
                 *
         
     | 
| 
      
 693 
     | 
    
         
            +
                 * @param c
         
     | 
| 
      
 694 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 695 
     | 
    
         
            +
                 */
         
     | 
| 
      
 696 
     | 
    
         
            +
                protected int indexActual(char c) {
         
     | 
| 
       638 
697 
     | 
    
         
             
                // degenerate case, but the find function will have trouble
         
     | 
| 
       639 
698 
     | 
    
         
             
                // if there are somehow zero chars in the lookup
         
     | 
| 
       640 
699 
     | 
    
         
             
                //if (value.length == 0) return -1;
         
     | 
| 
         @@ -648,8 +707,14 @@ public class PFont implements PConstants { 
     | 
|
| 
       648 
707 
     | 
    
         
             
                return indexHunt(c, 0, glyphCount-1);
         
     | 
| 
       649 
708 
     | 
    
         
             
              }
         
     | 
| 
       650 
709 
     | 
    
         | 
| 
       651 
     | 
    
         
            -
             
     | 
| 
       652 
     | 
    
         
            -
             
     | 
| 
      
 710 
     | 
    
         
            +
                /**
         
     | 
| 
      
 711 
     | 
    
         
            +
                 *
         
     | 
| 
      
 712 
     | 
    
         
            +
                 * @param c
         
     | 
| 
      
 713 
     | 
    
         
            +
                 * @param start
         
     | 
| 
      
 714 
     | 
    
         
            +
                 * @param stop
         
     | 
| 
      
 715 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 716 
     | 
    
         
            +
                 */
         
     | 
| 
      
 717 
     | 
    
         
            +
                protected int indexHunt(int c, int start, int stop) {
         
     | 
| 
       653 
718 
     | 
    
         
             
                int pivot = (start + stop) / 2;
         
     | 
| 
       654 
719 
     | 
    
         | 
| 
       655 
720 
     | 
    
         
             
                // if this is the char, then return it
         
     | 
| 
         @@ -670,6 +735,9 @@ public class PFont implements PConstants { 
     | 
|
| 
       670 
735 
     | 
    
         
             
              /**
         
     | 
| 
       671 
736 
     | 
    
         
             
               * Currently un-implemented for .vlw fonts,
         
     | 
| 
       672 
737 
     | 
    
         
             
               * but honored for layout in case subclasses use it.
         
     | 
| 
      
 738 
     | 
    
         
            +
                 * @param a
         
     | 
| 
      
 739 
     | 
    
         
            +
                 * @param b
         
     | 
| 
      
 740 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       673 
741 
     | 
    
         
             
               */
         
     | 
| 
       674 
742 
     | 
    
         
             
              public float kern(char a, char b) {
         
     | 
| 
       675 
743 
     | 
    
         
             
                return 0;
         
     | 
| 
         @@ -679,6 +747,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       679 
747 
     | 
    
         
             
              /**
         
     | 
| 
       680 
748 
     | 
    
         
             
               * Returns the ascent of this font from the baseline.
         
     | 
| 
       681 
749 
     | 
    
         
             
               * The value is based on a font of size 1.
         
     | 
| 
      
 750 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       682 
751 
     | 
    
         
             
               */
         
     | 
| 
       683 
752 
     | 
    
         
             
              public float ascent() {
         
     | 
| 
       684 
753 
     | 
    
         
             
                return ((float) ascent / (float) size);
         
     | 
| 
         @@ -688,6 +757,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       688 
757 
     | 
    
         
             
              /**
         
     | 
| 
       689 
758 
     | 
    
         
             
               * Returns how far this font descends from the baseline.
         
     | 
| 
       690 
759 
     | 
    
         
             
               * The value is based on a font size of 1.
         
     | 
| 
      
 760 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       691 
761 
     | 
    
         
             
               */
         
     | 
| 
       692 
762 
     | 
    
         
             
              public float descent() {
         
     | 
| 
       693 
763 
     | 
    
         
             
                return ((float) descent / (float) size);
         
     | 
| 
         @@ -696,6 +766,8 @@ public class PFont implements PConstants { 
     | 
|
| 
       696 
766 
     | 
    
         | 
| 
       697 
767 
     | 
    
         
             
              /**
         
     | 
| 
       698 
768 
     | 
    
         
             
               * Width of this character for a font of size 1.
         
     | 
| 
      
 769 
     | 
    
         
            +
                 * @param c
         
     | 
| 
      
 770 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       699 
771 
     | 
    
         
             
               */
         
     | 
| 
       700 
772 
     | 
    
         
             
              public float width(char c) {
         
     | 
| 
       701 
773 
     | 
    
         
             
                if (c == 32) return width('i');
         
     | 
| 
         @@ -709,23 +781,41 @@ public class PFont implements PConstants { 
     | 
|
| 
       709 
781 
     | 
    
         | 
| 
       710 
782 
     | 
    
         
             
              //////////////////////////////////////////////////////////////
         
     | 
| 
       711 
783 
     | 
    
         | 
| 
      
 784 
     | 
    
         
            +
                /**
         
     | 
| 
      
 785 
     | 
    
         
            +
                 *
         
     | 
| 
      
 786 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 787 
     | 
    
         
            +
                 */
         
     | 
| 
      
 788 
     | 
    
         
            +
             
     | 
| 
       712 
789 
     | 
    
         | 
| 
       713 
790 
     | 
    
         
             
              public int getGlyphCount()  {
         
     | 
| 
       714 
791 
     | 
    
         
             
                return glyphCount;
         
     | 
| 
       715 
792 
     | 
    
         
             
              }
         
     | 
| 
       716 
793 
     | 
    
         | 
| 
       717 
     | 
    
         
            -
             
     | 
| 
       718 
     | 
    
         
            -
             
     | 
| 
      
 794 
     | 
    
         
            +
                /**
         
     | 
| 
      
 795 
     | 
    
         
            +
                 *
         
     | 
| 
      
 796 
     | 
    
         
            +
                 * @param i
         
     | 
| 
      
 797 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 798 
     | 
    
         
            +
                 */
         
     | 
| 
      
 799 
     | 
    
         
            +
                public Glyph getGlyph(int i)  {
         
     | 
| 
       719 
800 
     | 
    
         
             
                return glyphs[i];
         
     | 
| 
       720 
801 
     | 
    
         
             
              }
         
     | 
| 
       721 
802 
     | 
    
         | 
| 
       722 
     | 
    
         
            -
             
     | 
| 
       723 
     | 
    
         
            -
             
     | 
| 
      
 803 
     | 
    
         
            +
                /**
         
     | 
| 
      
 804 
     | 
    
         
            +
                 *
         
     | 
| 
      
 805 
     | 
    
         
            +
                 * @param ch
         
     | 
| 
      
 806 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 807 
     | 
    
         
            +
                 */
         
     | 
| 
      
 808 
     | 
    
         
            +
                public PShape getShape(char ch) {
         
     | 
| 
       724 
809 
     | 
    
         
             
                return getShape(ch, 0);
         
     | 
| 
       725 
810 
     | 
    
         
             
              }
         
     | 
| 
       726 
811 
     | 
    
         | 
| 
       727 
     | 
    
         
            -
             
     | 
| 
       728 
     | 
    
         
            -
             
     | 
| 
      
 812 
     | 
    
         
            +
                /**
         
     | 
| 
      
 813 
     | 
    
         
            +
                 *
         
     | 
| 
      
 814 
     | 
    
         
            +
                 * @param ch
         
     | 
| 
      
 815 
     | 
    
         
            +
                 * @param detail
         
     | 
| 
      
 816 
     | 
    
         
            +
                 * @return
         
     | 
| 
      
 817 
     | 
    
         
            +
                 */
         
     | 
| 
      
 818 
     | 
    
         
            +
                public PShape getShape(char ch, float detail) {
         
     | 
| 
       729 
819 
     | 
    
         
             
                Font font = (Font) getNative();
         
     | 
| 
       730 
820 
     | 
    
         
             
                if (font == null) {
         
     | 
| 
       731 
821 
     | 
    
         
             
                  throw new IllegalArgumentException("getShape() only works on fonts loaded with createFont()");
         
     | 
| 
         @@ -882,6 +972,7 @@ public class PFont implements PConstants { 
     | 
|
| 
       882 
972 
     | 
    
         
             
               *
         
     | 
| 
       883 
973 
     | 
    
         
             
               * ( end auto-generated )
         
     | 
| 
       884 
974 
     | 
    
         
             
               *
         
     | 
| 
      
 975 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       885 
976 
     | 
    
         
             
               * @webref pfont
         
     | 
| 
       886 
977 
     | 
    
         
             
               * @usage application
         
     | 
| 
       887 
978 
     | 
    
         
             
               * @brief     Gets a list of the fonts installed on the system
         
     | 
| 
         @@ -895,8 +986,10 @@ public class PFont implements PConstants { 
     | 
|
| 
       895 
986 
     | 
    
         
             
                return list;
         
     | 
| 
       896 
987 
     | 
    
         
             
              }
         
     | 
| 
       897 
988 
     | 
    
         | 
| 
       898 
     | 
    
         
            -
             
     | 
| 
       899 
     | 
    
         
            -
             
     | 
| 
      
 989 
     | 
    
         
            +
                /**
         
     | 
| 
      
 990 
     | 
    
         
            +
                 *
         
     | 
| 
      
 991 
     | 
    
         
            +
                 */
         
     | 
| 
      
 992 
     | 
    
         
            +
                static public void loadFonts() {
         
     | 
| 
       900 
993 
     | 
    
         
             
                if (fonts == null) {
         
     | 
| 
       901 
994 
     | 
    
         
             
                  GraphicsEnvironment ge =
         
     | 
| 
       902 
995 
     | 
    
         
             
                    GraphicsEnvironment.getLocalGraphicsEnvironment();
         
     | 
| 
         @@ -917,6 +1010,8 @@ public class PFont implements PConstants { 
     | 
|
| 
       917 
1010 
     | 
    
         
             
               * Starting with Java 1.5, Apple broke the ability to specify most fonts.
         
     | 
| 
       918 
1011 
     | 
    
         
             
               * This bug was filed years ago as #4769141 at bugreporter.apple.com. More:
         
     | 
| 
       919 
1012 
     | 
    
         
             
               * <a href="http://dev.processing.org/bugs/show_bug.cgi?id=407">Bug 407</a>.
         
     | 
| 
      
 1013 
     | 
    
         
            +
                 * @param name
         
     | 
| 
      
 1014 
     | 
    
         
            +
                 * @return 
         
     | 
| 
       920 
1015 
     | 
    
         
             
               */
         
     | 
| 
       921 
1016 
     | 
    
         
             
              static public Font findFont(String name) {
         
     | 
| 
       922 
1017 
     | 
    
         
             
                loadFonts();
         
     | 
| 
         @@ -942,29 +1037,71 @@ public class PFont implements PConstants { 
     | 
|
| 
       942 
1037 
     | 
    
         
             
               * A single character, and its visage.
         
     | 
| 
       943 
1038 
     | 
    
         
             
               */
         
     | 
| 
       944 
1039 
     | 
    
         
             
              public class Glyph {
         
     | 
| 
       945 
     | 
    
         
            -
                public PImage image;
         
     | 
| 
       946 
     | 
    
         
            -
                public int value;
         
     | 
| 
       947 
     | 
    
         
            -
                public int height;
         
     | 
| 
       948 
     | 
    
         
            -
                public int width;
         
     | 
| 
       949 
     | 
    
         
            -
                public int index;
         
     | 
| 
       950 
     | 
    
         
            -
                public int setWidth;
         
     | 
| 
       951 
     | 
    
         
            -
                public int topExtent;
         
     | 
| 
       952 
     | 
    
         
            -
                public int leftExtent;
         
     | 
| 
       953 
     | 
    
         
            -
             
     | 
| 
       954 
1040 
     | 
    
         | 
| 
       955 
     | 
    
         
            -
             
     | 
| 
      
 1041 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1042 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1043 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1044 
     | 
    
         
            +
                  public PImage image;
         
     | 
| 
      
 1045 
     | 
    
         
            +
             
     | 
| 
      
 1046 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1047 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1048 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1049 
     | 
    
         
            +
                  public int value;
         
     | 
| 
      
 1050 
     | 
    
         
            +
             
     | 
| 
      
 1051 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1052 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1053 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1054 
     | 
    
         
            +
                  public int height;
         
     | 
| 
      
 1055 
     | 
    
         
            +
             
     | 
| 
      
 1056 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1057 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1058 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1059 
     | 
    
         
            +
                  public int width;
         
     | 
| 
      
 1060 
     | 
    
         
            +
             
     | 
| 
      
 1061 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1062 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1063 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1064 
     | 
    
         
            +
                  public int index;
         
     | 
| 
      
 1065 
     | 
    
         
            +
             
     | 
| 
      
 1066 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1067 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1068 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1069 
     | 
    
         
            +
                  public int setWidth;
         
     | 
| 
      
 1070 
     | 
    
         
            +
             
     | 
| 
      
 1071 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1072 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1073 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1074 
     | 
    
         
            +
                  public int topExtent;
         
     | 
| 
      
 1075 
     | 
    
         
            +
             
     | 
| 
      
 1076 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1077 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1078 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1079 
     | 
    
         
            +
                  public int leftExtent;
         
     | 
| 
      
 1080 
     | 
    
         
            +
             
     | 
| 
      
 1081 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1082 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1083 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1084 
     | 
    
         
            +
                  public Glyph() {
         
     | 
| 
       956 
1085 
     | 
    
         
             
                  index = -1;
         
     | 
| 
       957 
1086 
     | 
    
         
             
                  // used when reading from a stream or for subclasses
         
     | 
| 
       958 
1087 
     | 
    
         
             
                }
         
     | 
| 
       959 
1088 
     | 
    
         | 
| 
       960 
     | 
    
         
            -
             
     | 
| 
       961 
     | 
    
         
            -
             
     | 
| 
      
 1089 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1090 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1091 
     | 
    
         
            +
                   * @param is
         
     | 
| 
      
 1092 
     | 
    
         
            +
                   * @throws IOException
         
     | 
| 
      
 1093 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1094 
     | 
    
         
            +
                  public Glyph(DataInputStream is) throws IOException {
         
     | 
| 
       962 
1095 
     | 
    
         
             
                  index = -1;
         
     | 
| 
       963 
1096 
     | 
    
         
             
                  readHeader(is);
         
     | 
| 
       964 
1097 
     | 
    
         
             
                }
         
     | 
| 
       965 
1098 
     | 
    
         | 
| 
       966 
     | 
    
         
            -
             
     | 
| 
       967 
     | 
    
         
            -
             
     | 
| 
      
 1099 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1100 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1101 
     | 
    
         
            +
                   * @param is
         
     | 
| 
      
 1102 
     | 
    
         
            +
                   * @throws IOException
         
     | 
| 
      
 1103 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1104 
     | 
    
         
            +
                  protected void readHeader(DataInputStream is) throws IOException {
         
     | 
| 
       968 
1105 
     | 
    
         
             
                  value = is.readInt();
         
     | 
| 
       969 
1106 
     | 
    
         
             
                  height = is.readInt();
         
     | 
| 
       970 
1107 
     | 
    
         
             
                  width = is.readInt();
         
     | 
| 
         @@ -986,8 +1123,12 @@ public class PFont implements PConstants { 
     | 
|
| 
       986 
1123 
     | 
    
         
             
                  }
         
     | 
| 
       987 
1124 
     | 
    
         
             
                }
         
     | 
| 
       988 
1125 
     | 
    
         | 
| 
       989 
     | 
    
         
            -
             
     | 
| 
       990 
     | 
    
         
            -
             
     | 
| 
      
 1126 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1127 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1128 
     | 
    
         
            +
                   * @param os
         
     | 
| 
      
 1129 
     | 
    
         
            +
                   * @throws IOException
         
     | 
| 
      
 1130 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1131 
     | 
    
         
            +
                  protected void writeHeader(DataOutputStream os) throws IOException {
         
     | 
| 
       991 
1132 
     | 
    
         
             
                  os.writeInt(value);
         
     | 
| 
       992 
1133 
     | 
    
         
             
                  os.writeInt(height);
         
     | 
| 
       993 
1134 
     | 
    
         
             
                  os.writeInt(width);
         
     | 
| 
         @@ -997,8 +1138,12 @@ public class PFont implements PConstants { 
     | 
|
| 
       997 
1138 
     | 
    
         
             
                  os.writeInt(0); // padding
         
     | 
| 
       998 
1139 
     | 
    
         
             
                }
         
     | 
| 
       999 
1140 
     | 
    
         | 
| 
       1000 
     | 
    
         
            -
             
     | 
| 
       1001 
     | 
    
         
            -
             
     | 
| 
      
 1141 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1142 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1143 
     | 
    
         
            +
                   * @param is
         
     | 
| 
      
 1144 
     | 
    
         
            +
                   * @throws IOException
         
     | 
| 
      
 1145 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1146 
     | 
    
         
            +
                  protected void readBitmap(DataInputStream is) throws IOException {
         
     | 
| 
       1002 
1147 
     | 
    
         
             
                  image = new PImage(width, height, ALPHA);
         
     | 
| 
       1003 
1148 
     | 
    
         
             
                  int bitmapSize = width * height;
         
     | 
| 
       1004 
1149 
     | 
    
         | 
| 
         @@ -1019,8 +1164,12 @@ public class PFont implements PConstants { 
     | 
|
| 
       1019 
1164 
     | 
    
         
             
            //      System.out.println();
         
     | 
| 
       1020 
1165 
     | 
    
         
             
                }
         
     | 
| 
       1021 
1166 
     | 
    
         | 
| 
       1022 
     | 
    
         
            -
             
     | 
| 
       1023 
     | 
    
         
            -
             
     | 
| 
      
 1167 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1168 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1169 
     | 
    
         
            +
                   * @param os
         
     | 
| 
      
 1170 
     | 
    
         
            +
                   * @throws IOException
         
     | 
| 
      
 1171 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1172 
     | 
    
         
            +
                  protected void writeBitmap(DataOutputStream os) throws IOException {
         
     | 
| 
       1024 
1173 
     | 
    
         
             
                  int[] pixels  = image.pixels;
         
     | 
| 
       1025 
1174 
     | 
    
         
             
                  for (int y = 0; y < height; y++) {
         
     | 
| 
       1026 
1175 
     | 
    
         
             
                    for (int x = 0; x < width; x++) {
         
     | 
| 
         @@ -1029,8 +1178,11 @@ public class PFont implements PConstants { 
     | 
|
| 
       1029 
1178 
     | 
    
         
             
                  }
         
     | 
| 
       1030 
1179 
     | 
    
         
             
                }
         
     | 
| 
       1031 
1180 
     | 
    
         | 
| 
       1032 
     | 
    
         
            -
             
     | 
| 
       1033 
     | 
    
         
            -
             
     | 
| 
      
 1181 
     | 
    
         
            +
                  /**
         
     | 
| 
      
 1182 
     | 
    
         
            +
                   *
         
     | 
| 
      
 1183 
     | 
    
         
            +
                   * @param c
         
     | 
| 
      
 1184 
     | 
    
         
            +
                   */
         
     | 
| 
      
 1185 
     | 
    
         
            +
                  protected Glyph(char c) {
         
     | 
| 
       1034 
1186 
     | 
    
         
             
                  int mbox3 = size * 3;
         
     | 
| 
       1035 
1187 
     | 
    
         
             
                  lazyGraphics.setColor(Color.white);
         
     | 
| 
       1036 
1188 
     | 
    
         
             
                  lazyGraphics.fillRect(0, 0, mbox3, mbox3);
         
     |