Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Notable changes to this project are documented in this file. The format is based
## [Unreleased]

Breaking changes:
- Changed types of width and height from Number to Int. The API guarantees that these values are integers as is, and even silently rounds non-integers if given.

New features:
- Added `imageSmoothingEnabled` to toggle the image smoothing of a `Context2D`.
Expand Down
10 changes: 5 additions & 5 deletions src/Graphics/Canvas.purs
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,19 @@ getCanvasElementById elId = runFn3 getCanvasElementByIdImpl elId Just Nothing
foreign import getContext2D :: CanvasElement -> Effect Context2D

-- | Get the canvas width in pixels.
foreign import getCanvasWidth :: CanvasElement -> Effect Number
foreign import getCanvasWidth :: CanvasElement -> Effect Int

-- | Get the canvas height in pixels.
foreign import getCanvasHeight :: CanvasElement -> Effect Number
foreign import getCanvasHeight :: CanvasElement -> Effect Int

-- | Set the canvas width in pixels.
foreign import setCanvasWidth :: CanvasElement -> Number -> Effect Unit
foreign import setCanvasWidth :: CanvasElement -> Int -> Effect Unit

-- | Set the canvas height in pixels.
foreign import setCanvasHeight :: CanvasElement -> Number -> Effect Unit
foreign import setCanvasHeight :: CanvasElement -> Int -> Effect Unit

-- | Canvas dimensions (width and height) in pixels.
type Dimensions = { width :: Number, height :: Number }
type Dimensions = { width :: Int, height :: Int }

-- | Get the canvas dimensions in pixels.
getCanvasDimensions :: CanvasElement -> Effect Dimensions
Expand Down