¿Qué técnicas se utilizan para rotar un mapa de bits en lenguaje ensamblador?
Rotación de mapa de bits, llamada a función.
Implementación de la función (solo esta parte la escribió usted mismo, puede insertar lenguaje C en el ensamblado o puede convertirlo)
void RotateAnyAngle(HDC dcSrc, int SrcWidth, int SrcHeight, doble ángulo )
{
doble x1, x2, x3
doble y1, y2, y3
doble maxWidth; , maxHeight, minWidth , minHeight;
doble srcX, srcY;
doble sinA, cosA;
doble DstWidth;
doble DstHeight ;
HDC dcDst; // Entorno del dispositivo de memoria rotado
HBITMAP newBitmap;
sinA = sin(angle);
cosA = cos( ángulo);
x1 = -SrcHeight * sinA;
y1 = SrcHeight * cosA;
x2 = SrcWidth * cosA - SrcHeight * sinA;
y2 = SrcHeight * cosA SrcWidth * sinA;
x3 = SrcWidth * cosA
y3 = SrcWidth * sinA; x3gt; (x1gt; x2? x2: x1)? (x1gt; x2? (y1gt;y2?y2:y1)?(y1gt;y2?y2:y1):y3;
alturamin = alturamingt; 0?0:minHeight;
maxWidth = x3gt; (x1gt; x2?x1:x2)?x3: (x1gt; (y1gt;y2?y1:y2)?y3: (y1gt;y2?y1 :y2);
maxHeight = maxHeightgt;0?maxHeight:0;
DstWidth = maxWidth - minWidth
DstHeight = maxHeight - minHeight
dcDst = CreateCompatibleDC(dcSrc);
newBitmap = CreateCompatibleBitmap(dcSrc, (int)DstWidth, (int) DstHeight);
SelectObject(dcDst, newBitmap);
for( int I = 0; Ilt; DstHeight; I)
{
for(int J = 0; Jlt; DstWidth; J)
{
srcX = (J
minWidth) * cosA (I minHeight) * sinA;
srcY = (I minHeight) * cosA - (J minWidth) * sinA;
if( (srcX gt; = 0) amplificador; (srcX lt; = SrcWidth) amplificador; (srcY lt; = 0) amplificador (srcY lt; = SrcHeight))
{
BitBlt; (dcDst, J, I, 1, 1, dcSrc, (int)srcX, (int)srcY, SRCCOPY);
}
}
}