チャイルド画像の確保
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static FHANDLE fnFIE_img_child_alloc( FHANDLE hroot, int offset_x, int offset_y, int width, int height ) |
Visual Basic |
---|
Public Shared Function fnFIE_img_child_alloc ( hroot As FHANDLE, offset_x As Integer, offset_y As Integer, width As Integer, height As Integer ) As FHANDLE |
Parameters
- hroot
- Type: fvalgcli..::..FHANDLE
ルート画像のハンドル(チャイルド画像でも可)
- offset_x
- Type: System..::..Int32
ルート座標系における、チャイルド領域左上x座標 (0≦ offset_x ≦ (ルート画像の幅 -1 - width ))
- offset_y
- Type: System..::..Int32
ルート座標系における、チャイルド領域左上y座標 (0≦ offset_y ≦ (ルート画像の高さ -1 - height ))
- width
- Type: System..::..Int32
チャイルド領域幅 (1≦ width ≦(ルート画像の幅 - offset_x ))
- height
- Type: System..::..Int32
チャイルド領域高さ(1≦ height ≦(ルート画像の高さ - offset_y ))
Return Value
Type: FHANDLE正常終了した場合は、確保されたチャイルド画像のハンドルを返す。 ライセンスエラー、未初期化エラー、パラメータ不正やメモリ確保失敗により異常終了した場合は、IntPtr.Zero を返す。
Examples
C# | Copy |
---|---|
// $Revision: 1.2 $ using System; using System.Collections.Generic; using System.Text; using fvalgcli; namespace TC { public partial class FIE { /// <summary> /// チャイルド画像の確保. /// </summary> [FvPluginExecute] public void fnFIE_img_child_alloc() { FHANDLE hroot = FHANDLE.Zero; FHANDLE hchild = 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: エラーが発生しました。"); // 画像情報取得. { IntPtr _adrs0 = api.fnFIE_img_get_adrs(hchild); Console.WriteLine("fnFIE_img_get_adrs : {0}", _adrs0.ToInt64()); IntPtr _adrs1 = api.fnFIE_img_get_ch_adrs(hchild, 1); Console.WriteLine("fnFIE_img_get_ch_adrs : {0}", _adrs1.ToInt64()); int _channels = api.fnFIE_img_get_channels(hchild); int _type = api.fnFIE_img_get_type(hchild); int _width = api.fnFIE_img_get_width(hchild); int _height = api.fnFIE_img_get_height(hchild); SIZE_T _step = api.fnFIE_img_get_step(hchild); SIZE_T _step_byte = api.fnFIE_img_get_step_as_bytes(hchild); SIZE_T _pixel_size = api.fnFIE_img_get_pixel_size(hchild); Assert.IsTrue(IntPtr.Zero != _adrs0, "画像アドレス1:取得できていません"); Assert.IsTrue(IntPtr.Zero != _adrs1, "画像アドレス2:取得できていません"); Assert.IsTrue(channels == _channels, "チャネル数:期待値と一致しません."); Assert.IsTrue(type == _type, "タイプ:期待値と一致しません."); Assert.IsTrue(child_width == _width, "幅:期待値と一致しません."); Assert.IsTrue(child_height == _height, "高さ:期待値と一致しません."); Console.WriteLine("_step={0}", _step.ToInt32()); Console.WriteLine("_step_byte={0}", _step_byte.ToInt32()); Console.WriteLine("_pixel_size={0}", _pixel_size.ToInt32()); } } finally { // オブジェクトの開放. hroot.Dispose(); hchild.Dispose(); } } } } |
Visual Basic | Copy |
---|---|
' $Revision: 1.1 $ Imports System.Collections.Generic Imports System.Text Imports fvalgcli Public Partial Class FIE ''' <summary> ''' チャイルド画像の確保. ''' </summary> <FvPluginExecute> _ Public Sub fnFIE_img_child_alloc() Dim hroot As FHANDLE = FHANDLE.Zero Dim hchild 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: エラーが発生しました。") ' 画像情報取得. If True Then Dim _adrs0 As IntPtr = api.fnFIE_img_get_adrs(hchild) Console.WriteLine("fnFIE_img_get_adrs : {0}", _adrs0.ToInt64()) Dim _adrs1 As IntPtr = api.fnFIE_img_get_ch_adrs(hchild, 1) Console.WriteLine("fnFIE_img_get_ch_adrs : {0}", _adrs1.ToInt64()) Dim _channels As Integer = api.fnFIE_img_get_channels(hchild) Dim _type As Integer = api.fnFIE_img_get_type(hchild) Dim _width As Integer = api.fnFIE_img_get_width(hchild) Dim _height As Integer = api.fnFIE_img_get_height(hchild) Dim _step As SIZE_T = api.fnFIE_img_get_step(hchild) Assert.IsTrue(IntPtr.Zero <> _adrs0, "画像アドレス1:取得できていません") Assert.IsTrue(IntPtr.Zero <> _adrs1, "画像アドレス2:取得できていません") Assert.IsTrue(channels = _channels, "チャネル数:期待値と一致しません.") Assert.IsTrue(type = _type, "タイプ:期待値と一致しません.") Assert.IsTrue(child_width = _width, "幅:期待値と一致しません.") Assert.IsTrue(child_height = _height, "高さ:期待値と一致しません.") Console.WriteLine("_step={0}", _step) End If Finally ' オブジェクトの開放. hroot.Dispose() hchild.Dispose() End Try End Sub End Class |