Cleanup the code of getBitmap

This commit is contained in:
Cheng Zhao 2016-08-05 17:55:57 +09:00
parent b5c19a9c6d
commit 1be253e1aa
2 changed files with 20 additions and 15 deletions

View file

@ -163,7 +163,8 @@ Returns a [Buffer][buffer] that contains the image's `JPEG` encoded data.
#### `image.toBitmap()`
Returns a [Buffer][buffer] that contains a copy of the image's raw pixel data.
Returns a [Buffer][buffer] that contains a copy of the image's raw bitmap pixel
data.
#### `image.toDataURL()`
@ -171,8 +172,11 @@ Returns the data URL of the image.
#### `image.getBitmap()`
Returns a [Buffer][buffer] that contains the image's raw pixel data. The pixel
data is not owned by the `Buffer` object.
Returns a [Buffer][buffer] that contains the image's raw bitmap pixel data.
The difference between `getBitmap()` and `toBitmap()` is, `getBitmap()` does not
copy the bitmap data, so you have to use the returned Buffer immediately in
current event loop tick, otherwise the data might be changed or destroyed.
#### `image.getNativeHandle()` _macOS_