Recent

Author Topic: Fcl-Image and ptcGraph  (Read 2711 times)

cybermonkey342

  • New member
  • *
  • Posts: 41
    • Home of EGSL interpreter
Fcl-Image and ptcGraph
« on: March 12, 2014, 08:47:33 pm »
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: [Select]
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.
--
Best regards

cybermonkey342