Re: FreeImage help
wow thanks for the great replies but to be honest im a little
confused, i apologize for so many 'newbie' questions cause well im
pretty new to this coding.
so from what i get this is what i see...
CMyFullScreen screen; //This is a variable
class CMyFullScreen : public CWnd {
//Should anything go in here?
};
void screeny() //i don't need the 'condition here as i will be using a
function call to link here to display the image
{
LPCTSTR classname = AfxRegisterWndClass(0);
screen.CreateEx(0,
NULL,
WS_OVERLAPPED | WS_VISIBLE,
0, 0,
1280, 768,
NULL,
NULL);
}
void CMyFullScreen::OnPaint()
{
CPaintDC dc(this);
... do your drawing here
int dest_x, dest_y, width, height;
dest_x=0;
dest_y=0;
width=800;
height=900;
FIBITMAP *fibmp_img = FreeImage_Load(FIF_JPEG, "screen1.JPG",
JPEG_DEFAULT);
StretchDIBits(hdcC, dest_x, dest_y, width, height, 0, 0, width,
height, FreeImage_GetBits(fibmp_img), FreeImage_GetInfo
(fibmp_img),
DIB_RGB_COLORS, SRCCOPY);
FreeImage_Unload(fibmp_img);
dc.BitBlt(0, 0, bmpWidth, bmpHeight, &MemDC, 0, 0,SRCCOPY );
}
CMyFullScreen::LoadFromFile(const CString & filename) //Whats this
function for as i already drew the image in OnPaint dialog right?
{
// FreeImage class
fipWinImage img;
#ifdef _UNICODE
img.loadU("Screeny1.jpg");
#else
img.load("Screeny1.jpg");
#endif
.....
// CRect with the image size
CRect r(CPoint(0,0), CSize(img.getWidth(), img.getHeight())) ;
// assuming MemDC is a protected CDC member variable of CMyFullScreen
// also a CBitmap member ( created CreateCompatibleBitmap) is selected
in
// that MemDC
img.draw(MemDC.GetSafeHdc(), r);
....
}