SDLImage.cpp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627
  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. optimizeSurface();
  123. }
  124. }
  125. void SDLImageShared::draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, const ColorRGBA & colorMultiplier, uint8_t alpha, EImageBlitMode mode) const
  126. {
  127. if (!surf)
  128. return;
  129. Rect sourceRect(0, 0, surf->w, surf->h);
  130. Point destShift(0, 0);
  131. if(src)
  132. {
  133. if(src->x < margins.x)
  134. destShift.x += margins.x - src->x;
  135. if(src->y < margins.y)
  136. destShift.y += margins.y - src->y;
  137. sourceRect = Rect(*src).intersect(Rect(margins.x, margins.y, surf->w, surf->h));
  138. sourceRect -= margins;
  139. }
  140. else
  141. destShift = margins;
  142. destShift += dest;
  143. SDL_SetSurfaceColorMod(surf, colorMultiplier.r, colorMultiplier.g, colorMultiplier.b);
  144. SDL_SetSurfaceAlphaMod(surf, alpha);
  145. if (alpha != SDL_ALPHA_OPAQUE || (mode != EImageBlitMode::OPAQUE && surf->format->Amask != 0))
  146. SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_BLEND);
  147. else
  148. SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
  149. if (palette && surf->format->palette)
  150. SDL_SetSurfacePalette(surf, palette);
  151. if(surf->format->palette && mode != EImageBlitMode::OPAQUE && mode != EImageBlitMode::COLORKEY)
  152. {
  153. CSDL_Ext::blit8bppAlphaTo24bpp(surf, sourceRect, where, destShift, alpha);
  154. }
  155. else
  156. {
  157. CSDL_Ext::blitSurface(surf, sourceRect, where, destShift);
  158. }
  159. if (surf->format->palette)
  160. SDL_SetSurfacePalette(surf, originalPalette);
  161. }
  162. void SDLImageShared::optimizeSurface()
  163. {
  164. if (!surf)
  165. return;
  166. int left = surf->w;
  167. int top = surf->h;
  168. int right = 0;
  169. int bottom = 0;
  170. // locate fully-transparent area around image
  171. // H3 hadles this on format level, but mods or images scaled in runtime do not
  172. if (surf->format->palette)
  173. {
  174. for (int y = 0; y < surf->h; ++y)
  175. {
  176. const uint8_t * row = static_cast<uint8_t *>(surf->pixels) + y * surf->pitch;
  177. for (int x = 0; x < surf->w; ++x)
  178. {
  179. if (row[x] != 0)
  180. {
  181. // opaque or can be opaque (e.g. disabled shadow)
  182. top = std::min(top, y);
  183. left = std::min(left, x);
  184. right = std::max(right, x);
  185. bottom = std::max(bottom, y);
  186. }
  187. }
  188. }
  189. }
  190. else
  191. {
  192. for (int y = 0; y < surf->h; ++y)
  193. {
  194. for (int x = 0; x < surf->w; ++x)
  195. {
  196. ColorRGBA color;
  197. SDL_GetRGBA(CSDL_Ext::getPixel(surf, x, y), surf->format, &color.r, &color.g, &color.b, &color.a);
  198. if (color.a != SDL_ALPHA_TRANSPARENT)
  199. {
  200. // opaque
  201. top = std::min(top, y);
  202. left = std::min(left, x);
  203. right = std::max(right, x);
  204. bottom = std::max(bottom, y);
  205. }
  206. }
  207. }
  208. }
  209. if (left == surf->w)
  210. {
  211. // empty image - simply delete it
  212. SDL_FreeSurface(surf);
  213. surf = nullptr;
  214. return;
  215. }
  216. if (left != 0 || top != 0 || right != surf->w - 1 || bottom != surf->h - 1)
  217. {
  218. // non-zero border found
  219. Rect newDimensions(left, top, right - left + 1, bottom - top + 1);
  220. SDL_Rect rectSDL = CSDL_Ext::toSDL(newDimensions);
  221. auto newSurface = CSDL_Ext::newSurface(newDimensions.dimensions(), surf);
  222. SDL_SetSurfaceBlendMode(surf, SDL_BLENDMODE_NONE);
  223. SDL_BlitSurface(surf, &rectSDL, newSurface, nullptr);
  224. SDL_FreeSurface(surf);
  225. surf = newSurface;
  226. margins.x += left;
  227. margins.y += top;
  228. }
  229. }
  230. std::shared_ptr<const ISharedImage> SDLImageShared::scaleInteger(int factor, SDL_Palette * palette) const
  231. {
  232. if (factor <= 0)
  233. throw std::runtime_error("Unable to scale by integer value of " + std::to_string(factor));
  234. if (palette && surf && surf->format->palette)
  235. SDL_SetSurfacePalette(surf, palette);
  236. SDL_Surface * scaled = nullptr;
  237. if(preScaleFactor == factor)
  238. return shared_from_this();
  239. else if(preScaleFactor == 1)
  240. scaled = CSDL_Ext::scaleSurfaceIntegerFactor(surf, factor, EScalingAlgorithm::XBRZ);
  241. else
  242. scaled = CSDL_Ext::scaleSurface(surf, (surf->w / preScaleFactor) * factor, (surf->h / preScaleFactor) * factor);
  243. auto ret = std::make_shared<SDLImageShared>(scaled, preScaleFactor);
  244. ret->fullSize.x = fullSize.x * factor;
  245. ret->fullSize.y = fullSize.y * factor;
  246. ret->margins.x = margins.x * factor;
  247. ret->margins.y = margins.y * factor;
  248. ret->optimizeSurface();
  249. // erase our own reference
  250. SDL_FreeSurface(scaled);
  251. if (surf && surf->format->palette)
  252. SDL_SetSurfacePalette(surf, originalPalette);
  253. return ret;
  254. }
  255. std::shared_ptr<const ISharedImage> SDLImageShared::scaleTo(const Point & size, SDL_Palette * palette) const
  256. {
  257. float scaleX = float(size.x) / fullSize.x;
  258. float scaleY = float(size.y) / fullSize.y;
  259. if (palette && surf->format->palette)
  260. SDL_SetSurfacePalette(surf, palette);
  261. auto scaled = CSDL_Ext::scaleSurface(surf, (int)(surf->w * scaleX), (int)(surf->h * scaleY));
  262. if (scaled->format && scaled->format->palette) // fix color keying, because SDL loses it at this point
  263. CSDL_Ext::setColorKey(scaled, scaled->format->palette->colors[0]);
  264. else if(scaled->format && scaled->format->Amask)
  265. SDL_SetSurfaceBlendMode(scaled, SDL_BLENDMODE_BLEND);//just in case
  266. else
  267. CSDL_Ext::setDefaultColorKey(scaled);//just in case
  268. auto ret = std::make_shared<SDLImageShared>(scaled, preScaleFactor);
  269. ret->fullSize.x = (int) round((float)fullSize.x * scaleX);
  270. ret->fullSize.y = (int) round((float)fullSize.y * scaleY);
  271. ret->margins.x = (int) round((float)margins.x * scaleX);
  272. ret->margins.y = (int) round((float)margins.y * scaleY);
  273. // erase our own reference
  274. SDL_FreeSurface(scaled);
  275. if (surf->format->palette)
  276. SDL_SetSurfacePalette(surf, originalPalette);
  277. return ret;
  278. }
  279. void SDLImageShared::exportBitmap(const boost::filesystem::path& path, SDL_Palette * palette) const
  280. {
  281. if (!surf)
  282. return;
  283. if (palette && surf->format->palette)
  284. SDL_SetSurfacePalette(surf, palette);
  285. IMG_SavePNG(surf, path.string().c_str());
  286. if (palette && surf->format->palette)
  287. SDL_SetSurfacePalette(surf, originalPalette);
  288. }
  289. void SDLImageIndexed::playerColored(PlayerColor player)
  290. {
  291. graphics->setPlayerPalette(currentPalette, player);
  292. }
  293. bool SDLImageShared::isTransparent(const Point & coords) const
  294. {
  295. if (surf)
  296. return CSDL_Ext::isTransparent(surf, coords.x, coords.y);
  297. else
  298. return true;
  299. }
  300. Point SDLImageShared::dimensions() const
  301. {
  302. return fullSize / preScaleFactor;
  303. }
  304. std::shared_ptr<IImage> SDLImageShared::createImageReference(EImageBlitMode mode) const
  305. {
  306. if (surf && surf->format->palette)
  307. return std::make_shared<SDLImageIndexed>(shared_from_this(), originalPalette, mode);
  308. else
  309. return std::make_shared<SDLImageRGB>(shared_from_this(), mode);
  310. }
  311. std::shared_ptr<const ISharedImage> SDLImageShared::horizontalFlip() const
  312. {
  313. SDL_Surface * flipped = CSDL_Ext::horizontalFlip(surf);
  314. auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
  315. ret->fullSize = fullSize;
  316. ret->margins.x = margins.x;
  317. ret->margins.y = fullSize.y - surf->h - margins.y;
  318. ret->fullSize = fullSize;
  319. return ret;
  320. }
  321. std::shared_ptr<const ISharedImage> SDLImageShared::verticalFlip() const
  322. {
  323. SDL_Surface * flipped = CSDL_Ext::verticalFlip(surf);
  324. auto ret = std::make_shared<SDLImageShared>(flipped, preScaleFactor);
  325. ret->fullSize = fullSize;
  326. ret->margins.x = fullSize.x - surf->w - margins.x;
  327. ret->margins.y = margins.y;
  328. ret->fullSize = fullSize;
  329. return ret;
  330. }
  331. // Keep the original palette, in order to do color switching operation
  332. void SDLImageShared::savePalette()
  333. {
  334. // For some images that don't have palette, skip this
  335. if(surf->format->palette == nullptr)
  336. return;
  337. if(originalPalette == nullptr)
  338. originalPalette = SDL_AllocPalette(surf->format->palette->ncolors);
  339. SDL_SetPaletteColors(originalPalette, surf->format->palette->colors, 0, surf->format->palette->ncolors);
  340. }
  341. void SDLImageIndexed::shiftPalette(uint32_t firstColorID, uint32_t colorsToMove, uint32_t distanceToMove)
  342. {
  343. std::vector<SDL_Color> shifterColors(colorsToMove);
  344. for(uint32_t i=0; i<colorsToMove; ++i)
  345. shifterColors[(i+distanceToMove)%colorsToMove] = originalPalette->colors[firstColorID + i];
  346. SDL_SetPaletteColors(currentPalette, shifterColors.data(), firstColorID, colorsToMove);
  347. }
  348. void SDLImageIndexed::adjustPalette(const ColorFilter & shifter, uint32_t colorsToSkipMask)
  349. {
  350. // If shadow is enabled, following colors must be skipped unconditionally
  351. if (blitMode == EImageBlitMode::WITH_SHADOW || blitMode == EImageBlitMode::WITH_SHADOW_AND_OVERLAY)
  352. colorsToSkipMask |= (1 << 0) + (1 << 1) + (1 << 4);
  353. // Note: here we skip first colors in the palette that are predefined in H3 images
  354. for(int i = 0; i < currentPalette->ncolors; i++)
  355. {
  356. if (i < std::size(sourcePalette) && colorsSimilar(sourcePalette[i], originalPalette->colors[i]))
  357. continue;
  358. if(i < std::numeric_limits<uint32_t>::digits && ((colorsToSkipMask >> i) & 1) == 1)
  359. continue;
  360. currentPalette->colors[i] = CSDL_Ext::toSDL(shifter.shiftColor(CSDL_Ext::fromSDL(originalPalette->colors[i])));
  361. }
  362. }
  363. SDLImageIndexed::SDLImageIndexed(const std::shared_ptr<const ISharedImage> & image, SDL_Palette * originalPalette, EImageBlitMode mode)
  364. :SDLImageBase::SDLImageBase(image, mode)
  365. ,originalPalette(originalPalette)
  366. {
  367. currentPalette = SDL_AllocPalette(originalPalette->ncolors);
  368. SDL_SetPaletteColors(currentPalette, originalPalette->colors, 0, originalPalette->ncolors);
  369. preparePalette();
  370. }
  371. SDLImageIndexed::~SDLImageIndexed()
  372. {
  373. SDL_FreePalette(currentPalette);
  374. }
  375. void SDLImageIndexed::setShadowTransparency(float factor)
  376. {
  377. ColorRGBA shadow50(0, 0, 0, 128 * factor);
  378. ColorRGBA shadow25(0, 0, 0, 64 * factor);
  379. std::array<SDL_Color, 5> colorsSDL = {
  380. originalPalette->colors[0],
  381. originalPalette->colors[1],
  382. originalPalette->colors[2],
  383. originalPalette->colors[3],
  384. originalPalette->colors[4]
  385. };
  386. // seems to be used unconditionally
  387. colorsSDL[0] = CSDL_Ext::toSDL(Colors::TRANSPARENCY);
  388. colorsSDL[1] = CSDL_Ext::toSDL(shadow25);
  389. colorsSDL[4] = CSDL_Ext::toSDL(shadow50);
  390. // seems to be used only if color matches
  391. if (colorsSimilar(originalPalette->colors[2], sourcePalette[2]))
  392. colorsSDL[2] = CSDL_Ext::toSDL(shadow25);
  393. if (colorsSimilar(originalPalette->colors[3], sourcePalette[3]))
  394. colorsSDL[3] = CSDL_Ext::toSDL(shadow50);
  395. SDL_SetPaletteColors(currentPalette, colorsSDL.data(), 0, colorsSDL.size());
  396. }
  397. void SDLImageIndexed::setOverlayColor(const ColorRGBA & color)
  398. {
  399. currentPalette->colors[5] = CSDL_Ext::toSDL(addColors(targetPalette[5], color));
  400. for (int i : {6,7})
  401. {
  402. if (colorsSimilar(originalPalette->colors[i], sourcePalette[i]))
  403. currentPalette->colors[i] = CSDL_Ext::toSDL(addColors(targetPalette[i], color));
  404. }
  405. }
  406. void SDLImageIndexed::preparePalette()
  407. {
  408. switch(blitMode)
  409. {
  410. case EImageBlitMode::ONLY_SHADOW:
  411. case EImageBlitMode::ONLY_OVERLAY:
  412. adjustPalette(ColorFilter::genAlphaShifter(0), 0);
  413. break;
  414. }
  415. switch(blitMode)
  416. {
  417. case EImageBlitMode::SIMPLE:
  418. case EImageBlitMode::WITH_SHADOW:
  419. case EImageBlitMode::ONLY_SHADOW:
  420. case EImageBlitMode::WITH_SHADOW_AND_OVERLAY:
  421. setShadowTransparency(1.0);
  422. break;
  423. case EImageBlitMode::ONLY_BODY:
  424. case EImageBlitMode::ONLY_BODY_IGNORE_OVERLAY:
  425. case EImageBlitMode::ONLY_OVERLAY:
  426. setShadowTransparency(0.0);
  427. break;
  428. }
  429. switch(blitMode)
  430. {
  431. case EImageBlitMode::ONLY_OVERLAY:
  432. case EImageBlitMode::WITH_SHADOW_AND_OVERLAY:
  433. setOverlayColor(Colors::WHITE_TRUE);
  434. break;
  435. case EImageBlitMode::ONLY_SHADOW:
  436. case EImageBlitMode::ONLY_BODY:
  437. setOverlayColor(Colors::TRANSPARENCY);
  438. break;
  439. }
  440. }
  441. SDLImageShared::~SDLImageShared()
  442. {
  443. SDL_FreeSurface(surf);
  444. SDL_FreePalette(originalPalette);
  445. }
  446. SDLImageBase::SDLImageBase(const std::shared_ptr<const ISharedImage> & image, EImageBlitMode mode)
  447. :image(image)
  448. , alphaValue(SDL_ALPHA_OPAQUE)
  449. , blitMode(mode)
  450. {}
  451. std::shared_ptr<const ISharedImage> SDLImageBase::getSharedImage() const
  452. {
  453. return image;
  454. }
  455. void SDLImageRGB::draw(SDL_Surface * where, const Point & pos, const Rect * src) const
  456. {
  457. image->draw(where, nullptr, pos, src, Colors::WHITE_TRUE, alphaValue, blitMode);
  458. }
  459. void SDLImageIndexed::draw(SDL_Surface * where, const Point & pos, const Rect * src) const
  460. {
  461. image->draw(where, currentPalette, pos, src, Colors::WHITE_TRUE, alphaValue, blitMode);
  462. }
  463. void SDLImageIndexed::exportBitmap(const boost::filesystem::path & path) const
  464. {
  465. image->exportBitmap(path, currentPalette);
  466. }
  467. void SDLImageIndexed::scaleTo(const Point & size)
  468. {
  469. image = image->scaleTo(size, currentPalette);
  470. }
  471. void SDLImageRGB::scaleTo(const Point & size)
  472. {
  473. image = image->scaleTo(size, nullptr);
  474. }
  475. void SDLImageIndexed::scaleInteger(int factor)
  476. {
  477. image = image->scaleInteger(factor, currentPalette);
  478. }
  479. void SDLImageRGB::scaleInteger(int factor)
  480. {
  481. image = image->scaleInteger(factor, nullptr);
  482. }
  483. void SDLImageRGB::exportBitmap(const boost::filesystem::path & path) const
  484. {
  485. image->exportBitmap(path, nullptr);
  486. }
  487. bool SDLImageBase::isTransparent(const Point & coords) const
  488. {
  489. return image->isTransparent(coords);
  490. }
  491. Point SDLImageBase::dimensions() const
  492. {
  493. return image->dimensions();
  494. }
  495. void SDLImageBase::setAlpha(uint8_t value)
  496. {
  497. alphaValue = value;
  498. }
  499. void SDLImageBase::setBlitMode(EImageBlitMode mode)
  500. {
  501. blitMode = mode;
  502. }
  503. void SDLImageRGB::setOverlayColor(const ColorRGBA & color)
  504. {}
  505. void SDLImageRGB::playerColored(PlayerColor player)
  506. {}
  507. void SDLImageRGB::shiftPalette(uint32_t firstColorID, uint32_t colorsToMove, uint32_t distanceToMove)
  508. {}
  509. void SDLImageRGB::adjustPalette(const ColorFilter & shifter, uint32_t colorsToSkipMask)
  510. {}