windows系统下,可以使用StretchDIBits将一个与设备无关点阵图放大或者缩小的方式显示出来。
StretchDIBits的原型为:
iLines = StretchDIBits (
hdc, // device context handle
xDst, // x destination coordinate
yDst, // y destination coordinate
cxDst, // destination rectangle width
cyDst, // destination rectangle height
xSrc, // x source coordinate
ySrc, // y source coordinate
cxSrc, // source rectangle width
cySrc, // source rectangle height
pBits, // pointer to DIB pixel bits
pInfo, // pointer to DIB information
fClrUse, // color use flag
dwRop) ; // raster operation
在windows里,图像的坐标远点是位于左上角,向右为X递增,向下为Y递增。设定图像位置的时候,先确定显示的坐标点,也就是(xDst, yDst),然后设定cxDst和cyDst,这两个参数可以改变符号,改变一次符号意味着图像的方向改变一次。例如高度,如果为正的话,图像显示的时候从上往下绘图,如果为负的话从下往上绘图。一定要把坐标和方向结合起来设置,否则图像显示会出问题。