オブジェクトの複製
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static FHANDLE fnFIE_copy_object(
FHANDLE hsrc
) |
Visual Basic |
---|
Public Shared Function fnFIE_copy_object (
hsrc As FHANDLE
) As FHANDLE |
Return Value
Type:
FHANDLE
指定されたハンドルオブジェクトをコピーして返します。 異常終了時には IntPtr.Zero を返します。
ただし、本関数では画像オブジェクトは (ルート画像とチャイルド画像共に)コピーすることが出来ません。
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_copy_object()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hsrc = FHANDLE.Zero;
FHANDLE hdst = FHANDLE.Zero;
UCHAR_PTR ptrn = UCHAR_PTR.Zero;
int size_x = 3;
int size_y = 3;
int step_x = 3;
int anchor_x = 1;
int anchor_y = 1;
try
{
ptrn = UCHAR_PTR.alloc(size_x * size_y);
for (int i = 0; i < size_x * size_y; i++)
{
if (i == 4)
ptrn[i] = 1;
else
ptrn[i] = 0;
}
hsrc = api.fnFIE_morphology_se_alloc(ptrn, size_x, size_y, step_x, anchor_x, anchor_y);
hdst = api.fnFIE_copy_object(hsrc);
Assert.IsTrue(hdst != FHANDLE.Zero, "エラーが発生しました。({0})", (f_err)status);
{
int dst_size_x = 0;
int dst_size_y = 0;
int dst_anchor_x = 0;
int dst_anchor_y = 0;
status = api.fnFIE_morphology_get_params(hdst, ref dst_size_x, ref dst_size_y, ref dst_anchor_x, ref dst_anchor_y);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "Error. {0}", status);
Assert.IsTrue(size_x == dst_size_x && size_y == dst_size_y
&& anchor_x == dst_anchor_x && anchor_y == dst_anchor_y, "期待値と一致しません");
}
}
finally
{
hsrc.Dispose();
hdst.Dispose();
ptrn.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_copy_object()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hsrc As FHANDLE = FHANDLE.Zero
Dim hdst As FHANDLE = FHANDLE.Zero
Dim ptrn As UCHAR_PTR = UCHAR_PTR.Zero
Dim size_x As Integer = 3
Dim size_y As Integer = 3
Dim step_x As Integer = 3
Dim anchor_x As Integer = 1
Dim anchor_y As Integer = 1
Try
ptrn = UCHAR_PTR.alloc(size_x * size_y)
For i As Integer = 0 To size_x * size_y - 1
If i = 4 Then
ptrn(i) = 1
Else
ptrn(i) = 0
End If
Next
hsrc = api.fnFIE_morphology_se_alloc(ptrn, size_x, size_y, step_x, anchor_x, anchor_y)
hdst = api.fnFIE_copy_object(hsrc)
Assert.IsTrue(hdst <> FHANDLE.Zero, "エラーが発生しました。({0})", CType(status, f_err))
If True Then
Dim dst_size_x As Integer = 0
Dim dst_size_y As Integer = 0
Dim dst_anchor_x As Integer = 0
Dim dst_anchor_y As Integer = 0
status = api.fnFIE_morphology_get_params(hdst, dst_size_x, dst_size_y, dst_anchor_x, dst_anchor_y)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "Error. {0}", status)
Assert.IsTrue(size_x = dst_size_x AndAlso size_y = dst_size_y AndAlso anchor_x = dst_anchor_x AndAlso anchor_y = dst_anchor_y, "期待値と一致しません")
End If
Finally
hsrc.Dispose()
hdst.Dispose()
ptrn.Dispose()
End Try
End Sub
End Class |
See Also