Garry's Mod Wiki
Description
DImage is an advanced, more robust version of the Material panel.
See DImageButton for a click-able version of this panel.
Parent
Derives methods, etc not listed on this page from DPanel.
Methods
DImage:DoLoadMaterial()
This is used internally - although you're able to use it you probably shouldn't.
Actually loads the IMaterial to render it. Called from DImage:LoadMaterial.
DImage:FixVertexLitMaterial()
This is used internally - although you're able to use it you probably shouldn't.
"Fixes" the current material of the DImage if it has VertexLit shader by creating a new one with the same name and a prefix of "_DImage" and automatically calling DImage:SetMaterial with the new material.
This fixes the problem where using materials using shaders that expect lighting information causing "weird" flickering when displayed in 2D/Unlit environment.
string DImage:GetFailsafeMatName()
This is used internally - although you're able to use it you probably shouldn't.
Returns the texture path set by DImage:SetFailsafeMatName.
table DImage:GetImageColor()
Returns the color override of the image panel.
boolean DImage:GetKeepAspect()
Returns whether the DImage should keep the aspect ratio of its image when being resized.
See DImage:SetKeepAspect for more info on how it works.
IMaterial DImage:GetMaterial()
Returns the current Material of the DImage.
string DImage:GetMatName()
This is used internally - although you're able to use it you probably shouldn't.
Returns the texture path set by DImage:SetMatName.
DImage:LoadMaterial()
This is used internally - although you're able to use it you probably shouldn't.
Initializes the loading process of the material to render if it is not loaded yet.
You do not need to call this function. It is done for you automatically.
Paints a ghost copy of the DImage panel at the given position and dimensions. This function overrides Panel:PaintAt.
DImage:SetFailsafeMatName( string backupMat )
This is used internally - although you're able to use it you probably shouldn't.
Sets the backup material to be loaded when the image is first rendered. Used by DImage:SetOnViewMaterial.
Sets the image to load into the frame. If the first image can't be loaded and strBackup is set, that image will be loaded instead.
This eventually calls DImage:SetMaterial.
DImage:SetImageColor( table col )
Sets the image's color override.
DImage:SetKeepAspect( boolean keep )
Sets whether the DImage should keep the aspect ratio of its image when being resized.
Note that this will not try to fit the image inside the button, but instead it will fill the button with the image.
DImage:SetMaterial( IMaterial mat )
Sets a Material directly as an image.
DImage:SetMatName( string mat )
This is used internally - although you're able to use it you probably shouldn't.
Sets the material to be loaded when the image is first rendered. Used by DImage:SetOnViewMaterial.
Similar to DImage:SetImage, but will only do the expensive part of actually loading the textures/material if the material is about to be rendered/viewed.
Useful for cases like DIconBrowser, where there are hundreds of small icons in 1 panel in a list that do not need all to be loaded at the same time.
Example
Creates a DImage of Dr. Breen inside a DFrame panel.
Example
Creates three DImage panels and arranges them into a new image.
Output:
This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.
Page content is automatically updated twice a day. Edits and history are not available.
Last Parsed: Loading...