// Essentially, a StretchBlt, but draws cicular pels.
BOOL CircleBlt (HDC hdcDest, int xDst, int yDst, int iWidthDst, int iHeightDst, HDC hdcSrc, int xSrc, int ySrc, int iWidthSrc, int iHeightSrc, DWORD dwROP)
{
int x, y, x1, y1, x2, y2;
DWORD rgb;
float fXUnit, fYUnit;
HBRUSH hbrush, hbrushOld;
if (iWidthSrc != 0){
fXUnit = (float)iWidthDst / (float)iWidthSrc;
} else {
fXUnit = (float)iWidthDst;
}
if (iHeightSrc != 0) {
fYUnit = (float)iHeightDst / (float)iHeightSrc;
} else {
fYUnit = (float)iHeightDst;
}
for (y=ySrc; y<(ySrc+iHeightSrc); y++) {
for (x=xSrc; x<(xSrc+iWidthSrc); x++) {
rgb = GetPixel (hdcSrc, x, y);
if (rgb != -1 && rgb != 0x00FFFFFF) {
hbrush = CreateSolidBrush (rgb);
hbrushOld = SelectObject (hdcDest, hbrush);
x1 = xDst + (int)((x-xSrc)*fXUnit);
y1 = yDst + (int)((y-ySrc)*fYUnit);
x2 = xDst + (int)(((x-xSrc)+1)*fXUnit)+1;
y2 = yDst + (int)(((y-ySrc)+1)*fYUnit)+1;
Ellipse (hdcDest, x1, y1, x2, y2);
DeleteObject(SelectObject(hdcDest, hbrushOld));
}
}
}
return TRUE;
dwROP;
}
double Radian(double ang)
{
return ang * (double)3.1415926535 / (double)180.0;