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

Unexpected effect while using HColorPool #138

Open
bryanmaina opened this issue Jan 20, 2017 · 0 comments
Open

Unexpected effect while using HColorPool #138

bryanmaina opened this issue Jan 20, 2017 · 0 comments

Comments

@bryanmaina
Copy link

I can't get any svg from inkscape to work properly with HGridLayout and HColorPool at the same time. When I run the following code, the layout is just as expected. Things go wrong when I uncomment the following line // d.randomColors(colors);. The layout is messed up when I try to put random colors on each path of the svg.

import hype.*;
import hype.extended.colorist.HColorPool;
import hype.extended.layout.HGridLayout;

HDrawablePool pool;
HColorPool colors;

void setup(){
  size(600, 600);
  H.init(this).background(#220000);

  pool = new HDrawablePool(4);

  colors = new HColorPool(#FFFFFF, #F7F7F7, #ECECEC, #333333, #0095a8, #00616f, #FF3300, #FF6600).fillOnly();
  
  float scaling = 300.0/1000;
  println(scaling);
  
  pool.autoAddToStage()
    .add(new HShape("ex_1.svg").scale(scaling))
    .layout(new HGridLayout()
            .startX(150)
            .startY(150)
            .spacing(300,300)
            .cols(2)
            )
    .onCreate(new HCallback() {
        public void run(Object obj) {
          HShape d = (HShape) obj;
          d
            .enableStyle(false)
            .strokeJoin(ROUND)
            .strokeCap(ROUND)
            .stroke(#ffffff)
            .strokeWeight(1)
            .noFill()
            .anchorAt(H.CENTER)
            .rotation((int)random(4) * 90);
          //          d.randomColors(colors);
        }
      })
    .requestAll();

  H.drawStage();
}

void draw(){
  
}

I tried the examples and they all works as expected. I also made some svg files with illustrator and they all work well. But all those made with inkscape fails to preserve the layout while they are assigned a color.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant