1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
template<class T>
void CSuperImage<T>::Draw(CDC* pDC, const unsigned int &unViewWidth, const unsigned int &unViewHeight, const float &fZoom) const
{
CDC MemDC;
CBitmap Bitmap;
CSuperImage<T> Temp(get_resize2D(fZoom, 1));
MemDC.CreateCompatibleDC(pDC);// creation d'un DC en memoire
Bitmap.CreateCompatibleBitmap(pDC,Temp.width + 2, Temp.height + 2);
MemDC.SelectObject(&Bitmap);
for (unsigned int x(0) ; x < Temp.width ; x++)
for (unsigned int y(0) ; y < Temp.height ; y++)
{
MemDC.SetPixel(x + 1, y + 1, RGB(Temp(x,y,0,0), Temp(x,y,0,1), Temp(x,y,0,2)));
}
pDC->BitBlt(((int)unViewWidth - (int)(Temp.width + 2)) < 0 ? -1 : (unViewWidth - (Temp.width + 2)) / 2,
((int)unViewHeight - (int)(Temp.height + 2)) < 0 ? -1 : (unViewHeight - (Temp.height + 2)) / 2,
Temp.width + 2, Temp.height + 2,
&MemDC,
0,0,
SRCCOPY);
} |