it uses the same Gaussian blur as the text shadow.
Change-Id: I3b7d7534c68cfae5de55747158b4f74ffcaa2e88
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
outlineMapSet["color"] = Color::RED;
outlineMapSet["width"] = 2.0f;
outlineMapSet["offset"] = Vector2(0.0f, 0.0f);
+ outlineMapSet["blurRadius"] = 0.0f;
editor.SetProperty(TextEditor::Property::OUTLINE, outlineMapSet);
outlineMapSet["color"] = Color::RED;
outlineMapSet["width"] = 2.0f;
outlineMapSet["offset"] = Vector2(0.0f, 0.0f);
+ outlineMapSet["blurRadius"] = 0.0f;
field.SetProperty(TextField::Property::OUTLINE, outlineMapSet);
outlineMapSet["color"] = Color::RED;
outlineMapSet["width"] = 2.0f;
outlineMapSet["offset"] = Vector2(2.0f, 2.0f);
+ outlineMapSet["blurRadius"] = 3.0f;
label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
outlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::OUTLINE);
outlineMapSet[Toolkit::DevelText::Outline::Property::COLOR] = Color::BLUE;
outlineMapSet[Toolkit::DevelText::Outline::Property::WIDTH] = 3.0f;
outlineMapSet[Toolkit::DevelText::Outline::Property::OFFSET] = Vector2(3.0f, 3.0f);
+ outlineMapSet[Toolkit::DevelText::Outline::Property::BLUR_RADIUS] = 4.0f;
label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
outlineMapGet = label.GetProperty<Property::Map>(TextLabel::Property::OUTLINE);
DALI_TEST_EQUALS(outlineMapGet.Count(), outlineMapSet.Count(), TEST_LOCATION);
- std::vector<std::string> outlineIndicesConversionTable = {"color", "width", "offset"};
+ std::vector<std::string> outlineIndicesConversionTable = {"color", "width", "offset", "blurRadius"};
DALI_TEST_EQUALS(DaliTestCheckMaps(outlineMapGet, outlineMapSet, outlineIndicesConversionTable), true, TEST_LOCATION);
// Check the background property
outlineMapSet["color"] = Color::BLUE;
outlineMapSet["width"] = 2.0f;
outlineMapSet["offset"] = "2 2";
+ outlineMapSet["blurRadius"] = "3";
label.SetProperty(TextLabel::Property::OUTLINE, outlineMapSet);
application.SendNotification();
propertyMap.Insert("underline", underlineMapSet.Add("enable", true).Add("color", Color::GREEN).Add("height", 1).Add("type", Text::Underline::Type::SOLID).Add("dashWidth", 2).Add("dashGap", 1));
Property::Map outlineMapSet;
- propertyMap.Insert("outline", outlineMapSet.Add("color", Color::YELLOW).Add("width", 1).Add("offset", Vector2(2.0f, 2.0f)));
+ propertyMap.Insert("outline", outlineMapSet.Add("color", Color::YELLOW).Add("width", 1).Add("offset", Vector2(2.0f, 2.0f)).Add("blurRadius", 3.0f));
Property::Map backgroundMapSet;
propertyMap.Insert("textBackground", backgroundMapSet.Add("enable", true).Add("color", Color::CYAN));
* @details Name "offset", type Property::STRING or Property::VECTOR2. i.e "3.0 3.0" or Vector2( 3.f, 3.f )
* @note Optional. If not provided then the outline is not enabled.
*/
- OFFSET
+ OFFSET,
+
+ /**
+ * @brief The radius of the Gaussian blur for the outline.
+ * @details Name "blurRadius", type Property::STRING or Property::FLOAT. i.e "5.0" or 5.f
+ * @note Optional. If not provided then the outline is not enabled.
+ */
+ BLUR_RADIUS
};
} // namespace Property
return mImpl->mModel->mVisualModel->GetOutlineWidth();
}
+void Controller::SetOutlineBlurRadius(const float& outlineBlurRadius)
+{
+ if(fabsf(GetOutlineBlurRadius() - outlineBlurRadius) > Math::MACHINE_EPSILON_1)
+ {
+ mImpl->mModel->mVisualModel->SetOutlineBlurRadius(outlineBlurRadius);
+ mImpl->RequestRelayout();
+ }
+}
+
+const float& Controller::GetOutlineBlurRadius() const
+{
+ return mImpl->mModel->mVisualModel->GetOutlineBlurRadius();
+}
+
void Controller::SetBackgroundColor(const Vector4& color)
{
mImpl->mModel->mVisualModel->SetBackgroundColor(color);
*/
uint16_t GetOutlineWidth() const;
+ /**
+ * @brief Set the outline blur radius.
+ *
+ * @param[in] outlineBlurRadius The outline blur radius, 0,0 indicates no blur.
+ */
+ void SetOutlineBlurRadius(const float& outlineBlurRadius);
+
+ /**
+ * @brief Retrieve the outline blur radius.
+ *
+ * @return The outline blur radius.
+ */
+ const float& GetOutlineBlurRadius() const;
+
/**
* @brief Set the background color.
*
// Create the image buffer for outline
Devel::PixelBuffer outlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_OUTLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
+ const float& blurRadius = mModel->GetOutlineBlurRadius();
+
+ if(blurRadius > Math::MACHINE_EPSILON_1)
+ {
+ outlineImageBuffer.ApplyGaussianBlur(blurRadius);
+ }
+
// Combine the two buffers
CombineImageBuffer(imageBuffer, outlineImageBuffer, bufferWidth, bufferHeight, true);
}
return mModel->GetOutlineWidth();
}
+const float& ViewModel::GetOutlineBlurRadius() const
+{
+ return mModel->GetOutlineBlurRadius();
+}
+
const Vector4& ViewModel::GetBackgroundColor() const
{
return mModel->GetBackgroundColor();
*/
uint16_t GetOutlineWidth() const override;
+ /**
+ * @copydoc ModelInterface::GetOutlineBlurRadius()
+ */
+ const float& GetOutlineBlurRadius() const override;
+
/**
* @copydoc ModelInterface::GetBackgroundColor()
*/
bool& widthDefined,
uint16_t& width,
bool& offsetDefined,
- Vector2& offset)
+ Vector2& offset,
+ bool& blurRadiusDefined,
+ float& blurRadius)
{
const unsigned int numberOfItems = underlinePropertiesMap.Count();
offset = valueGet.second.Get<Vector2>();
}
}
+ else if((DevelText::Outline::Property::BLUR_RADIUS == valueGet.first.indexKey) || (BLUR_RADIUS_KEY == valueGet.first.stringKey))
+ {
+ /// Blur radius key.
+ blurRadiusDefined = true;
+
+ if(valueGet.second.GetType() == Dali::Property::STRING)
+ {
+ const std::string blurRadiusStr = valueGet.second.Get<std::string>();
+ blurRadius = StringToFloat(blurRadiusStr.c_str());
+ }
+ else
+ {
+ blurRadius = valueGet.second.Get<float>();
+ }
+ }
}
return 0u == numberOfItems;
uint16_t width = 0u;
bool offsetDefined = false;
Vector2 offset;
+ bool blurRadiusDefined = false;
+ float blurRadius;
bool empty = true;
widthDefined,
width,
offsetDefined,
- offset);
+ offset,
+ blurRadiusDefined,
+ blurRadius);
controller->OutlineSetByString(false);
}
controller->SetOutlineOffset(offset);
update = true;
}
+
+ if(blurRadiusDefined && (!Dali::Equals(controller->GetOutlineBlurRadius(), blurRadius)))
+ {
+ controller->SetOutlineBlurRadius(blurRadius);
+ update = true;
+ }
}
else
{
}
else
{
- const Vector4& color = controller->GetOutlineColor();
- const uint16_t width = controller->GetOutlineWidth();
- const Vector2& offset = controller->GetOutlineOffset();
-
+ const Vector4& color = controller->GetOutlineColor();
+ const uint16_t width = controller->GetOutlineWidth();
+ const Vector2& offset = controller->GetOutlineOffset();
+ const float& blurRadius = controller->GetOutlineBlurRadius();
Property::Map map;
map.Insert(COLOR_KEY, color);
map.Insert(WIDTH_KEY, static_cast<int>(width));
map.Insert(OFFSET_KEY, offset);
+ map.Insert(BLUR_RADIUS_KEY, blurRadius);
value = map;
*/
virtual uint16_t GetOutlineWidth() const = 0;
+ /**
+ * @brief Retrieve the outline blur radius.
+ *
+ * @return The outline blur radius.
+ */
+ virtual const float& GetOutlineBlurRadius() const = 0;
+
/**
* @brief Retrieves the background color.
*
return mVisualModel->GetOutlineWidth();
}
+const float& Model::GetOutlineBlurRadius() const
+{
+ return mVisualModel->mOutlineBlurRadius;
+}
+
const Vector4& Model::GetBackgroundColor() const
{
return mVisualModel->GetBackgroundColor();
*/
uint16_t GetOutlineWidth() const override;
+ /**
+ * @copydoc ModelInterface::GetOutlineBlurRadius()
+ */
+ const float& GetOutlineBlurRadius() const override;
+
/**
* @copydoc ModelInterface::GetBackgroundColor()
*/
mOutlineColor = color;
}
+void VisualModel::SetOutlineBlurRadius(const float& outlineBlurRadius)
+{
+ mOutlineBlurRadius = outlineBlurRadius;
+}
+
void VisualModel::SetUnderlineEnabled(bool enabled)
{
mUnderlineEnabled = enabled;
return mOutlineColor;
}
+const float& VisualModel::GetOutlineBlurRadius() const
+{
+ return mOutlineBlurRadius;
+}
+
bool VisualModel::IsUnderlineEnabled() const
{
return mUnderlineEnabled;
mDashedUnderlineWidth(2.0f),
mDashedUnderlineGap(1.0f),
mShadowBlurRadius(0.0f),
+ mOutlineBlurRadius(0.0f),
mOutlineWidth(0u),
mNaturalSize(),
mLayoutSize(),
*/
uint16_t GetOutlineWidth() const;
+ /**
+ * @brief Set the outline blur radius.
+ *
+ * @param[in] outlineBlurRadius The outline blur radius, 0,0 indicates no blur.
+ */
+ void SetOutlineBlurRadius(const float& outlineBlurRadius);
+
+ /**
+ * @brief Retrieve the outline blur radius.
+ *
+ * @return The outline blur radius.
+ */
+ const float& GetOutlineBlurRadius() const;
+
/**
* @brief Sets the text's background color.
*
float mDashedUnderlineWidth; ///< The width of the dashes of the dashed underline.
float mDashedUnderlineGap; ///< The gap between the dashes of the dashed underline.
float mShadowBlurRadius; ///< Blur radius of shadow, 0 indicates no blur.
+ float mOutlineBlurRadius; ///< Blur radius of outline, 0 indicates no blur.
uint16_t mOutlineWidth; ///< Width of outline.
Vector<StrikethroughGlyphRun> mStrikethroughRuns; ///< Runs of glyphs that have strikethrough.
Vector<CharacterSpacingGlyphRun> mCharacterSpacingRuns; ///< Runs of glyphs that have character-spacing.