docs: Show how to use bitmap data directly
authorCheng Zhao <zcbenz@gmail.com>
Thu, 4 Aug 2016 04:58:50 +0000 (13:58 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 5 Aug 2016 08:40:42 +0000 (17:40 +0900)
docs/api/web-contents.md
docs/tutorial/offscreen-rendering.md

index 6a1193e..1ca64d9 100644 (file)
@@ -473,9 +473,11 @@ Emitted when a new frame is generated. Only the dirty area is passed in the
 buffer.
 
 ```javascript
+const {BrowserWindow} = require('electron')
+
 let win = new BrowserWindow({webPreferences: {offscreen: true}})
 win.webContents.on('paint', (event, dirty, image) => {
-  fs.writeSync('frame.png', image.toPNG())
+  // updateBitmap(dirty, image.toBitmap())
 })
 win.loadURL('http://github.com')
 ```
index 8d75e74..0f8a6b3 100644 (file)
@@ -46,7 +46,7 @@ app.once('ready', () => {
   })
   win.loadURL('http://github.com')
   win.webContents.on('paint', (event, dirty, image) => {
-    fs.writeSync('frame.png', image.toPNG())
+    // updateBitmap(dirty, image.toBitmap())
   })
   win.webContents.setFrameRate(30)
 })