Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Design

Fast Bitmap Rotation and Scaling


July 2001/Fast Bitmap Rotation and Scaling/Listing 3

Listing 3: rotate.h — Interface to rotation functions

///////////////////////////////////////////////////////////////////
void Rotate(
    WORD *pDstBase, int dstW, int dstH, int dstDelta,
    WORD *pSrcBase, int srcW, int srcH, int srcDelta,
    float fDstRotCenterX, float fDstRotCenterY,
    float fSrcRotCenterX, float fSrcRotCenterY, 
    float fAngle, float fScale);

///////////////////////////////////////////////////////////////////
void FastRotate(
    WORD *pDstBase, int dstW, int dstH, int dstDelta,
    WORD *pSrcBase, int srcW, int srcH, int srcDelta,
    float fDstRotCenterX, float fDstRotCenterY,
    float fSrcRotCenterX, float fSrcRotCenterY, 
    float fAngle, float fScale);

///////////////////////////////////////////////////////////////////
void RotateWithClip(
    WORD *pDstBase, int dstW, int dstH, int dstDelta,
    WORD *pSrcBase, int srcW, int srcH, int srcDelta,
    float fDstRotCenterX, float fDstRotCenterY,
    float fSrcRotCenterX, float fSrcRotCenterY, 
    float fAngle, float fScale);
/* End of File */

Related Reading


More Insights




Deirdre Blake

The passage how now also been fixed in the text.

Andrew Binstock

Daniel Forslund was kind enough to pass along this suggestion:

"The passage reading: 'These two vectors are at right angles to each other:

duCol = sin(-angle) * (1.0 / scale)
dvCol = cos(-angle) * (1.0 / scale)
duRow = dvRow
dvRow =-duRow '

should be:

duCol = sin(-angle) * (1.0 / scale)
dvCol = cos(-angle) * (1.0 / scale)
duRow = dvCol
dvRow =-duCol

Thank you for a great resource!"