疑似カラー表示用マップ生成
Namespace: fvalgcliAssembly: 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 |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[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 |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<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