package com.haxademic.demo.draw.shapes;

import com.haxademic.core.app.PAppletHax;
import com.haxademic.core.app.config.AppSettings;
import com.haxademic.core.app.config.Config;
import com.haxademic.core.draw.context.PG;
import com.haxademic.core.draw.shapes.PShapeUtil;
import com.haxademic.core.media.DemoAssets;

import processing.core.PShape;

public class Demo_PShapeUtil_shapeFromImage 
extends PAppletHax {
	public static void main(String args[]) { arguments = args; PAppletHax.main(Thread.currentThread().getStackTrace()[1].getClassName()); }

	protected PShape shape;
	
	protected void config() {
		Config.setProperty( AppSettings.WIDTH, 1200 );
		Config.setProperty( AppSettings.HEIGHT, 900 );
	}
	
	protected void firstFrame() {
		shape = PShapeUtil.shapeFromImage(DemoAssets.textureCursor());
		PShapeUtil.centerShape(shape);
		PShapeUtil.scaleVertices(shape, 1, 1, 4);
		PShapeUtil.scaleShapeToExtent(shape, p.height * 0.2f);
	}
	
	protected void drawApp() {
		p.background(200, 255, 200);
		PG.setCenterScreen(p);
		PG.setBetterLights(p);
		PG.basicCameraFromMouse(p.g);
		p.ortho();

		// draw
		p.shape(shape);
	}
}
@@ -30,24 +30,57 @@
 aw.shapes;%0A%0A
+import com.haxademic.core.app.P;%0A
 import com.h
@@ -109,16 +109,16 @@
 letHax;%0A
-
 import c
@@ -300,52 +300,8 @@
 til;
-%0Aimport com.haxademic.core.media.DemoAssets;
 %0A%0Aim
@@ -559,16 +559,42 @@
  shape;%0A
+%09protected PShape shape2;%0A
 %09%0A%09prote
@@ -748,16 +748,18 @@
 ame() %7B%0A
+//
 %09%09shape 
@@ -819,40 +819,620 @@
 ));%0A
-%09%09PShapeUtil.centerShape(shape);
+//%09%09shape = PShapeUtil.shapeFromImage(P.getImage(%22images/_sketch/pixel-objects/power-glove.png%22));%0A//%09%09shape = PShapeUtil.shapeFromImage(P.getImage(%22images/_sketch/pixel-objects/hand-peace.png%22));%0A//%09%09shape = PShapeUtil.shapeFromImage(P.getImage(%22images/_sketch/pixel-objects/mario-mushroom.png%22));%0A//%09%09shape = PShapeUtil.shapeFromImage(P.getImage(%22images/_sketch/pixel-objects/mario-cloud-smile.png%22));%0A%09%09shape = PShapeUtil.shapeFromImage(P.getImage(%22images/_sketch/pixel-objects/skull-mini.png%22));%0A%09%09shape2 = PShapeUtil.shapeFromImage(P.getImage(%22images/_sketch/pixel-objects/sunglasses-deal-with-it.png%22));%0A%09%09
 %0A%09%09P
@@ -1466,18 +1466,23 @@
 pe, 
-1, 1, 4
+40, 40, 80
 );%0A
+//
 %09%09PS
@@ -1506,37 +1506,214 @@
 peTo
-Extent(shape, p.height * 0.2f
+Width(shape, p.height * 0.2f);%0A//%09%09PShapeUtil.scaleShapeToWidth(shape, p.height * 0.01f * 40);%0A%0A%09%09PShapeUtil.scaleVertices(shape2, 40, 40, 80);%0A//%09%09PShapeUtil.scaleShapeToWidth(shape2, p.height * 0.01f * 40
 );%0A%09
@@ -1881,16 +1881,16 @@
 // draw%0A
-
 %09%09p.shap
@@ -1899,12 +1899,62 @@
 shape);%0A
+%09%09%0A%09%09p.translate(0, 0, 80);%0A%09%09p.shape(shape2);%0A%09%09%0A
 %09%7D%0A%7D

Update Demo_PShapeUtil_shapeFromImage.java