Script v1_7_1_0
- AI
- Animals
- Collections
- Contracts
- Debug
- Economy
- Elements
- EnvironmentalScore
- Errors
- Events
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ColorPickButtonElement
- ConstructionScreen
- ContextActionDisplay
- ControlBarDisplay
- DialogElement
- DynamicFadedBitmapElement
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GameInfoDisplayMobile
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiTopDownCursor
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDSliderElement
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InfoDisplay
- InfoHUDBox
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputGlyphElementUI
- InputHelpDisplay
- KeyValueInfoHUDBox
- ListElement
- ListItemElement
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PictureElement
- PlatformIconElement
- PlayerControlPadDisplay
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- ScrollingLayoutElement
- SettingsModel
- SideNotification
- SideNotificationMobile
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- SpeedSliderDisplay
- StatusBar
- SteeringSliderDisplay
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TerrainLayerElement
- TextBackdropElement
- TextElement
- TextInputElement
- ThreePartBitmapElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VariableWorkWidthHUDExten...
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- WardrobeScreen
- Handtools
- Hud
- I3d
- Input
- Jobs
- Maps
- Materials
- Misc
- Objects
- Parameters
- Placeables
- Placement
- Player
- Shop
- Sounds
- Specialization
- Specializations
- StateMachine
- Statistics
- Tasks
- Triggers
- Utils
- Vehicles
Engine v1_7_1_0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- general
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- NoteNode
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- VoiceChat
- XML
Foundation Reference
PictureElement
DescriptionDisplays an image with content sizing constraintsParent
BitmapElementXML Configuration Parameters
GuiElement#offset | string [optional] Position offset of the displayed image relative to this element's origin in reference resolution, defaults to [0, 0]. Format: "[x]px [y]px". |
GuiElement#focuseOffset | string [optional] Position offset of the displayed image when it's focused, pressed, highlighted or selected. Works like #offset. |
Functions
copyAttributes
DescriptionDefinitioncopyAttributes()Code
65 | function PictureElement:copyAttributes(src) |
66 | PictureElement:superClass().copyAttributes(self, src) |
67 | |
68 | self.contentMode = src.contentMode |
69 | self.aspectRatio = src.aspectRatio |
70 | self.imageSize = src.imageSize |
71 | end |
draw
DescriptionDefinitiondraw()Code
127 | function PictureElement:draw(clipX1, clipY1, clipX2, clipY2) |
128 | local x, y, width, height = self:getAdjustedPosition() |
129 | |
130 | GuiOverlay.renderOverlay(self.overlay, self.absPosition[1] + x, self.absPosition[2] + y, width, height, self:getOverlayState(), clipX1, clipY1, clipX2, clipY2) |
131 | |
132 | if self.debugEnabled or g_uiDebugEnabled then |
133 | local xPixel = 1 / g_screenWidth |
134 | local yPixel = 1 / g_screenHeight |
135 | |
136 | drawFilledRect(self.absPosition[1] - xPixel + x, self.absPosition[2] - yPixel + y, width + 2 * xPixel, yPixel, 1, 1, 0, 1) |
137 | drawFilledRect(self.absPosition[1] - xPixel + x, self.absPosition[2] + height + y, width + 2 * xPixel, yPixel, 1, 1, 0, 1) |
138 | drawFilledRect(self.absPosition[1] - xPixel + x, self.absPosition[2] + y, xPixel, height, 1, 1, 0, 1) |
139 | drawFilledRect(self.absPosition[1] + width + x, self.absPosition[2] + y, xPixel, height, 1, 1, 0, 1) |
140 | end |
141 | |
142 | -- Skip over superclass |
143 | PictureElement:superClass():superClass().draw(self, clipX1, clipY1, clipX2, clipY2) |
144 | end |
loadFromXML
DescriptionDefinitionloadFromXML()Code
40 | function PictureElement:loadFromXML(xmlFile, key) |
41 | PictureElement:superClass().loadFromXML(self, xmlFile, key) |
42 | |
43 | self.imageSize = GuiUtils.getNormalizedValues(getXMLString(xmlFile, key.."#imageSize"), self.outputSize, self.imageSize) |
44 | self.aspectRatio = self.imageSize[1] / self.imageSize[2] |
45 | end |
loadProfile
DescriptionDefinitionloadProfile()Code
49 | function PictureElement:loadProfile(profile, applyProfile) |
50 | PictureElement:superClass().loadProfile(self, profile, applyProfile) |
51 | |
52 | self.imageSize = GuiUtils.getNormalizedValues(profile:getValue("imageSize"), self.outputSize, self.imageSize) |
53 | self.aspectRatio = self.imageSize[1] / self.imageSize[2] |
54 | |
55 | local mode = profile:getValue("pictureContentMode") |
56 | if mode == "scaleToFill" then |
57 | self.contentMode = PictureElement.CONTENT_MODE.SCALE_TO_FILL |
58 | elseif mode == "scaleAspectFit" then |
59 | self.contentMode = PictureElement.CONTENT_MODE.SCALE_ASPECT_FIT |
60 | end |
61 | end |
new
DescriptionDefinitionnew()Code
27 | function PictureElement.new(target, custom_mt) |
28 | local self = BitmapElement.new(target, custom_mt or PictureElement_mt) |
29 | |
30 | self.contentMode = PictureElement.CONTENT_MODE.SCALE_ASPECT_FIT |
31 | |
32 | self.imageSize = {1, 1} |
33 | self.aspectRatio = 1 |
34 | |
35 | return self |
36 | end |