Forum > General

Fcl-Image and ptcGraph

(1/1)

cybermonkey342:
Well, I know that those GRAPH stuff is rather deprecated but the units ptcgraph, ptccrt and ptcmouse are really easy to use. So I thought it might be possible to load an image into memory with fpimage and display it onto the screen. Unfortunately this does not work. Does anyone have an idea how to do that?
That's my test program:


--- Code: ---program putimagetest;

uses
  ptcCrt, ptcGraph,fpreadbmp, fpimage;

var
  ErrorCode : Integer;
  GraphDriver, GraphMode:Smallint;
   image: TFPCustomImage;
  reader: TFPCustomImageReader;
 
begin
  GraphDriver:=D16bit;
  GraphMode:=m1024x768;
  InitGraph (GraphDriver, GraphMode, '');
  ErrorCode := GraphResult;
  If ErrorCode <> grOk then
    begin
      Writeln ('Graphics Error: ',GraphErrorMsg(ErrorCode));
      Halt;
    end;
   
    cleardevice;
  Image := TFPMemoryImage.Create(32, 32);
  Reader := TFPReaderBMP.Create;
  Image.LoadFromFile('sprite.bmp', Reader);

  putimage (100,100,image,CopyPut);

  ReadKey;
  ClearDevice;
  CloseGraph;
  image.free;
  reader.free;
end.

--- End code ---

Navigation

[0] Message Index

Go to full version