ルート画像の変更

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

Syntax

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

Parameters

himg
Type: fvalgcli..::..FHANDLE
サイズを変更する画像のハンドル
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: Int32
以下のエラーコードを返します。

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_NOMEMORYメモリ不足エラー
F_ERR_INVALID_IMAGE画像オブジェクトの異常(ハンドルが不正orインポートされていてリサイズ不可)
F_ERR_INVALID_PARAMパラメータ異常
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

注意: ルート画像をreallocすると、それまでattachされていたチャイルド画像はすべて IntPtr.Zero 画像になります。 また fnFIE_img_root_import_alloc() にて確保されたルート画像が指定された場合は、 F_ERR_INVALID_IMAGE エラーとなります。

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_realloc()
        {
            int status = (int)f_err.F_ERR_NONE;

            FHANDLE hroot = 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: エラーが発生しました。");

                // root 画像変更.
                int type_re = (int)f_imgtype.F_IMG_UI32;
                int channels_re = 1;
                int width_re = 800;
                int height_re = 600;
                status = api.fnFIE_img_root_realloc(hroot, type_re, channels_re, width_re, height_re);
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "fnFIE_img_root_realloc: エラーが発生しました。({0})", (f_err)status);

                // 画像情報取得.
                {
                    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);

                    Assert.IsTrue(channels_re == _channels, "チャネル数:期待値と一致しません.");
                    Assert.IsTrue(type_re == _type, "タイプ:期待値と一致しません.");
                    Assert.IsTrue(width_re == _width, "幅:期待値と一致しません.");
                    Assert.IsTrue(height_re == _height, "高さ:期待値と一致しません.");
                }
            }
            finally
            {
                // オブジェクトの開放.
                hroot.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_realloc()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        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

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

            ' root 画像変更.
            Dim type_re As Integer = CInt(f_imgtype.F_IMG_UI32)
            Dim channels_re As Integer = 1
            Dim width_re As Integer = 800
            Dim height_re As Integer = 600
            status = api.fnFIE_img_root_realloc(hroot, type_re, channels_re, width_re, height_re)
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "fnFIE_img_root_realloc: エラーが発生しました。({0})", CType(status, f_err))

            ' 画像情報取得.
            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)

                Assert.IsTrue(channels_re = _channels, "チャネル数:期待値と一致しません.")
                Assert.IsTrue(type_re = _type, "タイプ:期待値と一致しません.")
                Assert.IsTrue(width_re = _width, "幅:期待値と一致しません.")
                Assert.IsTrue(height_re = _height, "高さ:期待値と一致しません.")
            End If
        Finally
            ' オブジェクトの開放.
            hroot.Dispose()
        End Try
    End Sub
End Class

See Also