SHARE
TWEET

Untitled

a guest Feb 11th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unsigned width_max, height_max;
  2. width_max = picture->width();
  3. height_max = picture->height();
  4. for (unsigned i=0 ; i<num_ ; i++)
  5. {
  6.   width_max = max(width_max, xPos[i]+stickers[i]->width());
  7.   height_max = max(height_max, yPos[i]+stickers[i]->height());
  8. }
  9. Image output;
  10. output.resize(width_max, height_max);
  11. //copy the images
  12. for (unsigned x = 0; x < picture->width(); x++)
  13. for (unsigned y = 0; y < picture->height(); y++) {     
  14.   HSLAPixel & pixel = picture->getPixel(x, y);
  15.   HSLAPixel & out = output.getPixel(x, y);
  16.   out = pixel;
  17. }
  18. for (unsigned i=0; i<num_ ; i++)
  19. {
  20.   for (unsigned x = xPos[i]; x < xPos[i] + stickers[i]->width() ; x++)
  21.   for (unsigned y = yPos[i]; y < yPos[i] + stickers[i]->height() ; y++) {      
  22.     HSLAPixel & pixel = stickers[i]->getPixel(x-xPos[i], y-yPos[i]);
  23.     HSLAPixel & out = output.getPixel(x, y);
  24.     if (pixel.a != 0)
  25.     {
  26.       out = pixel;
  27.     }
  28.   }
  29. }
  30. return output;
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top