Add Canvas::Image.dirtyPixels()

This commit is contained in:
James Turner 2020-04-28 09:36:29 +01:00
parent 57b0f70a55
commit ad3621e23b
2 changed files with 15 additions and 2 deletions

View File

@ -947,6 +947,14 @@ SGRect<int> intersectRect(const SGRect<int>& a, const SGRect<int>& b)
}
image->setColor(color, x, y);
}
void Image::dirtyPixels()
{
osg::ref_ptr<osg::Image> image = _texture->getImage();
if (!image)
return;
image->dirty();
auto c = getCanvas().lock();
c->enableRendering(true); // force a repaint
}

View File

@ -115,6 +115,11 @@ namespace canvas
void setPixel(int x, int y, const osg::Vec4& color);
/**
* mark the image pixels as modified, so the canvas is re-painted
*/
void dirtyPixels();
osg::ref_ptr<osg::Image> getImage() const;
// void setRow(int row, int offset, )