Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
iOS Documentation
SDLStreamingVideoScaleManager

SDLStreamingVideoScaleManager Class Reference

Section Contents

Overview

This class consolidates the logic of scaling between the view controller’s coordinate system and the display’s coordinate system.

The main goal of using scaling is to align different screens and use a common range of “points per inch”. This allows showing assets with a similar size on different screen resolutions.

scale

The scaling factor the app should use to change the size of the projecting view.

Objective-C

@property (nonatomic) float scale;

Swift

var scale: Float { get set }

displayViewportResolution

The screen resolution of the connected display. The units are pixels.

Objective-C

@property (nonatomic) CGSize displayViewportResolution;

Swift

var displayViewportResolution: CGSize { get set }

appViewportFrame

The frame of the app’s projecting view. This is calculated by dividing the display’s viewport resolution by the scale. The units are points.

Objective-C

@property (nonatomic, readonly) CGRect appViewportFrame;

Swift

var appViewportFrame: CGRect { get }

-init

Creates a default streaming video scale manager. The scale value will be set to 1.0 and the displayViewportResolution will be set to {0, 0}.

Objective-C

- (nonnull instancetype)init;

Swift

init()

Return Value

A SDLStreamingVideoScaleManager object

-initWithScale:displayViewportResolution:

Convenience init for creating the manager with a scale and connected display viewport resolution.

Objective-C

- (nonnull instancetype)initWithScale:(float)scale
            displayViewportResolution:(CGSize)displayViewportResolution;

Swift

init(scale: Float, displayViewportResolution: CGSize)

Parameters

scale

The scaling factor the app should use to change the size of the projecting view

displayViewportResolution

The current screen resolution of the connected display

Return Value

A SDLStreamingVideoScaleManager object

-scaleTouchEventCoordinates:

Scales the coordinates of an OnTouchEvent from the display’s coordinate system to the app’s viewport coordinate system. If the scale value is less than 1.0, the touch events will be returned without being scaled.

Objective-C

- (nonnull SDLOnTouchEvent *)scaleTouchEventCoordinates:
    (nonnull SDLOnTouchEvent *)onTouchEvent;

Swift

func scaleTouchEventCoordinates(_ onTouchEvent: SDLOnTouchEvent) -> SDLOnTouchEvent

Parameters

onTouchEvent

A touch event with coordinates

Return Value

The touch event coordinates in the app’s viewport coordinate system

-scaleHapticRect:

Scales a haptic rectangle from the app’s viewport coordinate system to the display’s coordinate system. If the scale value is less than 1.0, the haptic rectangle will be returned without being scaled.

Objective-C

- (nonnull SDLHapticRect *)scaleHapticRect:(nonnull SDLHapticRect *)hapticRect;

Swift

func scale(_ hapticRect: SDLHapticRect) -> SDLHapticRect

Parameters

hapticRect

A haptic rectangle

Return Value

The position of the haptic rectangle in the display’s coordinate system

-makeScaledResolution

Create and return the current display resolution respecting the scale factor

Objective-C

- (nonnull SDLImageResolution *)makeScaledResolution;

Swift

func makeScaledResolution() -> SDLImageResolution

Return Value

A new created object of type SDLImageResolution

-stop

Stops the manager. This method is used internally.

Objective-C

- (void)stop;

Swift

func stop()

+scale:size:

Calculate a new size based on the given size and the scale factor

Objective-C

+ (CGSize)scale:(float)scale size:(CGSize)size;

Swift

class func scale(_ scale: Float, size: CGSize) -> CGSize

Parameters

scale

The scale factor to apply

size

The size struct to apply the scale to

Return Value

A new created and inited struct of type CGSize

View on GitHub.com
Previous Section Next Section