Add ability to export compressed image (WIP)
This commit is contained in:
parent
70f3f4f197
commit
f426402123
1 changed files with 19 additions and 9 deletions
|
@ -45,17 +45,27 @@ QuadTree::~QuadTree(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Surface * QuadTree::image(short niveau_p) {
|
SDL_Surface * QuadTree::image(short niveau_p) {
|
||||||
// Temporaire, créer une image noire
|
if(final || niveau == niveau_p) {
|
||||||
(void)niveau_p;
|
SDL_Surface * couleur_unie = SDL_CreateRGBSurface(0, dimensions.first, dimensions.second, 32, r_mask, g_mask, b_mask, a_mask);
|
||||||
SDL_Surface * nouvelle_image = SDL_CreateRGBSurface(0, dimensions.first, dimensions.second, 32, 0, 0, 0, 0);
|
if(SDL_LockSurface(couleur_unie) == 0) {
|
||||||
if(SDL_LockSurface(nouvelle_image) == 0) {
|
SDL_memset(couleur_unie->pixels, static_cast<int>(
|
||||||
SDL_memset(nouvelle_image->pixels, static_cast<int>(SDL_MapRGB(nouvelle_image->format, 0, 0, 0)), static_cast<size_t>(nouvelle_image->h * nouvelle_image->pitch));
|
SDL_MapRGB(couleur_unie->format, couleur.r, couleur.g, couleur.b)
|
||||||
SDL_UnlockSurface(nouvelle_image);
|
), static_cast<size_t>(couleur_unie->h * couleur_unie->pitch));
|
||||||
} else {
|
|
||||||
exit(1);
|
SDL_UnlockSurface(couleur_unie);
|
||||||
|
}
|
||||||
|
|
||||||
|
return couleur_unie;
|
||||||
}
|
}
|
||||||
|
|
||||||
return nouvelle_image;
|
return colleQuatreImages(
|
||||||
|
std::array<SDL_Surface *, 4>{
|
||||||
|
nord_ouest->image(niveau_p),
|
||||||
|
sud_ouest->image(niveau_p),
|
||||||
|
nord_est->image(niveau_p),
|
||||||
|
sud_est->image(niveau_p)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_Color QuadTree::calculeCouleur(SDL_Surface * s) {
|
SDL_Color QuadTree::calculeCouleur(SDL_Surface * s) {
|
||||||
|
|
Reference in a new issue