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>
22 #include <dali/public-api/rendering/shader.h>
25 #include <dali-toolkit/public-api/visuals/visual-properties.h>
26 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
34 Dali::Property::Map CreateDistanceFieldEffect()
36 const char* fragmentShaderPrefix("#extension GL_OES_standard_derivatives : enable\n");
38 const char* fragmentShader = SHADER_DISTANCE_FIELD_EFFECT_FRAG.data();
42 Property::Map customShader;
44 std::string fragmentShaderString;
45 fragmentShaderString.reserve(strlen(fragmentShaderPrefix) + strlen(fragmentShader));
46 fragmentShaderString.append(fragmentShaderPrefix);
47 fragmentShaderString.append(fragmentShader);
49 customShader[Visual::Shader::Property::FRAGMENT_SHADER] = fragmentShaderString;
50 customShader[Visual::Shader::Property::HINTS] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
52 map[Toolkit::Visual::Property::SHADER] = customShader;
56 } // namespace Toolkit