Does Paper.js have helpers for canva's ImageData?

437 views
Skip to first unread message

Phyo Arkar Lwin

unread,
Jun 6, 2013, 4:04:20 PM6/6/13
to pap...@googlegroups.com
Hello Paperjs

i am looking for a image helper library , I want to plot a lot of points (over couple millions) on canvas and only efficient way on Canvas is to mainipulate ImageData array and it is quite hard.

I am new to this so , i am looking for a library and would like to know if paper.js have low level helpers for mainipulating imagedata , for example geometries as ImageData array (for circle, paths,etc) 

my plan is to plot circles as a scatterplot on 3000 x 3000 canvas and  let user to view each parts using a minimap.

I am new to this field and i would like some pointers (for minimap , viewport etc) too.

Thanks a lot!

Tranek

unread,
Jun 12, 2013, 9:44:29 PM6/12/13
to pap...@googlegroups.com
Is that something that Chart.js can do? http://www.chartjs.org/

Jürg Lehni

unread,
Jun 18, 2013, 8:51:45 PM6/18/13
to pap...@googlegroups.com
Paper.js doesn't really have this, but what it does support is rasterizing any item into a Raster, from which you could then access the image data through its undocumented Raster#getImageData(rect) method, e.g.:

var group = new Group(
new Path.Circle({
center: [100, 100],
radius: 100,
fillColor: 'red'
}),
new Path.Rectangle({
topLeft: [100, 100],
bottomRight: [200, 200],
fillColor: 'blue'
})
);
var raster = group.rasterize();
var imageData = raster.getImageData();

Look at the source code of Raster.js and you'll see.

Jürg
> --
> You received this message because you are subscribed to the Google Groups "Paper.js" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to paperjs+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Phyo Arkar

unread,
Jun 19, 2013, 11:42:52 AM6/19/13
to pap...@googlegroups.com
Oh thats gonna be very helpful! I will test it out!
Reply all
Reply to author
Forward
0 new messages