Merge pull request #1383 from deepak1556/nativeimage_patch
nativeImage: adding setTemplateImage method
This commit is contained in:
commit
f11988a354
4 changed files with 14 additions and 0 deletions
|
@ -138,6 +138,9 @@ mate::ObjectTemplateBuilder NativeImage::GetObjectTemplateBuilder(
|
||||||
.SetMethod("toDataUrl", &NativeImage::ToDataURL)
|
.SetMethod("toDataUrl", &NativeImage::ToDataURL)
|
||||||
.SetMethod("isEmpty", &NativeImage::IsEmpty)
|
.SetMethod("isEmpty", &NativeImage::IsEmpty)
|
||||||
.SetMethod("getSize", &NativeImage::GetSize)
|
.SetMethod("getSize", &NativeImage::GetSize)
|
||||||
|
#if defined(OS_MACOSX)
|
||||||
|
.SetMethod("setTemplateImage", &NativeImage::SetTemplateImage)
|
||||||
|
#endif
|
||||||
.Build());
|
.Build());
|
||||||
|
|
||||||
return mate::ObjectTemplateBuilder(
|
return mate::ObjectTemplateBuilder(
|
||||||
|
|
|
@ -62,6 +62,7 @@ class NativeImage : public mate::Wrappable {
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
// Mark the image as template image if possible.
|
// Mark the image as template image if possible.
|
||||||
static void MakeTemplateImage(gfx::Image* image);
|
static void MakeTemplateImage(gfx::Image* image);
|
||||||
|
void SetTemplateImage(bool setAsTemplate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
v8::Handle<v8::Value> ToPNG(v8::Isolate* isolate);
|
v8::Handle<v8::Value> ToPNG(v8::Isolate* isolate);
|
||||||
|
|
|
@ -15,6 +15,10 @@ void NativeImage::MakeTemplateImage(gfx::Image* image) {
|
||||||
[image->AsNSImage() setTemplate:YES];
|
[image->AsNSImage() setTemplate:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeImage::SetTemplateImage(bool setAsTemplate) {
|
||||||
|
[image_.AsNSImage() setTemplate:setAsTemplate];
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace api
|
} // namespace api
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -131,3 +131,9 @@ Returns whether the image is empty.
|
||||||
Returns the size of the image.
|
Returns the size of the image.
|
||||||
|
|
||||||
[buffer]: https://iojs.org/api/buffer.html#buffer_class_buffer
|
[buffer]: https://iojs.org/api/buffer.html#buffer_class_buffer
|
||||||
|
|
||||||
|
### NativeImage.setTemplateImage(option)
|
||||||
|
|
||||||
|
* `option` Boolean
|
||||||
|
|
||||||
|
To toggle a `NativeImage` as Template image on OSX
|
||||||
|
|
Loading…
Reference in a new issue