Convert gfx::Image to NativeImage instance
This commit is contained in:
parent
b76615f3e7
commit
aae576b484
5 changed files with 111 additions and 4 deletions
41
atom/common/api/atom_api_native_image.h
Normal file
41
atom/common/api/atom_api_native_image.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright (c) 2015 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_COMMON_API_ATOM_API_NATIVE_IMAGE_H_
|
||||
#define ATOM_COMMON_API_ATOM_API_NATIVE_IMAGE_H_
|
||||
|
||||
#include "native_mate/handle.h"
|
||||
#include "native_mate/wrappable.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
namespace api {
|
||||
|
||||
class NativeImage : public mate::Wrappable {
|
||||
public:
|
||||
static mate::Handle<NativeImage> Create(v8::Isolate* isolate,
|
||||
const gfx::Image& image);
|
||||
|
||||
protected:
|
||||
NativeImage(const gfx::Image& image);
|
||||
virtual ~NativeImage();
|
||||
|
||||
// mate::Wrappable:
|
||||
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
|
||||
v8::Isolate* isolate) override;
|
||||
|
||||
private:
|
||||
v8::Handle<v8::Value> ToPNG(v8::Isolate* isolate);
|
||||
|
||||
gfx::Image image_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NativeImage);
|
||||
};
|
||||
|
||||
} // namespace api
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_COMMON_API_ATOM_API_NATIVE_IMAGE_H_
|
Loading…
Add table
Add a link
Reference in a new issue