]> khamidou — GitHub mirrors - electron.git/commitdiff
docs: Update NativeImage
authorCheng Zhao <zcbenz@gmail.com>
Thu, 12 Feb 2015 07:38:16 +0000 (15:38 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 12 Feb 2015 07:38:16 +0000 (15:38 +0800)
docs/api/native-image.md

index e38f9abd35be92080ed28983700357ee62db8c7a..de46ad1c4c4db9f2d3c00691baebc4970a1999d9 100644 (file)
@@ -82,25 +82,27 @@ To mark an image as template image, its filename should end with the word
 
 ## nativeImage.createEmpty()
 
-Creates a new `NativeImage` instance that contains empty image.
+Creates an empty `NativeImage` instance.
 
-## nativeImage.createFromPng(buffer)
+## nativeImage.createFromPath(path)
 
-* `buffer` [Buffer][buffer]
+* `path` String
 
-Creates a new `NativeImage` instance from `buffer` with `PNG` format.
+Creates a new `NativeImage` instance from file located at `path`.
 
-## nativeImage.createFromPng(buffer)
+## nativeImage.createFromBuffer(buffer[, scaleFactor])
 
 * `buffer` [Buffer][buffer]
+* `scaleFactor` Double
 
-Creates a new `NativeImage` instance from `buffer` with `JPEG` format.
+Creates a new `NativeImage` instance from `buffer`. The `scaleFactor` is 1.0 by
+default.
 
-## nativeImage.createFromPath(path)
+## nativeImage.createFromDataUrl(dataUrl)
 
-* `path` String
+* `dataUrl` String
 
-Creates a new `NativeImage` instance from file located at `path`.
+Creates a new `NativeImage` instance from `dataUrl`.
 
 ## Class: NativeImage
 
@@ -110,10 +112,16 @@ This class is used to represent an image.
 
 Returns a [Buffer][buffer] that contains image's `PNG` encoded data.
 
-### NativeImage.isJpeg()
+### NativeImage.toJpeg(quality)
+
+* `quality` Integer
 
 Returns a [Buffer][buffer] that contains image's `JPEG` encoded data.
 
+### NativeImage.toDataUrl()
+
+Returns the data URL of image.
+
 ### NativeImage.isEmpty()
 
 Returns whether the image is empty.