|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- unit ultsImage;
-
- {$mode objfpc}{$H+}
-
- interface
-
- uses
- Classes, SysUtils,
- utsTextSuite,
- ultsTypes;
-
- type
- TltsImageLoadFunc = procedure(aHandle: TltsImageHandle; X, Y: Integer; var aPixel: TtsColor4f; aArgs: Pointer); stdcall;
- TltsImageBlendFunc = procedure(aHandle: TltsImageHandle; aSrc, aDst: TtsColor4f; out aResult: TtsColor4f; aArgs: Pointer); stdcall;
-
- function ltsImageCreate (aContext: TltsContextHandle): TltsImageHandle; stdcall;
- function ltsImageIsEmpty (aHandle: TltsImageHandle; out aValue: Boolean): TltsErrorCode; stdcall;
- function ltsImageGetWidth (aHandle: TltsImageHandle): Integer; stdcall;
- function ltsImageGetHeight (aHandle: TltsImageHandle): Integer; stdcall;
- function ltsImageGetLineSize (aHandle: TltsImageHandle): Integer; stdcall;
- function ltsImageGetDataSize (aHandle: TltsImageHandle): Integer; stdcall;
- function ltsImageGetFormat (aHandle: TltsImageHandle; out aValue: TtsFormat): TltsErrorCode; stdcall;
- function ltsImageGetData (aHandle: TltsImageHandle): Pointer; stdcall;
- function ltsImageGetScanline (aHandle: TltsImageHandle; aIndex: Integer): Pointer; stdcall;
- function ltsImageGetPixelAt (aHandle: TltsImageHandle; aX, aY: Integer; out aColor: TtsColor4f): TltsErrorCode; stdcall;
- function ltsImageAssign (aHandle, aSource: TltsImageHandle): TltsErrorCode; stdcall;
- function ltsImageCreateEmpty (aHandle: TltsImageHandle; aFormat: TtsFormat; aWidth, aHeight: Integer): TltsErrorCode; stdcall;
- function ltsImageLoadFromFunc (aHandle: TltsImageHandle; aCallback: TltsImageLoadFunc; aArgs: Pointer): TltsErrorCode; stdcall;
- function ltsImageResize (aHandle: TltsImageHandle; aWidth, aHeight, aX, aY: Integer): TltsErrorCode; stdcall;
- function ltsImageFillColor (aHandle: TltsImageHandle; aColor: TtsColor4f; aMask: TtsColorChannels; aModes: TtsImageModes): TltsErrorCode; stdcall;
- function ltsImageFillPattern (aHandle, aPattern: TltsImageHandle; aX, aY: Integer; aMask: TtsColorChannels; aModes: TtsImageModes): TltsErrorCode; stdcall;
- function ltsImageBlend (aHandle, aSource: TltsImageHandle; aX, aY: Integer; aBlendFunc: TltsImageBlendFunc; aArgs: Pointer): TltsErrorCode; stdcall;
- function ltsImageBlur (aHandle: TltsImageHandle; aHorzRad, aHorzStr, aVertRad, aVertStr: Single; aMask: TtsColorChannels): TltsErrorCode; stdcall;
- function ltsImageDestroy (aHandle: TltsImageHandle): TltsErrorCode; stdcall;
-
- implementation
-
- uses
- ultsUtils, utsUtils {$IFDEF DEBUG}, uutlLogger{$ENDIF};
-
- type
- PLoadArgs = ^TLoadArgs;
- TLoadArgs = packed record
- args: Pointer;
- handle: TltsImageHandle;
- callback: TltsImageLoadFunc
- end;
-
- PBlendArgs = ^TBlendArgs;
- TBlendArgs = packed record
- args: Pointer;
- handle: TltsImageHandle;
- callback: TltsImageBlendFunc;
- end;
-
- procedure ImageLoadCallback(const aImage: TtsImage; X, Y: Integer; var aPixel: TtsColor4f; aArgs: Pointer);
- var
- p: PLoadArgs;
- begin
- p := PLoadArgs(aArgs);
- p^.callback(p^.handle, X, Y, aPixel, p^.args);
- end;
-
- function ImageBlendCallback(const aSrc, aDst: TtsColor4f; aArgs: Pointer): TtsColor4f;
- var
- p: PBlendArgs;
- begin
- p := PBlendArgs(aArgs);
- p^.callback(p^.handle, aSrc, aDst, result, p^.args);
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //ltsImage//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageCreate(aContext: TltsContextHandle): TltsImageHandle; stdcall;
- var
- img: TtsImage;
- c: TtsContext;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageCreate(Context=%p)', [Pointer(aContext)]);{$ENDIF}
- result := nil;
- if not CheckContextHandle(aContext, c) then
- exit;
- img := TtsImage.Create(c);
- AddReference(ltsObjTypeImage, img);
- result := img;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := nil;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageCreate=%p', [Pointer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageIsEmpty(aHandle: TltsImageHandle; out aValue: Boolean): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageIsEmpty(Handle=%p; Value=%p)', [Pointer(aHandle), Pointer(@aValue)]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img)
- then aValue := img.IsEmpty
- else result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageIsEmpty=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageGetWidth(aHandle: TltsImageHandle): Integer; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetWidth(Handle=%p)', [Pointer(aHandle)]);{$ENDIF}
- if CheckImageHandle(aHandle, img)
- then result := img.Width
- else result := -1;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := -1;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetWidth=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageGetHeight(aHandle: TltsImageHandle): Integer; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetHeight(Handle=%p)', [Pointer(aHandle)]);{$ENDIF}
- if CheckImageHandle(aHandle, img)
- then result := img.Height
- else result := -1;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := -1;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetHeight=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageGetLineSize(aHandle: TltsImageHandle): Integer; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetLineSize(Handle=%p)', [Pointer(aHandle)]);{$ENDIF}
- if CheckImageHandle(aHandle, img)
- then result := img.LineSize
- else result := -1;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := -1;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetLineSize=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageGetDataSize(aHandle: TltsImageHandle): Integer; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetDataSize(Handle=%p)', [Pointer(aHandle)]);{$ENDIF}
- if CheckImageHandle(aHandle, img)
- then result := img.DataSize
- else result := -1;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := -1;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetDataSize=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageGetFormat(aHandle: TltsImageHandle; out aValue: TtsFormat): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetFormat(Handle=%p; Value=%p)', [Pointer(aHandle), Pointer(@aValue)]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img)
- then aValue := img.Format
- else result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetFormat=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageGetData(aHandle: TltsImageHandle): Pointer; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetData(Handle=%p)', [Pointer(aHandle)]);{$ENDIF}
- if CheckImageHandle(aHandle, img)
- then result := img.Data
- else result := nil;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := nil;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetData=%p', [Pointer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageGetScanline(aHandle: TltsImageHandle; aIndex: Integer): Pointer; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetScanline(Handle=%p; Index=%d)', [Pointer(aHandle), aIndex]);{$ENDIF}
- if CheckImageHandle(aHandle, img) then begin
- result := img.Scanline[aIndex];
- if not Assigned(result) then
- SetLastError(ltsErrInvalidValue, Format('index (%d) is out of range', [aIndex]));
- end else
- result := nil;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := nil;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetScanline=%p', [Pointer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageGetPixelAt(aHandle: TltsImageHandle; aX, aY: Integer; out aColor: TtsColor4f): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetPixelAt(Handle=%p; X=%d; Y=%d; Color=%p)', [Pointer(aHandle), aX, aY, Pointer(@aColor)]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img) then begin
- if not img.GetPixelAt(aX, aY, aColor) then begin
- SetLastError(ltsErrInvalidValue, Format('x (%d) or y (%d) is out of range', [aX, aY]));
- result := LastErrorCode;
- end;
- end else
- result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageGetPixelAt=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageAssign(aHandle, aSource: TltsImageHandle): TltsErrorCode; stdcall;
- var
- img, src: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageAssign(Handle=%p; Source=%p)', [Pointer(aHandle), Pointer(aSource)]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img) and CheckImageHandle(aSource, src)
- then img.Assign(src)
- else result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageAssign=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageCreateEmpty(aHandle: TltsImageHandle; aFormat: TtsFormat; aWidth, aHeight: Integer): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageCreateEmpty(Handle=%p; Format=%d; Width=%d; Height=%d)', [Pointer(aHandle), Integer(aFormat), aWidth, aHeight]);{$ENDIF}
- result := ltsErrNone;
- if not ValidateFormat(aFormat) then begin
- result := LastErrorCode;
- end else if (aWidth < 0) then begin
- SetLastError(ltsErrInvalidValue, 'width must be a positive value');
- result := LastErrorCode;
- end else if (aHeight < 0) then begin
- SetLastError(ltsErrInvalidValue, 'height must be a positive value');
- result := LastErrorCode;
- end else if not CheckImageHandle(aHandle, img) then begin
- result := LastErrorCode;
- end else
- img.CreateEmpty(aFormat, aWidth, aHeight);
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageCreateEmpty=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageLoadFromFunc(aHandle: TltsImageHandle; aCallback: TltsImageLoadFunc; aArgs: Pointer): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- la: TLoadArgs;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageLoadFromFunc(Handle=%p; Callback=%p; Args=%p)', [Pointer(aHandle), Pointer(aCallback), aArgs]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img) then begin
- la.args := aArgs;
- la.callback := aCallback;
- la.handle := aHandle;
- img.LoadFromFunc(@ImageLoadCallback, @la);
- end else
- result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageLoadFromFunc=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageResize(aHandle: TltsImageHandle; aWidth, aHeight, aX, aY: Integer): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageResize(Handle=%p; Width=%d; Height=%d; X=%d; Y=%d)', [Pointer(aHandle), aWidth, aHeight, aX, aY]);{$ENDIF}
- result := ltsErrNone;
- if (aWidth < 0) then begin
- SetLastError(ltsErrInvalidValue, 'width must be a positive value');
- result := LastErrorCode;
- end else if (aHeight < 0) then begin
- SetLastError(ltsErrInvalidValue, 'height must be a positive value');
- result := LastErrorCode;
- end else if not CheckImageHandle(aHandle, img) then begin
- result := LastErrorCode;
- end else
- img.Resize(aWidth, aHeight, aX, aY);
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageResize=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageFillColor(aHandle: TltsImageHandle; aColor: TtsColor4f; aMask: TtsColorChannels; aModes: TtsImageModes): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageFillColor(Handle=%p; Color=(%f;%f;%f;%f); Mask=%d; Modes=(%d;%d;%d;%d))', [Pointer(aHandle), aColor.r, aColor.g, aColor.b, aColor.a, Integer(aMask), Integer(aModes[TtsColorChannel.tsChannelRed]), Integer(aModes[TtsColorChannel.tsChannelGreen]), Integer(aModes[TtsColorChannel.tsChannelBlue]), Integer(aModes[TtsColorChannel.tsChannelAlpha])]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img)
- then img.FillColor(aColor, aMask, aModes)
- else result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageFillColor=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageFillPattern(aHandle, aPattern: TltsImageHandle; aX, aY: Integer; aMask: TtsColorChannels; aModes: TtsImageModes): TltsErrorCode; stdcall;
- var
- img, pattern: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageFillPattern(Handle=%p; Pattern=%p; X=%d; Y=%d; Mask=%d; Modes=(%d;%d;%d;%d))', [Pointer(aHandle), Pointer(aPattern), aX, aY, Integer(aMask), Integer(aModes[TtsColorChannel.tsChannelRed]), Integer(aModes[TtsColorChannel.tsChannelGreen]), Integer(aModes[TtsColorChannel.tsChannelBlue]), Integer(aModes[TtsColorChannel.tsChannelAlpha])]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img) and CheckImageHandle(aPattern, pattern)
- then img.FillPattern(pattern, aX, aY, aMask, aModes)
- else result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageFillPattern=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageBlend(aHandle, aSource: TltsImageHandle; aX, aY: Integer; aBlendFunc: TltsImageBlendFunc; aArgs: Pointer): TltsErrorCode; stdcall;
- var
- img, src: TtsImage;
- ba: TBlendArgs;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageBlend(Handle=%p; Source=%p; X=%d; Y=%d; BlendFunc=%p; Args=%p)', [Pointer(aHandle), Pointer(aSource), aX, aY, Pointer(aBlendFunc), aArgs]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img) and CheckImageHandle(aSource, src) then begin
- ba.args := aArgs;
- ba.handle := aHandle;
- ba.callback := aBlendFunc;
- img.Blend(src, aX, aY, @ImageBlendCallback, @ba);
- end else
- result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageBlend=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageBlur(aHandle: TltsImageHandle; aHorzRad, aHorzStr, aVertRad, aVertStr: Single; aMask: TtsColorChannels): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- horz, vert: TtsKernel1D;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageBlur(Handle=%p; HorzRad=%f; HorzStr=%f; VertRad=%f; VertStr=%f; Mask=%d)', [Pointer(aHandle), aHorzRad, aHorzStr, aVertRad, aVertStr, Integer(aMask)]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img) then begin
- horz := TtsKernel1D.Create(aHorzRad, aHorzStr);
- vert := TtsKernel1D.Create(aVertRad, aVertStr);
- try
- img.Blur(horz, vert, aMask);
- finally
- FreeAndNil(horz);
- FreeAndNil(vert);
- end;
- end else
- result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageBlur=%d', [Integer(result)]);{$ENDIF}
- end;
-
- ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function ltsImageDestroy(aHandle: TltsImageHandle): TltsErrorCode; stdcall;
- var
- img: TtsImage;
- begin
- try
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageDestroy(Handle=%p)', [Pointer(aHandle)]);{$ENDIF}
- result := ltsErrNone;
- if CheckImageHandle(aHandle, img) then begin
- DelReference(ltsObjTypeImage, img);
- FreeAndNil(img);
- end else
- result := LastErrorCode;
- except
- on ex: Exception do begin
- SetLastError(ex);
- result := LastErrorCode;
- end;
- end;
- {$IFDEF DEBUG}utlLogger.Log(nil, 'ltsImageDestroy=%d', [Integer(result)]);{$ENDIF}
- end;
-
- end.
-
|