疑似カラー表示用マップ生成

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

Syntax

C#
public static int fnFIE_make_pseudo_colormap(
	RGBQUAD_PTR pallet,
	int size,
	f_colormap_type type,
	byte reserve
)
Visual Basic
Public Shared Function fnFIE_make_pseudo_colormap ( 
	pallet As RGBQUAD_PTR,
	size As Integer,
	type As f_colormap_type,
	reserve As Byte
) As Integer

Parameters

pallet
Type: fvalgcli..::..RGBQUAD_PTR
色テーブル
size
Type: System..::..Int32
テーブルサイズ( 1 ≦ size )
type
Type: fvalgcli..::..f_colormap_type
カラーマップタイプ。下記の何れかを指定。
  • F_COLORMAP_GRAY 濃淡カラーマップ
  • F_COLORMAP_RED 赤色カラーマップ
  • F_COLORMAP_GREEN 緑色カラーマップ
  • F_COLORMAP_BLUE 青色カラーマップ
  • F_COLORMAP_RAINBOW7 虹色7色カラーマップ
  • F_COLORMAP_RAINBOW4 虹色4色カラーマップ
  • F_COLORMAP_RAINBOW 虹色カラーマップ
  • F_COLORMAP_LAND 地形図カラーマップ
  • F_COLORMAP_HOTCOLD 赤青カラーマップ
  • F_COLORMAP_LEAF 葉色カラーマップ
  • F_COLORMAP_KAKI 柿色カラーマップ
  • F_COLORMAP_OCEAN 海色カラーマップ
reserve
Type: System..::..Byte
RGBQUAD構造体の rgbReserved に設定する値

Return Value

Type: Int32
以下のエラーコードを返します。

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_NOMEMORYメモリ不足エラー
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_make_pseudo_colormap()
        {
            int status = (int)f_err.F_ERR_NONE;

            FHANDLE hdst = FHANDLE.Zero;    // 出力画像.
            RGBQUAD_PTR pallet = IntPtr.Zero;

            try
            {
                int w = 512;
                int h = 10;
                pallet = RGBQUAD_PTR.alloc(w);

                // 出力画像の生成.
                hdst = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_RGBQUAD, 1, w, h);

                // 処理の実行.
                status = api.fnFIE_make_pseudo_colormap(pallet, w, f_colormap_type.F_COLORMAP_GRAY, 255);

                // エラー判定.
                Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

                // 擬似カラー表示用マップを出力画像領域に配置.
                SIZE_T step = api.fnFIE_img_get_step(hdst);
                UCHAR_PTR adrs = api.fnFIE_img_get_adrs(hdst);
                for (int y = 0; y < h; y++)
                {
                    RGBQUAD_PTR pixel = (IntPtr)adrs;
                    for (int x = 0; x < w; x++)
                    {
                        pixel[x] = pallet[x];
                    }
                    adrs += step;
                }

                // 出力画像の保存.
                api.fnFIE_save_png(ResultDir + "/fnFIE_make_pseudo_colormap.png", hdst, -1);
            }
            finally
            {
                // オブジェクトの開放.
                hdst.Dispose();
                pallet.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_make_pseudo_colormap()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        Dim hdst As FHANDLE = FHANDLE.Zero
        ' 出力画像.
        Dim pallet As RGBQUAD_PTR = IntPtr.Zero

        Try
            Dim w As Integer = 512
            Dim h As Integer = 10
            pallet = RGBQUAD_PTR.alloc(w)

            ' 出力画像の生成.
            hdst = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_RGBQUAD), 1, w, h)

            ' 処理の実行.
            status = api.fnFIE_make_pseudo_colormap(pallet, w, f_colormap_type.F_COLORMAP_GRAY, 255)

            ' エラー判定.
            Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))

            ' 擬似カラー表示用マップを出力画像領域に配置.
            Dim [step] As SIZE_T = api.fnFIE_img_get_step(hdst)
            Dim adrs As UCHAR_PTR = api.fnFIE_img_get_adrs(hdst)
            For y As Integer = 0 To h - 1
                Dim pixel As RGBQUAD_PTR = CType(adrs, IntPtr)
                For x As Integer = 0 To w - 1
                    pixel(x) = pallet(x)
                Next
                adrs += [step]
            Next

            ' 出力画像の保存.
            api.fnFIE_save_png(ResultDir & "/fnFIE_make_pseudo_colormap.png", hdst, -1)
        Finally
            ' オブジェクトの開放.
            hdst.Dispose()
            pallet.Dispose()
        End Try
    End Sub
End Class

See Also