1. 程式人生 > >Unity2017.1官方UGUI文檔翻譯——Raw Image

Unity2017.1官方UGUI文檔翻譯——Raw Image

controls show pri 功能 sca lin cto ref 適合

Raw Image

原生圖片

The Raw Image control displays a non-interactive image to the user. This can be used for decoration, icons, etc, and the image can also be changed from a script to reflect changes in other controls. The control is similar to the Image control but does not have the same set of options for animating the image and accurately filing the control rectangle. However, the Raw Image can display any texture whilst the Image can only show a Sprite texture.

Raw Image控件向用戶展示一個不可交互的圖片。它可以被用作裝飾品、圖標等。而且Image可以用腳本更改Image以反映其他控件的更改。這個控件類似於Image控件但是沒有提供更多的設置來讓圖片用不同的方式填充空間的矩形空間。然而,Raw Image可以用所有類型的texture,Image控件的texture卻必須是Sprite,

技術分享圖片

A Raw Image control

Properties

屬性

技術分享圖片

Property:Function:
Texture The texture that represents the image to display.
Color The color to apply to the image.
Material The Material to use for rendering the image.
UV Rectangle The image’s offset and size within the control rectangle, given in normalized coordinates (range 0.0 to 1.0). The edges of the image are stretched to fill the space around the UV rectangle.
屬性功能
Texture 表示要顯示的圖像的紋理
Color 要應用於圖像的顏色
Material 用於渲染圖片的Material
UV Rectangle

圖像在控件矩形區域內的偏移和大小,以規範化坐標(範圍為0.0到1.0)給出。 圖像的邊緣被拉伸以填充UV矩形周圍的空間。

The image’s offset and size within the control rectangle, given in normalized coordinates (range 0.0 to 1.0). The edges of the image are stretched to fill the space around the UV rectangle.

Details

詳細

Since the Raw Image does not require a sprite texture, you can use it to display any texture available to the Unity player. For example, you might show an image downloaded from a URL using the WWW class or a texture from an object in a game.

由於原始圖像不需要精靈紋理,因此可以使用它來顯示Unity可用的任何紋理。 例如,您可能會使用WWW類從URL下載的圖像或來自遊戲中物體的紋理。

The UV Rectangle properties allow you to display a small section of a larger image. The X and Y coordinates specify which part of the image is aligned with the bottom left corner of the control. For example, an X coordinate of 0.25 will cut off the leftmost quarter of the image. The W and H (ie, width and height) properties indicate the width and height of the section of image that will be scaled to fit the control rectangle. For example, a width and height of 0.5 will scale a quarter of the image area up to the control rectangle. By changing these properties, you can zoom and scale the image as desired (see also the Scrollbar control).

UV Rectangle屬性允許你顯示較大圖像的一小部分。X和Y坐標指定圖像的哪一部分與控件的左下角對齊。例如,0.25的X坐標將切斷圖像的最左邊的四分之一。W和H(即,寬度和高度)屬性表示將被縮放以適合控制矩形的圖像部分的寬度和高度。例如,寬度和高度為0.5將按比例縮放四分之一圖像區域填滿控件矩形。 通過更改這些屬性,可以根據需要縮放和縮放圖像(另請參閱Scrollbar控件)。

Unity2017.1官方UGUI文檔翻譯——Raw Image