diff --git a/samples/LibDemo/cvSetImageROI/cv_SetImageROI.dproj b/samples/LibDemo/cvSetImageROI/cv_SetImageROI.dproj
index 8430f15..8eab8d1 100644
--- a/samples/LibDemo/cvSetImageROI/cv_SetImageROI.dproj
+++ b/samples/LibDemo/cvSetImageROI/cv_SetImageROI.dproj
@@ -7,7 +7,7 @@
3
Console
None
- 18.2
+ 18.6
Win32
diff --git a/samples/LibDemo/cvSetImageROI/cv_SetImageROI2.dpr b/samples/LibDemo/cvSetImageROI/cv_SetImageROI2.dpr
index d6dc587..21480e7 100644
--- a/samples/LibDemo/cvSetImageROI/cv_SetImageROI2.dpr
+++ b/samples/LibDemo/cvSetImageROI/cv_SetImageROI2.dpr
@@ -1,25 +1,25 @@
-//*****************************************************************
- // Delphi-OpenCV Demo
- // Copyright (C) 2013 Project Delphi-OpenCV
- // ****************************************************************
- // Contributor:
- // Laentir Valetov
- // email:laex@bk.ru
- // ****************************************************************
- // You may retrieve the latest version of this file at the GitHub,
- // located at git://github.com/Laex/Delphi-OpenCV.git
- // ****************************************************************
- // The contents of this file are used with permission, subject to
- // the Mozilla Public License Version 1.1 (the "License"); you may
- // not use this file except in compliance with the License. You may
- // obtain a copy of the License at
- // http://www.mozilla.org/MPL/MPL-1_1Final.html
- //
- // Software distributed under the License is distributed on an
- // "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- // implied. See the License for the specific language governing
- // rights and limitations under the License.
- //*******************************************************************
+(* ****************************************************************
+ Delphi-OpenCV Demo
+ Copyright (C) 2013 Project Delphi-OpenCV
+ ****************************************************************
+ Contributor:
+ Laentir Valetov
+ email:laex@bk.ru
+ ****************************************************************
+ You may retrieve the latest version of this file at the GitHub,
+ located at git://github.com/Laex/Delphi-OpenCV.git
+ ****************************************************************
+ The contents of this file are used with permission, subject to
+ the Mozilla Public License Version 1.1 (the "License"); you may
+ not use this file except in compliance with the License. You may
+ obtain a copy of the License at
+ http://www.mozilla.org/MPL/MPL-1_1Final.html
+
+ Software distributed under the License is distributed on an
+ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ rights and limitations under the License.
+ ****************************************************************** *)
program cv_SetImageROI2;
diff --git a/samples/LibDemo/cvSetImageROI/cv_SetImageROI2.dproj b/samples/LibDemo/cvSetImageROI/cv_SetImageROI2.dproj
index e6dbdf4..4404ac7 100644
--- a/samples/LibDemo/cvSetImageROI/cv_SetImageROI2.dproj
+++ b/samples/LibDemo/cvSetImageROI/cv_SetImageROI2.dproj
@@ -7,7 +7,7 @@
3
Console
None
- 18.2
+ 18.6
Win32
diff --git a/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.dpr b/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.dpr
new file mode 100644
index 0000000..7cde7ea
--- /dev/null
+++ b/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.dpr
@@ -0,0 +1,82 @@
+(* ****************************************************************
+ Delphi-OpenCV Demo
+ Copyright (C) 2013 Project Delphi-OpenCV
+ ****************************************************************
+ Contributor:
+ Laentir Valetov
+ email:laex@bk.ru
+ ****************************************************************
+ You may retrieve the latest version of this file at the GitHub,
+ located at git://github.com/Laex/Delphi-OpenCV.git
+ ****************************************************************
+ The contents of this file are used with permission, subject to
+ the Mozilla Public License Version 1.1 (the "License"); you may
+ not use this file except in compliance with the License. You may
+ obtain a copy of the License at
+ http://www.mozilla.org/MPL/MPL-1_1Final.html
+
+ Software distributed under the License is distributed on an
+ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ implied. See the License for the specific language governing
+ rights and limitations under the License.
+ ****************************************************************** *)
+
+program cv_SetImageROI3;
+
+{$APPTYPE CONSOLE}
+{$R *.res}
+
+uses
+ System.SysUtils,
+ ocv.highgui_c,
+ ocv.core_c,
+ ocv.core.types_c,
+ ocv.imgproc_c,
+ ocv.imgproc.types_c,
+ uResourcePaths;
+
+const
+ // имя картинки
+ filename = cResourceMedia + 'cat2.jpg';
+
+var
+ image: PIplImage = nil;
+ x: Integer;
+ y: Integer;
+ width: Integer;
+ height: Integer;
+
+begin
+ try
+ image := cvLoadImage(filename, 1);
+
+ Writeln('[i] image: ', filename);
+ if not Assigned(image) then
+ Halt;
+
+ cvNamedWindow('origianl', CV_WINDOW_AUTOSIZE);
+ cvNamedWindow('ROI', CV_WINDOW_AUTOSIZE);
+ // задаём ROI
+ x := 10;
+ y := 10;
+ width := image^.width div 2;
+ height := image^.height div 2;
+
+ cvShowImage('origianl', image);
+ // уcтанавливаем ROI
+ cvSetImageROI(image, cvRect(x, y, width, height));
+ // показываем изображение
+ cvShowImage('ROI', image);
+ // cбрccываем ROI
+ cvResetImageROI(image);
+ // ждём нажатия клавиши
+ cvWaitKey(0);
+ // оcвобождаем реcурcы
+ cvReleaseImage(image);
+ cvDestroyAllWindows;
+ except
+ on E: Exception do
+ Writeln(E.ClassName, ': ', E.Message);
+ end;
+
+end.
diff --git a/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.dproj b/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.dproj
new file mode 100644
index 0000000..7f4ad1f
--- /dev/null
+++ b/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.dproj
@@ -0,0 +1,712 @@
+п»ї
+
+ {3D97FEC0-CEF8-454F-8C5C-4DC2BCE7EE3F}
+ cv_SetImageROI3.dpr
+ True
+ Debug
+ 3
+ Console
+ None
+ 18.6
+ Win32
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ $(BDS)\bin\delphi_PROJECTICNS.icns
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ .\$(Platform)\$(Config)
+ cv_SetImageROI3
+ false
+ false
+ System;Xml;Data;Datasnap;Web;Soap;$(DCC_Namespace)
+ None
+ 00400000
+ false
+ false
+ ..\..\..\bin\$(Platform)
+ 1049
+ false
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=;CFBundleDisplayName=;CFBundleIdentifier=;CFBundleVersion=;CFBundlePackageType=;CFBundleSignature=;CFBundleAllowMixedLocalizations=;CFBundleExecutable=
+
+
+ true
+ true
+ true
+ true
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_144x144.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_96x96.png
+ true
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_470x320.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_48x48.png
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_36x36.png
+ true
+ true
+ package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=auto;largeHeap=False;theme=TitleBar;hardwareAccelerated=true;apiKey=
+ android-support-v4.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_426x320.png
+ true
+ Debug
+ true
+ $(BDS)\bin\Artwork\Android\FM_LauncherIcon_72x72.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_640x480.png
+ $(BDS)\bin\Artwork\Android\FM_SplashImage_960x720.png
+
+
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ iPhoneAndiPad
+ $(MSBuildProjectName)
+ Debug
+
+
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ true
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+ iPhoneAndiPad
+ $(MSBuildProjectName)
+ Debug
+
+
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_768x1024.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImagePortrait_1536x2048.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_80x80.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_152x152.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_120x120.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_2048x1536.png
+ CFBundleName=$(MSBuildProjectName);CFBundleDevelopmentRegion=en;CFBundleDisplayName=$(MSBuildProjectName);CFBundleIdentifier=$(MSBuildProjectName);CFBundleInfoDictionaryVersion=7.1;CFBundleVersion=1.0.0.0;CFBundlePackageType=APPL;CFBundleSignature=????;LSRequiresIPhoneOS=true;CFBundleAllowMixedLocalizations=YES;CFBundleExecutable=$(MSBuildProjectName);UIDeviceFamily=iPhone & iPad;CFBundleResourceSpecification=ResourceRules.plist;NSLocationAlwaysUsageDescription=The reason for accessing the location information of the user;NSLocationWhenInUseUsageDescription=The reason for accessing the location information of the user;FMLocalNotificationPermission=false;UIBackgroundModes=
+ $(BDS)\bin\Artwork\iOS\iPad\FM_ApplicationIcon_76x76.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_SpotlightSearchIcon_40x40.png
+ $(BDS)\bin\Artwork\iOS\iPhone\FM_ApplicationIcon_60x60.png
+ true
+ iPhoneAndiPad
+ $(BDS)\bin\Artwork\iOS\iPad\FM_LaunchImageLandscape_1024x768.png
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
+ 1033
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ 1033
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
+
+
+ 0
+ 0
+ RELEASE;$(DCC_Define)
+ false
+
+
+ true
+ false
+ DEBUG;$(DCC_Define)
+
+
+ true
+
+
+ true
+
+
+ true
+
+
+ None
+ CompanyName=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName);FileDescription=$(MSBuildProjectName);ProductName=$(MSBuildProjectName)
+ 1033
+
+
+
+ MainSource
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+ Delphi.Personality.12
+
+
+
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1049
+ 1251
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ False
+ False
+ False
+ False
+ False
+ True
+ True
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ true
+
+
+
+
+ cv_SetImageROI3.exe
+ true
+
+
+
+
+ 1
+
+
+ 0
+
+
+
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+ .framework
+
+
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 12
+
+
+
+
+
diff --git a/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.res b/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.res
new file mode 100644
index 0000000..d95ca05
Binary files /dev/null and b/samples/LibDemo/cvSetImageROI/cv_SetImageROI3.res differ
diff --git a/source/ocv.fmxutils.pas b/source/ocv.fmxutils.pas
index a9ecc2b..de0b443 100644
--- a/source/ocv.fmxutils.pas
+++ b/source/ocv.fmxutils.pas
@@ -32,12 +32,13 @@ interface
Uses
ocv.core.types_c
{$IFDEF DELPHIXE5_UP}
- , FMX.Graphics
+ , FMX.Graphics
{$IFEND}
- ;
+ ;
{$IFDEF DELPHIXE5_UP}
-procedure IPLImageToFMXBitmap(const IpImage: pIplImage; const FMXBitmap: TBitmap); inline;
+procedure IPLImageToFMXBitmap(const IpImage: pIplImage; const FMXBitmap: TBitmap;
+ const WithROI: Boolean = true); inline;
{$IFEND}
implementation
@@ -46,10 +47,10 @@ implementation
Uses FMX.Types;
-procedure IPLImageToFMXBitmap(const IpImage: pIplImage; const FMXBitmap: TBitmap); inline;
+procedure IPLImageToFMXBitmap(const IpImage: pIplImage; const FMXBitmap: TBitmap; const WithROI: Boolean); inline;
Var
BitmapData: TBitmapData;
- i: Integer;
+ i, j, src_index, dst_index: Integer;
SrcData, DestData: pByte;
nC: Integer;
pf: Integer;
@@ -64,27 +65,44 @@ begin
SrcData := AllocMem(Width * Height * nC);
Move(imageData^, SrcData^, Width * Height * nC);
end;
- // FMXBitmap.Canvas.BeginScene;
- // try
- if (FMXBitmap.Width <> IpImage^.Width) or (FMXBitmap.Height <> IpImage^.Height) then
+
+ if WithROI and Assigned(IpImage^.roi) then
+ begin
+ if (FMXBitmap.Width <> IpImage^.roi^.Width) or (FMXBitmap.Height <> IpImage^.roi^.Height) then
+ FMXBitmap.SetSize(IpImage^.roi^.Width, IpImage^.roi^.Height);
+ end
+ else if (FMXBitmap.Width <> IpImage^.Width) or (FMXBitmap.Height <> IpImage^.Height) then
FMXBitmap.SetSize(IpImage^.Width, IpImage^.Height);
+
if FMXBitmap.Map(TMapAccess.Write, BitmapData) then
try
DestData := pByte(BitmapData.Data);
pf := PixelFormatBytes[FMXBitmap.PixelFormat];
- for i := 0 to BitmapData.Width * BitmapData.Height - 1 do
+
+ if WithROI and Assigned(IpImage^.roi) then
begin
- DestData[i * pf + 0] := SrcData[i * nC + 0];
- DestData[i * pf + 1] := SrcData[i * nC + 1];
- DestData[i * pf + 2] := SrcData[i * nC + 2];
- DestData[i * pf + 3] := $FF;
- end;
+ for j := 0 to BitmapData.Height - 1 do
+ for i := 0 to BitmapData.Width - 1 do
+ begin
+ src_index := ((j + IpImage^.roi^.yOffset) * IpImage^.Width + (i + IpImage^.roi^.xOffset)) * nC;
+ dst_index := (j * BitmapData.Width + i) * pf;
+ DestData[dst_index + 0] := SrcData[src_index + 0];
+ DestData[dst_index + 1] := SrcData[src_index + 1];
+ DestData[dst_index + 2] := SrcData[src_index + 2];
+ DestData[dst_index + 3] := $FF;
+ end;
+ end
+ else
+ for i := 0 to BitmapData.Width * BitmapData.Height - 1 do
+ begin
+ DestData[i * pf + 0] := SrcData[i * nC + 0];
+ DestData[i * pf + 1] := SrcData[i * nC + 1];
+ DestData[i * pf + 2] := SrcData[i * nC + 2];
+ DestData[i * pf + 3] := $FF;
+ end;
finally
FMXBitmap.Unmap(BitmapData);
end;
- // finally
- // FMXBitmap.Canvas.EndScene;
- // end;
finally
if Assigned(SrcData) then
FreeMem(SrcData);