OpenTTD
Functions
zoom_func.h File Reference

Functions related to zooming. More...

#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 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 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

◆ 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 24 of file zoom_func.h.

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

◆ 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 49 of file zoom_func.h.

◆ ScaleGUITrad()

static int ScaleGUITrad ( int  value)
inlinestatic

◆ 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 37 of file zoom_func.h.

Referenced by MarkViewportDirty(), SetupScreenshotViewport(), 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 61 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 72 of file zoom_func.h.

References UnScaleByZoom().

Referenced by GetSingleVehicleWidth(), and ScaleGUITrad().