OpenTTD Source  13.2.1
zoom_func.h File Reference
#include "zoom_type.h"

Go to the source code of this file.

Functions

static int ScaleByZoom (int value, ZoomLevel zoom)
 Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right, value is rounded up. More...
 
static int UnScaleByZoom (int value, ZoomLevel zoom)
 Scale by zoom level, usually shift right (when zoom > ZOOM_LVL_NORMAL) When shifting right, value is rounded up. More...
 
static int AdjustByZoom (int value, int zoom)
 Adjust by zoom level; zoom < 0 shifts right, zoom >= 0 shifts left. More...
 
static int ScaleByZoomLower (int value, ZoomLevel zoom)
 Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) More...
 
static int UnScaleByZoomLower (int value, ZoomLevel zoom)
 Scale by zoom level, usually shift right (when zoom > ZOOM_LVL_NORMAL) More...
 
static int UnScaleGUI (int value)
 Short-hand to apply GUI zoom level. More...
 
static ZoomLevel ScaleZoomGUI (ZoomLevel value)
 Scale zoom level relative to GUI zoom. More...
 
static ZoomLevel UnScaleZoomGUI (ZoomLevel value)
 UnScale zoom level relative to GUI zoom. More...
 
static int ScaleSpriteTrad (int value)
 Scale traditional pixel dimensions to GUI zoom level, for drawing sprites. More...
 
static int ScaleGUITrad (int value)
 Scale traditional pixel dimensions to GUI zoom level. More...
 

Detailed Description

Functions related to zooming.

Definition in file zoom_func.h.

Function Documentation

◆ AdjustByZoom()

static int AdjustByZoom ( int  value,
int  zoom 
)
inlinestatic

Adjust by zoom level; zoom < 0 shifts right, zoom >= 0 shifts left.

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 45 of file zoom_func.h.

References ScaleByZoom(), and UnScaleByZoom().

◆ ScaleByZoom()

static int ScaleByZoom ( int  value,
ZoomLevel  zoom 
)
inlinestatic

Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL) When shifting right, value is rounded up.

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 22 of file zoom_func.h.

Referenced by AdjustByZoom(), Blitter_8bppSimple::Draw(), Blitter_32bppSimple::Draw(), ViewportSign::MarkDirty(), ExtraViewportWindow::OnScroll(), MainWindow::OnScroll(), NWidgetViewport::UpdateViewportCoordinates(), and ViewportAddString().

◆ ScaleByZoomLower()

static int ScaleByZoomLower ( int  value,
ZoomLevel  zoom 
)
inlinestatic

Scale by zoom level, usually shift left (when zoom > ZOOM_LVL_NORMAL)

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 56 of file zoom_func.h.

◆ ScaleGUITrad()

static int ScaleGUITrad ( int  value)
inlinestatic

Scale traditional pixel dimensions to GUI zoom level.

Parameters
valuePixel amount at #ZOOM_LVL_BASE (traditional "normal" interface size).
Returns
Pixel amount at #ZOOM_LVL_GUI (current interface size).

Definition at line 117 of file zoom_func.h.

References _gui_scale.

◆ ScaleSpriteTrad()

static int ScaleSpriteTrad ( int  value)
inlinestatic

Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.

Parameters
valuePixel amount at #ZOOM_LVL_BASE (traditional "normal" interface size).
Returns
Pixel amount at #ZOOM_LVL_GUI (current interface size).

Definition at line 107 of file zoom_func.h.

References UnScaleGUI().

Referenced by SpriteFontCache::ClearFontCache(), DepotWindow::DrawVehicleInDepot(), DepotWindow::DrawWidget(), GetTrainDetailsWndVScroll(), EndGameWindow::OnPaint(), HighScoreWindow::OnPaint(), SpriteFontCache::SpriteFontCache(), and DepotWindow::UpdateWidgetSize().

◆ ScaleZoomGUI()

static ZoomLevel ScaleZoomGUI ( ZoomLevel  value)
inlinestatic

Scale zoom level relative to GUI zoom.

Parameters
valuezoom level to scale
Returns
scaled zoom level

Definition at line 87 of file zoom_func.h.

Referenced by WaypointWindow::WaypointWindow().

◆ UnScaleByZoom()

static int UnScaleByZoom ( int  value,
ZoomLevel  zoom 
)
inlinestatic

Scale by zoom level, usually shift right (when zoom > ZOOM_LVL_NORMAL) When shifting right, value is rounded up.

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 34 of file zoom_func.h.

Referenced by AdjustByZoom(), MarkViewportDirty(), and UnScaleGUI().

◆ UnScaleByZoomLower()

static int UnScaleByZoomLower ( int  value,
ZoomLevel  zoom 
)
inlinestatic

Scale by zoom level, usually shift right (when zoom > ZOOM_LVL_NORMAL)

Parameters
valuevalue to shift
zoomzoom level to shift to
Returns
shifted value

Definition at line 67 of file zoom_func.h.

Referenced by MarkViewportDirty().

◆ UnScaleGUI()

static int UnScaleGUI ( int  value)
inlinestatic

Short-hand to apply GUI zoom level.

Parameters
valuePixel amount at ZOOM_LVL_BEGIN (full zoom in).
Returns
Pixel amount at #ZOOM_LVL_GUI (current interface size).

Definition at line 77 of file zoom_func.h.

References UnScaleByZoom().

Referenced by DrawAircraftImage(), DrawShipImage(), GetSingleVehicleWidth(), and ScaleSpriteTrad().

◆ UnScaleZoomGUI()

static ZoomLevel UnScaleZoomGUI ( ZoomLevel  value)
inlinestatic

UnScale zoom level relative to GUI zoom.

Parameters
valuezoom level to scale
Returns
un-scaled zoom level

Definition at line 97 of file zoom_func.h.