X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Fdevel-api%2Fshader-effects%2Fimage-region-effect.h;h=65504c1264438793d6b4729e9ca61d708d1e9fa0;hp=2bce6b36a0dd73bd58ea39ac5d4b25bc43dae20a;hb=HEAD;hpb=31df2b9472ccbe0ae460a958535be8ef790c96f2 diff --git a/dali-toolkit/devel-api/shader-effects/image-region-effect.h b/dali-toolkit/devel-api/shader-effects/image-region-effect.h index 2bce6b3..65504c1 100644 --- a/dali-toolkit/devel-api/shader-effects/image-region-effect.h +++ b/dali-toolkit/devel-api/shader-effects/image-region-effect.h @@ -1,8 +1,8 @@ -#ifndef __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__ -#define __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__ +#ifndef DALI_TOOLKIT_IMAGE_REGION_EFFECT_H +#define DALI_TOOLKIT_IMAGE_REGION_EFFECT_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,14 +19,15 @@ */ // EXTERNAL INCLUDES -#include +#include + +// INTERNAL INCLUDES +#include namespace Dali { - namespace Toolkit { - /** * @brief Creates a new ImageRegionEffect * @@ -38,36 +39,12 @@ namespace Toolkit * "uBottomRight" - The bottom-right corner of the image region. The coordinates are in percentage, * (0,0) being the top-left and (1,1) the bottom right of the original image * - * @return A handle to a newly allocated ShaderEffect + * @return A property map of the required shader */ -inline ShaderEffect CreateImageRegionEffect() -{ - std::string vertexShader( - "uniform mediump vec2 uTopLeft;\n" - "uniform mediump vec2 uBottomRight;\n" - "void main()\n" - "{\n" - " mediump vec4 position = vec4(aPosition,1.0);\n" - " gl_Position = uMvpMatrix * position;\n" - // The line below is doing the same as the following commented lines: - //" vec2 imageSize = sTextureRect.zw - sTextureRect.xy;\n" - //" vec2 topLeft = sTextureRect.xy + uTopLeft * imageSize;\n" - //" vec2 bottomRight = sTextureRect.xy + uBottomRight * imageSize;\n" - //" vec2 texCoord = (aTexCoord - sTextureRect.xy) / imageSize;\n" - //" vTexCoord = topLeft + texCoord * ( bottomRight - topLeft );\n" - " vTexCoord = sTextureRect.xy + uTopLeft * ( sTextureRect.zw - sTextureRect.xy ) + ( aTexCoord - sTextureRect.xy ) * ( uBottomRight - uTopLeft );\n" - "}\n" - ); - - Dali::ShaderEffect shaderEffect = Dali::ShaderEffect::New( vertexShader, "" ); - shaderEffect.SetUniform( "uTopLeft", Vector2( 0.f, 0.f ) ); - shaderEffect.SetUniform( "uBottomRight", Vector2( 1.f, 1.f ) ); - - return shaderEffect; -} +DALI_TOOLKIT_API Property::Map CreateImageRegionEffect(); } // namespace Toolkit } // namespace Dali -#endif // __DALI_TOOLKIT_IMAGE_REGION_EFFECT_H__ +#endif // DALI_TOOLKIT_IMAGE_REGION_EFFECT_H