Skip to main content
gamedev.net
🔒 Locked

JPeg Function dont work

Started by Corrosive Jun 11, 2002 at 9:02 AM 3 replies 850+ views
Original Post
Corrosive
Corrosive
Hi, i need some help with this... I was trying to load some JPeg files with DirectX and used the topic JPeg load with DirectX here in gamedev in the resources... It didn´t work!!! i made some changes to work and then it compiled, but the only thing i can get in my screen is junk. I dont know what else i can do, oh, and one more thing, i´m using the Intel JPeg LIB 1.51... Any help will be interesting and if you need the source, just ask... thanks BTW!
To code is to make things come to life ;)
Pzh
Pzh
Can you tell more about problem, what really you have - bad quality of source nontransparent image (fone) or strange pixels around transparent sprites. Last case - not use jpeg, only bitmap or any other format without losing of quality.
Corrosive
Corrosive
What i really get is a screen with black and white banners and some dots of rgb colors... It dont shows the image.

It seems to show a bad file format or something.. very strange... i will put the source later and try to put a picture of the screen to show you.

To code is to make things come to life
To code is to make things come to life ;)
Pzh
Pzh
Usualy when i need load JPEG in DirectDrawSurface i do this steps
It's not very fast method, but work ...

On Delphi:

uses ....,Jpeg;

function LoadJpeg(Filename:string):IDirectDrawSurface;
var
JPG:TJpegImage;
Canva:TCanvas;
begin
JPG:=TJpegImage.Create;
JPG.LoadFromFile(Filename);

// Ñreating DirectDrawSurface with width and height as JPEGImage
CreateSurface(Result,JPG.Width,JPG.Height);

Canva:=TCanvas.Create;
Result.GetDC(Canva.Handle);

// Draw Jpeg on Surface
Canva.Draw(0,0,JPG);

Result.ReleaseDC(Canva.Handle);
Canva.Free;

JPG.Free;
end;


[edited by - pzh on June 12, 2002 11:01:14 AM]
Corrosive
Corrosive
Good, reading this last reply, i think i can fix my problem...

I made some newbie stuff damn, i used DDSURFACEDESC2 in the declaration of the function JPegLoad to return this valor but the correct is to use IDirectDrawSurface... thanks!!!

this will resolve the problem

i think

To code is to make things come to life
To code is to make things come to life ;)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.