Programación de conversión
{
//Crear un DC de memoria compatible con la pantalla
CDC sourceDC, destDC
sourceDC. CreateCompatibleDC(NULL);
destDC. CreateCompatibleDC(NULL); //Obtener coordenadas lógicas
Bitmap BM;
* GetObject(hbit map, sizeof(bm), ampBM coseno = (punto flotante) cos; (radianes/180 * PI);
seno flotante = (flotante)sin(radianes/180 * PI); int x 1 =(int)(BM . Altura BM * seno);
int y1 = (int)(bm.bmHeight *coseno);
int x2 = (int)(bm.bmWidth *coseno bm.bmHeight *seno);
int y2 = (int)(bm.bmHeight *coseno - bm.bmWidth *seno);
int x3 = (int)(bm.bmWidth *coseno);
int y3 =(int)(-BM . Ancho BM * seno); int minx = min(0, min(x1, min(x2, x3));
int miny = min(0, min( y1) , min(y2, y3)));
int maxx = max(0, max(x1, max(x2, x3)));
int maxy = max( 0 , max(y1, max(y2, y3))); int w = maxx-minx;
int h = maxy-miny; //Crea un mapa de bits para guardar el resultado
mapa de hbit hbm resultado =::CreateCompatibleBitmap(CClientDC(NULL),w,h);mapa de hbit hbmOldSource =(mapa de hbit)::select object(sourcedc.m_hDC,hbitmap);
mapa de hbit hbmoldest = (hbit map)::select object(dest DC . m _ hDC, hbm result); // Dibuja el color de fondo antes de cambiar el modo de mapeo
HBRUSH HBR back = CreateSolidBrush(clr back);
HBRUSH hbrOld = (HBRUSH)::select object(dest DC . m_hDC, HBR back);
destDC.
PatBlt(0, 0, w, h, pat copy);
* eliminar objeto(::select object(dest DC . m _ hDC, HB rold)); para rotar mapa de bits
SetGraphicsMode(destDC.m_hDC, GM_ADVANCED);
XFORM xform
xform.eM11 = coseno;
xform . em 12 =-seno;
xform.eM21 =seno;
xform.eM22 =coseno;
xform.EDX =(flotador)-minx ;
xform . edy = (float)-miny; SetWorldTransform(destDC.m_hDC, ampxform); //Ahora para la rotación real: un píxel a la vez
destDC. BitBlt(0, 0, bm.bmWidth, bm.bmHeight, ampsourceDC, 0, 0, src copy); nWidth[m_count]=BM.BM width;
n altura[m_count] = BM. altura; //Restaurar DC
* seleccionar objeto(sourcedc . m _ hDC, hbmOldSource
* seleccionar objeto (dest DC . m _ hDC, hbmoldest) ;Devolver hbmResult
}