指定座標の濃度値設定(全チャネル一括)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_img_set_dens_channels( FHANDLE himg, int x, int y, double[] dens ) |
Visual Basic |
---|
Public Shared Function fnFIE_img_set_dens_channels ( himg As FHANDLE, x As Integer, y As Integer, dens As Double() ) As Integer |
Parameters
- himg
- Type: fvalgcli..::..FHANDLE
濃度を設定する画像( type: bin, uc8, s16, us16, i32, ui32, double, float, rgbq, rgbtri)
- x
- Type: System..::..Int32
対象画素のX座標
- y
- Type: System..::..Int32
対象画素のY座標
- dens
- Type: array<System..::..Double>[]()[][]
濃度値配列 (himg のチャネル数分。RGBQUAD, RGBTRIPLE型の場合は3以上。)
Return Value
Type: Int32以下のエラーコードを返します。
エラーコード:
f_err | 内容 |
---|---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_IMAGE | himg に指定された画像が不正 |
F_ERR_INVALID_PARAM | パラメータエラー |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Examples
C# | Copy |
---|---|
// $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_set_dens_channels() { int status = (int)f_err.F_ERR_NONE; FHANDLE himg = FHANDLE.Zero; const int channels = 3; const int width = 32; const int height = 24; try { // 処理画像の確保. himg = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_US16, channels, width, height); // 濃度値設定. for (int ch = 0; ch < channels; ch++) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { double dens = (ch + 1) + (y * width + x); status = api.fnFIE_img_set_dens(himg, ch, x, y, dens); // check Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status); } } } // 濃度値取得. for (int ch = 0; ch < channels; ch++) { for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { double dens = 0; status = api.fnFIE_img_get_dens(himg, ch, x, y, ref dens); // check Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status); double right_dens = (ch + 1) + (y * width + x); Assert.IsTrue(dens == right_dens, "期待値と一致しません."); } } } } finally { // オブジェクトの開放. himg.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_set_dens_channels() Dim status As Integer = CInt(f_err.F_ERR_NONE) Dim himg As FHANDLE = FHANDLE.Zero Const channels As Integer = 3 Const width As Integer = 32 Const height As Integer = 24 Try ' 処理画像の確保. himg = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_US16), channels, width, height) ' 濃度値設定. For ch As Integer = 0 To channels - 1 For y As Integer = 0 To height - 1 For x As Integer = 0 To width - 1 Dim dens As Double = (ch + 1) + (y * width + x) status = api.fnFIE_img_set_dens(himg, ch, x, y, dens) ' check Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err)) Next Next Next ' 濃度値取得. For ch As Integer = 0 To channels - 1 For y As Integer = 0 To height - 1 For x As Integer = 0 To width - 1 Dim dens As Double = 0 status = api.fnFIE_img_get_dens(himg, ch, x, y, dens) ' check Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err)) Dim right_dens As Double = (ch + 1) + (y * width + x) Assert.IsTrue(dens = right_dens, "期待値と一致しません.") Next Next Next Finally ' オブジェクトの開放. himg.Dispose() End Try End Sub End Class |