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
| ) |  |
| inline static

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

Parameters

  value | value to shift
  zoom | zoom 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
| ) |  |
| inline static

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

Parameters

  value | value to shift
  zoom | zoom level to shift to

Returns
  shifted value

Definition at line 49 of file zoom_func.h.

## ◆ ScaleGUITrad()

static int ScaleGUITrad | ( | int | value | ) |
| inline static

Scale traditional pixel dimensions to GUI zoom level.

Parameters

  value | Pixel amount at #ZOOM_LVL_BASE (traditional "normal" interface size).

Returns
  Pixel amount at #ZOOM_LVL_GUI (current interface size).

Definition at line 82 of file zoom_func.h.

References UnScaleGUI().

Referenced by DepotWindow::DrawWidget(), BuildRoadDepotWindow::DrawWidget(), BuildRailWaypointWindow::DrawWidget(), WindowDesc::GetDefaultHeight(), WindowDesc::GetDefaultWidth(), SpriteFontCache::GetHeight(), VehicleDetailsWindow::GetRoadVehDetailsHeight(), GetVehicleListHeight(), BuildDocksDepotWindow::OnPaint(), BuildObjectWindow::UpdateWidgetSize(), BuildDocksDepotWindow::UpdateWidgetSize(), ScenarioEditorLandscapeGenerationWindow::UpdateWidgetSize(), RefitWindow::UpdateWidgetSize(), TooltipsWindow::UpdateWidgetSize(), BuildRoadDepotWindow::UpdateWidgetSize(), BuildRoadStationWindow::UpdateWidgetSize(), BuildRailStationWindow::UpdateWidgetSize(), BuildRailDepotWindow::UpdateWidgetSize(), and BuildRailWaypointWindow::UpdateWidgetSize().

## ◆ UnScaleByZoom()

static int UnScaleByZoom | ( | int | value,
|  | ZoomLevel | zoom
| ) |  |
| inline static

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

Parameters

  value | value to shift
  zoom | zoom 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
| ) |  |
| inline static

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

Parameters

  value | value to shift
  zoom | zoom 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 | ) |
| inline static

Short-hand to apply GUI zoom level.

Parameters

  value | Pixel 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().