j'aimerais reussir à collé une vignette (120*90) dans un bitmap carre (120*120), qui soit centré et dont les bord hors vignette soient transparents.
J'ai essayé de le codé avec le code ci-dessous mais les bords ne sont toujours pas transparents.
Code: Select all
GFL_BITMAP * GFL_tmp;
int max = width;
int xDest;
int yDest;
GFL_RECT rect;
GFL_COLOR color;
//centrage de l'image
if (height > width)
{
max = height;
yDest = 0;
xDest = (height - width)/2;
}
else
{
yDest = (width - height)/2;
xDest = 0;
}
//Création du Bitmap vide
color.Red=255;
color.Blue=255;
color.Green=255;
color.Alpha=0;
GFL_tmp = gflAllockBitmap(GFL_RGBA,
max,
max,
4,
&color);
//On redimentionne le bitmap
ResizeImage();
rect.x = 0;
rect.y = 0;
rect.w = width;
rect.h = height;
//Copie de l'image mini dans le carre
gflBitblt(GFL_Image,
&rect,
GFL_tmp,
xDest,
yDest);
GFL_Image = gflCloneBitmap(GFL_tmp);
//Creation du contour de l'image
color.Red=0;
color.Blue=0;
color.Green=0;
DrawRectangleColor(max, max, &color);
//Sauvegarde de l'image PNG
SaveImageJPG(_compress_);
//Supression du BMP temporaire
gflFreeBitmap(GFL_tmp);
merci