2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-toolkit/devel-api/shader-effects/distance-field-effect.h>
21 #include <dali/public-api/rendering/shader.h>
25 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
26 #include <dali-toolkit/public-api/visuals/visual-properties.h>
32 Dali::Property::Map CreateDistanceFieldEffect()
34 const char* fragmentShaderPrefix("#extension GL_OES_standard_derivatives : enable\n");
36 const char* fragmentShader = SHADER_DISTANCE_FIELD_EFFECT_FRAG.data();
40 Property::Map customShader;
42 std::string fragmentShaderString;
43 fragmentShaderString.reserve(strlen(fragmentShaderPrefix) + strlen(fragmentShader));
44 fragmentShaderString.append(fragmentShaderPrefix);
45 fragmentShaderString.append(fragmentShader);
47 customShader[Visual::Shader::Property::FRAGMENT_SHADER] = fragmentShaderString;
48 customShader[Visual::Shader::Property::HINTS] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
50 map[Toolkit::Visual::Property::SHADER] = customShader;
54 } // namespace Toolkit