X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=dali-toolkit%2Finternal%2Ftext%2Frendering%2Ftext-typesetter.h;h=bf46b90590eba6341ccb1818fa6ca39ca33344ad;hb=f6004b92a7b8ea0feed9c468943a3c369da4501e;hp=2f29a47d71f74ffa7fd03d85205f0c787840c6d7;hpb=9ddd5fea6278d06b8874988498c7c4c6508750ba;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git
diff --git a/dali-toolkit/internal/text/rendering/text-typesetter.h b/dali-toolkit/internal/text/rendering/text-typesetter.h
index 2f29a47..bf46b90 100644
--- a/dali-toolkit/internal/text/rendering/text-typesetter.h
+++ b/dali-toolkit/internal/text/rendering/text-typesetter.h
@@ -2,7 +2,7 @@
#define DALI_TOOLKIT_TEXT_TYPESETTER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -51,9 +51,10 @@ public:
enum RenderBehaviour
{
RENDER_TEXT_AND_STYLES, ///< Render both the text and its styles
- RENDER_NO_TEXT, ///< Do not render the text itself
+ RENDER_NO_TEXT, ///< Do not render the text itself but render the background styles such as outline and background.
RENDER_NO_STYLES, ///< Do not render any styles
- RENDER_MASK ///< Render an alpha mask (for color glyphs with no color animation, e.g. emoji)
+ RENDER_MASK, ///< Render an alpha mask (for color glyphs with no color animation, e.g. emoji)
+ RENDER_OVERLAY_STYLE ///< Do not render the text itself but render the style but overlay the style on the text (foreground styles such as strikethrough and underline)
};
/**
@@ -61,13 +62,14 @@ public:
*/
enum Style
{
- STYLE_NONE, ///< No style
- STYLE_MASK, ///< Alpha mask
- STYLE_SHADOW, ///< Hard shadow
- STYLE_SOFT_SHADOW, ///< Soft shadow
- STYLE_UNDERLINE, ///< Underline
- STYLE_OUTLINE, ///< Outline
- STYLE_BACKGROUND ///< Text background
+ STYLE_NONE, ///< No style
+ STYLE_MASK, ///< Alpha mask
+ STYLE_SHADOW, ///< Hard shadow
+ STYLE_SOFT_SHADOW, ///< Soft shadow
+ STYLE_UNDERLINE, ///< Underline
+ STYLE_OUTLINE, ///< Outline
+ STYLE_BACKGROUND, ///< Text background
+ STYLE_STRIKETHROUGH ///< Strikethrough
};
public: // Constructor.
@@ -123,7 +125,7 @@ private:
Typesetter& operator=(const Typesetter& handle);
/**
- * @brief Create the image buffer for the given range of the glyphs in the given style.
+ * @brief Create & draw the image buffer for the given range of the glyphs in the given style.
*
* Does the following operations:
* - Retrieves the data buffers from the text model.
@@ -145,6 +147,19 @@ private:
Devel::PixelBuffer CreateImageBuffer(const unsigned int bufferWidth, const unsigned int bufferHeight, Typesetter::Style style, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset, TextAbstraction::GlyphIndex fromGlyphIndex, TextAbstraction::GlyphIndex toGlyphIndex);
/**
+ * @brief Create an initialized image buffer.
+ *
+ * Creates the pixel data used to generate the final image with the given size.
+ *
+ * @param[in] bufferWidth The width of the image buffer.
+ * @param[in] bufferHeight The height of the image buffer.
+ * @param[in] pixelFormat The format of the pixel in the image that the text is rendered as (i.e. either Pixel::BGRA8888 or Pixel::L8).
+ *
+ * @return An image buffer.
+ */
+ Devel::PixelBuffer CreateImageBuffer(const unsigned int bufferWidth, const unsigned int bufferHeight, Pixel::Format pixelFormat);
+
+ /**
* @brief Combine the two RGBA image buffers together.
*
* The top layer buffer will blend over the bottom layer buffer:
@@ -163,6 +178,63 @@ private:
*/
Devel::PixelBuffer CombineImageBuffer(Devel::PixelBuffer topPixelBuffer, Devel::PixelBuffer bottomPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeightbool);
+ /**
+ * @brief Apply behaviour of tags if the markup-processor is enabled.
+ *
+ * @param[in] topPixelBuffer The top layer buffer.
+ * @param[in] bufferWidth The width of the image buffer.
+ * @param[in] bufferHeight The height of the image buffer.
+ * @param[in] ignoreHorizontalAlignment Whether to ignore the horizontal alignment, not ignored by default.
+ * @param[in] pixelFormat The format of the pixel in the image that the text is rendered as (i.e. either Pixel::BGRA8888 or Pixel::L8).
+ * @param[in] horizontalOffset The horizontal offset to be added to the glyph's position.
+ * @param[in] verticalOffset The vertical offset to be added to the glyph's position.
+ *
+ * @return The image buffer with the markup.
+ */
+ Devel::PixelBuffer ApplyMarkupProcessorOnPixelBuffer(Devel::PixelBuffer topPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeight, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset);
+
+ /**
+ * @brief Apply markup underline tags.
+ *
+ * The properties on TextLabel override the behavior of Markup.
+ * Because the markup will be the bottom layer buffer
+ * - i.e: If you set property UNDERLINE to enabled and blue.
+ * And the TEXT is "Hello World Hello World".
+ * Then the output of the whole text is underlined by blue line.
+ *
+ * @param[in] topPixelBuffer The top layer buffer.
+ * @param[in] bufferWidth The width of the image buffer.
+ * @param[in] bufferHeight The height of the image buffer.
+ * @param[in] ignoreHorizontalAlignment Whether to ignore the horizontal alignment, not ignored by default.
+ * @param[in] pixelFormat The format of the pixel in the image that the text is rendered as (i.e. either Pixel::BGRA8888 or Pixel::L8).
+ * @param[in] horizontalOffset The horizontal offset to be added to the glyph's position.
+ * @param[in] verticalOffset The vertical offset to be added to the glyph's position.
+ *
+ * @return The image buffer with the markup.
+ */
+ Devel::PixelBuffer ApplyUnderlineMarkupImageBuffer(Devel::PixelBuffer topPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeight, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset);
+
+ /**
+ * @brief Apply markup strikethrough tags.
+ *
+ * The properties on TextLabel override the behavior of Markup.
+ * Because the markup will be the bottom layer buffer
+ * - i.e: If you set property STRIKETHROUGH to enabled and blue.
+ * And the TEXT is "Hello World Hello World".
+ * Then the whole text will have a blue line strikethrough.
+ *
+ * @param[in] topPixelBuffer The top layer buffer.
+ * @param[in] bufferWidth The width of the image buffer.
+ * @param[in] bufferHeight The height of the image buffer.
+ * @param[in] ignoreHorizontalAlignment Whether to ignore the horizontal alignment, not ignored by default.
+ * @param[in] pixelFormat The format of the pixel in the image that the text is rendered as (i.e. either Pixel::BGRA8888 or Pixel::L8).
+ * @param[in] horizontalOffset The horizontal offset to be added to the glyph's position.
+ * @param[in] verticalOffset The vertical offset to be added to the glyph's position.
+ *
+ * @return The image buffer with the markup.
+ */
+ Devel::PixelBuffer ApplyStrikethroughMarkupImageBuffer(Devel::PixelBuffer topPixelBuffer, const unsigned int bufferWidth, const unsigned int bufferHeight, bool ignoreHorizontalAlignment, Pixel::Format pixelFormat, int horizontalOffset, int verticalOffset);
+
protected:
/**
* @brief A reference counted object may only be deleted by calling Unreference().
@@ -181,4 +253,4 @@ private:
} // namespace Dali
-#endif // DALI_TOOLKIT_TEXT_TYPESETTER_H
+#endif // DALI_TOOLKIT_TEXT_TYPESETTER_H
\ No newline at end of file