Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HPath.java #162

Open
wants to merge 1 commit into
base: lib_staging
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/main/java/hype/HPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class HPath extends HDrawable {
private ArrayList<Integer> vertexColors;
private int mode;
private boolean drawsHandles;
private boolean orderedPool = false;

public HPath() {
this(PConstants.PATH);
Expand All @@ -36,6 +37,11 @@ public HPath vertexColors(HColorist clr) {
return this;
}

public HPath vertexOrder(boolean b) {
orderedPool = b;
return this;
}

public HPath texture(Object imgArg) {
texture = H.getImage(imgArg);
return this;
Expand All @@ -48,6 +54,7 @@ public HPath createCopy() {
copy.drawsHandles = drawsHandles;
copy.vertexColor = vertexColor;
copy.texture = texture;
copy.orderedPool = orderedPool;
for (int i = 0; i < numVertices(); ++i) {
copy.vertices.add(vertex(i).createCopy(copy));
if (vertexColors.size() > 0) {
Expand Down Expand Up @@ -345,8 +352,16 @@ public void draw(PGraphics g, boolean usesZ,

if (vertexColor instanceof HColorPool) {
HColorPool c = (HColorPool) vertexColor;

if (vertexColors.size() <= numv) {
vertexColors.add(c.getColor());

if(orderedPool == false) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

				if (!orderedPool) {

vertexColors.add(c.getColor());
}
else {
vertexColors.add(c.getColorAt(i%c.size()));
}

}
v.vertexPoolColor = vertexColors.get(i);
}
Expand Down