Advertisement
Guest User

Untitled

a guest
Jul 8th, 2019
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. NSVGShape shape;
  2. NSVGPath path;
  3.  
  4. for(shape=nsvgImage.shapes(); shape != null && shape.address() > 0; shape=shape.next()){
  5.  
  6. if((shape.flags() & NanoSVG.NSVG_FLAGS_VISIBLE) == 0){
  7. continue;
  8. }
  9. nvgFillColor(vg, colour);
  10. nvgStrokeColor(vg, colour);
  11. nvgStrokeWidth(vg, shape.strokeWidth());
  12.  
  13. for(path = shape.paths(); path != null && path.address() > 0; path = path.next()) {
  14. FloatBuffer pts = path.pts();
  15. nvgBeginPath(vg);
  16. nvgMoveTo(vg, pts.get(0), pts.get(1));
  17.  
  18. for (int i = 0; i < path.npts()-1; i += 3) {
  19. int offset = i*2;
  20.  
  21. if(offset+7 < path.npts()){
  22. nvgBezierTo(vg, pts.get(offset+2), pts.get(offset+3), pts.get(offset+4), pts.get(offset+5), pts.get(offset+6), pts.get(offset+7));
  23. nvgStroke(vg);
  24. }
  25.  
  26. if(path.closed() != 0){
  27. nvgLineTo(vg, pts.get(0), pts.get(1));
  28. }
  29. if(shape.fill().type() != 0){
  30. nvgFill(vg);
  31. }
  32. if(shape.stroke().type() != 0){
  33. nvgStroke(vg);
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement