File tree 3 files changed +14
-0
lines changed
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
7
7
Breaking changes:
8
8
9
9
New features:
10
+ - Added ` createImageDataWith ` (#81 )
10
11
11
12
Bugfixes:
12
13
Original file line number Diff line number Diff line change @@ -469,6 +469,14 @@ exports.createImageDataCopy = function(ctx) {
469
469
} ;
470
470
} ;
471
471
472
+ exports . createImageDataWith = function ( arr ) {
473
+ return function ( sw ) {
474
+ return function ( ) {
475
+ return new ImageData ( arr , sw ) ;
476
+ } ;
477
+ } ;
478
+ } ;
479
+
472
480
exports . drawImage = function ( ctx ) {
473
481
return function ( image_source ) {
474
482
return function ( dx ) {
Original file line number Diff line number Diff line change @@ -94,6 +94,7 @@ module Graphics.Canvas
94
94
, putImageDataFull
95
95
, createImageData
96
96
, createImageDataCopy
97
+ , createImageDataWith
97
98
, imageDataWidth
98
99
, imageDataHeight
99
100
, imageDataBuffer
@@ -634,6 +635,10 @@ foreign import createImageData :: Context2D -> Number -> Number -> Effect ImageD
634
635
-- | Create a copy of an image data object.
635
636
foreign import createImageDataCopy :: Context2D -> ImageData -> Effect ImageData
636
637
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
+
637
642
-- | Get the width of an `ImageData` object.
638
643
foreign import imageDataWidth :: ImageData -> Int
639
644
You can’t perform that action at this time.
0 commit comments