* * rct2: 0x006EB951 */
| 859 | * rct2: 0x006EB951 |
| 860 | */ |
| 861 | static void WidgetDrawImage(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex) |
| 862 | { |
| 863 | // Get the widget |
| 864 | const auto& widget = w.widgets[widgetIndex]; |
| 865 | |
| 866 | // Get the image |
| 867 | if (widget.image.GetIndex() == kImageIndexUndefined) |
| 868 | return; |
| 869 | auto image = widget.image; |
| 870 | |
| 871 | // Resolve the absolute ltrb |
| 872 | auto screenCoords = w.windowPos + ScreenCoordsXY{ widget.left, widget.top }; |
| 873 | |
| 874 | if (widget.type == WidgetType::colourBtn || widget.type == WidgetType::trnBtn || widget.type == WidgetType::tab) |
| 875 | if (widgetIsPressed(w, widgetIndex) || isToolActive(w, widgetIndex)) |
| 876 | image = image.WithIndexOffset(1); |
| 877 | |
| 878 | const auto colour = w.colours[widget.colour].colour; |
| 879 | if (widgetIsDisabled(w, widgetIndex)) |
| 880 | { |
| 881 | // Draw greyed out (light border bottom right shadow) |
| 882 | auto mappedColour = getColourMap(colour).lighter; |
| 883 | GfxDrawSpriteSolid(rt, image, screenCoords + ScreenCoordsXY{ 1, 1 }, mappedColour); |
| 884 | |
| 885 | // Draw greyed out (dark) |
| 886 | mappedColour = getColourMap(colour).midLight; |
| 887 | GfxDrawSpriteSolid(rt, image, screenCoords, mappedColour); |
| 888 | } |
| 889 | else |
| 890 | { |
| 891 | if (image.HasSecondary()) |
| 892 | { |
| 893 | // ? |
| 894 | } |
| 895 | |
| 896 | if (image.IsBlended()) |
| 897 | image = image.WithBlended(false); |
| 898 | else |
| 899 | image = image.WithPrimary(colour); |
| 900 | |
| 901 | GfxDrawSprite(rt, image, screenCoords); |
| 902 | } |
| 903 | } |
| 904 | |
| 905 | bool widgetIsDisabled(const WindowBase& w, WidgetIndex widgetIndex) |
| 906 | { |
no test coverage detected