Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.

The Alchemist

intel jpeg lib loading problems(using ddraw)

This topic is 5954 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i realy hate post help me threads, but after 2 weeks with this problem... well im trying to load a jpg image with intel jpeg lib into a ddraw surface... most of the code was even copied from a tutorial about it. but it never loads the bitmap or blit it. i already checked the code many times and i have no clue of what may be happening well thats my load codei removed the error checking to make it smaller, but in the original i check every function and new)
bool EasyDDraw::LoadJPG(char *filename, DDSURFACEDESC2 ddsd, LPDIRECTDRAWSURFACE7 &surface)
  	JPGprop.JPGFile = filename;
	BYTE *buffer;
	int szbuff = JPGprop.JPGHeight * JPGprop.JPGWidth * JPGprop.JPGChannels;
	buffer = new BYTE [szbuff];

	JPGprop.DIBWidth    = JPGprop.JPGWidth;
	JPGprop.DIBHeight   = JPGprop.JPGHeight; //Implies a bottom-up DIB.

	JPGprop.DIBChannels = 3;
	JPGprop.DIBColor    = IJL_BGR;
	JPGprop.DIBPadBytes = IJL_DIB_PAD_BYTES(JPGprop.JPGWidth, 3);
	JPGprop.DIBBytes    = reinterpret_cast <BYTE*> (buffer);

		case 1: JPGprop.JPGColor = IJL_G;
		case 3: JPGprop.JPGColor = IJL_YCBCR;
			//This catches everything else, but no color twist will be

			//performed by the IJL.



	ijlFree(&JPGprop);// we dont need it anymore


	//Create the bitmap and get a handle to it

	hbm = CreateBitmap (JPGprop.JPGWidth, JPGprop.JPGHeight, 1, 16, buffer);
    delete buffer;// we dont need this too

    HDC                     hdcImage;
    HDC                     hdc;
    BITMAP                  bm;
    // Make sure this surface is restored.

    hdcImage = CreateCompatibleDC(NULL);
    SelectObject(hdcImage, hbm);

    GetObject(hbm, sizeof(bm), &bm);

    ddsd.dwSize = sizeof(ddsd);
    ddsd.dwFlags = DDSD_HEIGHT | DDSD_WIDTH;
    if ((error = DDSprimary->GetDC(&hdc)) == DD_OK)
    {          StretchBlt(hdc,0,0,100,100,hdcImage,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY);
    return true;
like it was 80% copied from a working code(well i dont think taht people do tutorials with non working code ) and i dont see why it wouldnt be working well thx in advance ------------------------------- MOTHERSHIP!!! hahaha! very funny! now take me outta here!!!!! [edited by - The Alchemist on June 5, 2002 9:32:55 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!