refactor: remove redundant NativeImage::GetBitmap() (#46696)
* refactor: remove redundant NativeImage::GetBitmap() * docs: mark NativeImage.getBitmap() as deprecated * have getBitmap() emit a deprecation warning * docs: update obsolete refefence to getBitmap() * test: update obsolete refefences to getBitmap() --------- Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
parent
dd03cceda0
commit
686ae47696
7 changed files with 36 additions and 22 deletions
|
@ -271,16 +271,12 @@ changes:
|
|||
|
||||
Returns `string` - The [Data URL][data-url] of the image.
|
||||
|
||||
#### `image.getBitmap([options])`
|
||||
#### `image.getBitmap([options])` _Deprecated_
|
||||
|
||||
* `options` Object (optional)
|
||||
* `scaleFactor` Number (optional) - Defaults to 1.0.
|
||||
|
||||
Returns `Buffer` - A [Buffer][buffer] that contains the image's raw bitmap pixel data.
|
||||
|
||||
The difference between `getBitmap()` and `toBitmap()` is that `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.
|
||||
Legacy alias for `image.toBitmap()`.
|
||||
|
||||
#### `image.getNativeHandle()` _macOS_
|
||||
|
||||
|
|
|
@ -887,7 +887,7 @@ const { BrowserWindow } = require('electron')
|
|||
|
||||
const win = new BrowserWindow({ webPreferences: { offscreen: true } })
|
||||
win.webContents.on('paint', (event, dirty, image) => {
|
||||
// updateBitmap(dirty, image.getBitmap())
|
||||
// updateBitmap(dirty, image.toBitmap())
|
||||
})
|
||||
win.loadURL('https://github.com')
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue