Merge "add Padding parameter at RendererParameters" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / text / text-utils-devel.h
index 0670e8e..e4bf375 100755 (executable)
@@ -2,7 +2,7 @@
 #define DALI_TOOLKIT_TEXT_UTILS_DEVEL_H
 
 /*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/object/property-array.h>
 #include <dali-toolkit/public-api/dali-toolkit-common.h>
 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
 #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h>
+#include <dali/public-api/object/property-array.h>
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace DevelText
 {
-
 /**
  * @brief Struct with the text and style parameters to be rendered into a pixel buffer.
  */
@@ -40,52 +37,59 @@ struct DALI_TOOLKIT_API RendererParameters
 {
   RendererParameters()
   : text{},
-    horizontalAlignment{ "begin" },
-    verticalAlignment{ "top" },
+    horizontalAlignment{"begin"},
+    verticalAlignment{"top"},
     fontFamily{},
     fontWeight{},
     fontWidth{},
     fontSlant{},
-    layout{ "singleLine" },
-    circularAlignment{ "begin" },
-    textColor{ Color::WHITE },
-    fontSize{ 0.f },
-    textWidth{ 0u },
-    textHeight{ 0u },
-    radius{ 0u },
-    beginAngle{ 0.f },
-    incrementAngle{ 0.f },
-    ellipsisEnabled{ true },
-    markupEnabled{ false },
-    isTextColorSet{ false }
-  {}
+    layout{"singleLine"},
+    circularAlignment{"begin"},
+    textColor{Color::WHITE},
+    fontSize{0.f},
+    textWidth{0u},
+    textHeight{0u},
+    radius{0u},
+    beginAngle{0.f},
+    incrementAngle{0.f},
+    ellipsisEnabled{true},
+    markupEnabled{false},
+    isTextColorSet{false},
+    minLineSize{0.f},
+    padding{0u, 0u, 0u, 0u}
+  {
+  }
 
   std::string text;                ///< The text to be rendered encoded in utf8.
-
+                                   //
   std::string horizontalAlignment; ///< The horizontal alignment: one of {"begin", "center", "end"}.
   std::string verticalAlignment;   ///< The vertical alignment: one of {"top", "center", "bottom"}.
-
+                                   //
   std::string fontFamily;          ///< The font's family.
   std::string fontWeight;          ///< The font's weight: one of {"thin", "ultraLight", "extraLight", "light", "demiLight", "semiLight", "book", "normal", "regular", "medium", "demiBold", "semiBold", "bold", "ultraBold", "extraBold", "black", "heavy", "extraBlack"}.
   std::string fontWidth;           ///< The font's width: one of {"ultraCondensed", "extraCondensed", "condensed", "semiCondensed", "normal", "semiExpanded", "expanded", "extraExpanded", "ultraExpanded"}.
   std::string fontSlant;           ///< The font's slant. one of {"normal", "roman", "italic", "oblique"}
   std::string layout;              ///< The type of layout: one of {"singleLine", "multiLine", "circular"}
   std::string circularAlignment;   ///< The text alignment within the arc: one of {"begin", "center", "end"}. The @p horizontalAlignment and @p verticalAlignment can be used to align the text within the text area.
-
+                                   //
   Vector4 textColor;               ///< The default text's color. Default is white.
-
-  float fontSize;           ///< The font's size (in points).
-
+                                   //
+  float fontSize;                  ///< The font's size (in points).
+                                   //
   unsigned int textWidth;          ///< The width in pixels of the boundaries where the text is going to be laid-out.
   unsigned int textHeight;         ///< The height in pixels of the boundaries where the text is going to be laid-out.
-
+                                   //
   unsigned int radius;             ///< The radius in pixels of the circular text.
-  float beginAngle;                ///< The begin angle in degrees of the text area on the circle. The top of the circle is 0°, the right side 90°, the bottom 180° and the left 270°.
-  float incrementAngle;            ///< The increment angle in degrees of the text area on the circle. The @p incrementAngle defines a direction. If positive, the text will be laid out clockwise.
-
-  bool ellipsisEnabled:1;          ///< Whether the ellipsis layout option is enabled.
-  bool markupEnabled:1;            ///< Whether the mark-up processor is enabled.
-  bool isTextColorSet:1;           ///< Whether a default color has been set.
+  float        beginAngle;         ///< The begin angle in degrees of the text area on the circle. The top of the circle is 0°, the right side 90°, the bottom 180° and the left 270°.
+  float        incrementAngle;     ///< The increment angle in degrees of the text area on the circle. The @p incrementAngle defines a direction. If positive, the text will be laid out clockwise.
+                                   //
+  bool ellipsisEnabled : 1;        ///< Whether the ellipsis layout option is enabled.
+  bool markupEnabled : 1;          ///< Whether the mark-up processor is enabled.
+  bool isTextColorSet : 1;         ///< Whether a default color has been set.
+                                   //
+  float minLineSize;               ///< The line's minimum size (in points).
+
+  Extents padding;                 ///< The padding of the boundaries where the text is going to be laid-out.
 };
 
 /**
@@ -93,12 +97,12 @@ struct DALI_TOOLKIT_API RendererParameters
  */
 struct DALI_TOOLKIT_API EmbeddedItemInfo
 {
-  TextAbstraction::CharacterIndex characterIndex;       ///< Index to the character within the string.
-  TextAbstraction::GlyphIndex glyphIndex;               ///< Index to the glyph
-  Vector2 position;                                     ///< The layout position within the buffer (top, left corner).
-  Size size;                                            ///< The size within the buffer of the embedded item.
-  Size rotatedSize;                                     ///< The rotated size within the buffer of the embedded item.
-  Degree angle;                                         ///< Rotation angle of the pixel buffer in degrees.
+  TextAbstraction::CharacterIndex    characterIndex;    ///< Index to the character within the string.
+  TextAbstraction::GlyphIndex        glyphIndex;        ///< Index to the glyph
+  Vector2                            position;          ///< The layout position within the buffer (top, left corner).
+  Size                               size;              ///< The size within the buffer of the embedded item.
+  Size                               rotatedSize;       ///< The rotated size within the buffer of the embedded item.
+  Degree                             angle;             ///< Rotation angle of the pixel buffer in degrees.
   TextAbstraction::ColorBlendingMode colorBlendingMode; ///< Whether the color of the image is multiplied by the color of the text.
 };
 
@@ -107,11 +111,11 @@ struct DALI_TOOLKIT_API EmbeddedItemInfo
 */
 struct DALI_TOOLKIT_API ShadowParameters
 {
-  Devel::PixelBuffer input; ///< The input pixel buffer used to create the shadow.
-  Vector4 textColor;        ///< The color of the text.
-  Vector4 color;            ///< The color of the shadow.
-  Vector2 offset;           ///< The offset of the shadow.
-  bool blendShadow;         ///< Whether to blend the shadow.
+  Devel::PixelBuffer input;       ///< The input pixel buffer used to create the shadow.
+  Vector4            textColor;   ///< The color of the text.
+  Vector4            color;       ///< The color of the shadow.
+  Vector2            offset;      ///< The offset of the shadow.
+  bool               blendShadow; ///< Whether to blend the shadow.
 };
 
 /**
@@ -147,7 +151,7 @@ struct DALI_TOOLKIT_API ShadowParameters
  *
  * @return A pixel buffer with the text rendered on it.
  */
-DALI_TOOLKIT_API Devel::PixelBuffer Render( const RendererParameters& textParameters, Vector<EmbeddedItemInfo>& embeddedItemLayout );
+DALI_TOOLKIT_API Devel::PixelBuffer Render(const RendererParameters& textParameters, Vector<EmbeddedItemInfo>& embeddedItemLayout);
 
 /**
  * @brief Creates a shadow for the text given in the input pixel buffer.
@@ -175,7 +179,7 @@ DALI_TOOLKIT_API Devel::PixelBuffer CreateShadow(const ShadowParameters& shadowP
  *
  * @return The pixel buffer converted to RGBA8888.
  */
-DALI_TOOLKIT_API Devel::PixelBuffer ConvertToRgba8888( Devel::PixelBuffer pixelBuffer, const Vector4& color, bool multiplyByAlpha );
+DALI_TOOLKIT_API Devel::PixelBuffer ConvertToRgba8888(Devel::PixelBuffer pixelBuffer, const Vector4& color, bool multiplyByAlpha);
 
 /**
 * @brief Updates the @p dst pixel buffer with the data from @p src pixel buffer.
@@ -191,7 +195,7 @@ DALI_TOOLKIT_API Devel::PixelBuffer ConvertToRgba8888( Devel::PixelBuffer pixelB
 * @param[in] y The top left corner's y within the destination pixel buffer.
 * @param[in] blend Whether to blend the source pixel buffer with the destination pixel buffer as background.
 */
-DALI_TOOLKIT_API void UpdateBuffer( Devel::PixelBuffer src, Devel::PixelBuffer dst, unsigned int x, unsigned int y, bool blend);
+DALI_TOOLKIT_API void UpdateBuffer(Devel::PixelBuffer src, Devel::PixelBuffer dst, unsigned int x, unsigned int y, bool blend);
 
 /**
  * @brief Splits the text in pages of the size given in @p textParameters
@@ -199,7 +203,7 @@ DALI_TOOLKIT_API void UpdateBuffer( Devel::PixelBuffer src, Devel::PixelBuffer d
  * @note The returned indices are indices to utf32 characters. The input text is encoded in utf8.
  * @return An array with the indices of the last character of each page
  */
-DALI_TOOLKIT_API Dali::Property::Array GetLastCharacterIndex( RendererParameters& textParameters );
+DALI_TOOLKIT_API Dali::Property::Array GetLastCharacterIndex(RendererParameters& textParameters);
 
 } // namespace DevelText