ルート画像の確保

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

Syntax

C#
public static FHANDLE fnFIE_img_root_alloc(
	f_imgtype type,
	int channels,
	int width,
	int height
)
Visual Basic
Public Shared Function fnFIE_img_root_alloc ( 
	type As f_imgtype,
	channels As Integer,
	width As Integer,
	height As Integer
) As FHANDLE

Parameters

type
Type: fvalgcli..::..f_imgtype
確保する画像種別。f_imgtype に定義された定数を指定。
channels
Type: System..::..Int32
チャネル数(1〜16)
width
Type: System..::..Int32
画像幅(1以上)
height
Type: System..::..Int32
画像高さ(1以上)

Return Value

Type: FHANDLE
確保された画像のハンドルを返します。 ライセンスエラー、未初期化エラー、またはメモリ不足で確保に失敗した場合は IntPtr.Zero を返します。

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_root_alloc()
        {
            FHANDLE hroot = FHANDLE.Zero;
            FHANDLE hchild = FHANDLE.Zero;
            FHANDLE _adrs0 = FHANDLE.Zero;
            FHANDLE _adrs1 = FHANDLE.Zero;

            int type = (int)f_imgtype.F_IMG_UC8;
            int channels = 3;
            int width = 640;
            int height = 480;

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

                // パラメータ取得.
                {
                    int _channels = api.fnFIE_img_get_channels(hroot);
                    int _type = api.fnFIE_img_get_type(hroot);
                    int _width = api.fnFIE_img_get_width(hroot);
                    int _height = api.fnFIE_img_get_height(hroot);
                    SIZE_T _step = api.fnFIE_img_get_step(hroot);

                    Assert.IsTrue(channels == _channels, "チャネル数:期待値と一致しません.");
                    Assert.IsTrue(type == _type, "タイプ:期待値と一致しません.");
                    Assert.IsTrue(width == _width, "幅:期待値と一致しません.");
                    Assert.IsTrue(height == _height, "高さ:期待値と一致しません.");
                    Console.WriteLine("_step={0}", _step);
                }
            }
            finally
            {
                // オブジェクトの開放.
                hroot.Dispose();
                hchild.Dispose();
                _adrs0.Dispose();
                _adrs1.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_root_alloc()
        Dim hroot As FHANDLE = FHANDLE.Zero
        Dim hchild As FHANDLE = FHANDLE.Zero
        Dim _adrs0 As FHANDLE = FHANDLE.Zero
        Dim _adrs1 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

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

            ' パラメータ取得.
            If True Then
                Dim _channels As Integer = api.fnFIE_img_get_channels(hroot)
                Dim _type As Integer = api.fnFIE_img_get_type(hroot)
                Dim _width As Integer = api.fnFIE_img_get_width(hroot)
                Dim _height As Integer = api.fnFIE_img_get_height(hroot)
                Dim _step As SIZE_T = api.fnFIE_img_get_step(hroot)

                Assert.IsTrue(channels = _channels, "チャネル数:期待値と一致しません.")
                Assert.IsTrue(type = _type, "タイプ:期待値と一致しません.")
                Assert.IsTrue(width = _width, "幅:期待値と一致しません.")
                Assert.IsTrue(height = _height, "高さ:期待値と一致しません.")
                Console.WriteLine("_step={0}", _step)
            End If
        Finally
            ' オブジェクトの開放.
            hroot.Dispose()
            hchild.Dispose()
            _adrs0.Dispose()
            _adrs1.Dispose()
        End Try
    End Sub
End Class

See Also