mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
basic algorithm
This commit is contained in:
@@ -429,6 +429,47 @@ std::shared_ptr<const ISharedImage> SDLImageShared::verticalFlip() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::shared_ptr<const ISharedImage> SDLImageShared::drawShadow(bool doSheer) const
|
||||
{
|
||||
if(upscalingInProgress)
|
||||
throw std::runtime_error("Attempt to access images that is still being loaded!");
|
||||
|
||||
if (!surf)
|
||||
return shared_from_this();
|
||||
|
||||
SDL_Surface * shadow = CSDL_Ext::drawShadow(surf, doSheer);
|
||||
auto ret = std::make_shared<SDLImageShared>(shadow);
|
||||
ret->fullSize = fullSize;
|
||||
ret->margins.x = margins.x;
|
||||
ret->margins.y = margins.y;
|
||||
|
||||
// erase our own reference
|
||||
SDL_FreeSurface(shadow);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::shared_ptr<const ISharedImage> SDLImageShared::drawOutline(const ColorRGBA & color, int thickness) const
|
||||
{
|
||||
if(upscalingInProgress)
|
||||
throw std::runtime_error("Attempt to access images that is still being loaded!");
|
||||
|
||||
if (!surf)
|
||||
return shared_from_this();
|
||||
|
||||
SDL_Color sdlColor = { color.r, color.g, color.b, color.a };
|
||||
SDL_Surface * outline = CSDL_Ext::drawOutline(surf, sdlColor, thickness);
|
||||
auto ret = std::make_shared<SDLImageShared>(outline);
|
||||
ret->fullSize = fullSize;
|
||||
ret->margins.x = margins.x;
|
||||
ret->margins.y = margins.y;
|
||||
|
||||
// erase our own reference
|
||||
SDL_FreeSurface(outline);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Keep the original palette, in order to do color switching operation
|
||||
void SDLImageShared::savePalette()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user