Decouper un gos bmp en plusieur petit (par rapport au handle) ????
SnOOpss
Messages postés571Date d'inscriptionsamedi 3 avril 2004StatutMembreDernière intervention 5 décembre 2013
-
16 avril 2004 à 15:23
cs_JCDjcd
Messages postés1138Date d'inscriptionmardi 10 juin 2003StatutMembreDernière intervention25 janvier 2009
-
16 avril 2004 à 16:53
Bonjour tout le monde !!
Voila en fait pr un RPG mon moteur 2d utilise le procedure suivante
fichierbmp[0] = LoadABitmap("wall.bmp");
avec
HBITMAP LoadABitmap(LPSTR szFileName)
{
return (HBITMAP)LoadImage(NULL, szFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
}
Et il me reste plus qu'a faire le tableau avec les handle des bitmaps. Le probleme c'est que ca m'oblige a avoir plusieurs bmp, donc ma solution a été d'essayer de faire un gros bmp pour que le programme decoupe plusieurs petit bmp dedans
ca aurait donné
gros = LoadABitmap("wall.bmp");
petit = getbmp(gros,0,0,32,32);
avec
HBITMAP getbmp(HBITMAP hSourceBitmap,int x,int y,int w,int h)
{
HBITMAP tmp;
tmp = CreateCompatibleBitmap(hSourceBitmap,w,h);
bool a = BitBlt(tmp, 0, 0,w,h,hSourceBitmap, x, y, SRCCOPY);
if (a==0) { ShowMessage(GetLastError());}
// avec la ligne precedente j'obtient l'erreur numero 87 sous W98 et 6 sous XP!!!!
GetObject(hSourceBitmap, sizeof(BITMAP), (LPSTR)&SrcBitmap);
int planes = SrcBitmap.bmPlanes;
int pixel = SrcBitmap.bmBitsPixel;
tmp = CreateBitmap(w,h,planes,pixel,NULL);
bool a = BitBlt(tmp, 0, 0,w,h,hSourceBitmap, x, y, SRCCOPY);
if (a==0) { ShowMessage(GetLastError());}
// avec la ligne precedente j'obtient l'erreur numero 87 sous W98 et 6 sous XP!!!!
return tmp;
}
Et evidement aucun des 2 ne marchent !!
Si quelqu'un voyait mon erreur ...............
A voir également:
Decouper un gos bmp en plusieur petit (par rapport au handle) ????