OpenTTD Source: src/zoom_func.h File Reference

OpenTTD Source 12.0-beta1

Functions
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 | 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...
static int | UnScaleFont (int value)
| Short-hand to apply font zoom level. More...
static int | ScaleFontTrad (int value)
| Scale traditional pixel dimensions to Font 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

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

Returns
  shifted value

Definition at line 22 of file zoom_func.h.

Referenced by 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

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

Returns
  shifted value

Definition at line 45 of file zoom_func.h.

## ◆ ScaleFontTrad()

static int ScaleFontTrad | ( | int | value | ) |
| inlinestatic

Scale traditional pixel dimensions to Font zoom level.

Parameters

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

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

Definition at line 96 of file zoom_func.h.

References UnScaleFont().

Referenced by SpriteFontCache::ClearFontCache(), BuildIndustryWindow::DrawWidget(), PaymentRatesGraphWindow::OnInit(), SpriteFontCache::SpriteFontCache(), CompanyStationsWindow::UpdateWidgetSize(), and BuildIndustryWindow::UpdateWidgetSize().

## ◆ ScaleGUITrad()

static int ScaleGUITrad | ( | int | value | ) |
| inlinestatic

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

References UnScaleGUI().

Referenced by ClickVolumeSliderWidget(), BuildTreesWindow::DrawWidget(), DepotWindow::DrawWidget(), BuildRoadDepotWindow::DrawWidget(), BuildRailWaypointWindow::DrawWidget(), WindowDesc::GetDefaultHeight(), WindowDesc::GetDefaultWidth(), VehicleDetailsWindow::GetRoadVehDetailsHeight(), GetVehicleListHeight(), HighlightDragPosition(), EndGameWindow::OnPaint(), HighScoreWindow::OnPaint(), BuildDocksDepotWindow::OnPaint(), NWidgetResizeBase::SetMinimalSize(), NWidgetResizeBase::SetMinimalTextLines(), NWidgetPIPContainer::SetPIP(), BuildTreesWindow::UpdateWidgetSize(), BuildObjectWindow::UpdateWidgetSize(), BuildDocksDepotWindow::UpdateWidgetSize(), ScenarioEditorLandscapeGenerationWindow::UpdateWidgetSize(), TooltipsWindow::UpdateWidgetSize(), RefitWindow::UpdateWidgetSize(), SpriteAlignerWindow::UpdateWidgetSize(), BuildRoadDepotWindow::UpdateWidgetSize(), BuildRoadStationWindow::UpdateWidgetSize(), BuildRailStationWindow::UpdateWidgetSize(), BuildRailDepotWindow::UpdateWidgetSize(), and BuildRailWaypointWindow::UpdateWidgetSize().

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

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

Returns
  shifted value

Definition at line 34 of file zoom_func.h.

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

## ◆ UnScaleByZoomLower()

static int UnScaleByZoomLower | ( | int | value,
|  | ZoomLevel | zoom
| ) |  |
| inlinestatic

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

Referenced by MarkViewportDirty().

## ◆ UnScaleFont()

static int UnScaleFont | ( | int | value | ) |
| inlinestatic

Short-hand to apply font zoom level.

Parameters

  value | Pixel amount at ZOOM_LVL_BEGIN (full zoom in).

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

Definition at line 86 of file zoom_func.h.

References UnScaleByZoom().

Referenced by ScaleFontTrad().

## ◆ UnScaleGUI()

static int UnScaleGUI | ( | int | value | ) |
| inlinestatic

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

References UnScaleByZoom().

Referenced by GetSingleVehicleWidth(), and ScaleGUITrad().