Merge pull request #1383 from deepak1556/nativeimage_patch

nativeImage: adding setTemplateImage method
This commit is contained in:
Cheng Zhao 2015-04-13 11:47:58 +08:00
commit f11988a354
4 changed files with 14 additions and 0 deletions

View file

@ -138,6 +138,9 @@ mate::ObjectTemplateBuilder NativeImage::GetObjectTemplateBuilder(
.SetMethod("toDataUrl", &NativeImage::ToDataURL)
.SetMethod("isEmpty", &NativeImage::IsEmpty)
.SetMethod("getSize", &NativeImage::GetSize)
#if defined(OS_MACOSX)
.SetMethod("setTemplateImage", &NativeImage::SetTemplateImage)
#endif
.Build());
return mate::ObjectTemplateBuilder(

View file

@ -62,6 +62,7 @@ class NativeImage : public mate::Wrappable {
#if defined(OS_MACOSX)
// Mark the image as template image if possible.
static void MakeTemplateImage(gfx::Image* image);
void SetTemplateImage(bool setAsTemplate);
#endif
v8::Handle<v8::Value> ToPNG(v8::Isolate* isolate);

View file

@ -15,6 +15,10 @@ void NativeImage::MakeTemplateImage(gfx::Image* image) {
[image->AsNSImage() setTemplate:YES];
}
void NativeImage::SetTemplateImage(bool setAsTemplate) {
[image_.AsNSImage() setTemplate:setAsTemplate];
}
} // namespace api
} // namespace atom

View file

@ -131,3 +131,9 @@ Returns whether the image is empty.
Returns the size of the image.
[buffer]: https://iojs.org/api/buffer.html#buffer_class_buffer
### NativeImage.setTemplateImage(option)
* `option` Boolean
To toggle a `NativeImage` as Template image on OSX