画像のルート情報取得

Namespace: fvalgcli
Assembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)

Syntax

C#
public static int fnFIE_img_get_root_params(
	FHANDLE himg,
	ref FHANDLE hroot,
	ref int channel,
	ref int offset_x,
	ref int offset_y
)
Visual Basic
Public Shared Function fnFIE_img_get_root_params ( 
	himg As FHANDLE,
	ByRef hroot As FHANDLE,
	ByRef channel As Integer,
	ByRef offset_x As Integer,
	ByRef offset_y As Integer
) As Integer

Parameters

himg
Type: fvalgcli..::..FHANDLE
情報を取得する画像
hroot
Type: fvalgcli..::..FHANDLE%
himg の割り当てられているルート画像のハンドル
himg がルート画像のときは himg を返す(つまり hroot = himg )
関数エントリー時 hroot == IntPtr.Zero でなければなりません。
channel
Type: System..::..Int32%
hroot のうち himg の割り当てられているチャネル番号
himg がルート画像の場合、または himg が hroot の全チャネルに 割り当てられている場合は -1 を返す
offset_x
Type: System..::..Int32%
himg の左上X座標(ルート画像の左上画素を(0,0)としたときの座標)
offset_y
Type: System..::..Int32%
himg の左上Y座標(ルート画像の左上画素を(0,0)としたときの座標)

Return Value

Type: Int32
以下のエラーコードを返します。

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_IMAGE画像オブジェクトの異常
F_ERR_INVALID_PARAMパラメータ異常
  • 出力パラメータの何れかが IntPtr.Zero
  • hroot が IntPtr.Zero でない
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

Examples

C# Copy imageCopy
//    $Revision: 1.1 $

using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        /// <summary>
        /// 画像のルート情報取得.
        /// </summary>
        [FvPluginExecute]
        public void fnFIE_img_get_root_params()
        {
            int status = (int)f_err.F_ERR_NONE;

            FHANDLE hroot = FHANDLE.Zero;
            FHANDLE hchild = FHANDLE.Zero;
            FHANDLE _hroot = FHANDLE.Zero;

            int type = (int)f_imgtype.F_IMG_UC8;
            int channels = 3;
            int width = 640;
            int height = 480;
            int offset_x = 10;
            int offset_y = 20;
            int child_width = 128;
            int child_height = 64;

            try
            {
                // root 画像生成.
                hroot = api.fnFIE_img_root_alloc(type, channels, width, height);
                Assert.IsTrue(hroot != FHANDLE.Zero, "fnFIE_img_root_alloc: エラーが発生しました。");

                // child 画像生成.
                hchild = api.fnFIE_img_child_alloc(hroot, offset_x, offset_y, child_width, child_height);
                Assert.IsTrue(hchild != FHANDLE.Zero, "fnFIE_img_child_alloc: エラーが発生しました。");

                // 画像情報取得.            
                int _channel = 0;
                int _offset_x = 0;
                int _offset_y = 0;
                status = api.fnFIE_img_get_root_params(hchild, ref _hroot, ref _channel, ref _offset_x, ref _offset_y);
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

                Assert.IsTrue(_hroot == hroot, "ルート画像:一致しません。");
                Assert.IsTrue(_offset_x == offset_x, "オフセット(x):一致しません.");
                Assert.IsTrue(_offset_y == offset_y, "オフセット(y):一致しません.");
            }
            finally
            {
                hroot.Dispose(); // _hroot はhroot を開放すれば、開放されます.
                hchild.Dispose();
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

Public Partial Class FIE
    ''' <summary>
    ''' 画像のルート情報取得.
    ''' </summary>
    <FvPluginExecute> _
    Public Sub fnFIE_img_get_root_params()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        Dim hroot As FHANDLE = FHANDLE.Zero
        Dim hchild As FHANDLE = FHANDLE.Zero
        Dim _hroot As FHANDLE = FHANDLE.Zero

        Dim type As Integer = CInt(f_imgtype.F_IMG_UC8)
        Dim channels As Integer = 3
        Dim width As Integer = 640
        Dim height As Integer = 480
        Dim offset_x As Integer = 10
        Dim offset_y As Integer = 20
        Dim child_width As Integer = 128
        Dim child_height As Integer = 64

        Try
            ' root 画像生成.
            hroot = api.fnFIE_img_root_alloc(type, channels, width, height)
            Assert.IsTrue(hroot <> FHANDLE.Zero, "fnFIE_img_root_alloc: エラーが発生しました。")

            ' child 画像生成.
            hchild = api.fnFIE_img_child_alloc(hroot, offset_x, offset_y, child_width, child_height)
            Assert.IsTrue(hchild <> FHANDLE.Zero, "fnFIE_img_child_alloc: エラーが発生しました。")

            ' 画像情報取得.            
            Dim _channel As Integer = 0
            Dim _offset_x As Integer = 0
            Dim _offset_y As Integer = 0
            status = api.fnFIE_img_get_root_params(hchild, _hroot, _channel, _offset_x, _offset_y)
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))

            Assert.IsTrue(_hroot = hroot, "ルート画像:一致しません。")
            Assert.IsTrue(_offset_x = offset_x, "オフセット(x):一致しません.")
            Assert.IsTrue(_offset_y = offset_y, "オフセット(y):一致しません.")
        Finally
            hroot.Dispose()
            ' _hroot はhroot を開放すれば、開放されます.
            hchild.Dispose()
        End Try
    End Sub
End Class

See Also