紋理貼圖器和動畫紋理貼圖器
介紹
從TouchGFX 4.12.3開始
的Texture Mapper
&Animation Texture Mapper
能夠繪制變換圖像的窗口小部件,即可以自由地縮放和旋轉圍繞調節原點。透視印象也可以通過應用虛擬相機來實現,其中透視量也可以調整。
本文將逐步介紹創建和配置Texture Mapper
/ 的步驟 Animation Texture Mapper
。
- 此小部件僅在4.12.3及更高版本中可用。
- 此小部件對MCU負載有重大影響。
- 此小部件不支持每像素顏色深度1位。
Texture Mapper
在TouchGFX Designer中的“圖像”下。
重要屬性
位置 | 設置x ,y ,width ,height 和 visible 的性能Texture Mapper 。也可以設置是否 Texture Mapper 將生成為Animation Texture Mapper 。 |
圖片 | 設置應該轉化的的形象x ,y 在小部件中的圖像的位置。 |
角度和比例 | 設置 應該顯示的圖像 的 角度以弧度設置。 |
奧里戈 | 設置
|
相機 | 設置 |
出現 | 配置 |
用法
當 選擇Texture Mapper
/ Animation Texture Mapper
並將其放在TouchGFX Designer畫布上時,上表中的屬性用於配置 Texture Mapper
/ Animation Texture Mapper
。
位置
在TouchGFX Designer中修改位置屬性
通過調整“位置”下的屬性來確定Texture Mapper
/ 的面積 Animation Texture Mapper
。要設置位置,請設置坐標屬性,x
並 y
確定Texture Mapper
/ 角左上角的Animation Texture Mapper
位置。大小由屬性確定的width
,height
。
根據Texture Mapper
/ 的大小裁剪轉換后的圖像 Animation Texture Mapper
。為了使圖像完全可見,Texture Mapper
/ Animation Texture Mapper
應該足夠大以容納轉換后的圖像。
這也可以將部件從改變 Texture Mapper
到Animation Texture Mapper
,通過把一個對勾復選框與標簽“動畫紋理映射”。
- 如果將旋轉或縮放交互應用於持續時間或延遲大於零的“紋理映射器”,則還將生成為“動畫紋理映射器”。
圖片
在TouchGFX Designer中修改圖像屬性
通過調整“圖像”下的屬性,可以設置要變換的圖像及其位置。坐標屬性x
, y
確定圖像左上角的位置。要將圖像鎖定在Texture Mapper
/ 的中心, Animation Texture Mapper
請在復選框中打上帶有“鎖定圖像至中心”標簽的復選框。
- 如果在運行時調整紋理映射器/動畫紋理映射器的大小,則此選項不會保持圖像的居中位置。
Origo和相機
在TouchGFX Designer中修改Origo和Camera屬性
在“ Origo”和“ Camera”下的屬性中設置Origo和Camera Texture Mapper
/ Animation Texture Mapper
。
Origo確定應在其周圍進行所選圖像轉換的位置。坐標特性x
和 y
可相對於紋理映射器的寬度和高度與不相對於所選擇的圖像的寬度和高度。
坐標屬性 z
是相對於camera distance.
如果camera distance
設置為1000,並且圖像必須繞它自己的軸 z
ORIGO也應設置為1000。
為了在中心鎖定位置變換 Texture Mapper
/Animation Texture Mapper
,在帶有“鎖定origo到中心”標簽的復選框中打勾。這會將x
and y
屬性鎖定在 Texture Mapper
/ 的中心, Animation Texture Mapper
並將該z
屬性鎖定在 / 的值 camera distance
。
- 如果在運行時調整紋理貼圖器/動畫紋理貼圖器的大小或更改了相機距離,則此選項不會保持居中的變換位置。
相機距離決定了獲得的透視量,較低的值將導致較大的透視圖,而較高的值將導致較少的透視圖。
請參閱下圖,直觀地了解Texture Mapper
/中使用的坐標系 Animation Texture Mapper
。
用於Texture Mapper / Animation Texture Mapper中的Origo和相機距離的坐標系
回呼
如果將Texture Mapper
設置為a Animation Texture Mapper
,則將調用兩個回調: textureMapperAnimationStepCallback
&textureMapperAnimationEndedCallback
。
textureMapperAnimationStepCallback
每當當前動畫執行一個步驟時,就會調用。
textureMapperAnimationStepCallback
所有動畫結束時調用。