propane 3.10.0-java → 3.11.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.
Files changed (163) hide show
  1. checksums.yaml +4 -4
  2. data/.mvn/wrapper/maven-wrapper.properties +1 -1
  3. data/CHANGELOG.md +2 -0
  4. data/README.md +7 -7
  5. data/lib/propane/app.rb +2 -5
  6. data/lib/propane/helper_methods.rb +6 -6
  7. data/lib/propane/version.rb +1 -1
  8. data/lib/{propane-3.10.0.jar → propane-3.11.0.jar} +0 -0
  9. data/pom.rb +6 -6
  10. data/pom.xml +6 -6
  11. data/propane.gemspec +3 -3
  12. data/src/main/java/monkstone/noise/OpenSimplex2F.java +838 -737
  13. data/src/main/java/monkstone/vecmath/vec2/Vec2.java +8 -13
  14. data/src/main/java/monkstone/vecmath/vec3/Vec3.java +14 -28
  15. data/src/main/java/processing/awt/PImageAWT.java +6 -4
  16. data/src/main/java/processing/core/PApplet.java +71 -59
  17. data/src/main/java/processing/core/PImage.java +14 -14
  18. data/src/main/java/processing/opengl/PGraphicsOpenGL.java +13 -13
  19. data/src/main/java/processing/opengl/PShader.java +1 -6
  20. data/src/main/java/processing/opengl/PSurfaceJOGL.java +6 -6
  21. data/{lib/java/processing/opengl → src/main/resources}/cursors/arrow.png +0 -0
  22. data/{lib/java/processing/opengl → src/main/resources}/cursors/cross.png +0 -0
  23. data/{lib/java/processing/opengl → src/main/resources}/cursors/hand.png +0 -0
  24. data/{lib/java/processing/opengl → src/main/resources}/cursors/license.txt +0 -0
  25. data/{lib/java/processing/opengl → src/main/resources}/cursors/move.png +0 -0
  26. data/{lib/java/processing/opengl → src/main/resources}/cursors/text.png +0 -0
  27. data/{lib/java/processing/opengl → src/main/resources}/cursors/wait.png +0 -0
  28. data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorFrag.glsl +0 -0
  29. data/{lib/java/processing/opengl → src/main/resources}/shaders/ColorVert.glsl +0 -0
  30. data/{lib/java/processing/opengl → src/main/resources}/shaders/LightFrag.glsl +0 -0
  31. data/{lib/java/processing/opengl → src/main/resources}/shaders/LightVert.glsl +0 -0
  32. data/{lib/java/processing/opengl → src/main/resources}/shaders/LineFrag.glsl +0 -0
  33. data/{lib/java/processing/opengl → src/main/resources}/shaders/LineVert.glsl +0 -0
  34. data/{lib/java/processing/opengl → src/main/resources}/shaders/MaskFrag.glsl +0 -0
  35. data/{lib/java/processing/opengl → src/main/resources}/shaders/PointFrag.glsl +0 -0
  36. data/{lib/java/processing/opengl → src/main/resources}/shaders/PointVert.glsl +0 -0
  37. data/{lib/java/processing/opengl → src/main/resources}/shaders/TexFrag.glsl +0 -0
  38. data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightFrag.glsl +0 -0
  39. data/{lib/java/processing/opengl → src/main/resources}/shaders/TexLightVert.glsl +0 -0
  40. data/{lib/java/processing/opengl → src/main/resources}/shaders/TexVert.glsl +0 -0
  41. data/test/test_helper.rb +1 -0
  42. data/vendors/Rakefile +1 -1
  43. metadata +29 -155
  44. data/lib/java/japplemenubar/JAppleMenuBar.java +0 -88
  45. data/lib/java/japplemenubar/libjAppleMenuBar.jnilib +0 -0
  46. data/lib/java/monkstone/ColorUtil.java +0 -127
  47. data/lib/java/monkstone/MathToolModule.java +0 -287
  48. data/lib/java/monkstone/PropaneLibrary.java +0 -46
  49. data/lib/java/monkstone/core/LibraryProxy.java +0 -136
  50. data/lib/java/monkstone/fastmath/DegLutTables.java +0 -111
  51. data/lib/java/monkstone/fastmath/Deglut.java +0 -71
  52. data/lib/java/monkstone/fastmath/package-info.java +0 -6
  53. data/lib/java/monkstone/filechooser/Chooser.java +0 -39
  54. data/lib/java/monkstone/noise/FastTerrain.java +0 -874
  55. data/lib/java/monkstone/noise/Noise.java +0 -90
  56. data/lib/java/monkstone/noise/NoiseGenerator.java +0 -75
  57. data/lib/java/monkstone/noise/NoiseMode.java +0 -28
  58. data/lib/java/monkstone/noise/OpenSimplex2F.java +0 -881
  59. data/lib/java/monkstone/noise/OpenSimplex2S.java +0 -1106
  60. data/lib/java/monkstone/noise/SmoothTerrain.java +0 -1099
  61. data/lib/java/monkstone/slider/CustomHorizontalSlider.java +0 -164
  62. data/lib/java/monkstone/slider/CustomVerticalSlider.java +0 -178
  63. data/lib/java/monkstone/slider/SimpleHorizontalSlider.java +0 -145
  64. data/lib/java/monkstone/slider/SimpleSlider.java +0 -166
  65. data/lib/java/monkstone/slider/SimpleVerticalSlider.java +0 -157
  66. data/lib/java/monkstone/slider/Slider.java +0 -61
  67. data/lib/java/monkstone/slider/SliderBar.java +0 -245
  68. data/lib/java/monkstone/slider/SliderGroup.java +0 -56
  69. data/lib/java/monkstone/slider/WheelHandler.java +0 -35
  70. data/lib/java/monkstone/vecmath/GfxRender.java +0 -86
  71. data/lib/java/monkstone/vecmath/JRender.java +0 -56
  72. data/lib/java/monkstone/vecmath/ShapeRender.java +0 -87
  73. data/lib/java/monkstone/vecmath/package-info.java +0 -20
  74. data/lib/java/monkstone/vecmath/vec2/Vec2.java +0 -802
  75. data/lib/java/monkstone/vecmath/vec2/package-info.java +0 -6
  76. data/lib/java/monkstone/vecmath/vec3/Vec3.java +0 -727
  77. data/lib/java/monkstone/vecmath/vec3/package-info.java +0 -6
  78. data/lib/java/monkstone/videoevent/CaptureEvent.java +0 -27
  79. data/lib/java/monkstone/videoevent/MovieEvent.java +0 -32
  80. data/lib/java/monkstone/videoevent/package-info.java +0 -20
  81. data/lib/java/processing/awt/PGraphicsJava2D.java +0 -3040
  82. data/lib/java/processing/awt/PImageAWT.java +0 -377
  83. data/lib/java/processing/awt/PShapeJava2D.java +0 -387
  84. data/lib/java/processing/awt/PSurfaceAWT.java +0 -1581
  85. data/lib/java/processing/awt/ShimAWT.java +0 -581
  86. data/lib/java/processing/core/PApplet.java +0 -15156
  87. data/lib/java/processing/core/PConstants.java +0 -523
  88. data/lib/java/processing/core/PFont.java +0 -1126
  89. data/lib/java/processing/core/PGraphics.java +0 -8600
  90. data/lib/java/processing/core/PImage.java +0 -3377
  91. data/lib/java/processing/core/PMatrix.java +0 -208
  92. data/lib/java/processing/core/PMatrix2D.java +0 -562
  93. data/lib/java/processing/core/PMatrix3D.java +0 -890
  94. data/lib/java/processing/core/PShape.java +0 -3561
  95. data/lib/java/processing/core/PShapeOBJ.java +0 -483
  96. data/lib/java/processing/core/PShapeSVG.java +0 -2016
  97. data/lib/java/processing/core/PStyle.java +0 -63
  98. data/lib/java/processing/core/PSurface.java +0 -198
  99. data/lib/java/processing/core/PSurfaceNone.java +0 -431
  100. data/lib/java/processing/core/PVector.java +0 -1066
  101. data/lib/java/processing/core/ThinkDifferent.java +0 -115
  102. data/lib/java/processing/data/DoubleDict.java +0 -850
  103. data/lib/java/processing/data/DoubleList.java +0 -928
  104. data/lib/java/processing/data/FloatDict.java +0 -847
  105. data/lib/java/processing/data/FloatList.java +0 -936
  106. data/lib/java/processing/data/IntDict.java +0 -807
  107. data/lib/java/processing/data/IntList.java +0 -936
  108. data/lib/java/processing/data/JSONArray.java +0 -1260
  109. data/lib/java/processing/data/JSONObject.java +0 -2282
  110. data/lib/java/processing/data/JSONTokener.java +0 -435
  111. data/lib/java/processing/data/LongDict.java +0 -802
  112. data/lib/java/processing/data/LongList.java +0 -937
  113. data/lib/java/processing/data/Sort.java +0 -46
  114. data/lib/java/processing/data/StringDict.java +0 -613
  115. data/lib/java/processing/data/StringList.java +0 -800
  116. data/lib/java/processing/data/Table.java +0 -4936
  117. data/lib/java/processing/data/TableRow.java +0 -198
  118. data/lib/java/processing/data/XML.java +0 -1156
  119. data/lib/java/processing/dxf/RawDXF.java +0 -404
  120. data/lib/java/processing/event/Event.java +0 -125
  121. data/lib/java/processing/event/KeyEvent.java +0 -70
  122. data/lib/java/processing/event/MouseEvent.java +0 -114
  123. data/lib/java/processing/event/TouchEvent.java +0 -57
  124. data/lib/java/processing/javafx/PGraphicsFX2D.java +0 -32
  125. data/lib/java/processing/javafx/PSurfaceFX.java +0 -173
  126. data/lib/java/processing/net/Client.java +0 -744
  127. data/lib/java/processing/net/Server.java +0 -388
  128. data/lib/java/processing/opengl/FontTexture.java +0 -378
  129. data/lib/java/processing/opengl/FrameBuffer.java +0 -513
  130. data/lib/java/processing/opengl/LinePath.java +0 -627
  131. data/lib/java/processing/opengl/LineStroker.java +0 -681
  132. data/lib/java/processing/opengl/PGL.java +0 -3483
  133. data/lib/java/processing/opengl/PGraphics2D.java +0 -615
  134. data/lib/java/processing/opengl/PGraphics3D.java +0 -281
  135. data/lib/java/processing/opengl/PGraphicsOpenGL.java +0 -13753
  136. data/lib/java/processing/opengl/PJOGL.java +0 -2008
  137. data/lib/java/processing/opengl/PShader.java +0 -1484
  138. data/lib/java/processing/opengl/PShapeOpenGL.java +0 -5269
  139. data/lib/java/processing/opengl/PSurfaceJOGL.java +0 -1385
  140. data/lib/java/processing/opengl/Texture.java +0 -1696
  141. data/lib/java/processing/opengl/VertexBuffer.java +0 -88
  142. data/lib/java/processing/pdf/PGraphicsPDF.java +0 -581
  143. data/lib/java/processing/svg/PGraphicsSVG.java +0 -378
  144. data/src/main/java/processing/opengl/cursors/arrow.png +0 -0
  145. data/src/main/java/processing/opengl/cursors/cross.png +0 -0
  146. data/src/main/java/processing/opengl/cursors/hand.png +0 -0
  147. data/src/main/java/processing/opengl/cursors/license.txt +0 -27
  148. data/src/main/java/processing/opengl/cursors/move.png +0 -0
  149. data/src/main/java/processing/opengl/cursors/text.png +0 -0
  150. data/src/main/java/processing/opengl/cursors/wait.png +0 -0
  151. data/src/main/java/processing/opengl/shaders/ColorFrag.glsl +0 -32
  152. data/src/main/java/processing/opengl/shaders/ColorVert.glsl +0 -34
  153. data/src/main/java/processing/opengl/shaders/LightFrag.glsl +0 -33
  154. data/src/main/java/processing/opengl/shaders/LightVert.glsl +0 -151
  155. data/src/main/java/processing/opengl/shaders/LineFrag.glsl +0 -32
  156. data/src/main/java/processing/opengl/shaders/LineVert.glsl +0 -100
  157. data/src/main/java/processing/opengl/shaders/MaskFrag.glsl +0 -40
  158. data/src/main/java/processing/opengl/shaders/PointFrag.glsl +0 -32
  159. data/src/main/java/processing/opengl/shaders/PointVert.glsl +0 -56
  160. data/src/main/java/processing/opengl/shaders/TexFrag.glsl +0 -37
  161. data/src/main/java/processing/opengl/shaders/TexLightFrag.glsl +0 -37
  162. data/src/main/java/processing/opengl/shaders/TexLightVert.glsl +0 -157
  163. data/src/main/java/processing/opengl/shaders/TexVert.glsl +0 -38
@@ -1,378 +0,0 @@
1
- /* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2
-
3
- /*
4
- Part of the Processing project - http://processing.org
5
-
6
- Copyright (c) 2012-15 The Processing Foundation
7
- Copyright (c) 2004-12 Ben Fry and Casey Reas
8
- Copyright (c) 2001-04 Massachusetts Institute of Technology
9
-
10
- This library is free software; you can redistribute it and/or
11
- modify it under the terms of the GNU Lesser General Public
12
- License as published by the Free Software Foundation, version 2.1.
13
-
14
- This library is distributed in the hope that it will be useful,
15
- but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
- Lesser General Public License for more details.
18
-
19
- You should have received a copy of the GNU Lesser General
20
- Public License along with this library; if not, write to the
21
- Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22
- Boston, MA 02111-1307 USA
23
- */
24
-
25
- package processing.opengl;
26
-
27
- import processing.core.PApplet;
28
- import processing.core.PConstants;
29
- import processing.core.PFont;
30
- import processing.core.PGraphics;
31
- import processing.core.PImage;
32
-
33
- import java.util.HashMap;
34
-
35
- /**
36
- * All the infrastructure needed for optimized font rendering
37
- * in OpenGL. Basically, this special class is needed because
38
- * fonts in Processing are handled by a separate PImage for each
39
- * glyph. For performance reasons, all these glyphs should be
40
- * stored in a single OpenGL texture (otherwise, rendering a
41
- * string of text would involve binding and un-binding several
42
- * textures.
43
- * PFontTexture manages the correspondence between individual
44
- * glyphs and the large OpenGL texture containing them. Also,
45
- * in the case that the font size is very large, one single
46
- * OpenGL texture might not be enough to store all the glyphs,
47
- * so PFontTexture also takes care of spreading a single font
48
- * over several textures.
49
- * @author Andres Colubri
50
- */
51
- class FontTexture implements PConstants {
52
- protected PGL pgl;
53
- protected boolean is3D;
54
-
55
- protected int minSize;
56
- protected int maxSize;
57
- protected int offsetX;
58
- protected int offsetY;
59
- protected int lineHeight;
60
- protected Texture[] textures = null;
61
- protected PImage[] images = null;
62
- protected int lastTex;
63
- protected TextureInfo[] glyphTexinfos;
64
- protected HashMap<PFont.Glyph, TextureInfo> texinfoMap;
65
-
66
- public FontTexture(PGraphicsOpenGL pg, PFont font, boolean is3D) {
67
- pgl = pg.pgl;
68
- this.is3D = is3D;
69
-
70
- initTexture(pg, font);
71
- }
72
-
73
-
74
- protected void allocate() {
75
- // Nothing to do here: the font textures will allocate
76
- // themselves.
77
- }
78
-
79
-
80
- protected void dispose() {
81
- for (Texture texture : textures) {
82
- texture.dispose();
83
- }
84
- }
85
-
86
-
87
- protected void initTexture(PGraphicsOpenGL pg, PFont font) {
88
- lastTex = -1;
89
-
90
- int spow = PGL.nextPowerOfTwo(font.getSize());
91
- minSize = PApplet.min(PGraphicsOpenGL.maxTextureSize,
92
- PApplet.max(PGL.MIN_FONT_TEX_SIZE, spow));
93
- maxSize = PApplet.min(PGraphicsOpenGL.maxTextureSize,
94
- PApplet.max(PGL.MAX_FONT_TEX_SIZE, 2 * spow));
95
-
96
- if (maxSize < spow) {
97
- PGraphics.showWarning("The font size is too large to be properly " +
98
- "displayed with OpenGL");
99
- }
100
-
101
- addTexture(pg);
102
-
103
- offsetX = 0;
104
- offsetY = 0;
105
- lineHeight = 0;
106
-
107
- texinfoMap = new HashMap<>();
108
- glyphTexinfos = new TextureInfo[font.getGlyphCount()];
109
- addAllGlyphsToTexture(pg, font);
110
- }
111
-
112
-
113
- public boolean addTexture(PGraphicsOpenGL pg) {
114
- int w, h;
115
- boolean resize;
116
-
117
- w = maxSize;
118
- if (-1 < lastTex && textures[lastTex].glHeight < maxSize) {
119
- // The height of the current texture is less than the maximum, this
120
- // means we can replace it with a larger texture.
121
- h = PApplet.min(2 * textures[lastTex].glHeight, maxSize);
122
- resize = true;
123
- } else {
124
- h = minSize;
125
- resize = false;
126
- }
127
-
128
- Texture tex;
129
- if (is3D) {
130
- // Bilinear sampling ensures that the texture doesn't look pixelated
131
- // either when it is magnified or minified...
132
- tex = new Texture(pg, w, h,
133
- new Texture.Parameters(ARGB, Texture.BILINEAR, false));
134
- } else {
135
- // ...however, the effect of bilinear sampling is to add some blurriness
136
- // to the text in its original size. In 2D, we assume that text will be
137
- // shown at its original size, so linear sampling is chosen instead (which
138
- // only affects minimized text).
139
- tex = new Texture(pg, w, h,
140
- new Texture.Parameters(ARGB, Texture.LINEAR, false));
141
- }
142
-
143
- if (textures == null) {
144
- textures = new Texture[1];
145
- textures[0] = tex;
146
- images = new PImage[1];
147
- images[0] = pg.wrapTexture(tex);
148
- lastTex = 0;
149
- } else if (resize) {
150
- // Replacing old smaller texture with larger one.
151
- // But first we must copy the contents of the older
152
- // texture into the new one.
153
- Texture tex0 = textures[lastTex];
154
- tex.put(tex0);
155
- textures[lastTex] = tex;
156
-
157
- pg.setCache(images[lastTex], tex);
158
- images[lastTex].width = tex.width;
159
- images[lastTex].height = tex.height;
160
- } else {
161
- // Adding new texture to the list.
162
- lastTex = textures.length;
163
- Texture[] tempTex = new Texture[lastTex + 1];
164
- PApplet.arrayCopy(textures, tempTex, textures.length);
165
- tempTex[lastTex] = tex;
166
- textures = tempTex;
167
-
168
- PImage[] tempImg = new PImage[textures.length];
169
- PApplet.arrayCopy(images, tempImg, images.length);
170
- tempImg[lastTex] = pg.wrapTexture(tex);
171
- images = tempImg;
172
- }
173
-
174
- // Make sure that the current texture is bound.
175
- tex.bind();
176
-
177
- return resize;
178
- }
179
-
180
-
181
- public void begin() {
182
- }
183
-
184
-
185
- public void end() {
186
- for (Texture texture : textures) {
187
- pgl.disableTexturing(texture.glTarget);
188
- }
189
- }
190
-
191
-
192
- public PImage getTexture(TextureInfo info) {
193
- return images[info.texIndex];
194
- }
195
-
196
-
197
- // Add all the current glyphs to opengl texture.
198
- public void addAllGlyphsToTexture(PGraphicsOpenGL pg, PFont font) {
199
- // loop over current glyphs.
200
- for (int i = 0; i < font.getGlyphCount(); i++) {
201
- addToTexture(pg, i, font.getGlyph(i));
202
- }
203
- }
204
-
205
-
206
- public void updateGlyphsTexCoords() {
207
- // loop over current glyphs.
208
- for (TextureInfo tinfo : glyphTexinfos) {
209
- if (tinfo != null && tinfo.texIndex == lastTex) {
210
- tinfo.updateUV();
211
- }
212
- }
213
- }
214
-
215
-
216
- public TextureInfo getTexInfo(PFont.Glyph glyph) {
217
- TextureInfo info = texinfoMap.get(glyph);
218
- return info;
219
- }
220
-
221
-
222
- public TextureInfo addToTexture(PGraphicsOpenGL pg, PFont.Glyph glyph) {
223
- int n = glyphTexinfos.length;
224
- if (n == 0) {
225
- glyphTexinfos = new TextureInfo[1];
226
- }
227
- addToTexture(pg, n, glyph);
228
- return glyphTexinfos[n];
229
- }
230
-
231
-
232
- public boolean contextIsOutdated() {
233
- boolean outdated = false;
234
- for (Texture texture : textures) {
235
- if (texture.contextIsOutdated()) {
236
- outdated = true;
237
- }
238
- }
239
- if (outdated) {
240
- for (Texture texture : textures) {
241
- texture.dispose();
242
- }
243
- }
244
- return outdated;
245
- }
246
-
247
- // public void draw() {
248
- // Texture tex = textures[lastTex];
249
- // pgl.drawTexture(tex.glTarget, tex.glName,
250
- // tex.glWidth, tex.glHeight,
251
- // 0, 0, tex.glWidth, tex.glHeight);
252
- // }
253
-
254
-
255
- // Adds this glyph to the opengl texture in PFont.
256
- protected void addToTexture(PGraphicsOpenGL pg, int idx, PFont.Glyph glyph) {
257
- // We add one pixel to avoid issues when sampling the font texture at
258
- // fractional screen positions. I.e.: the pixel on the screen only contains
259
- // half of the font rectangle, so it would sample half of the color from the
260
- // glyph area in the texture, and the other half from the contiguous pixel.
261
- // If the later contains a portion of the neighbor glyph and the former
262
- // doesn't, this would result in a shaded pixel when the correct output is
263
- // blank. This is a consequence of putting all the glyphs in a common
264
- // texture with bilinear sampling.
265
- int w = 1 + glyph.width + 1;
266
- int h = 1 + glyph.height + 1;
267
-
268
- // Converting the pixels array from the PImage into a valid RGBA array for
269
- // OpenGL.
270
- int[] rgba = new int[w * h];
271
- int t = 0;
272
- int p = 0;
273
- if (PGL.BIG_ENDIAN) {
274
- java.util.Arrays.fill(rgba, 0, w, 0xFFFFFF00); // Set the first row to blank pixels.
275
- t = w;
276
- for (int y = 0; y < glyph.height; y++) {
277
- rgba[t++] = 0xFFFFFF00; // Set the leftmost pixel in this row as blank
278
- for (int x = 0; x < glyph.width; x++) {
279
- rgba[t++] = 0xFFFFFF00 | glyph.image.pixels[p++];
280
- }
281
- rgba[t++] = 0xFFFFFF00; // Set the rightmost pixel in this row as blank
282
- }
283
- java.util.Arrays.fill(rgba, (h - 1) * w, h * w, 0xFFFFFF00); // Set the last row to blank pixels.
284
- } else {
285
- java.util.Arrays.fill(rgba, 0, w, 0x00FFFFFF); // Set the first row to blank pixels.
286
- t = w;
287
- for (int y = 0; y < glyph.height; y++) {
288
- rgba[t++] = 0x00FFFFFF; // Set the leftmost pixel in this row as blank
289
- for (int x = 0; x < glyph.width; x++) {
290
- rgba[t++] = (glyph.image.pixels[p++] << 24) | 0x00FFFFFF;
291
- }
292
- rgba[t++] = 0x00FFFFFF; // Set the rightmost pixel in this row as blank
293
- }
294
- java.util.Arrays.fill(rgba, (h - 1) * w, h * w, 0x00FFFFFF); // Set the last row to blank pixels.
295
- }
296
-
297
- // Is there room for this glyph in the current line?
298
- if (offsetX + w > textures[lastTex].glWidth) {
299
- // No room, go to the next line:
300
- offsetX = 0;
301
- offsetY += lineHeight;
302
- }
303
- lineHeight = Math.max(lineHeight, h);
304
-
305
- boolean resized = false;
306
- if (offsetY + lineHeight > textures[lastTex].glHeight) {
307
- // We run out of space in the current texture, so we add a new texture:
308
- resized = addTexture(pg);
309
- if (resized) {
310
- // Because the current texture has been resized, we need to
311
- // update the UV coordinates of all the glyphs associated to it:
312
- updateGlyphsTexCoords();
313
- } else {
314
- // A new texture has been created. Reseting texture coordinates
315
- // and line.
316
- offsetX = 0;
317
- offsetY = 0;
318
- lineHeight = 0;
319
- }
320
- }
321
-
322
- TextureInfo tinfo = new TextureInfo(lastTex, offsetX, offsetY, w, h, rgba);
323
- offsetX += w;
324
-
325
- if (idx == glyphTexinfos.length) {
326
- TextureInfo[] temp = new TextureInfo[glyphTexinfos.length + 1];
327
- System.arraycopy(glyphTexinfos, 0, temp, 0, glyphTexinfos.length);
328
- glyphTexinfos = temp;
329
- }
330
-
331
- glyphTexinfos[idx] = tinfo;
332
- texinfoMap.put(glyph, tinfo);
333
- }
334
-
335
-
336
- class TextureInfo {
337
- int texIndex;
338
- int width;
339
- int height;
340
- int[] crop;
341
- float u0, u1;
342
- float v0, v1;
343
- int[] pixels;
344
-
345
- TextureInfo(int tidx, int cropX, int cropY, int cropW, int cropH,
346
- int[] pix) {
347
- texIndex = tidx;
348
- crop = new int[4];
349
- // The region of the texture corresponding to the glyph is surrounded by a
350
- // 1-pixel wide border to avoid artifacts due to bilinear sampling. This
351
- // is why the additions and subtractions to the crop values.
352
- crop[0] = cropX + 1;
353
- crop[1] = cropY + 1 + cropH - 2;
354
- crop[2] = cropW - 2;
355
- crop[3] = -cropH + 2;
356
- pixels = pix;
357
- updateUV();
358
- updateTex();
359
- }
360
-
361
-
362
- void updateUV() {
363
- width = textures[texIndex].glWidth;
364
- height = textures[texIndex].glHeight;
365
-
366
- u0 = (float)crop[0] / (float)width;
367
- u1 = u0 + (float)crop[2] / (float)width;
368
- v0 = (float)(crop[1] + crop[3]) / (float)height;
369
- v1 = v0 - (float)crop[3] / (float)height;
370
- }
371
-
372
-
373
- void updateTex() {
374
- textures[texIndex].setNative(pixels, crop[0] - 1, crop[1] + crop[3] - 1,
375
- crop[2] + 2, -crop[3] + 2);
376
- }
377
- }
378
- }