File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ Notable changes to this project are documented in this file. The format is based
77Breaking changes:
88
99New features:
10+ - Added ` createImageDataWith ` (#81 )
1011
1112Bugfixes:
1213
Original file line number Diff line number Diff line change @@ -469,6 +469,14 @@ exports.createImageDataCopy = function(ctx) {
469469 } ;
470470} ;
471471
472+ exports . createImageDataWith = function ( arr ) {
473+ return function ( sw ) {
474+ return function ( ) {
475+ return new ImageData ( arr , sw ) ;
476+ } ;
477+ } ;
478+ } ;
479+
472480exports . drawImage = function ( ctx ) {
473481 return function ( image_source ) {
474482 return function ( dx ) {
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ module Graphics.Canvas
9494 , putImageDataFull
9595 , createImageData
9696 , createImageDataCopy
97+ , createImageDataWith
9798 , imageDataWidth
9899 , imageDataHeight
99100 , imageDataBuffer
@@ -634,6 +635,10 @@ foreign import createImageData :: Context2D -> Number -> Number -> Effect ImageD
634635-- | Create a copy of an image data object.
635636foreign import createImageDataCopy :: Context2D -> ImageData -> Effect ImageData
636637
638+ -- | Create an image data object given a `Uint8ClampedArray` containing the underlying pixel representation of the image.
639+ -- | The height is inferred from the array's size and the given width.
640+ foreign import createImageDataWith :: Uint8ClampedArray -> Int -> Effect ImageData
641+
637642-- | Get the width of an `ImageData` object.
638643foreign import imageDataWidth :: ImageData -> Int
639644
You can’t perform that action at this time.
0 commit comments