Skip to content

Commit 96a3589

Browse files
committed
Had to stash some changes to merge they were probably insignificant.
2 parents 05c31bd + 27d8b4d commit 96a3589

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+18905
-21427
lines changed

Rakefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ task :init do
1616
opengl.each do |gl|
1717
FileUtils.cp(File.join(jogl24, gl), File.join('.', 'lib'))
1818
end
19-
2019
end
2120

2221
desc 'Build gem'
@@ -31,6 +30,11 @@ task :compile do
3130
system "#{MVN} dependency:copy"
3231
end
3332

33+
desc 'pmd'
34+
task :pmd do
35+
sh './mvnw pmd:pmd'
36+
end
37+
3438
desc 'Test'
3539
task :test do
3640
system 'jruby --dev test/deglut_spec_test.rb'

lib/jruby_art/app.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class App < PApplet
4343
include Math
4444
include MathTool
4545
include Render
46+
include FastNoise
4647
# Alias some methods for familiarity for Shoes coders.
4748
# surface replaces :frame
4849
alias oval ellipse

pom.rb

Lines changed: 69 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
# frozen_string_literal: true
2-
31
project 'jruby_art', 'https://github.com/ruby-processing/JRubyArt' do
2+
43
model_version '4.0.0'
54
id 'ruby-processing:jruby_art:2.5.0'
65
packaging 'jar'
76

87
description 'Jar for JRubyArt'
98

109
{
11-
'monkstone' => 'Martin Prout', 'benfry' => 'Ben Fry',
12-
'REAS' => 'Casey Reas', 'codeanticode' => 'Andres Colubri'
10+
'monkstone' => 'Martin Prout', 'sampottinger' => 'Sam Pottinger',
11+
'benfry' => 'Ben Fry', 'REAS' => 'Casey Reas', 'codeanticode' => 'Andres Colubri'
1312
}.each do |key, value|
1413
developer key do
1514
name value
@@ -19,75 +18,75 @@
1918

2019
issue_management 'https://github.com/ruby-processing/JRubyArt/issues', 'Github'
2120

22-
source_control(url: 'https://github.com/ruby-processing/JRubyArt',
23-
connection: 'scm:git:git://github.com/ruby-processing/JRubyArt.git',
24-
developer_connection: 'scm:git:[email protected]/ruby-processing/JRubyArt.git')
21+
source_control( :url => 'https://github.com/ruby-processing/JRubyArt',
22+
:connection => 'scm:git:git://github.com/ruby-processing/JRubyArt.git',
23+
:developer_connection => 'scm:git:[email protected]/ruby-processing/JRubyArt.git' )
2524

26-
properties('processing.api' => 'http://processing.github.io/processing-javadocs/core/',
27-
'source.directory' => 'src',
28-
'polyglot.dump.pom' => 'pom.xml',
29-
'project.build.sourceEncoding' => 'UTF-8',
30-
'jruby_art.basedir' => '${project.basedir}',
31-
'jogl.version' => '2.3.2',
32-
'batik.version' => '1.14',
33-
'itextpdf.version' => '5.5.13.2',
34-
'jruby.api' => 'http://jruby.org/apidocs/')
25+
properties( 'jruby_art.basedir' => '${project.basedir}',
26+
'processing.api' => 'http://processing.github.io/processing-javadocs/core/',
27+
'source.directory' => 'src',
28+
'polyglot.dump.pom' => 'pom.xml',
29+
'project.build.sourceEncoding' => 'UTF-8',
30+
'jogl.version' => '2.3.2',
31+
'itextpdf.version' => '5.5.13.2',
32+
'batik.version' => '1.14',
33+
'jruby.api' => 'http://jruby.org/apidocs/' )
3534

36-
pom 'org.jruby:jruby:9.2.16.0'
37-
jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
38-
jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
39-
jar 'org.processing:video:3.0.2'
40-
jar 'org.apache.xmlgraphics:batik-all:${batik.version}'
41-
jar 'com.itextpdf:itextpdf:${itextpdf.version}'
35+
pom 'org.jruby:jruby:9.2.17.0'
36+
jar 'org.jogamp.jogl:jogl-all:${jogl.version}'
37+
jar 'org.jogamp.gluegen:gluegen-rt-main:${jogl.version}'
38+
jar 'org.processing:video:3.0.2'
39+
jar 'org.apache.xmlgraphics:batik-all:${batik.version}'
40+
jar 'com.itextpdf:itextpdf:${itextpdf.version}'
4241

43-
overrides do
44-
plugin :resources, '3.1.0'
45-
plugin :dependency, '3.1.2' do
46-
execute_goals( id: 'default-cli',
47-
artifactItems:[
48-
{ groupId: 'com.itextpdf',
49-
artifactId: 'itextpdf',
50-
version: '${itextpdf.version}',
51-
type: 'jar',
52-
outputDirectory: '${jruby_art.basedir}/library/pdf'
53-
},
54-
{ groupId: 'org.apache.xmlgraphics',
55-
artifactId: 'batik-all',
56-
version: '${batik.version}',
57-
type: 'jar',
58-
outputDirectory: '${jruby_art.basedir}/library/svg'
59-
}
60-
]
61-
)
62-
end
63-
plugin(:compiler, '3.8.1',
64-
'release' => '11')
65-
plugin(:javadoc, '2.10.4',
66-
'detectOfflineLinks' => 'false',
67-
'links' => ['${processing.api}',
68-
'${jruby.api}'])
69-
plugin(:jar, '3.2.0',
70-
'archive' => {
71-
'manifestEntries' => {
72-
'Automatic-Module-Name' => 'processing.core'
73-
}
74-
})
75-
plugin :jdeps, '3.1.2' do
76-
execute_goals 'jdkinternals', 'test-jdkinternals'
77-
end
78-
end
42+
overrides do
43+
plugin :resources, '3.1.0'
44+
plugin :dependency, '3.1.2' do
45+
execute_goals( :id => 'default-cli',
46+
'artifactItems' => [ { 'groupId' => 'com.itextpdf',
47+
'artifactId' => 'itextpdf',
48+
'version' => '${itextpdf.version}',
49+
'type' => 'jar',
50+
'outputDirectory' => '${jruby_art.basedir}/library/pdf' },
51+
{ 'groupId' => 'org.apache.xmlgraphics',
52+
'artifactId' => 'batik-all',
53+
'version' => '${batik.version}',
54+
'type' => 'jar',
55+
'outputDirectory' => '${jruby_art.basedir}/library/svg' } ] )
56+
end
7957

80-
build do
81-
resource do
82-
directory '${source.directory}/main/java'
83-
includes '**/**/*.glsl', '**/*.jnilib'
84-
excludes '**/**/*.java'
85-
end
58+
plugin( :compiler, '3.8.1',
59+
'release' => '11' )
60+
plugin( :javadoc, '2.10.4',
61+
'detectOfflineLinks' => 'false',
62+
'links' => [ '${processing.api}',
63+
'${jruby.api}' ] )
64+
plugin( :jar, '3.2.0',
65+
'archive' => {
66+
'manifestEntries' => {
67+
'Automatic-Module-Name' => 'processing.core'
68+
}
69+
} )
70+
plugin :pmd, '3.14.0'
71+
plugin :jdeps, '3.1.2' do
72+
execute_goals 'jdkinternals', 'test-jdkinternals'
73+
end
74+
end
8675

87-
resource do
88-
directory '${source.directory}/main/resources'
89-
includes '**/*.png', '*.txt'
90-
excludes
91-
end
92-
end
76+
build do
77+
resource do
78+
directory '${source.directory}/main/java'
79+
includes '**/**/*.glsl', '**/*.jnilib'
80+
excludes '**/**/*.java'
81+
end
82+
resource do
83+
directory '${source.directory}/main/resources'
84+
includes '**/*.png', '*.txt'
9385
end
86+
end
87+
88+
reporting do
89+
plugin 'org.apache.maven.plugins:mavan-jxr-plugin:2.3'
90+
end
91+
92+
end

pom.xml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ DO NOT MODIFY - GENERATED CODE
2323
<role>developer</role>
2424
</roles>
2525
</developer>
26+
<developer>
27+
<id>sampottinger</id>
28+
<name>Sam Pottinger</name>
29+
<roles>
30+
<role>developer</role>
31+
</roles>
32+
</developer>
2633
<developer>
2734
<id>benfry</id>
2835
<name>Ben Fry</name>
@@ -69,7 +76,7 @@ DO NOT MODIFY - GENERATED CODE
6976
<dependency>
7077
<groupId>org.jruby</groupId>
7178
<artifactId>jruby</artifactId>
72-
<version>9.2.16.0</version>
79+
<version>9.2.17.0</version>
7380
<type>pom</type>
7481
</dependency>
7582
<dependency>
@@ -180,6 +187,10 @@ DO NOT MODIFY - GENERATED CODE
180187
</archive>
181188
</configuration>
182189
</plugin>
190+
<plugin>
191+
<artifactId>maven-pmd-plugin</artifactId>
192+
<version>3.14.0</version>
193+
</plugin>
183194
<plugin>
184195
<artifactId>maven-jdeps-plugin</artifactId>
185196
<version>3.1.2</version>
@@ -195,4 +206,12 @@ DO NOT MODIFY - GENERATED CODE
195206
</plugins>
196207
</pluginManagement>
197208
</build>
209+
<reporting>
210+
<plugins>
211+
<plugin>
212+
<artifactId>mavan-jxr-plugin</artifactId>
213+
<version>2.3</version>
214+
</plugin>
215+
</plugins>
216+
</reporting>
198217
</project>

src/main/java/monkstone/ColorUtil.java

Lines changed: 27 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/**
22
* This utility allows JRubyArt users to use the processing.org color method
3-
* in their sketches. Includes a method to efficiently convert an cols of web
4-
* strings to an cols of color int, and another to convert an cols of p5 color
5-
* (int) to a string that can be used in ruby code (to generate web color cols).
3+
* in their sketches. Includes a method to efficiently convert an array of web
4+
* strings to an array of color int, and another to convert an array of color
5+
* int to a string that can be used in ruby code (to generate web color array).
66
* Copyright (c) 2015-20 Martin Prout.
77
* This utility is free software; you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by
@@ -13,8 +13,6 @@
1313
*/
1414
package monkstone;
1515

16-
import java.util.ArrayList;
17-
import java.util.List;
1816
import java.util.Random;
1917

2018
/**
@@ -23,8 +21,6 @@
2321
*/
2422
public class ColorUtil {
2523

26-
static final String TOO_BIG = "produces a line too long a line for code";
27-
2824
/**
2925
* Returns hex long as a positive int unless greater than Integer.MAX_VALUE
3026
* else return the complement as a negative integer or something like that
@@ -34,11 +30,7 @@ public class ColorUtil {
3430
*/
3531
static final int hexLong(long hexlong) {
3632
long SPLIT = Integer.MAX_VALUE + 1;
37-
if (hexlong < SPLIT) {
38-
return (int) hexlong;
39-
} else {
40-
return (int) (hexlong - SPLIT * 2L);
41-
}
33+
return hexlong < SPLIT ? (int) hexlong : (int) (hexlong - SPLIT * 2L);
4234
}
4335

4436
/**
@@ -52,7 +44,7 @@ static public int colorString(String hexstring) {
5244
/**
5345
*
5446
* @param web Array of web (hex) String
55-
* @return cols of p5 color (int)
47+
* @return array of color int according to java
5648
*/
5749
static public int[] webArray(String[] web) {
5850
int[] result = new int[web.length];
@@ -63,41 +55,22 @@ static public int[] webArray(String[] web) {
6355
}
6456

6557
/**
66-
* Return a ruby string of the form "%w[a b c]" where a, b, c are raw web
58+
* Return a ruby string of the form "%w(a b c)" where a, b, c are raw web
6759
* strings. This string can be used in ruby code.
6860
*
69-
* @param p5colors cols of p5 colors (int)
61+
* @param hex int array
7062
* @return String for use in ruby
7163
*/
72-
static public String rubyString(int[] p5colors) {
73-
if (p5colors.length > 8){ return TOO_BIG;}
74-
StringBuilder sb = new StringBuilder("%w[");
75-
for (int p5color : p5colors) {
76-
sb.append(String.format("#%06X", (0xFFFFFF & p5color)));
77-
sb.append(' ');
64+
static public String rubyString(int[] hex) {
65+
StringBuilder result = new StringBuilder("%w[");
66+
for (int i = 0; i < hex.length; i++) {
67+
result.append(String.format("#%06X", 0xFFFFFF & hex[i]));
68+
if (i < hex.length - 1) {
69+
result.append(' ');
70+
}
7871
}
79-
sb.deleteCharAt(sb.length() - 1);
80-
sb.append("]\n");
81-
return sb.toString();
82-
}
83-
84-
static public String[] p5ToWeb(int[] p5colors) {
85-
List<String> list = new ArrayList<>();
86-
for (int p5color : p5colors) {
87-
list.add(String.format("#%06X", (0xFFFFFF & p5color)));
88-
}
89-
return list.toArray(new String[0]);
90-
}
91-
92-
static public int[] shuffle(int[] cols) {
93-
Random rgen = new Random(); // Random number generator
94-
for (int i = 0; i < cols.length; i++) {
95-
int randomPosition = rgen.nextInt(cols.length);
96-
int temp = cols[i];
97-
cols[i] = cols[randomPosition];
98-
cols[randomPosition] = temp;
99-
}
100-
return cols;
72+
result.append("]\n");
73+
return result.toString();
10174
}
10275

10376
/**
@@ -127,6 +100,17 @@ static public float colorDouble(double hex) {
127100
return (float) hex;
128101
}
129102

103+
static public int[] shuffle(int[] cols) {
104+
Random rgen = new Random(); // Random number generator
105+
for (int i = 0; i < cols.length; i++) {
106+
int randomPosition = rgen.nextInt(cols.length);
107+
int temp = cols[i];
108+
cols[i] = cols[randomPosition];
109+
cols[randomPosition] = temp;
110+
}
111+
return cols;
112+
}
113+
130114
/**
131115
*
132116
* @param hue

0 commit comments

Comments
 (0)