My program doesn't have bugs. It just develops random features.

Difference between revisions of "UE3:Canvas (UT3)"

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search
m (1 revision)
(added a few descriptions)
(One intermediate revision by one other user not shown)
Line 3: Line 3:
 
| parent1 = Object
 
| parent1 = Object
 
}}
 
}}
{{autogenerated}}
+
A drawing canvas for the {{cl|HUD}} and for {{cl|ScriptedTexture}}s.
Canvas: A drawing canvas.
+
 
Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
+
A canvas can define a clipping region through OrgX/Y and ClipX/Y, which is used as reference coordinate system for all drawing operations. The drawing position, CurX/Y, is relative to the origin of the clipping region. Drawing functions with "clipped" in their name will limit drawing to the clipping region, others only use the origin as offset and still draw to the entire canvas.
  
 
==Properties==
 
==Properties==
Line 28: Line 28:
 
'''Type:''' [[float]]
 
'''Type:''' [[float]]
  
<!-- enter variable description -->
+
Width of the clipping region.
  
 
====ClipY====
 
====ClipY====
 
'''Type:''' [[float]]
 
'''Type:''' [[float]]
  
Bottom right clipping region.
+
Height of the clipping region.
  
 
====ColorModulate====
 
====ColorModulate====
Line 61: Line 61:
 
'''Type:''' [[float]]
 
'''Type:''' [[float]]
  
<!-- enter variable description -->
+
Horizontal coordinate of current drawing position.
  
 
====CurY====
 
====CurY====
 
'''Type:''' [[float]]
 
'''Type:''' [[float]]
  
Current position for drawing.
+
Vertical coordinate of the current drawing position.
  
 
====CurYL====
 
====CurYL====
 
'''Type:''' [[float]]
 
'''Type:''' [[float]]
  
Largest Y size since DrawText.
+
Height of the last {{tl|DrawText}} output.
  
 
====DefaultTexture====
 
====DefaultTexture====
Line 106: Line 106:
 
'''Type:''' {{cl|Font}}
 
'''Type:''' {{cl|Font}}
  
Font for DrawText.
+
Font for {{tl|DrawText}}.
  
 
'''Default value:''' {{cl|Font}}'EngineFonts.SmallFont'
 
'''Default value:''' {{cl|Font}}'EngineFonts.SmallFont'
Line 113: Line 113:
 
'''Type:''' [[float]]
 
'''Type:''' [[float]]
  
<!-- enter variable description -->
+
Offset of the clipping region from the left side of the screen.
  
 
====OrgY====
 
====OrgY====
 
'''Type:''' [[float]]
 
'''Type:''' [[float]]
  
Origin for drawing.
+
Offset of the clipping region from the top side of the screen.
  
 
====SceneView====
 
====SceneView====
Line 132: Line 132:
 
'''[[Variables#Modifiers|Modifiers]]:''' const
 
'''[[Variables#Modifiers|Modifiers]]:''' const
  
<!-- enter variable description -->
+
Width of the screen in pixels.
  
 
====SizeY====
 
====SizeY====
Line 139: Line 139:
 
'''[[Variables#Modifiers|Modifiers]]:''' const
 
'''[[Variables#Modifiers|Modifiers]]:''' const
  
<!-- enter variable description -->
+
Height of the screen in pixels.
  
 
==Structs==
 
==Structs==
Line 145: Line 145:
 
Holds texture information with UV coordinates as well.
 
Holds texture information with UV coordinates as well.
 
; {{cl|Texture2D}} Texture : Source texture
 
; {{cl|Texture2D}} Texture : Source texture
; [[float]] U : UV coords
+
; [[float]] U : Offset from the left side of the texture region.
; [[float]] V : UV coords
+
; [[float]] V : Offset from the top side of the texture region.
; [[float]] UL : UV coords
+
; [[float]] UL : Texture region width.
; [[float]] VL : UV coords
+
; [[float]] VL : Texture region height.
  
 
==Functions==
 
==Functions==
Line 155: Line 155:
 
{{code|native final function {{tl|Vector|Object|structs}}&nbsp;'''DeProject''' ({{tl|Vector|Object|structs}}&nbsp;'''location''')}}
 
{{code|native final function {{tl|Vector|Object|structs}}&nbsp;'''DeProject''' ({{tl|Vector|Object|structs}}&nbsp;'''location''')}}
  
<!-- enter function description -->
+
Converts local (screen) coordinates to global (world) coordinates.
  
 
====Draw2DLine====
 
====Draw2DLine====
 
{{code|native final function '''Draw2DLine''' ([[float]]&nbsp;'''X1''', [[float]]&nbsp;'''Y1''', [[float]]&nbsp;'''X2''', [[float]]&nbsp;'''Y2''', {{tl|Color|Object|structs}}&nbsp;'''LineColor''')}}
 
{{code|native final function '''Draw2DLine''' ([[float]]&nbsp;'''X1''', [[float]]&nbsp;'''Y1''', [[float]]&nbsp;'''X2''', [[float]]&nbsp;'''Y2''', {{tl|Color|Object|structs}}&nbsp;'''LineColor''')}}
  
<!-- enter function description -->
+
Draws a line from (X1,Y1) to (X2,Y2).
  
 
====DrawColorizedTile====
 
====DrawColorizedTile====
Line 244: Line 244:
 
{{code|native final function {{tl|Vector|Object|structs}}&nbsp;'''Project''' ({{tl|Vector|Object|structs}}&nbsp;'''location''')}}
 
{{code|native final function {{tl|Vector|Object|structs}}&nbsp;'''Project''' ({{tl|Vector|Object|structs}}&nbsp;'''location''')}}
  
<!-- enter function description -->
+
Converts global (world) coordinates to local (screen) coordinates.
  
 
====PushTranslationMatrix====
 
====PushTranslationMatrix====
Line 262: Line 262:
 
{{code|native final function '''SetPos''' ([[float]]&nbsp;'''PosX''', [[float]]&nbsp;'''PosY''')}}
 
{{code|native final function '''SetPos''' ([[float]]&nbsp;'''PosX''', [[float]]&nbsp;'''PosY''')}}
  
<!-- enter function description -->
+
Sets {{tl|CurX}} and {{tl|CurY}}.
  
 
====StrLen====
 
====StrLen====
Line 319: Line 319:
 
{{code|final function '''SetClip''' ([[float]]&nbsp;'''X''', [[float]]&nbsp;'''Y''')}}
 
{{code|final function '''SetClip''' ([[float]]&nbsp;'''X''', [[float]]&nbsp;'''Y''')}}
  
<!-- enter function description -->
+
Sets {{tl|ClipX}}and {{tl|ClipY}}.
  
 
====SetOrigin====
 
====SetOrigin====
 
{{code|final function '''SetOrigin''' ([[float]]&nbsp;'''X''', [[float]]&nbsp;'''Y''')}}
 
{{code|final function '''SetOrigin''' ([[float]]&nbsp;'''X''', [[float]]&nbsp;'''Y''')}}
  
<!-- enter function description -->
+
Sets {{tl|OrgX}} and {{tl|OrgY}}.

Revision as of 12:23, 21 August 2008

UT3 Object >> Canvas
Package: 
Engine
This class in other games:
RTNP, U1, UT, U2XMP, UE2Runtime, U2, UT2003, UT2004, UDK

A drawing canvas for the HUD and for ScriptedTextures.

A canvas can define a clipping region through OrgX/Y and ClipX/Y, which is used as reference coordinate system for all drawing operations. The drawing position, CurX/Y, is relative to the origin of the clipping region. Drawing functions with "clipped" in their name will limit drawing to the clipping region, others only use the origin as offset and still draw to the entire canvas.

Properties

bCenter

Type: bool

Whether to center the text.

bNoSmooth

Type: bool

Don't bilinear filter.

Canvas

Type: pointer{FCanvas}

Modifiers: native, const


ClipX

Type: float

Width of the clipping region.

ClipY

Type: float

Height of the clipping region.

ColorModulate

Type: Object.Plane


Default value:

Member Value
W 1.0
X 1.0
Y 1.0
Z 1.0

CurX

Type: float

Horizontal coordinate of current drawing position.

CurY

Type: float

Vertical coordinate of the current drawing position.

CurYL

Type: float

Height of the last DrawText output.

DefaultTexture

Type: Texture2D


Default value: Texture2D'EngineResources.WhiteSquareTexture'

DrawColor

Type: Object.Color

Color for drawing.

Default value:

Member Value
A 255
B 127
G 127
R 127

Font

Type: Font

Font for DrawText.

Default value: Font'EngineFonts.SmallFont'

OrgX

Type: float

Offset of the clipping region from the left side of the screen.

OrgY

Type: float

Offset of the clipping region from the top side of the screen.

SceneView

Type: pointer{FSceneView}

Modifiers: native, const


SizeX

Type: int

Modifiers: const

Width of the screen in pixels.

SizeY

Type: int

Modifiers: const

Height of the screen in pixels.

Structs

CanvasIcon

Holds texture information with UV coordinates as well.

Texture2D Texture 
Source texture
float
Offset from the left side of the texture region.
float
Offset from the top side of the texture region.
float UL 
Texture region width.
float VL 
Texture region height.

Functions

Native functions

DeProject

native final function Object.Vector DeProject (Object.Vector location)

Converts local (screen) coordinates to global (world) coordinates.

Draw2DLine

native final function Draw2DLine (float X1, float Y1, float X2, float Y2, Object.Color LineColor)

Draws a line from (X1,Y1) to (X2,Y2).

DrawColorizedTile

native final function DrawColorizedTile (Texture2D Tex, float XL, float YL, float U, float V, float UL, float VL, Object.LinearColor LColor)


DrawMaterialTile

native final function DrawMaterialTile (MaterialInterface Mat, float XL, float YL, optional float U, optional float V, optional float UL, optional float VL)

Draws the emissive channel of a material to an axis-aligned quad at CurX,CurY.

Parameters:

  • Mat - The material which contains the emissive expression to render.
  • XL - The width of the quad in pixels.
  • YL - The height of the quad in pixels.
  • U - The U coordinate of the quad's upper left corner, in normalized coordinates.
  • V - The V coordinate of the quad's upper left corner, in normalized coordinates.
  • UL - The range of U coordinates which is mapped to the quad.
  • VL - The range of V coordinates which is mapped to the quad.

DrawMaterialTileClipped

native final function DrawMaterialTileClipped (MaterialInterface Mat, float XL, float YL, optional float U, optional float V, optional float UL, optional float VL)


DrawRotatedMaterialTile

native final function DrawRotatedMaterialTile (MaterialInterface Mat, Object.Rotator Rotation, float XL, float YL, optional float U, optional float V, optional float UL, optional float VL, optional float AnchorX, optional float AnchorY)


DrawRotatedTile

native final function DrawRotatedTile (Texture2D Tex, Object.Rotator Rotation, float XL, float YL, float U, float V, float UL, float VL, optional float AnchorX, optional float AnchorY)


DrawText

native final function DrawText (coerce string Text, optional bool CR, optional float XScale, optional float YScale)


DrawTextClipped

native final function DrawTextClipped (coerce string Text, optional bool bCheckHotKey, optional float XScale, optional float YScale)


DrawTextureDoubleLine

native final function DrawTextureDoubleLine (Object.Vector StartPoint, Object.Vector EndPoint, float Perc, float Spacing, float Width, Object.Color LineColor, Object.Color AltLineColor, Texture2D Tex, float U, float V, float UL, float VL)


DrawTextureLine

native final function DrawTextureLine (Object.Vector StartPoint, Object.Vector EndPoint, float Perc, float Width, Object.Color LineColor, Texture2D LineTexture, float U, float V, float UL, float VL)


DrawTile

native final function DrawTile (Texture2D Tex, float XL, float YL, float U, float V, float UL, float VL)


DrawTileClipped

native(468) final function DrawTileClipped (Texture2D Tex, float XL, float YL, float U, float V, float UL, float VL)


DrawTileNew

native final function DrawTileNew (Texture Tex, float XL, float YL, float U, float V, float UL, float VL)

the only difference in this new version is you can pass in other types of textures (e.g. ScriptedTexture)

DrawTileStretched

native final function DrawTileStretched (Texture2D Tex, float XL, float YL, float U, float V, float UL, float VL, Object.LinearColor LColor, optional bool bStretchHorizontally, optional bool bStretchVertically, optional float ScalingFactor)


PopTransform

native final function PopTransform ()

Pops the topmost matrix from the canvas transform stack.

Project

native final function Object.Vector Project (Object.Vector location)

Converts global (world) coordinates to local (screen) coordinates.

PushTranslationMatrix

native final function PushTranslationMatrix (Object.Vector TranslationVector)

Pushes a translation matrix onto the canvas.

Parameters:

  • TranslationVector - Translation vector to use to create the translation matrix.

SetDrawColor

native final function SetDrawColor (byte R, byte G, byte B, optional byte A)


SetPos

native final function SetPos (float PosX, float PosY)

Sets CurX and CurY.

StrLen

native final function StrLen (coerce string String, out float XL, out float YL)


TextSize

native final function TextSize (coerce string String, out float XL, out float YL)


Events

Reset

event Reset (optional bool bKeepOrigin)


Other instance functions

DrawBox

final simulated function DrawBox (float width, float height)


DrawIcon

final function DrawIcon (CanvasIcon Icon, float X, float Y, optional float Scale)

Draw a CanvasIcon at the desired canvas position.

DrawIconSection

final function DrawIconSection (CanvasIcon Icon, float X, float Y, float UStartPct, float VStartPct, float UEndPct, float VEndPct, optional float Scale)

Draw a subsection of a CanvasIcon at the desired canvas position.

DrawRect

final function DrawRect (float RectX, float RectY, optional Texture2D Tex)


DrawTextRA

final function DrawTextRA (coerce string Text, optional bool CR)

Draws text right aligned from the current position.

DrawTexture

final function DrawTexture (Texture2D Tex, float Scale)


MakeIcon

final function CanvasIcon MakeIcon (Texture2D Texture, optional float U, optional float V, optional float UL, optional float VL)

Fake CanvasIcon constructor.

SetClip

final function SetClip (float X, float Y)

Sets ClipXand ClipY.

SetOrigin

final function SetOrigin (float X, float Y)

Sets OrgX and OrgY.