Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned width_max, height_max;
- width_max = picture->width();
- height_max = picture->height();
- for (unsigned i=0 ; i<num_ ; i++)
- {
- width_max = max(width_max, xPos[i]+stickers[i]->width());
- height_max = max(height_max, yPos[i]+stickers[i]->height());
- }
- Image output;
- output.resize(width_max, height_max);
- //copy the images
- for (unsigned x = 0; x < picture->width(); x++)
- for (unsigned y = 0; y < picture->height(); y++) {
- HSLAPixel & pixel = picture->getPixel(x, y);
- HSLAPixel & out = output.getPixel(x, y);
- out = pixel;
- }
- for (unsigned i=0; i<num_ ; i++)
- {
- for (unsigned x = xPos[i]; x < xPos[i] + stickers[i]->width() ; x++)
- for (unsigned y = yPos[i]; y < yPos[i] + stickers[i]->height() ; y++) {
- HSLAPixel & pixel = stickers[i]->getPixel(x-xPos[i], y-yPos[i]);
- HSLAPixel & out = output.getPixel(x, y);
- if (pixel.a != 0)
- {
- out = pixel;
- }
- }
- }
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement