Browse Source

docs: Show how to use bitmap data directly

Cheng Zhao 8 years ago
parent
commit
736fbd46c6
2 changed files with 4 additions and 2 deletions
  1. 3 1
      docs/api/web-contents.md
  2. 1 1
      docs/tutorial/offscreen-rendering.md

+ 3 - 1
docs/api/web-contents.md

@@ -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')
 ```

+ 1 - 1
docs/tutorial/offscreen-rendering.md

@@ -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)
 })