nativeImage: adding setTemplateImage method
This commit is contained in:
parent
fb00c28026
commit
efd294d69d
4 changed files with 14 additions and 0 deletions
|
@ -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(
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue