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

wxGraphicsRenderer 是一個對應於所使用的渲染引擎的實例。

如果系統中存在不同的渲染引擎,則可能會有多個實例,但每個引擎始終只有一個實例。此實例會被它建立的所有物件(wxGraphicsContextwxGraphicsPath 等)指回,並且可以通過它們的 wxGraphicsObject:getRenderer/1 方法檢索。因此,您可以通過調用 wxGraphicsObject:getRenderer/1,然後使用該渲染器的適當的 CreateXXX() 函式來建立路徑等的其他實例。

wxWidgets 文件:wxGraphicsRenderer

摘要

函式

wxBrush 建立原生畫刷。

wxFont 和文字顏色建立原生圖形字體。

使用給定的特性建立圖形字體。

建立具有線性漸層的原生畫刷。

從傳入的值建立原生仿射變換矩陣。

建立初始為空的原生圖形路徑。

返回此平台上的預設渲染器。

類型

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

函式

連結到此函式

createBrush(This, Brush)

檢視原始碼
-spec createBrush(This, Brush) -> wxGraphicsBrush:wxGraphicsBrush()
                     when This :: wxGraphicsRenderer(), Brush :: wxBrush:wxBrush().

wxBrush 建立原生畫刷。

連結到此函式

createContext(This, WindowDC)

檢視原始碼
-spec createContext(This, WindowDC) -> wxGraphicsContext:wxGraphicsContext()
                       when
                           This :: wxGraphicsRenderer(),
                           WindowDC ::
                               wxWindowDC:wxWindowDC() | wxWindow:wxWindow() | wxMemoryDC:wxMemoryDC().

wxWindowDC 建立 wxGraphicsContext

連結到此函式

createFont(This, Font)

檢視原始碼
-spec createFont(This, Font) -> wxGraphicsFont:wxGraphicsFont()
                    when This :: wxGraphicsRenderer(), Font :: wxFont:wxFont().

等同於 createFont(This, Font, [])

-spec createFont(This, SizeInPixels, Facename) -> wxGraphicsFont:wxGraphicsFont()
                    when
                        This :: wxGraphicsRenderer(),
                        SizeInPixels :: number(),
                        Facename :: unicode:chardata();
                (This, Font, [Option]) -> wxGraphicsFont:wxGraphicsFont()
                    when
                        This :: wxGraphicsRenderer(),
                        Font :: wxFont:wxFont(),
                        Option :: {col, wx:wx_colour()}.

wxFont 和文字顏色建立原生圖形字體。

-spec createFont(This, SizeInPixels, Facename, [Option]) -> wxGraphicsFont:wxGraphicsFont()
                    when
                        This :: wxGraphicsRenderer(),
                        SizeInPixels :: number(),
                        Facename :: unicode:chardata(),
                        Option :: {flags, integer()} | {col, wx:wx_colour()}.

使用給定的特性建立圖形字體。

如果可以,應該使用採用 wxFontcreateFont/4 多載。此多載的主要優勢是它可以在使用 Cairo 時,在 Unix 下無需 X 伺服器連線即可使用。

自:2.9.3

連結到此函式

createLinearGradientBrush(This, X1, Y1, X2, Y2, Stops)

檢視原始碼
-spec createLinearGradientBrush(This, X1, Y1, X2, Y2, Stops) -> wxGraphicsBrush:wxGraphicsBrush()
                                   when
                                       This :: wxGraphicsRenderer(),
                                       X1 :: number(),
                                       Y1 :: number(),
                                       X2 :: number(),
                                       Y2 :: number(),
                                       Stops :: wxGraphicsGradientStops:wxGraphicsGradientStops().

建立具有線性漸層的原生畫刷。

Stops 支援是自 wxWidgets 2.9.1 以來新增的功能,以前只能指定開始和結束顏色。

在 3.1.3 中新增了將變換矩陣應用於漸層的功能。

-spec createMatrix(This) -> wxGraphicsMatrix:wxGraphicsMatrix() when This :: wxGraphicsRenderer().

等同於 createMatrix(This, [])

-spec createMatrix(This, [Option]) -> wxGraphicsMatrix:wxGraphicsMatrix()
                      when
                          This :: wxGraphicsRenderer(),
                          Option ::
                              {a, number()} |
                              {b, number()} |
                              {c, number()} |
                              {d, number()} |
                              {tx, number()} |
                              {ty, number()}.

從傳入的值建立原生仿射變換矩陣。

預設值會產生一個單位矩陣。

-spec createPath(This) -> wxGraphicsPath:wxGraphicsPath() when This :: wxGraphicsRenderer().

建立初始為空的原生圖形路徑。

連結到此函式

createRadialGradientBrush(This, StartX, StartY, EndX, EndY, Radius, Stops)

檢視原始碼
-spec createRadialGradientBrush(This, StartX, StartY, EndX, EndY, Radius, Stops) ->
                                   wxGraphicsBrush:wxGraphicsBrush()
                                   when
                                       This :: wxGraphicsRenderer(),
                                       StartX :: number(),
                                       StartY :: number(),
                                       EndX :: number(),
                                       EndY :: number(),
                                       Radius :: number(),
                                       Stops :: wxGraphicsGradientStops:wxGraphicsGradientStops().

建立具有放射狀漸層的原生畫刷。

Stops 支援是自 wxWidgets 2.9.1 以來新增的功能,以前只能指定開始和結束顏色。

在 3.1.3 中新增了將變換矩陣應用於漸層的功能。

-spec getDefaultRenderer() -> wxGraphicsRenderer().

返回此平台上的預設渲染器。

在 macOS 上,這是 Core Graphics (又名 Quartz 2D) 渲染器,在 MSW 上是 GDIPlus 渲染器,而在 GTK 上,我們目前預設為 Cairo 渲染器。