画像のボーダーを拡張する
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_copy_border(
FHANDLE hsrc,
FHANDLE hdst,
int border_left,
int border_top,
f_border_mode border_mode,
double value
) |
Visual Basic |
---|
Public Shared Function fnFIE_copy_border (
hsrc As FHANDLE,
hdst As FHANDLE,
border_left As Integer,
border_top As Integer,
border_mode As f_border_mode,
value As Double
) As Integer |
Parameters
- hsrc
- Type: fvalgcli..::..FHANDLE
入力画像ハンドル( type: bin, uc8, s16, us16, i32 ,ui32, i64, float, double, rgbq, rgbtri )
- hdst
- Type: fvalgcli..::..FHANDLE
出力先画像ハンドル( type: bin, uc8, s16, us16, i32 ,ui32, i64, float, double, rgbq, rgbtri )
- border_left
- Type: System..::..Int32
左側ボーダー幅(出力先左上X座標)
- border_top
- Type: System..::..Int32
上側ボーダー幅(出力先左上Y座標)
- border_mode
- Type: fvalgcli..::..f_border_mode
ボーダーコピーモード
- F_BORDER_ZERO :0埋めモード
- F_BORDER_VALUE :一定値モード
- F_BORDER_CONTINUOUS :端延長モード
- F_BORDER_REPEAT :繰り返しモード
- F_BORDER_MIRROR1 :反転モード1
- F_BORDER_MIRROR2 :反転モード2
- value
- Type: System..::..Double
ボーダー濃度値。
border_mode がF_BORDER_VALUEの場合のみ使用されます。
その他のモードの場合は、この値は無視されます。
画像が整数型の場合は、濃度値は単純キャストで整数に変換されます。
2値画像の場合は ((INT) val )==0 の場合は0, それ以外は1になります。
また、指定の濃度値が濃度値範囲を超えていた場合は、サチュレーション処理が行われます。
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_NOMEMORY | メモリ不足エラー |
F_ERR_INVALID_IMAGE | 画像オブジェクトの異常。画像の種類やチャネル数が違う場合はこのエラーを出します。 |
F_ERR_INVALID_PARAM | パラメータ異常。画像のサイズの影響でボーダー量がマイナスになる場合もこのエラーを出します。 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
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_border()
{
int status = (int)f_err.F_ERR_NONE;
FHANDLE hsrc = FHANDLE.Zero;
FHANDLE hdst = FHANDLE.Zero;
int border_left;
int border_top;
const f_border_mode border_mode = f_border_mode.F_BORDER_CONTINUOUS;
const double value = 0;
try
{
api.fnFIE_load_bmp(TestImageDir + "/testdata/lena256.bmp", ref hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8);
border_left = api.fnFIE_img_get_width(hsrc) / 2;
border_top = api.fnFIE_img_get_height(hsrc) / 2;
int dst_width = api.fnFIE_img_get_width(hsrc) + border_left * 3;
int dst_height = api.fnFIE_img_get_height(hsrc) + border_top * 3;
hdst = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_UC8, 1, dst_width, dst_height);
status = api.fnFIE_copy_border(hsrc, hdst, border_left, border_top, border_mode, value);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
api.fnFIE_save_png(ResultDir + "/fnFIE_copy_border.png", hdst, -1);
}
finally
{
hsrc.Dispose();
hdst.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_copy_border()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim hsrc As FHANDLE = FHANDLE.Zero
Dim hdst As FHANDLE = FHANDLE.Zero
Dim border_left As Integer
Dim border_top As Integer
Const border_mode As f_border_mode = f_border_mode.F_BORDER_CONTINUOUS
Const value As Double = 0
Try
api.fnFIE_load_bmp(TestImageDir & "/testdata/lena256.bmp", hsrc, f_color_img_type.F_COLOR_IMG_TYPE_UC8)
border_left = api.fnFIE_img_get_width(hsrc) \ 2
border_top = api.fnFIE_img_get_height(hsrc) \ 2
Dim dst_width As Integer = api.fnFIE_img_get_width(hsrc) + border_left * 3
Dim dst_height As Integer = api.fnFIE_img_get_height(hsrc) + border_top * 3
hdst = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_UC8), 1, dst_width, dst_height)
status = api.fnFIE_copy_border(hsrc, hdst, border_left, border_top, border_mode, value)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
api.fnFIE_save_png(ResultDir & "/fnFIE_copy_border.png", hdst, -1)
Finally
hsrc.Dispose()
hdst.Dispose()
End Try
End Sub
End Class |
See Also