SDLImageLoader.h 815 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * SDLImageLoader.h, 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. #pragma once
  11. #include "../render/IImageLoader.h"
  12. class SDLImageShared;
  13. class SDLImageLoader : public IImageLoader
  14. {
  15. static constexpr int DEFAULT_PALETTE_COLORS = 256;
  16. SDLImageShared * image;
  17. ui8 * lineStart;
  18. ui8 * position;
  19. public:
  20. //load size raw pixels from data
  21. void load(size_t size, const ui8 * data);
  22. //set size pixels to color
  23. void load(size_t size, ui8 color=0);
  24. void endLine();
  25. //init image with these sizes and palette
  26. void init(Point SpriteSize, Point Margins, Point FullSize, SDL_Color *pal);
  27. SDLImageLoader(SDLImageShared * Img);
  28. ~SDLImageLoader();
  29. };