[Lazarus] Fwd: using a weird DLL
duilio foschi
octopushole at gmail.com
Mon Feb 1 11:21:54 CET 2021
for Sven:
>Is the function declared inside an "extern "C"" block?
no
The code says:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Drawing;
using System.Drawing.Imaging;
namespace SkinAnalyzer
{
public class ImageProcessing
{
//--------------------------------------------------------------------------------------------
public ImageProcessing()
{
// init., if necessary
}
//--------------------------------------------------------------------------------------------
// get the features
public bool GetSkinFeatures(Bitmap Input_Bitmap, Rectangle
ROI_Rect, double[] ExtractedFeatures)
{
// check the parameters
if (Input_Bitmap == null)
return false;
if (Input_Bitmap.PixelFormat != PixelFormat.Format8bppIndexed &&
Input_Bitmap.PixelFormat != PixelFormat.Format24bppRgb
&&
Input_Bitmap.PixelFormat != PixelFormat.Format32bppArgb
&&
Input_Bitmap.PixelFormat != PixelFormat.Format32bppRgb)
return false;
// get the input pixels
Rectangle rect1 = new Rectangle(0, 0, Input_Bitmap.Width,
Input_Bitmap.Height);
BitmapData input_data = Input_Bitmap.LockBits(rect1,
ImageLockMode.ReadOnly, Input_Bitmap.PixelFormat);
IntPtr ptr1 = input_data.Scan0;
int bytesbpp = 0; // bytes_per_pixel
switch (Input_Bitmap.PixelFormat)
{
On Mon, Feb 1, 2021 at 10:08 AM duilio foschi <octopushole at gmail.com> wrote:
> I am corrected. The DLL is written in c#. It seems that Bitmap and
> Rectangle are common predefined/usable objects in C#.
>
> Re Bitmap, I found these notes:
> "Surely you cannot expect C# Bitmap to be binary compatible with Delphi
> TBitmap? You need to pass around an HBITMAP. On the Delphi side you use
> ReleaseHandle to get the HBITMAP. On the C# side it would be
> Image.FromHbitmap"
>
> Re Rectangle, I found nothing interesting :(
>
> However it seems natural to expect that Rectangle it is given by a pointer
> to a fixed array of 2 points= 4 integers= 16 bytes in all.
>
> Thank you
> Duilio
>
> On Mon, Feb 1, 2021 at 7:52 AM Sven Barth <pascaldragon at googlemail.com>
> wrote:
>
>> duilio foschi via lazarus <lazarus at lists.lazarus-ide.org> schrieb am
>> So., 31. Jan. 2021, 23:23:
>>
>>> I would like to use a function exported from a DLL. The DLL was written
>>> in C++ (Visual Studio 2015).
>>>
>>> Inside the original code the function is declared as
>>>
>>> public bool GetSkinFeatures(Bitmap Input_Bitmap, Rectangle
>>> ROI_Rect, double[] ExtractedFeatures)
>>>
>>> Anybody knows how to use it from Lazarus?
>>>
>>
>> Can you also show the declarations of Bitmap and Rectangle? Is the
>> function declared inside an "extern "C"" block?
>>
>> Regards,
>> Sven
>>
>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210201/b7b6fc88/attachment.html>
More information about the lazarus
mailing list