Convert to mate::Handle<NativeImage> instead of gfx::Image
This commit is contained in:
parent
7c34d8333c
commit
adfd99f5f0
6 changed files with 80 additions and 31 deletions
|
@ -53,6 +53,9 @@ class NativeImage : public mate::Wrappable<NativeImage> {
|
|||
v8::Local<v8::ObjectTemplate> prototype);
|
||||
|
||||
const gfx::Image& image() const { return image_; }
|
||||
#if defined(OS_WIN)
|
||||
HICON hicon() const { return hicon_.get(); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
NativeImage(v8::Isolate* isolate, const gfx::Image& image);
|
||||
|
@ -89,4 +92,19 @@ class NativeImage : public mate::Wrappable<NativeImage> {
|
|||
|
||||
} // namespace atom
|
||||
|
||||
namespace mate {
|
||||
|
||||
// A custom converter that allows converting path to NativeImage.
|
||||
template<>
|
||||
struct Converter<mate::Handle<atom::api::NativeImage>> {
|
||||
static v8::Local<v8::Value> ToV8(
|
||||
v8::Isolate* isolate,
|
||||
const mate::Handle<atom::api::NativeImage>& val);
|
||||
static bool FromV8(v8::Isolate* isolate, v8::Local<v8::Value> val,
|
||||
mate::Handle<atom::api::NativeImage>* out);
|
||||
};
|
||||
|
||||
} // namespace mate
|
||||
|
||||
|
||||
#endif // ATOM_COMMON_API_ATOM_API_NATIVE_IMAGE_H_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue