From: Yoonsang Lee Date: Tue, 12 May 2015 01:07:14 +0000 (+0900) Subject: Reduce ImageActor & RenderableActor APIs X-Git-Tag: accepted/tizen/common/20150529.134100~42^2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=c386ab67713f45fadefd131e047bcab65a00e8da;hp=-c;ds=sidebyside Reduce ImageActor & RenderableActor APIs - Remove ImageActor::IsPixelAreaSet(), ClearPixelArea() - Remove RenderableActor::SetBlendFunc(), SetBlendEquation(), GetBlendEquation(), SetBlendColor(), GetBlendColor() Change-Id: I3d13dd7450338380197361ecae2859f0fec78988 --- c386ab67713f45fadefd131e047bcab65a00e8da diff --git a/plugins/dali-script-v8/docs/content/constants.js b/plugins/dali-script-v8/docs/content/constants.js index e2383d0..51c869a 100644 --- a/plugins/dali-script-v8/docs/content/constants.js +++ b/plugins/dali-script-v8/docs/content/constants.js @@ -87,11 +87,6 @@ Constants accessible under the dali global object. |BLENDING_AUTO | integer value | |BLENDING_ON | integer value | -|**actor.SetBlendEquation() ** | | -|BLEND_EQUATION_ADD | integer value | -|BLEND_EQUATION_SUBTRACT | integer value | -|BLEND_EQUATION_REVERSE_SUBTRACT | integer value | - |**actor.SetCullFace()** | | |CULL_FACE_DISABLE | integer value | |CULL_FRONT_FACE | integer value | diff --git a/plugins/dali-script-v8/src/actors/actor-wrapper.cpp b/plugins/dali-script-v8/src/actors/actor-wrapper.cpp index 4df5d5c..7e4dcc4 100644 --- a/plugins/dali-script-v8/src/actors/actor-wrapper.cpp +++ b/plugins/dali-script-v8/src/actors/actor-wrapper.cpp @@ -258,10 +258,6 @@ const ActorFunctions ActorFunctionTable[]= { "GetBlendMode", RenderableActorApi::GetBlendMode, RENDERABLE_ACTOR_API }, { "SetBlendFunc", RenderableActorApi::SetBlendFunc, RENDERABLE_ACTOR_API }, { "GetBlendFunc", RenderableActorApi::GetBlendFunc, RENDERABLE_ACTOR_API }, - { "SetBlendEquation", RenderableActorApi::SetBlendEquation, RENDERABLE_ACTOR_API }, - { "GetBlendEquation", RenderableActorApi::GetBlendEquation, RENDERABLE_ACTOR_API }, - { "SetBlendColor", RenderableActorApi::SetBlendColor, RENDERABLE_ACTOR_API }, - { "GetBlendColor", RenderableActorApi::GetBlendColor, RENDERABLE_ACTOR_API }, { "SetShaderEffect", RenderableActorApi::SetShaderEffect, RENDERABLE_ACTOR_API }, { "GetShaderEffect", RenderableActorApi::GetShaderEffect, RENDERABLE_ACTOR_API }, { "RemoveShaderEffect", RenderableActorApi::RemoveShaderEffect,RENDERABLE_ACTOR_API }, @@ -296,8 +292,6 @@ const ActorFunctions ActorFunctionTable[]= { "GetImage", ImageActorApi::GetImage, IMAGE_ACTOR_API }, // ignore SetPixelArea, use imageActor.pixelArea // ignore GetPixelArea, use imageActor.pixelArea - { "IsPixelAreaSet", ImageActorApi::IsPixelAreaSet, IMAGE_ACTOR_API }, - { "ClearPixelArea", ImageActorApi::ClearPixelArea, IMAGE_ACTOR_API }, // ignore SetStyle, use imageActor.style // ignore GetStyle, use imageActor.style // ignore SetNinePatchBorder use imageActor.border diff --git a/plugins/dali-script-v8/src/actors/image-actor-api.cpp b/plugins/dali-script-v8/src/actors/image-actor-api.cpp index 9a30b21..d8644a5 100644 --- a/plugins/dali-script-v8/src/actors/image-actor-api.cpp +++ b/plugins/dali-script-v8/src/actors/image-actor-api.cpp @@ -150,40 +150,6 @@ void ImageActorApi::GetImage( const v8::FunctionCallbackInfo& args ) args.GetReturnValue().Set( localObject ); } -/** - * Query whether a pixel area has been set. - * @for ImageActor - * @method isPixelAreaSet - * @return {Boolean} True if a pixel area has been set. - */ -void ImageActorApi::IsPixelAreaSet( const v8::FunctionCallbackInfo& args ) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope handleScope( isolate ); - ImageActor imageActor = GetImageActor( isolate, args ); - - args.GetReturnValue().Set( v8::Boolean::New( isolate, imageActor.IsPixelAreaSet() ) ); -} - -/** - * Remove any pixel areas specified with SetPixelArea; the entire image will be displayed. - * - * The actor size will change to that of the Image unless a custom size was set, e.g. via - * actor.size - * @for ImageActor - * @method clearPixelArea - */ -void ImageActorApi::ClearPixelArea( const v8::FunctionCallbackInfo& args ) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope handleScope( isolate ); - ImageActor imageActor = GetImageActor( isolate, args ); - - imageActor.ClearPixelArea(); -} - - - } // namespace V8Plugin } // namespace Dali diff --git a/plugins/dali-script-v8/src/actors/image-actor-api.h b/plugins/dali-script-v8/src/actors/image-actor-api.h index d6b9f3a..4bdbe76 100644 --- a/plugins/dali-script-v8/src/actors/image-actor-api.h +++ b/plugins/dali-script-v8/src/actors/image-actor-api.h @@ -42,8 +42,6 @@ namespace ImageActorApi */ void SetImage( const v8::FunctionCallbackInfo< v8::Value >& args ); void GetImage( const v8::FunctionCallbackInfo< v8::Value >& args ); - void IsPixelAreaSet( const v8::FunctionCallbackInfo< v8::Value >& args ); - void ClearPixelArea( const v8::FunctionCallbackInfo< v8::Value >& args ); }; // namespace ImageActorApi } // namespace V8Plugin diff --git a/plugins/dali-script-v8/src/actors/renderable-actor-api.cpp b/plugins/dali-script-v8/src/actors/renderable-actor-api.cpp index 89b3569..14b2baf 100644 --- a/plugins/dali-script-v8/src/actors/renderable-actor-api.cpp +++ b/plugins/dali-script-v8/src/actors/renderable-actor-api.cpp @@ -190,34 +190,6 @@ void RenderableActorApi::GetBlendMode( const v8::FunctionCallbackInfo } -// 2 function definitions, as Dali uses 2 functions. -// JavaScript can't overload but we can document it twice with different params -/** - * @for RenderableActor - * @method setBlendFunc - * @param {Number} SourceBlending RGBA - * @param {Number} DestinationBlending RGBA - * @example - * blending constants - dali.BLEND_FACTOR_ZERO - dali.BLEND_FACTOR_ONE - dali.BLEND_FACTOR_SRC_COLOR - dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR - dali.BLEND_FACTOR_SRC_ALPHA - dali.BLEND_FACTOR_ONE_MINUS_SRC_ALPHA - dali.BLEND_FACTOR_DST_ALPHA - dali.BLEND_FACTOR_ONE_MINUS_DST_ALPHA - dali.BLEND_FACTOR_DST_COLOR - dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR - dali.BLEND_FACTOR_SRC_ALPHA_SATURATE - dali.BLEND_FACTOR_CONSTANT_COLOR - dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR - dali.BLEND_FACTOR_CONSTANT_ALPHA - dali.BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA - - actor.setBlendFunc( dali.BLEND_FACTOR_ONE_MINUS_SRC_COLOR, dali.BLEND_FACTOR_ONE_MINUS_DST_COLOR); - */ - /** * @for RenderableActor * @method setBlendFunc @@ -255,39 +227,20 @@ void RenderableActorApi::SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value RenderableActor actor = GetRenderableActor( isolate, args ); int params[4]; - if( args.Length() == 2 ) + bool foundAllParams(false); + V8Utils::ReadIntegerArguments( foundAllParams, ¶ms[0], 4, args,0 ); + if( foundAllParams ) { - bool foundAllParams(false); - V8Utils::ReadIntegerArguments( foundAllParams, ¶ms[0], 2, args,0 ); - if( foundAllParams ) - { - actor.SetBlendFunc( static_cast< Dali::BlendingFactor::Type>(params[0]), - static_cast< Dali::BlendingFactor::Type>(params[1]) ); - } - else - { - DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter"); - return; - } + actor.SetBlendFunc( static_cast< Dali::BlendingFactor::Type>(params[0]), + static_cast< Dali::BlendingFactor::Type>(params[1]), + static_cast< Dali::BlendingFactor::Type>(params[2]), + static_cast< Dali::BlendingFactor::Type>(params[3])); } - else if ( args.Length() == 4) + else { - bool foundAllParams(false); - V8Utils::ReadIntegerArguments( foundAllParams, ¶ms[0], 4, args,0 ); - if( foundAllParams ) - { - actor.SetBlendFunc( static_cast< Dali::BlendingFactor::Type>(params[0]), - static_cast< Dali::BlendingFactor::Type>(params[1]), - static_cast< Dali::BlendingFactor::Type>(params[2]), - static_cast< Dali::BlendingFactor::Type>(params[3])); - } - else - { - DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter"); - return; - } + DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendMode parameter"); + return; } - } /** @@ -323,148 +276,6 @@ void RenderableActorApi::GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value args.GetReturnValue().Set( blendInfo ); } -// 2 function definitions, as Dali uses 2 functions. -// JavaScript can't overload but we can document it twice with different params -/** - * @for RenderableActor - * @method setBlendEquation - * @param {Number } BlendEquation for RGBA - * @example - * - * //blending equation constants - dali.BLEND_EQUATION_ADD - dali.BLEND_EQUATION_SUBTRACT - dali.BLEND_EQUATION_REVERSE_SUBTRACT - actor.setBlendEquation( dali.BLEND_EQUATION_ADD ); - - */ - -/** - * @for RenderableActor - * @method setBlendEquation - * @param {Number } BlendEquation for RGB - * @param {Number } BlendEquation for Alpha - * @example - * - * //blending equation constants - dali.BLEND_EQUATION_ADD - dali.BLEND_EQUATION_SUBTRACT - dali.BLEND_EQUATION_REVERSE_SUBTRACT - actor.setBlendEquationSeparate( dali.BLEND_EQUATION_ADD, dali.BLEND_EQUATION_SUBTRACT ); - - */ -void RenderableActorApi::SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args ) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope handleScope( isolate ); - RenderableActor actor = GetRenderableActor( isolate, args ); - - int params[2]; - if( args.Length() == 1 ) - { - bool foundAllParams( false ); - V8Utils::ReadIntegerArguments( foundAllParams, ¶ms[0], 1, args, 0 ); - if( foundAllParams ) - { - actor.SetBlendEquation( static_cast( params[0] ) ); - } - else - { - DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendEquation parameter" ); - return; - } - } - else if( args.Length() == 2 ) - { - bool foundAllParams( false ); - V8Utils::ReadIntegerArguments( foundAllParams, ¶ms[0], 2, args, 0 ); - if( foundAllParams ) - { - actor.SetBlendEquation( static_cast( params[0] ), static_cast( params[1] ) ); - } - else - { - DALI_SCRIPT_EXCEPTION( isolate, "invalid BlendEquation parameter" ); - return; - } - } -} - -/** - * @for RenderableActor - * @method getBlendEquation - * @return {Object} equationProperties - * @example equation properties object has 2 fields - * - * equationProperties.equationRgb // rbg blend equation - * equationProperties.equationAlpha // alpha blend equation - */ -void RenderableActorApi::GetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args ) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope handleScope( isolate ); - RenderableActor actor = GetRenderableActor( isolate, args ); - - BlendingEquation::Type equationRgb, equationAlpha; - actor.GetBlendEquation( equationRgb, equationAlpha ); - - v8::Local object = v8::Object::New( isolate ); - - object->Set( v8::String::NewFromUtf8( isolate, "equationRgb" ), v8::Integer::New( isolate, equationRgb) ); - object->Set( v8::String::NewFromUtf8( isolate, "equationAlpha" ), v8::Integer::New( isolate, equationAlpha ) ); - - args.GetReturnValue().Set( object ); -} - -/** - * @for RenderableActor - * @method setBlendColor - * @param {Vector4} Color - * @example - * - * actor.SetBlendColor( dali.COLOR_RED ); - */ -void RenderableActorApi::SetBlendColor( const v8::FunctionCallbackInfo< v8::Value >& args ) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope handleScope( isolate ); - RenderableActor actor = GetRenderableActor( isolate, args ); - - Dali::Vector4 color; - - bool foundAllArguments( false ); - - V8Utils::ReadFloatArguments( foundAllArguments, color.AsFloat(), 4, args, 1.f ); // read the parameters - if( !foundAllArguments ) - { - DALI_SCRIPT_EXCEPTION( isolate, "invalid color parameter, should red,green,blue,alpha" ); - return; - } - actor.SetBlendColor( color ); - -} - -/** - * @for RenderableActor - * @method getBlendColor - * @return {Object} Dali vector 4 object - */ -void RenderableActorApi::GetBlendColor( const v8::FunctionCallbackInfo< v8::Value >& args ) -{ - v8::Isolate* isolate = args.GetIsolate(); - v8::HandleScope handleScope( isolate ); - RenderableActor actor = GetRenderableActor( isolate, args ); - - Dali::Vector4 color = actor.GetBlendColor(); - - Dali::Property::Value value( color ); - - v8::Local object = PropertyValueWrapper::WrapDaliProperty( isolate, value ); - - args.GetReturnValue().Set( object ); - -} - /** * @for RenderableActor diff --git a/plugins/dali-script-v8/src/actors/renderable-actor-api.h b/plugins/dali-script-v8/src/actors/renderable-actor-api.h index 463b295..79716a1 100644 --- a/plugins/dali-script-v8/src/actors/renderable-actor-api.h +++ b/plugins/dali-script-v8/src/actors/renderable-actor-api.h @@ -44,10 +44,6 @@ namespace RenderableActorApi void GetBlendMode( const v8::FunctionCallbackInfo< v8::Value >& args ); void SetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args ); void GetBlendFunc( const v8::FunctionCallbackInfo< v8::Value >& args ); - void SetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args ); - void GetBlendEquation( const v8::FunctionCallbackInfo< v8::Value >& args ); - void SetBlendColor( const v8::FunctionCallbackInfo< v8::Value >& args ); - void GetBlendColor( const v8::FunctionCallbackInfo< v8::Value >& args ); void GetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args ); void SetShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args ); void RemoveShaderEffect( const v8::FunctionCallbackInfo< v8::Value >& args );