был собран код для исполняемого файла.
суть его сводилась к изменению размера картинки к определенному размеру(если размер отличался в большую от шаблона он подгоняется).
ехе файл создался.
Но нужно получить такую же функциональность используя dll.
При переписывании проекта столкнулся с тем, что модуль Graphics не видится lazarus-ом.
в проекте испольюутся следующие объекты: TBItmap, TJpegImage, TPortableNetworkGraphic.
и модули Classes, SysUtils, Graphics, StdCtrls.
Нужна помощь в написании, сам я новичок в этом. Не понимаю как разрулить ситуацию эту.

Код :
- Код: Выделить всё
library resize_dll;
{$mode objfpc}{$H+}
uses
Classes, SysUtils, Graphics, StdCtrls
{ you can add units after this };
procedure resize_image(aBitmap:TBitMap;Height,Width:integer;desination:pChar);
var Dest: shortstring;
scale: Double;
res: TBitMap;
jpg: TJpegImage;
begin
Dest:=strpas(desination);
if (aBitmap.Width<>0)and(aBitmap.Height<>0) then
if (Width<>0)and (Height<>0) then
begin
if aBitmap.Height > aBitmap.Width then
scale := Height / aBitmap.Height
else scale := Width /aBitmap.Width;
try
res:=TBitmap.Create;
res.Width:=Round(aBitmap.Width*Scale);
res.Height:=Round(aBitmap.Height*Scale);
res.Canvas.StretchDraw(Bounds(0,0,res.Width,res.Height),aBitmap);
jpg := TJpegImage.Create;
jpg.Assign( res );
if (Dest<>'') then begin
if FileExists(Dest) then DeleteFile(Dest);
jpg.SaveToFile(Dest);
end;
finally
res.Free;
jpg.free;
end;
end else res:=nil;
end;
function resizeit(source:pchar;):pchar; cdecl;
var bmp: TBItmap;
jpg: TJpegImage;
fsource: shortstring;
destination: pchar;
pic: TPortableNetworkGraphic;
begin
Result:='';
destination:='C:\PERCO_IMG.JPG';
bmp:= Tbitmap.Create;
jpg:= TJpegImage.Create;
pic:= TPortableNetworkGraphic.Create;
fsource:=strpas(source);
try
if FileExists(fsource) then begin
if (pos('png',fsource)<>0) then begin
pic.LoadFromFile(fsource);
bmp.Assign(pic);
end
Else if (pos('bmp',fsource)<>0) then
bmp.LoadFromFile(fsource)
else if (pos('jpg',fsource)<>0)or(pos('jpeg',fsource)<>0) then begin
jpg.LoadFromFile(fsource);
bmp.Assign(jpg);
end
end;
resize_image(bmp,800,600,destination);
finally
bmp.Free;
jpg.free;
pic.free;
end;
if fileExists(destination) then Result:=destination;
end;
exports
resizeit name 'resizeit';
begin
isMultiThread:=True; //
end.