IMaterial/GetColor

From Garry's Mod
Jump to: navigation, search
 IMaterial:GetColor( )

Contents

Description

Returns the color of the specified pixel of the $basetexture, only works for materials created from PNG files.

Basically identical to ITexture:GetColor used on IMaterial:GetTexture( "$basetexture" ).

BUG

The returned color will not have the color metatable.

Issue Tracker: #2407

Arguments

number x

The X coordinate.

Arguments

number y

The Y coordinate.

Returns

table

The color of the pixel as a Color structure.

Examples

Example

Identical functionality.

local m = Material( "gui/colors_dark.png" )
local t = m:GetTexture("$basetexture")

PrintTable( t:GetColor( 5, 5 ) )
PrintTable( m:GetColor( 5, 5 ) )

Output:

Both printouts will return identical color, which at the time of testing is RGBA - 255, 244, 242, 255.
Personal tools
Navigation