2 * Copyright(c) 2020 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 extern alias TizenSystemSettings;
19 using TizenSystemSettings.Tizen.System;
21 using System.ComponentModel;
22 using System.Text.RegularExpressions;
25 namespace Tizen.NUI.BaseComponents
28 /// Class with the text and style parameters to be rendered into a pixel buffer.
30 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
31 [EditorBrowsable(EditorBrowsableState.Never)]
32 public class RendererParameters : Disposable
34 internal RendererParameters(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
38 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(RendererParameters obj)
40 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
46 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
48 Interop.RendererParameters.DeleteRendererParameters(swigCPtr);
52 /// Construct RendererParameters
54 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
55 [EditorBrowsable(EditorBrowsableState.Never)]
56 public RendererParameters() : this(Interop.RendererParameters.NewRendererParameters(), true)
58 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
62 /// The text to be rendered
64 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
65 [EditorBrowsable(EditorBrowsableState.Never)]
70 Interop.RendererParameters.TextSet(SwigCPtr, value);
71 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
75 string ret = Interop.RendererParameters.TextGet(SwigCPtr);
76 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
82 /// The horizontal alignment: one of HorizontalAlignment.
84 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
85 [EditorBrowsable(EditorBrowsableState.Never)]
86 public HorizontalAlignment HorizontalAlignment
90 string alignment = "begin";
93 case HorizontalAlignment.Begin:
98 case HorizontalAlignment.Center:
100 alignment = "center";
103 case HorizontalAlignment.End:
113 Interop.RendererParameters.HorizontalAlignmentSet(SwigCPtr, alignment);
114 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
118 string ret = Interop.RendererParameters.HorizontalAlignmentGet(SwigCPtr);
119 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
120 HorizontalAlignment alignment = HorizontalAlignment.Begin;
125 alignment = HorizontalAlignment.Begin;
130 alignment = HorizontalAlignment.Center;
135 alignment = HorizontalAlignment.End;
148 /// The vertical alignment: one of VerticalAlignment.
150 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
151 [EditorBrowsable(EditorBrowsableState.Never)]
152 public VerticalAlignment VerticalAlignment
156 string alignment = "top";
159 case VerticalAlignment.Top:
164 case VerticalAlignment.Center:
166 alignment = "center";
169 case VerticalAlignment.Bottom:
171 alignment = "bottom";
179 Interop.RendererParameters.VerticalAlignmentSet(SwigCPtr, alignment);
180 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
184 string ret = Interop.RendererParameters.VerticalAlignmentGet(SwigCPtr);
185 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
186 VerticalAlignment alignment = VerticalAlignment.Top;
191 alignment = VerticalAlignment.Top;
196 alignment = VerticalAlignment.Center;
201 alignment = VerticalAlignment.Bottom;
214 /// The font's family.
216 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
217 [EditorBrowsable(EditorBrowsableState.Never)]
218 public string FontFamily
222 Interop.RendererParameters.FontFamilySet(SwigCPtr, value);
223 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
227 string ret = Interop.RendererParameters.FontFamilyGet(SwigCPtr);
228 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
234 /// The font's weight: one of {"thin", "ultraLight", "extraLight", "light", "demiLight", "semiLight", "book", "normal", "regular", "medium", "demiBold", "semiBold", "bold", "ultraBold", "extraBold", "black", "heavy", "extraBlack"}.
236 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
237 [EditorBrowsable(EditorBrowsableState.Never)]
238 public string FontWeight
242 Interop.RendererParameters.FontWeightSet(SwigCPtr, value);
243 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
247 string ret = Interop.RendererParameters.FontWeightGet(SwigCPtr);
248 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
254 /// The font's width: one of {"ultraCondensed", "extraCondensed", "condensed", "semiCondensed", "normal", "semiExpanded", "expanded", "extraExpanded", "ultraExpanded"}.
256 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
257 [EditorBrowsable(EditorBrowsableState.Never)]
258 public string FontWidth
262 Interop.RendererParameters.FontWidthSet(SwigCPtr, value);
263 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
267 string ret = Interop.RendererParameters.FontWidthGet(SwigCPtr);
268 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
274 /// The font's slant. one of {"normal", "roman", "italic", "oblique"}
276 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
277 [EditorBrowsable(EditorBrowsableState.Never)]
278 public string FontSlant
282 Interop.RendererParameters.FontSlantSet(SwigCPtr, value);
283 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
287 string ret = Interop.RendererParameters.FontSlantGet(SwigCPtr);
288 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
294 /// The type of layout: one of TextLayout {"singleLine", "multiLine", "circular"}
296 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
297 [EditorBrowsable(EditorBrowsableState.Never)]
298 public TextLayout Layout
302 string textLayout = "singleLine";
305 case TextLayout.SingleLine:
307 textLayout = "singleLine";
310 case TextLayout.MultiLine:
312 textLayout = "multiLine";
315 case TextLayout.Circular:
317 textLayout = "circular";
325 Interop.RendererParameters.LayoutSet(SwigCPtr, textLayout);
326 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
330 string ret = Interop.RendererParameters.LayoutGet(SwigCPtr);
331 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
332 TextLayout textLayout = TextLayout.SingleLine;
337 textLayout = TextLayout.SingleLine;
342 textLayout = TextLayout.MultiLine;
347 textLayout = TextLayout.Circular;
360 /// The text alignment within the arc: one of CircularAlignment. The @p horizontalAlignment and @p verticalAlignment can be used to align the text within the text area.
362 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
363 [EditorBrowsable(EditorBrowsableState.Never)]
364 public CircularAlignment CircularAlignment
368 string alignment = "begin";
371 case CircularAlignment.Begin:
376 case CircularAlignment.Center:
378 alignment = "center";
381 case CircularAlignment.End:
391 Interop.RendererParameters.CircularAlignmentSet(SwigCPtr, alignment);
392 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
396 string ret = Interop.RendererParameters.CircularAlignmentGet(SwigCPtr);
397 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
398 CircularAlignment alignment = CircularAlignment.Begin;
403 alignment = CircularAlignment.Begin;
408 alignment = CircularAlignment.Center;
413 alignment = CircularAlignment.End;
426 /// The default text's color. Default is white.
428 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
429 [EditorBrowsable(EditorBrowsableState.Never)]
430 public Vector4 TextColor
434 Interop.RendererParameters.TextColorSet(SwigCPtr, Vector4.getCPtr(value));
435 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
439 Vector4 ret = new Vector4(Interop.RendererParameters.TextColorGet(SwigCPtr), true);
440 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
446 /// The font's size (in points).
448 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
449 [EditorBrowsable(EditorBrowsableState.Never)]
450 public float FontSize
454 Interop.RendererParameters.FontSizeSet(SwigCPtr, value);
455 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
459 float ret = Interop.RendererParameters.FontSizeGet(SwigCPtr);
460 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
466 /// The width in pixels of the boundaries where the text is going to be laid-out.
468 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
469 [EditorBrowsable(EditorBrowsableState.Never)]
470 public uint TextWidth
474 Interop.RendererParameters.TextWidthSet(SwigCPtr, value);
475 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
479 uint ret = Interop.RendererParameters.TextWidthGet(SwigCPtr);
480 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
486 /// The height in pixels of the boundaries where the text is going to be laid-out.
488 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
489 [EditorBrowsable(EditorBrowsableState.Never)]
490 public uint TextHeight
494 Interop.RendererParameters.TextHeightSet(SwigCPtr, value);
495 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
499 uint ret = Interop.RendererParameters.TextHeightGet(SwigCPtr);
500 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
506 /// The radius in pixels of the circular text.
508 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
509 [EditorBrowsable(EditorBrowsableState.Never)]
514 Interop.RendererParameters.RadiusSet(SwigCPtr, value);
515 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
519 uint ret = Interop.RendererParameters.RadiusGet(SwigCPtr);
520 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
526 /// 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°.
528 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
529 [EditorBrowsable(EditorBrowsableState.Never)]
530 public float BeginAngle
534 Interop.RendererParameters.BeginAngleSet(SwigCPtr, value);
535 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
539 float ret = Interop.RendererParameters.BeginAngleGet(SwigCPtr);
540 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
546 /// 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.
548 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
549 [EditorBrowsable(EditorBrowsableState.Never)]
550 public float IncrementAngle
554 Interop.RendererParameters.IncrementAngleSet(SwigCPtr, value);
555 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
559 float ret = Interop.RendererParameters.IncrementAngleGet(SwigCPtr);
560 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
566 /// Whether the ellipsis layout option is enabled.
568 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
569 [EditorBrowsable(EditorBrowsableState.Never)]
570 public bool EllipsisEnabled
574 Interop.RendererParameters.EllipsisEnabledSet(SwigCPtr, value);
575 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
579 bool ret = Interop.RendererParameters.EllipsisEnabledGet(SwigCPtr);
580 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
586 /// Whether the mark-up processor is enabled.
588 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
589 [EditorBrowsable(EditorBrowsableState.Never)]
590 public bool MarkupEnabled
594 Interop.RendererParameters.MarkupEnabledSet(SwigCPtr, value);
595 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
599 bool ret = Interop.RendererParameters.MarkupEnabledGet(SwigCPtr);
600 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
606 /// Whether a default color has been set.
608 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
609 [EditorBrowsable(EditorBrowsableState.Never)]
610 public bool IsTextColorSet
614 Interop.RendererParameters.IsTextColorSetSet(SwigCPtr, value);
615 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
619 bool ret = Interop.RendererParameters.IsTextColorSetGet(SwigCPtr);
620 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
626 /// Minimum size of line.
628 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
629 [EditorBrowsable(EditorBrowsableState.Never)]
630 public float MinLineSize
634 Interop.RendererParameters.MinLineSizeSet(SwigCPtr, value);
635 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
639 float ret = Interop.RendererParameters.MinLineSizeGet(SwigCPtr);
640 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
646 /// Padding of TextLabel.
648 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
649 [EditorBrowsable(EditorBrowsableState.Never)]
650 public Extents Padding
654 Interop.RendererParameters.PaddingSet(SwigCPtr, Extents.getCPtr(value));
655 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
659 Extents ret = new Extents(Interop.RendererParameters.PaddingGet(SwigCPtr), true);
660 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
668 /// Class with info of the embedded items layout.
670 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
671 [EditorBrowsable(EditorBrowsableState.Never)]
672 public class EmbeddedItemInfo : Disposable
675 internal EmbeddedItemInfo(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
679 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(EmbeddedItemInfo obj)
681 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
687 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
689 Interop.EmbeddedItemInfo.DeleteEmbeddedItemInfo(swigCPtr);
693 /// Construct EmbeddedItemInfo
695 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
696 [EditorBrowsable(EditorBrowsableState.Never)]
697 public EmbeddedItemInfo() : this(Interop.EmbeddedItemInfo.NewEmbeddedItemInfo(), true)
699 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
703 /// Index to the character within the string.
705 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
706 [EditorBrowsable(EditorBrowsableState.Never)]
707 public uint CharacterIndex
711 Interop.EmbeddedItemInfo.CharacterIndexSet(SwigCPtr, value);
712 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
716 uint ret = Interop.EmbeddedItemInfo.CharacterIndexGet(SwigCPtr);
717 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
723 /// Index to the glyph
725 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
726 [EditorBrowsable(EditorBrowsableState.Never)]
727 public uint GlyphIndex
731 Interop.EmbeddedItemInfo.GlyphIndexSet(SwigCPtr, value);
732 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
736 uint ret = Interop.EmbeddedItemInfo.GlyphIndexGet(SwigCPtr);
737 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
743 /// The layout position within the buffer (top, left corner).
745 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
746 [EditorBrowsable(EditorBrowsableState.Never)]
747 public Vector2 Position
751 Interop.EmbeddedItemInfo.PositionSet(SwigCPtr, Vector2.getCPtr(value));
752 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
756 Vector2 ret = new Vector2(Interop.EmbeddedItemInfo.PositionGet(SwigCPtr), SwigCMemOwn);
757 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
763 /// The size within the buffer of the embedded item.
765 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
766 [EditorBrowsable(EditorBrowsableState.Never)]
771 Interop.EmbeddedItemInfo.SizeSet(SwigCPtr, Size.getCPtr(value));
772 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
776 Size ret = new Size(Interop.EmbeddedItemInfo.SizeGet(SwigCPtr), SwigCMemOwn);
777 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
783 /// The rotated size within the buffer of the embedded item.
785 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
786 [EditorBrowsable(EditorBrowsableState.Never)]
787 public Size RotatedSize
791 Interop.EmbeddedItemInfo.RotatedSizeSet(SwigCPtr, Size.getCPtr(value));
792 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
796 Size ret = new Size(Interop.EmbeddedItemInfo.RotatedSizeGet(SwigCPtr), SwigCMemOwn);
797 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
803 /// Rotation angle of the pixel buffer in degrees.
805 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
806 [EditorBrowsable(EditorBrowsableState.Never)]
811 Interop.EmbeddedItemInfo.AngleSet(SwigCPtr, Degree.getCPtr(value));
812 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
816 Degree ret = new Degree(Interop.EmbeddedItemInfo.AngleGet(SwigCPtr), SwigCMemOwn);
817 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
823 /// Whether the color of the image is multiplied by the color of the text.
825 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
826 [EditorBrowsable(EditorBrowsableState.Never)]
827 public Tizen.NUI.ColorBlendingMode ColorBlendingMode
831 Interop.EmbeddedItemInfo.ColorBlendingModeSet(SwigCPtr, value);
832 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
836 Tizen.NUI.ColorBlendingMode ret = Interop.EmbeddedItemInfo.ColorBlendingModeGet(SwigCPtr);
837 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
844 /// Class with the parameters needed to build a shadow for the given pixel buffer.
846 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
847 [EditorBrowsable(EditorBrowsableState.Never)]
848 public class ShadowParameters : Disposable
851 internal ShadowParameters(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
855 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(ShadowParameters obj)
857 return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.SwigCPtr;
863 protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
865 Interop.ShadowParameters.DeleteShadowParameters(swigCPtr);
869 /// Construct ShadowParameters
871 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
872 [EditorBrowsable(EditorBrowsableState.Never)]
873 public ShadowParameters() : this(Interop.ShadowParameters.NewShadowParameters(), true)
875 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
879 /// The input pixel buffer used to create the shadow.
881 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
882 [EditorBrowsable(EditorBrowsableState.Never)]
883 public PixelBuffer Input
887 Interop.ShadowParameters.InputSet(SwigCPtr, PixelBuffer.getCPtr(value));
888 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
892 PixelBuffer ret = new PixelBuffer(Interop.ShadowParameters.InputGet(SwigCPtr), true);
893 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
899 /// The color of the text.
901 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
902 [EditorBrowsable(EditorBrowsableState.Never)]
903 public Vector4 TextColor
907 Interop.ShadowParameters.TextColorSet(SwigCPtr, Vector4.getCPtr(value));
908 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
912 Vector4 ret = new Vector4(Interop.ShadowParameters.TextColorGet(SwigCPtr), true);
913 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
919 /// The color of the shadow.
921 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
922 [EditorBrowsable(EditorBrowsableState.Never)]
927 Interop.ShadowParameters.ColorSet(SwigCPtr, Vector4.getCPtr(value));
928 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
932 Vector4 ret = new Vector4(Interop.ShadowParameters.ColorGet(SwigCPtr), true);
933 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
939 /// The offset of the shadow.
941 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
942 [EditorBrowsable(EditorBrowsableState.Never)]
943 public Vector2 Offset
947 Interop.ShadowParameters.OffsetSet(SwigCPtr, Vector2.getCPtr(value));
948 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
952 Vector2 ret = new Vector2(Interop.ShadowParameters.OffsetGet(SwigCPtr), true);
953 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
959 /// Whether to blend the shadow.
961 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
962 [EditorBrowsable(EditorBrowsableState.Never)]
963 public bool blendShadow
967 Interop.ShadowParameters.BlendShadowSet(SwigCPtr, value);
968 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
972 bool ret = Interop.ShadowParameters.BlendShadowGet(SwigCPtr);
973 if (NDalicPINVOKE.SWIGPendingException.Pending) throw new InvalidOperationException("FATAL: get Exception", NDalicPINVOKE.SWIGPendingException.Retrieve());
981 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
982 [EditorBrowsable(EditorBrowsableState.Never)]
983 public static partial class TextUtils
986 /// Renders text into a pixel buffer.
987 /// @note: Can process a mark-up string.
988 /// @note: It does the font selection, RTL reordering, shaping and layouting.
989 /// @note: The width of the pixel buffer may be different to the given @e textWidth
990 /// due to some padding pixels added.
992 /// The text is laid-out for the given size @e (textWidth,textHeight).
993 /// If the @e multiLineEnabled option is enabled, the text will wrap in lines.
994 /// If the @e ellipsisEnabled option is enabled, the text will be ellided if
995 /// there is no more space for new lines.
997 /// It won't be rendered the parts of the text exceeding the boundaries of
998 /// the given width and height.
1000 /// If the given @e textHeight is zero, a big enough pixel buffer will be created
1001 /// to render the full text.
1003 /// If the given @e textWidth is zero, the 'natural size' of the text will be
1004 /// used to create the pixel buffer to render the full text.
1006 /// If the radius is not zero, the text will be laid-out following a circular path.
1007 /// In that case the text is laid-out in a single line.
1009 /// If the mark-up string contains embedded items, the @p embeddedItemLayout vector
1010 /// contains the layout info of each embedded item.
1012 /// <param name="textParameters">The text and style options.</param>
1013 /// <param name="embeddedItemLayout">The layout info of the embedded items</param>
1014 /// <returns>A pixel buffer with the text rendered on it.</returns>
1015 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
1016 [EditorBrowsable(EditorBrowsableState.Never)]
1017 public static PixelBuffer Render(RendererParameters textParameters, ref EmbeddedItemInfo[] embeddedItemLayout)
1021 global::System.IntPtr returnItem = IntPtr.Zero;
1022 PixelBuffer ret = new PixelBuffer(Interop.TextUtils.Render(RendererParameters.getCPtr(textParameters), ref returnItem, ref count, ref length), true);
1024 embeddedItemLayout = new EmbeddedItemInfo[count];
1025 for (int i = 0; i < count; i++)
1027 IntPtr p = new IntPtr((returnItem.ToInt32() + i * length));
1028 embeddedItemLayout[i] = new EmbeddedItemInfo(p, false);
1030 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1035 /// Creates a shadow for the text given in the input pixel buffer.
1036 /// The function returns a RGBA8888 pixel buffer with the text and its shadow rendered on it.
1038 /// The pixel format of the @e input pixel buffer could be an A8 or an RGBA8888. If it's
1039 /// an A8 pixel buffer, it uses the given @e textColor to give color to the text. Otherwise
1040 /// it uses the color of the @e input pixel buffer.
1042 /// <param name="shadowParameters">The parameters needed to create the text's shadow.</param>
1043 /// <returns>A pixel buffer with the text and the shadow rendered on it.</returns>
1044 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
1045 [EditorBrowsable(EditorBrowsableState.Never)]
1046 public static PixelBuffer CreateShadow(ShadowParameters shadowParameters)
1048 PixelBuffer ret = new PixelBuffer(Interop.TextUtils.CreateShadow(ShadowParameters.getCPtr(shadowParameters)), true);
1049 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1054 /// Converts a @p pixelBuffer with pixel format A8 to RGBA8888 using the given @p color.
1055 /// @note Does nothing if the @p pixelBuffer is not A8.
1057 /// <param name="pixelBuffer">The pixel buffer with pixel format A8</param>
1058 /// <param name="color">The color used to convert to RGBA8888</param>
1059 /// <param name="multiplyByAlpha">multiplyByAlpha Whether to multiply the @p color with the alpha value of the @p pixel @p buffer.</param>
1060 /// <returns>The pixel buffer converted to RGBA8888.</returns>
1061 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
1062 [EditorBrowsable(EditorBrowsableState.Never)]
1063 public static PixelBuffer ConvertToRgba8888(PixelBuffer pixelBuffer, Vector4 color, bool multiplyByAlpha)
1065 PixelBuffer ret = new PixelBuffer(Interop.TextUtils.ConvertToRgba8888(PixelBuffer.getCPtr(pixelBuffer), Vector4.getCPtr(color), multiplyByAlpha), true);
1066 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1071 /// Updates the @p dst pixel buffer with the data from @p src pixel buffer.
1072 /// @note Both pixel buffers must have the same pixel format. Does nothing if both pixel format are different.
1073 /// @note The function does nothing if the @p src pixel buffer doesn't fit into the @p dst pixel buffer.
1075 /// The @p src pixel buffer could be blended with the @p dst pixel buffer if @p blend is set to @e true.
1077 /// <param name="src">The pixel buffer from where the data is read.</param>
1078 /// <param name="dst">The pixel buffer where the data is written.</param>
1079 /// <param name="x">The top left corner's X within the destination pixel buffer.</param>
1080 /// <param name="y">The top left corner's y within the destination pixel buffer.</param>
1081 /// <param name="blend">Whether to blend the source pixel buffer with the destination pixel buffer as background.</param>
1082 // This will be public opened after ACR done. (Before ACR, need to be hidden as Inhouse API)
1083 [EditorBrowsable(EditorBrowsableState.Never)]
1084 public static void UpdateBuffer(PixelBuffer src, PixelBuffer dst, uint x, uint y, bool blend)
1086 Interop.TextUtils.UpdateBuffer(PixelBuffer.getCPtr(src), PixelBuffer.getCPtr(dst), x, y, blend);
1087 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1091 /// Splits the text in pages of the size given in @p textParameters
1092 /// @note The returned indices are indices to utf32 characters. The input text is encoded in utf8.
1093 /// <returns> An array with the indices of the last character of each page </returns>
1095 [EditorBrowsable(EditorBrowsableState.Never)]
1096 public static Tizen.NUI.PropertyArray GetLastCharacterIndex(RendererParameters textParameters)
1098 Tizen.NUI.PropertyArray ret = new Tizen.NUI.PropertyArray(Interop.TextUtils.GetLastCharacterIndex(RendererParameters.getCPtr(textParameters)), true);
1099 if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
1104 private const float FontSizeScaleSmall = 0.8f;
1105 private const float FontSizeScaleNormal = 1.0f;
1106 private const float FontSizeScaleLarge = 1.5f;
1107 private const float FontSizeScaleHuge = 1.9f;
1108 private const float FontSizeScaleGiant = 2.5f;
1109 #elif PROFILE_WEARABLE
1110 // The following values from 'system-settings/libutil/sstu.c'
1111 private const float FontSizeScaleSmall = 0.9f;
1112 private const float FontSizeScaleNormal = 1.0f;
1113 private const float FontSizeScaleLarge = 1.1f;
1114 private const float FontSizeScaleHuge = 1.9f;
1115 private const float FontSizeScaleGiant = 2.5f;
1116 #else // PROFILE_MOBILE and etc
1117 // The following values from 'system-settings/libutil/sstu.c'
1118 private const float FontSizeScaleSmall = 0.8f;
1119 private const float FontSizeScaleNormal = 1.0f;
1120 private const float FontSizeScaleLarge = 1.5f;
1121 private const float FontSizeScaleHuge = 1.9f;
1122 private const float FontSizeScaleGiant = 2.5f;
1126 /// It returns a float value according to SystemSettingsFontSize.
1127 /// The returned value can be used for FontSizeScale property.
1128 /// <param name="systemSettingsFontSize">The SystemSettingsFontSize enum value.</param>
1129 /// <returns> A float value for FontSizeScale property. </returns>
1131 [EditorBrowsable(EditorBrowsableState.Never)]
1132 public static float GetFontSizeScale(SystemSettingsFontSize systemSettingsFontSize)
1134 float ret = FontSizeScaleNormal;
1136 switch (systemSettingsFontSize)
1138 case SystemSettingsFontSize.Small:
1139 ret = FontSizeScaleSmall;
1141 case SystemSettingsFontSize.Normal:
1142 ret = FontSizeScaleNormal;
1144 case SystemSettingsFontSize.Large:
1145 ret = FontSizeScaleLarge;
1147 case SystemSettingsFontSize.Huge:
1148 ret = FontSizeScaleHuge;
1150 case SystemSettingsFontSize.Giant:
1151 ret = FontSizeScaleGiant;
1159 /// It returns a string value according to FontWidthType.
1160 /// The returned value can be used for FontStyle PropertyMap.
1161 /// <param name="fontWidthType">The FontWidthType enum value.</param>
1162 /// <returns> A string value for FontStyle.Width property. </returns>
1164 [EditorBrowsable(EditorBrowsableState.Never)]
1165 public static string GetFontWidthString(FontWidthType fontWidthType)
1167 string value = fontWidthType.ToString();
1168 if (!string.IsNullOrEmpty(value))
1170 char[] charArray = value.ToCharArray();
1171 charArray[0] = Char.ToLower(charArray[0]);
1172 value = new string(charArray);
1176 value = "none"; // The default value.
1183 /// It returns a string value according to FontWeightType.
1184 /// The returned value can be used for FontStyle PropertyMap.
1185 /// <param name="fontWeightType">The FontWeightType enum value.</param>
1186 /// <returns> A string value for FontStyle.Weight property. </returns>
1188 [EditorBrowsable(EditorBrowsableState.Never)]
1189 public static string GetFontWeightString(FontWeightType fontWeightType)
1191 string value = fontWeightType.ToString();
1192 if (!string.IsNullOrEmpty(value))
1194 char[] charArray = value.ToCharArray();
1195 charArray[0] = Char.ToLower(charArray[0]);
1196 value = new string(charArray);
1200 value = "none"; // The default value.
1207 /// It returns a string value according to FontSlantType.
1208 /// The returned value can be used for FontStyle PropertyMap.
1209 /// <param name="fontSlantType">The FontSlantType enum value.</param>
1210 /// <returns> A string value for FontStyle.Slant property. </returns>
1212 [EditorBrowsable(EditorBrowsableState.Never)]
1213 public static string GetFontSlantString(FontSlantType fontSlantType)
1215 string value = fontSlantType.ToString();
1216 if (!string.IsNullOrEmpty(value))
1218 char[] charArray = value.ToCharArray();
1219 charArray[0] = Char.ToLower(charArray[0]);
1220 value = new string(charArray);
1224 value = "none"; // The default value.
1231 /// It returns a FontWidthType value according to fontWidthString.
1232 /// The returned value can be used for FontStyle PropertyMap.
1233 /// <param name="fontWidthString">The FontWidth string value.</param>
1234 /// <returns> A FontWidthType value for FontStyle.Width property. </returns>
1236 [EditorBrowsable(EditorBrowsableState.Never)]
1237 public static FontWidthType GetFontWidthType(string fontWidthString)
1239 FontWidthType value;
1241 if (!(Enum.TryParse(fontWidthString, true, out value) && Enum.IsDefined(typeof(FontWidthType), value)))
1243 value = FontWidthType.None; // If parsing fails, set a default value.
1250 /// It returns a FontWeightType value according to fontWeightString.
1251 /// The returned value can be used for FontStyle PropertyMap.
1252 /// <param name="fontWeightString">The FontWeight string value.</param>
1253 /// <returns> A FontWeightType value for FontStyle.Weight property. </returns>
1255 [EditorBrowsable(EditorBrowsableState.Never)]
1256 public static FontWeightType GetFontWeightType(string fontWeightString)
1258 FontWeightType value;
1260 if (!(Enum.TryParse(fontWeightString, true, out value) && Enum.IsDefined(typeof(FontWeightType), value)))
1262 value = FontWeightType.None; // If parsing fails, set a default value.
1269 /// It returns a FontSlantType value according to fontSlantString.
1270 /// The returned value can be used for FontStyle PropertyMap.
1271 /// <param name="fontSlantString">The FontSlant string value.</param>
1272 /// <returns> A FontSlantType value for FontStyle.Slant property. </returns>
1274 [EditorBrowsable(EditorBrowsableState.Never)]
1275 public static FontSlantType GetFontSlantType(string fontSlantString)
1277 FontSlantType value;
1279 if (!(Enum.TryParse(fontSlantString, true, out value) && Enum.IsDefined(typeof(FontSlantType), value)))
1281 value = FontSlantType.None; // If parsing fails, set a default value.
1288 /// This method converts a FontStyle struct to a PropertyMap and returns it.
1289 /// The returned map can be used for set FontStyle PropertyMap in the SetFontStyle method.
1290 /// <param name="fontStyle">The FontStyle struct value.</param>
1291 /// <returns> A PropertyMap for FontStyle property. </returns>
1293 [EditorBrowsable(EditorBrowsableState.Never)]
1294 public static PropertyMap GetFontStyleMap(FontStyle fontStyle)
1296 var map = new PropertyMap();
1297 var width = new PropertyValue(GetFontWidthString(fontStyle.Width));
1298 var weight = new PropertyValue(GetFontWeightString(fontStyle.Weight));
1299 var slant = new PropertyValue(GetFontSlantString(fontStyle.Slant));
1301 map.Add("width", width);
1302 map.Add("weight", weight);
1303 map.Add("slant", slant);
1309 /// This method converts a FontStyle map to a struct and returns it.
1310 /// The returned struct can be returned to the user as a FontStyle in the GetFontStyle method.
1311 /// <param name="map">The FontStyle PropertyMap.</param>
1312 /// <returns> A FontStyle struct. </returns>
1314 [EditorBrowsable(EditorBrowsableState.Never)]
1315 public static FontStyle GetFontStyleStruct(PropertyMap map)
1317 string width = "none";
1318 string weight = "none";
1319 string slant = "none";
1320 map.Find(0, "width")?.Get(out width);
1321 map.Find(0, "weight")?.Get(out weight);
1322 map.Find(0, "slant")?.Get(out slant);
1324 var fontStyle = new FontStyle();
1325 fontStyle.Width = GetFontWidthType(width);
1326 fontStyle.Weight = GetFontWeightType(weight);
1327 fontStyle.Slant = GetFontSlantType(slant);
1333 /// This method converts a InputFilter struct to a PropertyMap and returns it.
1334 /// The returned map can be used for set InputFilter PropertyMap in the SetInputFilter method.
1335 /// <param name="inputFilter">The InputFilter struct value.</param>
1336 /// <returns> A PropertyMap for InputFilter property. </returns>
1338 [EditorBrowsable(EditorBrowsableState.Never)]
1339 public static PropertyMap GetInputFilterMap(InputFilter inputFilter)
1341 var map = new PropertyMap();
1342 var accepted = inputFilter.Accepted != null ? new PropertyValue(inputFilter.Accepted.ToString()) : new PropertyValue("");
1343 var rejected = inputFilter.Rejected != null ? new PropertyValue(inputFilter.Rejected.ToString()) : new PropertyValue("");
1344 map.Add(0, accepted);
1345 map.Add(1, rejected);
1351 /// This method converts a InputFilter map to a struct and returns it.
1352 /// The returned struct can be returned to the user as a InputFilter in the GetInputFilter method.
1353 /// <param name="map">The InputFilter PropertyMap.</param>
1354 /// <returns> A InputFilter struct. </returns>
1356 [EditorBrowsable(EditorBrowsableState.Never)]
1357 public static InputFilter GetInputFilterStruct(PropertyMap map)
1359 string accepted = "";
1360 string rejected = "";
1361 map.Find(0)?.Get(out accepted);
1362 map.Find(1)?.Get(out rejected);
1364 var inputFilter = new InputFilter();
1365 inputFilter.Accepted = new Regex(accepted);
1366 inputFilter.Rejected = new Regex(rejected);
1373 /// This method converts a Underline struct to a PropertyMap and returns it.
1374 /// The returned map can be used for set Underline PropertyMap in the SetUnderline method.
1375 /// <param name="underline">The Underline struct value.</param>
1376 /// <returns> A PropertyMap for Underline property. </returns>
1378 [EditorBrowsable(EditorBrowsableState.Never)]
1379 public static PropertyMap GetUnderlineMap(Underline underline)
1381 var map = new PropertyMap();
1383 if (underline.Color != null)
1384 map.Add("color", new PropertyValue(underline.Color));
1386 map.Add("enable", new PropertyValue(underline.Enable));
1387 map.Add("height", new PropertyValue(underline.Height));
1393 /// This method converts a Underline map to a struct and returns it.
1394 /// The returned struct can be returned to the user as a Underline in the GetUnderline method.
1395 /// <param name="map">The Underline PropertyMap.</param>
1396 /// <returns> A Underline struct. </returns>
1398 [EditorBrowsable(EditorBrowsableState.Never)]
1399 public static Underline GetUnderlineStruct(PropertyMap map)
1401 Color color = new Color();
1402 map.Find(0, "enable").Get(out bool enable);
1403 map.Find(0, "color").Get(color);
1404 map.Find(0, "height").Get(out float height);
1406 var underline = new Underline();
1407 underline.Enable = enable;
1408 underline.Color = color;
1409 underline.Height = height;
1415 /// This method converts a Shadow struct to a PropertyMap and returns it.
1416 /// The returned map can be used for set Shadow PropertyMap in the SetShadow method.
1417 /// <param name="shadow">The Shadow struct value.</param>
1418 /// <returns> A PropertyMap for Shadow property. </returns>
1420 [EditorBrowsable(EditorBrowsableState.Never)]
1421 public static PropertyMap GetShadowMap(Tizen.NUI.Text.Shadow shadow)
1423 var map = new PropertyMap();
1425 if (shadow.Offset != null)
1426 map.Add("offset", new PropertyValue(shadow.Offset));
1428 if (shadow.Color != null)
1429 map.Add("color", new PropertyValue(shadow.Color));
1431 map.Add("blurRadius", new PropertyValue(shadow.BlurRadius));
1437 /// This method converts a Shadow map to a struct and returns it.
1438 /// The returned struct can be returned to the user as a Shadow in the GetShadow method.
1439 /// <param name="map">The Shadow PropertyMap.</param>
1440 /// <returns> A Shadow struct. </returns>
1442 [EditorBrowsable(EditorBrowsableState.Never)]
1443 public static Tizen.NUI.Text.Shadow GetShadowStruct(PropertyMap map)
1445 Vector2 offset = new Vector2();
1446 Color color = new Color();
1447 map.Find(0, "offset").Get(offset);
1448 map.Find(0, "color").Get(color);
1449 map.Find(0, "blurRadius").Get(out float blurRadius);
1451 var shadow = new Tizen.NUI.Text.Shadow();
1452 shadow.Offset = offset;
1453 shadow.Color = color;
1454 shadow.BlurRadius = blurRadius;
1460 /// This method converts a Outline struct to a PropertyMap and returns it.
1461 /// The returned map can be used for set Outline PropertyMap in the SetOutline method.
1462 /// <param name="outline">The Outline struct value.</param>
1463 /// <returns> A PropertyMap for Outline property. </returns>
1465 [EditorBrowsable(EditorBrowsableState.Never)]
1466 public static PropertyMap GetOutlineMap(Outline outline)
1468 var map = new PropertyMap();
1470 if (outline.Color != null)
1471 map.Add("color", new PropertyValue(outline.Color));
1473 map.Add("width", new PropertyValue(outline.Width));
1479 /// This method converts a Outline map to a struct and returns it.
1480 /// The returned struct can be returned to the user as a Outline in the GetOutline method.
1481 /// <param name="map">The Outline PropertyMap.</param>
1482 /// <returns> A Outline struct. </returns>
1484 [EditorBrowsable(EditorBrowsableState.Never)]
1485 public static Outline GetOutlineStruct(PropertyMap map)
1487 Color color = new Color();
1488 map.Find(0, "color").Get(color);
1489 map.Find(0, "width").Get(out float width);
1491 var outline = new Outline();
1492 outline.Color = color;
1493 outline.Width = width;
1499 /// It returns a string value according to FontSizeType.
1500 /// The returned value can be used for TextFit PropertyMap.
1501 /// <param name="fontSizeType">The FontSizeType enum value.</param>
1502 /// <returns> A string value for TextFit.FontSizeType property. </returns>
1504 [EditorBrowsable(EditorBrowsableState.Never)]
1505 public static string GetFontSizeString(FontSizeType fontSizeType)
1507 string value = fontSizeType.ToString();
1508 if (!string.IsNullOrEmpty(value))
1510 char[] charArray = value.ToCharArray();
1511 charArray[0] = Char.ToLower(charArray[0]);
1512 value = new string(charArray);
1516 value = "pointSize"; // The default value.
1523 /// It returns a FontSizeType value according to fontSizeString.
1524 /// The returned value can be used for FontStyle PropertyMap.
1525 /// <param name="fontSizeString">The FontSizeType string value.</param>
1526 /// <returns> A FontSizeType value for TextFit.FontSizeType property. </returns>
1528 [EditorBrowsable(EditorBrowsableState.Never)]
1529 public static FontSizeType GetFontSizeType(string fontSizeString)
1533 if (!(Enum.TryParse(fontSizeString, true, out value) && Enum.IsDefined(typeof(FontSizeType), value)))
1535 value = FontSizeType.PointSize; // If parsing fails, set a default value.
1542 /// This method converts a TextFit struct to a PropertyMap and returns it.
1543 /// The returned map can be used for set TextFit PropertyMap in the SetTextFit method.
1544 /// <param name="textFit">The TextFit struct value.</param>
1545 /// <returns> A PropertyMap for TextFit property. </returns>
1547 [EditorBrowsable(EditorBrowsableState.Never)]
1548 public static PropertyMap GetTextFitMap(TextFit textFit)
1550 var map = new PropertyMap();
1551 map.Add("enable", new PropertyValue(textFit.Enable));
1552 map.Add("minSize", new PropertyValue(textFit.MinSize));
1553 map.Add("maxSize", new PropertyValue(textFit.MaxSize));
1554 map.Add("stepSize", new PropertyValue(textFit.StepSize));
1555 map.Add("fontSizeType", new PropertyValue(GetFontSizeString(textFit.FontSizeType)));
1561 /// This method converts a TextFit map to a struct and returns it.
1562 /// The returned struct can be returned to the user as a TextFit in the GetTextFit method.
1563 /// <param name="map">The TextFit PropertyMap.</param>
1564 /// <returns> A TextFit struct. </returns>
1566 [EditorBrowsable(EditorBrowsableState.Never)]
1567 public static TextFit GetTextFitStruct(PropertyMap map)
1569 map.Find(0, "enable").Get(out bool enable);
1570 map.Find(0, "minSize").Get(out float minSize);
1571 map.Find(0, "maxSize").Get(out float maxSize);
1572 map.Find(0, "stepSize").Get(out float stepSize);
1573 map.Find(0, "fontSizeType").Get(out string fontSizeType);
1575 var textFit = new TextFit();
1576 textFit.Enable = enable;
1577 textFit.MinSize = minSize;
1578 textFit.MaxSize = maxSize;
1579 textFit.StepSize = stepSize;
1580 textFit.FontSizeType = GetFontSizeType(fontSizeType);