Canvas image fill and source rect setters.
C++ code can set the fill and source rect directly.
This commit is contained in:
@@ -487,11 +487,17 @@ namespace canvas
|
|||||||
if( !fill.empty() // If no color is given default to white
|
if( !fill.empty() // If no color is given default to white
|
||||||
&& !parseColor(fill, color) )
|
&& !parseColor(fill, color) )
|
||||||
return;
|
return;
|
||||||
|
setFill(color);
|
||||||
_colors->front() = color;
|
|
||||||
_colors->dirty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setFill(const osg::Vec4& color)
|
||||||
|
{
|
||||||
|
_colors->front() = color;
|
||||||
|
_colors->dirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Image::setOutset(const std::string& outset)
|
void Image::setOutset(const std::string& outset)
|
||||||
{
|
{
|
||||||
@@ -506,6 +512,13 @@ namespace canvas
|
|||||||
_attributes_dirty |= SRC_RECT;
|
_attributes_dirty |= SRC_RECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
void Image::setSourceRect(const SGRect<float>& sourceRect)
|
||||||
|
{
|
||||||
|
_attributes_dirty |= SRC_RECT;
|
||||||
|
_src_rect = sourceRect;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
void Image::setSlice(const std::string& slice)
|
void Image::setSlice(const std::string& slice)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace canvas
|
|||||||
|
|
||||||
void setImage(osg::ref_ptr<osg::Image> img);
|
void setImage(osg::ref_ptr<osg::Image> img);
|
||||||
void setFill(const std::string& fill);
|
void setFill(const std::string& fill);
|
||||||
|
void setFill(const osg::Vec4& color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see http://www.w3.org/TR/css3-background/#border-image-outset
|
* @see http://www.w3.org/TR/css3-background/#border-image-outset
|
||||||
@@ -95,6 +96,10 @@ namespace canvas
|
|||||||
|
|
||||||
bool handleEvent(const EventPtr& event);
|
bool handleEvent(const EventPtr& event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void setSourceRect(const SGRect<float>& sourceRect);
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
enum ImageAttributes
|
enum ImageAttributes
|
||||||
|
|||||||
Reference in New Issue
Block a user