画像のボーダーを拡張する

Namespace: fvalgcli
Assembly: 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 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_copy_border()
        {
            int status = (int)f_err.F_ERR_NONE;

            FHANDLE hsrc = FHANDLE.Zero;    // 入力画像ハンドル.
            FHANDLE hdst = FHANDLE.Zero;    // 出力画像ハンドル.
            int border_left;                // 左側ボーダー幅(出力先左上X座標).
            int border_top;                    // 上側ボーダー幅(出力先左上Y座標).
            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 imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text

Imports fvalgcli

Public Partial Class FIE
    ''' <summary>
    ''' 画像のボーダーの拡張.
    ''' </summary>
    <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
        ' 左側ボーダー幅(出力先左上X座標).
        Dim border_top As Integer
        ' 上側ボーダー幅(出力先左上Y座標).
        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