2 * Copyright (c) 2024 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.
19 #include <dali-toolkit/internal/text/rendering/vector-based/glyphy-shader/glyphy-shader.h>
25 #include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
35 GlyphyShader::GlyphyShader()
39 GlyphyShader::GlyphyShader(Shader handle)
44 GlyphyShader::~GlyphyShader()
48 GlyphyShader GlyphyShader::New(const Dali::Vector4& atlasInfo)
50 std::ostringstream vertexShaderStringStream;
51 std::ostringstream fragmentShaderStringStream;
53 vertexShaderStringStream << SHADER_GLYPHY_SHADER_EXTENTION_PREFIX_DEF.data() << SHADER_GLYPHY_SHADER_MAIN_VERT.data();
55 fragmentShaderStringStream << SHADER_GLYPHY_SHADER_EXTENTION_PREFIX_DEF.data()
56 << SHADER_GLYPHY_SHADER_FRAGMENT_PREFIX_FRAG.data()
57 << SHADER_GLYPHY_COMMON_GLSL_SHADER_DEF.data()
58 << "#define GLYPHY_SDF_PSEUDO_DISTANCE 1\n"
59 << SHADER_GLYPHY_SDF_GLSL_SHADER_DEF.data()
60 << SHADER_GLYPHY_SHADER_MAIN_FRAG.data();
62 Shader shaderEffectCustom = Shader::New(vertexShaderStringStream.str(),
63 fragmentShaderStringStream.str(),
64 Shader::Hint::OUTPUT_IS_TRANSPARENT,
67 GlyphyShader handle(shaderEffectCustom);
69 handle.RegisterProperty("u_atlas_info", atlasInfo);
70 handle.RegisterProperty("u_contrast", 1.f);
71 handle.RegisterProperty("u_gamma_adjust", 1.f);
72 handle.RegisterProperty("u_outline_thickness", 1.f);
73 handle.RegisterProperty("u_outline", 1.f);
74 handle.RegisterProperty("u_boldness", 0.f);
81 } // namespace Toolkit