Emit NativeImage objects in paint event

This commit is contained in:
Cheng Zhao 2016-08-04 13:47:52 +09:00
parent 3be68ba136
commit 8c4ebdc88e
3 changed files with 24 additions and 42 deletions

View file

@ -37,19 +37,18 @@ const {app, BrowserWindow} = require('electron')
app.disableHardwareAcceleration()
let win = new BrowserWindow({
width: 800,
height: 1500,
webPreferences: {
offscreen: true
}
})
win.loadURL('http://github.com')
win.webContents.setFrameRate(30)
win.webContents.on('paint', (event, dirty, data) => {
// updateBitmap(dirty, data)
let win
app.once('ready', () => {
win = new BrowserWindow({
webPreferences: {
offscreen: true
}
})
win.loadURL('http://github.com')
win.webContents.on('paint', (event, dirty, image) => {
fs.writeSync('frame.png', image.toPNG())
})
win.webContents.setFrameRate(30)
})
```