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,
56 FRAME_BUFFER_IMAGE = 3
62 ImageWrapper( const Image& image,
63 GarbageCollectorInterface& gc );
68 virtual ~ImageWrapper()
73 * @brief Creates a new Image wrapped inside a Javascript Object.
74 * @note: the actor type ie 'ImageImage' is expected to be the name of the callee function.
75 * @param[in] args v8 function call arguments interpreted
77 static void NewImage( const v8::FunctionCallbackInfo< v8::Value >& args);
80 * Wraps an image of a given type
82 static v8::Handle<v8::Object> WrapImage(v8::Isolate* isolate, const Dali::Image& image, ImageType imageType );
85 * Wraps an image, the type is looked up from the image
87 static v8::Handle<v8::Object> WrapImage(v8::Isolate* isolate, const Dali::Image& image );
95 * @return signal manager pointer
97 virtual SignalManager* GetSignalManager() { return &mSignalManager;}
99 // The Image ObjectTemplate, we cache templates so we don't have
100 // keep generating them everytime we want to create an Image
101 static v8::Persistent<v8::ObjectTemplate> mImageTemplate;
102 static v8::Persistent<v8::ObjectTemplate> mResourceImageTemplate;
103 static v8::Persistent<v8::ObjectTemplate> mBufferImageTemplate;
104 static v8::Persistent<v8::ObjectTemplate> mFrameBufferImageTemplate;
111 static ImageType GetImageType( const std::string& name );
113 static v8::Handle<v8::ObjectTemplate> MakeImageTemplate( v8::Isolate* isolate, ImageType imageType );
114 static v8::Local<v8::ObjectTemplate> GetImageTemplate( v8::Isolate* isolate , ImageType imageType );
117 Image mImage; ///< Image handle
118 SignalManager mSignalManager; ///< Signal Manager
122 } // namespace V8Plugin
126 #endif // __DALI_V8PLUGIN_IMAGE_WRAPPER_H__