[C++] Displaying .JPEG with FreeImage

Discussion in 'Programming' started by tylah, Oct 29, 2009.

  1. #1
    Hi, i am having problems displaying an image with the FreeImage library..im using this as i think its the simplest way to do so...

    this is my code, it compiles fine but just doesnt work..could someone help me fix it plz?

    void CLowerEicasDlg::screeny()
    {
    HDC hdc = CreateDC("DISPLAY", NULL, NULL, NULL);
    HDC hdcC = CreateCompatibleDC(hdc);

    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);

    DeleteDC(hdc);
    DeleteDC(hdcC);

    }


    Thanks!
     
    tylah, Oct 29, 2009 IP