SDLImage.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. /*
  2. * SDLImage.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "SDLImage.h"
  12. #include "SDLImageLoader.h"
  13. #include "SDL_Extensions.h"
  14. #include "../render/ColorFilter.h"
  15. #include "../render/Colors.h"
  16. #include "../render/CBitmapHandler.h"
  17. #include "../render/CDefFile.h"
  18. #include "../render/Graphics.h"
  19. #include "../xBRZ/xbrz.h"
  20. #include <tbb/parallel_for.h>
  21. #include <SDL_surface.h>
  22. #include <SDL_image.h>
  23. class SDLImageLoader;
  24. //First 8 colors in def palette used for transparency
  25. static constexpr std::array<SDL_Color, 8> sourcePalette = {{
  26. {0, 255, 255, SDL_ALPHA_OPAQUE},
  27. {255, 150, 255, SDL_ALPHA_OPAQUE},
  28. {255, 100, 255, SDL_ALPHA_OPAQUE},
  29. {255, 50, 255, SDL_ALPHA_OPAQUE},
  30. {255, 0, 255, SDL_ALPHA_OPAQUE},
  31. {255, 255, 0, SDL_ALPHA_OPAQUE},
  32. {180, 0, 255, SDL_ALPHA_OPAQUE},
  33. {0, 255, 0, SDL_ALPHA_OPAQUE}
  34. }};
  35. static constexpr std::array<ColorRGBA, 8> targetPalette = {{
  36. {0, 0, 0, 0 }, // 0 - transparency ( used in most images )
  37. {0, 0, 0, 64 }, // 1 - shadow border ( used in battle, adventure map def's )
  38. {0, 0, 0, 64 }, // 2 - shadow border ( used in fog-of-war def's )
  39. {0, 0, 0, 128}, // 3 - shadow body ( used in fog-of-war def's )
  40. {0, 0, 0, 128}, // 4 - shadow body ( used in battle, adventure map def's )
  41. {0, 0, 0, 0 }, // 5 - selection / owner flag ( used in battle, adventure map def's )
  42. {0, 0, 0, 128}, // 6 - shadow body below selection ( used in battle def's )
  43. {0, 0, 0, 64 } // 7 - shadow border below selection ( used in battle def's )
  44. }};
  45. static ui8 mixChannels(ui8 c1, ui8 c2, ui8 a1, ui8 a2)
  46. {
  47. return c1*a1 / 256 + c2*a2*(255 - a1) / 256 / 256;
  48. }
  49. static ColorRGBA addColors(const ColorRGBA & base, const ColorRGBA & over)
  50. {
  51. return ColorRGBA(
  52. mixChannels(over.r, base.r, over.a, base.a),
  53. mixChannels(over.g, base.g, over.a, base.a),
  54. mixChannels(over.b, base.b, over.a, base.a),
  55. static_cast<ui8>(over.a + base.a * (255 - over.a) / 256)
  56. );
  57. }
  58. static bool colorsSimilar (const SDL_Color & lhs, const SDL_Color & rhs)
  59. {
  60. // it seems that H3 does not requires exact match to replace colors -> (255, 103, 255) gets interpreted as shadow
  61. // exact logic is not clear and requires extensive testing with image editing
  62. // potential reason is that H3 uses 16-bit color format (565 RGB bits), meaning that 3 least significant bits are lost in red and blue component
  63. static const int threshold = 8;
  64. int diffR = static_cast<int>(lhs.r) - rhs.r;
  65. int diffG = static_cast<int>(lhs.g) - rhs.g;
  66. int diffB = static_cast<int>(lhs.b) - rhs.b;
  67. int diffA = static_cast<int>(lhs.a) - rhs.a;
  68. return std::abs(diffR) < threshold && std::abs(diffG) < threshold && std::abs(diffB) < threshold && std::abs(diffA) < threshold;
  69. }
  70. int IImage::width() const
  71. {
  72. return dimensions().x;
  73. }
  74. int IImage::height() const
  75. {
  76. return dimensions().y;
  77. }
  78. SDLImageShared::SDLImageShared(const CDefFile * data, size_t frame, size_t group, int preScaleFactor)
  79. : surf(nullptr),
  80. margins(0, 0),
  81. fullSize(0, 0),
  82. originalPalette(nullptr),
  83. preScaleFactor(preScaleFactor)
  84. {
  85. SDLImageLoader loader(this);
  86. data->loadFrame(frame, group, loader);
  87. savePalette();
  88. }
  89. SDLImageShared::SDLImageShared(SDL_Surface * from, int preScaleFactor)
  90. : surf(nullptr),
  91. margins(0, 0),
  92. fullSize(0, 0),
  93. originalPalette(nullptr),
  94. preScaleFactor(preScaleFactor)
  95. {
  96. surf = from;
  97. if (surf == nullptr)
  98. return;
  99. savePalette();
  100. surf->refcount++;
  101. fullSize.x = surf->w;
  102. fullSize.y = surf->h;
  103. }
  104. SDLImageShared::SDLImageShared(const ImagePath & filename, int preScaleFactor)
  105. : surf(nullptr),
  106. margins(0, 0),
  107. fullSize(0, 0),
  108. originalPalette(nullptr),
  109. preScaleFactor(preScaleFactor)
  110. {
  111. surf = BitmapHandler::loadBitmap(filename);
  112. if(surf == nullptr)
  113. {
  114. logGlobal->error("Error: failed to load image %s", filename.getOriginalName());
  115. return;
  116. }
  117. else
  118. {
  119. savePalette();
  120. fullSize.x = surf->w;
  121. fullSize.y = surf->h;
  122. }
  123. }
  124. void SDLImageShared::draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, const ColorRGBA & colorMultiplier, uint8_t alpha, EImageBlitMode mode) const
  125. {
  126. if (!surf)
  127. return;
  128. Rect sourceRect(0, 0, surf->w, surf->h);
  129. Point destShift(0, 0);
  130. if(src)
  131. {
  132. if(src->x < margins.x)
  133. destShift.x += margins.x - src->x;
  134. if(src->y < margins.y)
  135. destShift.y += margins.y - src->y;
  136. sourceRect = Rect(*src).intersect(Rect(margins.x, margins.y, surf->w, surf->h));
  137. sourceRect -= margins;
  138. }
  139. else
  140. destShift = margins;
  141. destShift += dest;
  142. SDL_SetSurfaceColorMod(surf, colorMultiplier.r, colorMultiplier.g, colorMultiplier.b);
  143. SDL_SetSurfaceAlphaMod(surf, alpha);
  144. if (alpha != SDL_ALPHA_OPAQUE || (mode != EImageBlitMode::OPAQUE && surf->format->Amask != 0))
  145. SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_BLEND);
  146. else
  147. SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
  148. if (palette && surf->format->palette)
  149. SDL_SetSurfacePalette(surf, palette);
  150. if(surf->format->palette && mode != EImageBlitMode::OPAQUE && mode != EImageBlitMode::COLORKEY)
  151. {
  152. CSDL_Ext::blit8bppAlphaTo24bpp(surf, sourceRect, where, destShift, alpha);
  153. }
  154. else
  155. {
  156. CSDL_Ext::blitSurface(surf, sourceRect, where, destShift);
  157. }
  158. if (surf->format->palette)
  159. SDL_SetSurfacePalette(surf, originalPalette);
  160. }
  161. void SDLImageShared::optimizeSurface()
  162. {
  163. if (!surf)
  164. return;
  165. int left = surf->w;
  166. int top = surf->h;
  167. int right = 0;
  168. int bottom = 0;
  169. // locate fully-transparent area around image
  170. // H3 hadles this on format level, but mods or images scaled in runtime do not
  171. if (surf->format->palette)
  172. {
  173. for (int y = 0; y < surf->h; ++y)
  174. {
  175. const uint8_t * row = static_cast<uint8_t *>(surf->pixels) + y * surf->pitch;
  176. for (int x = 0; x < surf->w; ++x)
  177. {
  178. if (row[x] != 0)
  179. {
  180. // opaque or can be opaque (e.g. disabled shadow)
  181. top = std::min(top, y);
  182. left = std::min(left, x);
  183. right = std::max(right, x);
  184. bottom = std::max(bottom, y);
  185. }
  186. }
  187. }
  188. }
  189. else
  190. {
  191. for (int y = 0; y < surf->h; ++y)
  192. {
  193. for (int x = 0; x < surf->w; ++x)
  194. {
  195. ColorRGBA color;
  196. SDL_GetRGBA(CSDL_Ext::getPixel(surf, x, y), surf->format, &color.r, &color.g, &color.b, &color.a);
  197. if (color.a != SDL_ALPHA_TRANSPARENT)
  198. {
  199. // opaque
  200. top = std::min(top, y);
  201. left = std::min(left, x);
  202. right = std::max(right, x);
  203. bottom = std::max(bottom, y);
  204. }
  205. }
  206. }
  207. }
  208. if (left == surf->w)
  209. {
  210. // empty image - simply delete it
  211. SDL_FreeSurface(surf);
  212. surf = nullptr;
  213. return;
  214. }
  215. if (left != 0 || top != 0 || right != surf->w - 1 || bottom != surf->h - 1)
  216. {
  217. // non-zero border found
  218. Rect newDimensions(left, top, right - left + 1, bottom - top + 1);
  219. SDL_Rect rectSDL = CSDL_Ext::toSDL(newDimensions);
  220. auto newSurface = CSDL_Ext::newSurface(newDimensions.dimensions(), surf);
  221. SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
  222. SDL_BlitSurface(surf, &rectSDL, newSurface, nullptr);
  223. SDL_FreeSurface(surf);
  224. surf = newSurface;
  225. margins.x += left;
  226. margins.y += top;
  227. }
  228. }
  229. std::shared_ptr<const ISharedImage> SDLImageShared::scaleInteger(int factor, SDL_Palette * palette) const
  230. {
  231. if (factor <= 0)
  232. throw std::runtime_error("Unable to scale by integer value of " + std::to_string(factor));
  233. if (palette && surf && surf->format->palette)
  234. SDL_SetSurfacePalette(surf, palette);
  235. SDL_Surface * scaled = nullptr;
  236. if(preScaleFactor == factor)
  237. return shared_from_this();
  238. else if(preScaleFactor == 1)
  239. scaled = CSDL_Ext::scaleSurfaceIntegerFactor(surf, factor, EScalingAlgorithm::XBRZ);
  240. else
  241. scaled = CSDL_Ext::scaleSurface(surf, (surf->w / preScaleFactor) * factor, (surf->h / preScaleFactor) * factor);
  242. auto ret = std::make_shared<SDLImageShared>(scaled, preScaleFactor);
  243. ret->fullSize.x = fullSize.x * factor;
  244. ret->fullSize.y = fullSize.y * factor;
  245. ret->margins.x = margins.x * factor;
  246. ret->margins.y = margins.y * factor;
  247. ret->optimizeSurface();
  248. // erase our own reference
  249. SDL_FreeSurface(scaled);
  250. if (surf && surf->format->palette)
  251. SDL_SetSurfacePalette(surf, originalPalette);
  252. return ret;
  253. }
  254. std::shared_ptr<const ISharedImage> SDLImageShared::scaleTo(const Point & size, SDL_Palette * palette) const
  255. {
  256. float scaleX = float(size.x) / fullSize.x;
  257. float scaleY = float(size.y) / fullSize.y;
  258. if (palette && surf->format->palette)
  259. SDL_SetSurfacePalette(surf, palette);
  260. auto scaled = CSDL_Ext::scaleSurface(surf, (int)(surf->w * scaleX), (int)(surf->h * scaleY));
  261. if (scaled->format && scaled->format->palette) // fix color keying, because SDL loses it at this point
  262. CSDL_Ext::setColorKey(scaled, scaled->format->palette->colors[0]);
  263. else if(scaled->format && scaled->format->Amask)
  264. SDL_SetSurfaceBlendMode(scaled, SDL_BLENDMODE_BLEND);//just in case
  265. else
  266. CSDL_Ext::setDefaultColorKey(scaled);//just in case
  267. auto ret = std::make_shared<SDLImageShared>(scaled, preScaleFactor);
  268. ret->fullSize.x = (int) round((float)fullSize.x * scaleX);
  269. ret->fullSize.y = (int) round((float)fullSize.y * scaleY);
  270. ret->margins.x = (int) round((float)margins.x * scaleX);
  271. ret->margins.y = (int) round((float)margins.y * scaleY);
  272. // erase our own reference
  273. SDL_FreeSurface(scaled);
  274. if (surf->format->palette)
  275. SDL_SetSurfacePalette(surf, originalPalette);
  276. return ret;
  277. }
  278. void SDLImageShared::exportBitmap(const boost::filesystem::path& path, SDL_Palette * palette) const
  279. {
  280. if (!surf)
  281. return;
  282. if (palette && surf->format->palette)
  283. SDL_SetSurfacePalette(surf, palette);
  284. IMG_SavePNG(surf, path.string().c_str());
  285. if (palette && surf->format->palette)
  286. SDL_SetSurfacePalette(surf, originalPalette);
  287. }
  288. void SDLImageIndexed::playerColored(PlayerColor player)
  289. {
  290. graphics->setPlayerPalette(currentPalette, player);
  291. }
  292. bool SDLImageShared::isTransparent(const Point & coords) const
  293. {
  294. if (surf)
  295. return CSDL_Ext::isTransparent(surf, coords.x, coords.y);
  296. else
  297. return true;
  298. }
  299. Point SDLImageShared::dimensions() const
  300. {
  301. return fullSize / preScaleFactor;
  302. }
  303. std::shared_ptr<IImage> SDLImageShared::createImageReference(EImageBlitMode mode) const
  304. {
  305. if (surf && surf->format->palette)
  306. return std::make_shared<SDLImageIndexed>(shared_from_this(), originalPalette, mode);
  307. else
  308. return std::make_shared<SDLImageRGB>(shared_from_this(), mode);
  309. }
  310. std::shared_ptr<const ISharedImage> SDLImageShared::horizontalFlip() const
  311. {
  312. SDL_Surface * flipped = CSDL_Ext::horizontalFlip(surf);
  313. auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
  314. ret->fullSize = fullSize;
  315. ret->margins.x = margins.x;
  316. ret->margins.y = fullSize.y - surf->h - margins.y;
  317. ret->fullSize = fullSize;
  318. return ret;
  319. }
  320. std::shared_ptr<const ISharedImage> SDLImageShared::verticalFlip() const
  321. {
  322. SDL_Surface * flipped = CSDL_Ext::verticalFlip(surf);
  323. auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
  324. ret->fullSize = fullSize;
  325. ret->margins.x = fullSize.x - surf->w - margins.x;
  326. ret->margins.y = margins.y;
  327. ret->fullSize = fullSize;
  328. return ret;
  329. }
  330. // Keep the original palette, in order to do color switching operation
  331. void SDLImageShared::savePalette()
  332. {
  333. // For some images that don't have palette, skip this
  334. if(surf->format->palette == nullptr)
  335. return;
  336. if(originalPalette == nullptr)
  337. originalPalette = SDL_AllocPalette(surf->format->palette->ncolors);
  338. SDL_SetPaletteColors(originalPalette, surf->format->palette->colors, 0, surf->format->palette->ncolors);
  339. }
  340. void SDLImageIndexed::shiftPalette(uint32_t firstColorID, uint32_t colorsToMove, uint32_t distanceToMove)
  341. {
  342. std::vector<SDL_Color> shifterColors(colorsToMove);
  343. for(uint32_t i=0; i<colorsToMove; ++i)
  344. shifterColors[(i+distanceToMove)%colorsToMove] = originalPalette->colors[firstColorID + i];
  345. SDL_SetPaletteColors(currentPalette, shifterColors.data(), firstColorID, colorsToMove);
  346. }
  347. void SDLImageIndexed::adjustPalette(const ColorFilter & shifter, uint32_t colorsToSkipMask)
  348. {
  349. // If shadow is enabled, following colors must be skipped unconditionally
  350. if (blitMode == EImageBlitMode::WITH_SHADOW || blitMode == EImageBlitMode::WITH_SHADOW_AND_OVERLAY)
  351. colorsToSkipMask |= (1 << 0) + (1 << 1) + (1 << 4);
  352. // Note: here we skip first colors in the palette that are predefined in H3 images
  353. for(int i = 0; i < currentPalette->ncolors; i++)
  354. {
  355. if (i < std::size(sourcePalette) && colorsSimilar(sourcePalette[i], originalPalette->colors[i]))
  356. continue;
  357. if(i < std::numeric_limits<uint32_t>::digits && ((colorsToSkipMask >> i) & 1) == 1)
  358. continue;
  359. currentPalette->colors[i] = CSDL_Ext::toSDL(shifter.shiftColor(CSDL_Ext::fromSDL(originalPalette->colors[i])));
  360. }
  361. }
  362. SDLImageIndexed::SDLImageIndexed(const std::shared_ptr<const ISharedImage> & image, SDL_Palette * originalPalette, EImageBlitMode mode)
  363. :SDLImageBase::SDLImageBase(image, mode)
  364. ,originalPalette(originalPalette)
  365. {
  366. currentPalette = SDL_AllocPalette(originalPalette->ncolors);
  367. SDL_SetPaletteColors(currentPalette, originalPalette->colors, 0, originalPalette->ncolors);
  368. preparePalette();
  369. }
  370. SDLImageIndexed::~SDLImageIndexed()
  371. {
  372. SDL_FreePalette(currentPalette);
  373. }
  374. void SDLImageIndexed::setShadowTransparency(float factor)
  375. {
  376. ColorRGBA shadow50(0, 0, 0, 128 * factor);
  377. ColorRGBA shadow25(0, 0, 0, 64 * factor);
  378. std::array<SDL_Color, 5> colorsSDL = {
  379. originalPalette->colors[0],
  380. originalPalette->colors[1],
  381. originalPalette->colors[2],
  382. originalPalette->colors[3],
  383. originalPalette->colors[4]
  384. };
  385. // seems to be used unconditionally
  386. colorsSDL[0] = CSDL_Ext::toSDL(Colors::TRANSPARENCY);
  387. colorsSDL[1] = CSDL_Ext::toSDL(shadow25);
  388. colorsSDL[4] = CSDL_Ext::toSDL(shadow50);
  389. // seems to be used only if color matches
  390. if (colorsSimilar(originalPalette->colors[2], sourcePalette[2]))
  391. colorsSDL[2] = CSDL_Ext::toSDL(shadow25);
  392. if (colorsSimilar(originalPalette->colors[3], sourcePalette[3]))
  393. colorsSDL[3] = CSDL_Ext::toSDL(shadow50);
  394. SDL_SetPaletteColors(currentPalette, colorsSDL.data(), 0, colorsSDL.size());
  395. }
  396. void SDLImageIndexed::setOverlayColor(const ColorRGBA & color)
  397. {
  398. currentPalette->colors[5] = CSDL_Ext::toSDL(addColors(targetPalette[5], color));
  399. for (int i : {6,7})
  400. {
  401. if (colorsSimilar(originalPalette->colors[i], sourcePalette[i]))
  402. currentPalette->colors[i] = CSDL_Ext::toSDL(addColors(targetPalette[i], color));
  403. }
  404. }
  405. void SDLImageIndexed::preparePalette()
  406. {
  407. switch(blitMode)
  408. {
  409. case EImageBlitMode::ONLY_SHADOW:
  410. case EImageBlitMode::ONLY_OVERLAY:
  411. adjustPalette(ColorFilter::genAlphaShifter(0), 0);
  412. break;
  413. }
  414. switch(blitMode)
  415. {
  416. case EImageBlitMode::SIMPLE:
  417. case EImageBlitMode::WITH_SHADOW:
  418. case EImageBlitMode::ONLY_SHADOW:
  419. case EImageBlitMode::WITH_SHADOW_AND_OVERLAY:
  420. setShadowTransparency(1.0);
  421. break;
  422. case EImageBlitMode::ONLY_BODY:
  423. case EImageBlitMode::ONLY_BODY_IGNORE_OVERLAY:
  424. case EImageBlitMode::ONLY_OVERLAY:
  425. setShadowTransparency(0.0);
  426. break;
  427. }
  428. switch(blitMode)
  429. {
  430. case EImageBlitMode::ONLY_OVERLAY:
  431. case EImageBlitMode::WITH_SHADOW_AND_OVERLAY:
  432. setOverlayColor(Colors::WHITE_TRUE);
  433. break;
  434. case EImageBlitMode::ONLY_SHADOW:
  435. case EImageBlitMode::ONLY_BODY:
  436. setOverlayColor(Colors::TRANSPARENCY);
  437. break;
  438. }
  439. }
  440. SDLImageShared::~SDLImageShared()
  441. {
  442. SDL_FreeSurface(surf);
  443. SDL_FreePalette(originalPalette);
  444. }
  445. SDLImageBase::SDLImageBase(const std::shared_ptr<const ISharedImage> & image, EImageBlitMode mode)
  446. :image(image)
  447. , alphaValue(SDL_ALPHA_OPAQUE)
  448. , blitMode(mode)
  449. {}
  450. std::shared_ptr<const ISharedImage> SDLImageBase::getSharedImage() const
  451. {
  452. return image;
  453. }
  454. void SDLImageRGB::draw(SDL_Surface * where, const Point & pos, const Rect * src) const
  455. {
  456. image->draw(where, nullptr, pos, src, Colors::WHITE_TRUE, alphaValue, blitMode);
  457. }
  458. void SDLImageIndexed::draw(SDL_Surface * where, const Point & pos, const Rect * src) const
  459. {
  460. image->draw(where, currentPalette, pos, src, Colors::WHITE_TRUE, alphaValue, blitMode);
  461. }
  462. void SDLImageIndexed::exportBitmap(const boost::filesystem::path & path) const
  463. {
  464. image->exportBitmap(path, currentPalette);
  465. }
  466. void SDLImageIndexed::scaleTo(const Point & size)
  467. {
  468. image = image->scaleTo(size, currentPalette);
  469. }
  470. void SDLImageRGB::scaleTo(const Point & size)
  471. {
  472. image = image->scaleTo(size, nullptr);
  473. }
  474. void SDLImageIndexed::scaleInteger(int factor)
  475. {
  476. image = image->scaleInteger(factor, currentPalette);
  477. }
  478. void SDLImageRGB::scaleInteger(int factor)
  479. {
  480. image = image->scaleInteger(factor, nullptr);
  481. }
  482. void SDLImageRGB::exportBitmap(const boost::filesystem::path & path) const
  483. {
  484. image->exportBitmap(path, nullptr);
  485. }
  486. bool SDLImageBase::isTransparent(const Point & coords) const
  487. {
  488. return image->isTransparent(coords);
  489. }
  490. Point SDLImageBase::dimensions() const
  491. {
  492. return image->dimensions();
  493. }
  494. void SDLImageBase::setAlpha(uint8_t value)
  495. {
  496. alphaValue = value;
  497. }
  498. void SDLImageBase::setBlitMode(EImageBlitMode mode)
  499. {
  500. blitMode = mode;
  501. }
  502. void SDLImageRGB::setOverlayColor(const ColorRGBA & color)
  503. {}
  504. void SDLImageRGB::playerColored(PlayerColor player)
  505. {}
  506. void SDLImageRGB::shiftPalette(uint32_t firstColorID, uint32_t colorsToMove, uint32_t distanceToMove)
  507. {}
  508. void SDLImageRGB::adjustPalette(const ColorFilter & shifter, uint32_t colorsToSkipMask)
  509. {}