Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library GifToBitmap;
- uses
- FastShareMem,
- SysUtils,
- Classes,
- Windows,
- Graphics,
- GIFimage;
- {$R *.res}
- type
- TSCARPlugFunc = record
- Name: string;
- Ptr: Pointer;
- end;
- TOneStrProc = procedure(s: string);
- var
- Writeln: TOneStrProc;
- procedure GifToBmp(gifPath: string; var bmp: TBitmap); stdcall;
- var
- gif: TGIFImage;
- begin
- try
- gif := TGIFImage.Create;
- try
- gif.OnProgress := OnProgress;
- gif.LoadFromFile(gifPath);
- try
- bmp.Free;
- finally
- bmp := TBitmap.Create;
- end;
- try
- bmp.Assign(gif);
- except
- bmp.Free;
- end;
- finally
- end;
- finally
- gif.Free;
- end;
- end;
- function GetFunctionCount(): Integer; stdcall; export;
- begin
- Result := 1;
- end;
- function GetFunctionInfo(x: Integer; var ProcAddr: Pointer; var ProcDef: PChar): Integer; stdcall;
- begin
- case x of
- 0:
- begin
- ProcAddr := @GifToBmp;
- StrPCopy(ProcDef, 'procedure GifToBmp(gifPath: string; var bmp: TBitmap);');
- end;
- else
- x := -1;
- end;
- Result := x;
- end;
- procedure SetFunctions(Funcs: array of TSCARPlugFunc); stdcall;
- var
- i: Integer;
- begin
- for i := 0 to Length(Funcs) - 1 do
- if Funcs[i].Name = 'Writeln' then
- Writeln := Funcs[i].Ptr;
- end;
- exports GetFunctionCount;
- exports GetFunctionInfo;
- exports SetFunctions;
- end.
Add Comment
Please, Sign In to add comment