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