1 #ifndef __DALI_V8PLUGIN_IMAGE_WRAPPER_H__
2 #define __DALI_V8PLUGIN_IMAGE_WRAPPER_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <dali/public-api/images/image.h>
26 #include <shared/base-wrapped-object.h>
27 #include <signals/signal-manager.h>
39 * Provides access to Image specific functionality and V8 memory handling.
41 class ImageWrapper : public BaseWrappedObject
47 * Image type used an index,
48 * please update the table in ImageApiLookup if this list changes ( the enum is used as an index)
52 UNKNOWN_IMAGE_TYPE = -1,
57 FRAME_BUFFER_IMAGE = 4,
64 ImageWrapper( const Image& image,
65 GarbageCollectorInterface& gc );
70 virtual ~ImageWrapper()
75 * @brief Creates a new Image wrapped inside a Javascript Object.
76 * @note: the actor type ie 'ImageImage' is expected to be the name of the callee function.
77 * @param[in] args v8 function call arguments interpreted
79 static void NewImage( const v8::FunctionCallbackInfo< v8::Value >& args);
82 * Wraps an image of a given type
84 static v8::Handle<v8::Object> WrapImage(v8::Isolate* isolate, const Dali::Image& image, ImageType imageType );
87 * Wraps an image, the type is looked up from the image
89 static v8::Handle<v8::Object> WrapImage(v8::Isolate* isolate, const Dali::Image& image );
97 * @return signal manager pointer
99 virtual SignalManager* GetSignalManager() { return &mSignalManager;}
101 // The Image ObjectTemplate, we cache templates so we don't have
102 // keep generating them everytime we want to create an Image
103 static v8::Persistent<v8::ObjectTemplate> mImageTemplate;
104 static v8::Persistent<v8::ObjectTemplate> mResourceImageTemplate;
105 static v8::Persistent<v8::ObjectTemplate> mNinePatchImageTemplate;
106 static v8::Persistent<v8::ObjectTemplate> mBufferImageTemplate;
107 static v8::Persistent<v8::ObjectTemplate> mFrameBufferImageTemplate;
108 static v8::Persistent<v8::ObjectTemplate> mNativeImageTemplate;
115 static ImageType GetImageType( const std::string& name );
117 static v8::Handle<v8::ObjectTemplate> MakeImageTemplate( v8::Isolate* isolate, ImageType imageType );
118 static v8::Local<v8::ObjectTemplate> GetImageTemplate( v8::Isolate* isolate , ImageType imageType );
121 Image mImage; ///< Image handle
122 SignalManager mSignalManager; ///< Signal Manager
126 } // namespace V8Plugin
130 #endif // __DALI_V8PLUGIN_IMAGE_WRAPPER_H__