Open Source Tomb Raider Engine
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pixel.cpp 601B

12345678910111213141516171819202122232425
  1. /*!
  2. * \file src/utils/pixel.cpp
  3. * \brief Pixel buffer utilities
  4. *
  5. * \author xythobuz
  6. */
  7. #include "global.h"
  8. #include "utils/pixel.h"
  9. void argb2rgba32(unsigned char *image, unsigned int w, unsigned int h) {
  10. assert(image != nullptr);
  11. assert(w > 0);
  12. assert(h > 0);
  13. for (unsigned int i = 0; i < (w * h); ++i) {
  14. /* 32-bit ARGB to RGBA */
  15. unsigned char swap = image[(i * 4) + 3];
  16. image[(i * 4)] = image[(i * 4) + 1];
  17. image[(i * 4) + 1] = image[(i * 4) + 2];
  18. image[(i * 4) + 2] = image[(i * 4) + 3];
  19. image[(i * 4) + 3] = swap;
  20. }
  21. }