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