檢視原始碼 wxPalette (wx v2.4.3)

調色盤是一個將像素值對應到 RGB 色彩的表格。

它允許將低色深的點陣圖的顏色,例如,映射到顯示器上可用的顏色。調色盤的概念在現今越來越過時,只有 MSW 埠仍然在使用原生調色盤。所有其他埠都使用通用的程式碼,基本上只是一個顏色陣列。

未來,wxWidgets 中調色盤的唯一用途很可能是用於表示來自圖像(例如 GIF 或 PNG)的顏色索引。這些格式的圖像處理程式已被修改為在原始圖像檔案中存在此類資訊時建立調色盤(通常為 256 色或更少的圖像)。有關更多資訊,請參閱 wxImage

預定義物件(包含 wx.hrl):?wxNullPalette

請參閱

wxWidgets 文件: wxPalette

摘要

函式

從大小為 n 的陣列建立調色盤,每個陣列分別對應紅色、藍色或綠色分量。

銷毀物件

傳回調色盤中的條目數量。

傳回給定 RGB 值的像素值(調色盤中的索引)。

傳回給定調色盤索引的 RGB 值。

如果調色盤資料存在,則傳回 true。

預設建構函式。

複製建構函式,使用 overview_refcount。

從大小為 n 的陣列建立調色盤,每個陣列分別對應紅色、藍色或綠色分量。

等同於: isOk/1

類型

-type wxPalette() :: wx:wx_object().

函式

連結到此函式

create(This, Red, Green, Blue)

檢視原始碼
-spec create(This, Red, Green, Blue) -> boolean()
                when This :: wxPalette(), Red :: binary(), Green :: binary(), Blue :: binary().

從大小為 n 的陣列建立調色盤,每個陣列分別對應紅色、藍色或綠色分量。

傳回值:如果建立成功,則傳回 true,否則傳回 false。

請參閱: new/3

-spec destroy(This :: wxPalette()) -> ok.

銷毀物件

-spec getColoursCount(This) -> integer() when This :: wxPalette().

傳回調色盤中的條目數量。

連結到此函式

getPixel(This, Red, Green, Blue)

檢視原始碼
-spec getPixel(This, Red, Green, Blue) -> integer()
                  when This :: wxPalette(), Red :: integer(), Green :: integer(), Blue :: integer().

傳回給定 RGB 值的像素值(調色盤中的索引)。

傳回值:最接近的調色盤索引,如果發生未預期的錯誤,則傳回 wxNOT_FOUND

請參閱: getRGB/2

-spec getRGB(This, Pixel) -> Result
                when
                    Result ::
                        {Res :: boolean(), Red :: integer(), Green :: integer(), Blue :: integer()},
                    This :: wxPalette(),
                    Pixel :: integer().

傳回給定調色盤索引的 RGB 值。

傳回值:如果操作成功,則傳回 true。

請參閱: getPixel/4

-spec isOk(This) -> boolean() when This :: wxPalette().

如果調色盤資料存在,則傳回 true。

-spec new() -> wxPalette().

預設建構函式。

-spec new(Palette) -> wxPalette() when Palette :: wxPalette().

複製建構函式,使用 overview_refcount。

-spec new(Red, Green, Blue) -> wxPalette() when Red :: binary(), Green :: binary(), Blue :: binary().

從大小為 n 的陣列建立調色盤,每個陣列分別對應紅色、藍色或綠色分量。

請參閱: create/4

-spec ok(This) -> boolean() when This :: wxPalette().

等同於: isOk/1