summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLStreamingVideoScaleManager.h
diff options
context:
space:
mode:
authorNicoleYarroch <nicole@livio.io>2019-10-03 13:21:39 -0400
committerNicoleYarroch <nicole@livio.io>2019-10-03 13:21:39 -0400
commit9b0a919546606b315c1fda1d098616d37a474d3d (patch)
treeb7bfd81c17985358c68fc87fc11be6a32cd894e2 /SmartDeviceLink/SDLStreamingVideoScaleManager.h
parent9b7f1a7190a682dafc17346d87697e52ac076785 (diff)
downloadsdl_ios-9b0a919546606b315c1fda1d098616d37a474d3d.tar.gz
Refactored the video scale manager
Diffstat (limited to 'SmartDeviceLink/SDLStreamingVideoScaleManager.h')
-rw-r--r--SmartDeviceLink/SDLStreamingVideoScaleManager.h57
1 files changed, 38 insertions, 19 deletions
diff --git a/SmartDeviceLink/SDLStreamingVideoScaleManager.h b/SmartDeviceLink/SDLStreamingVideoScaleManager.h
index 8438226e2..7df0c47ed 100644
--- a/SmartDeviceLink/SDLStreamingVideoScaleManager.h
+++ b/SmartDeviceLink/SDLStreamingVideoScaleManager.h
@@ -6,49 +6,68 @@
// Copyright © 2019 smartdevicelink. All rights reserved.
//
-#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
-#import "SDLOnTouchEvent.h"
-#import "SDLRectangle.h"
+@class SDLOnTouchEvent;
+@class SDLHapticRect;
NS_ASSUME_NONNULL_BEGIN
-extern const float DefaultScaleValue;
-
/**
- This class consolidates the logic of scaling from the view controller's coordinate system to the head unit screen's coordinate system and vice-versa.
+ 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 will allow showing assets with a similar size on different screen resolutions.
+ 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.
*/
@interface SDLStreamingVideoScaleManager : NSObject
/**
- Calculates the frame of the view controller using the screen resolution and a scale value. If the scale value is less than 1.0, the frame will not be scaled and the screen size will be returned.
+ The scale factor value to scale coordinates from one coordinate space to another.
+ */
+@property (assign, nonatomic) float scale;
- @param screenSize The resolution of the screen
- @param scaleAmount The amount to scale the screenSize
- @return The size of the view controller's frame for capturing video
+/**
+ The current screen size of a connected display
*/
-+ (CGRect)scaleFrameForScreenSize:(CGSize)screenSize scale:(float)scaleAmount;
+@property (assign, nonatomic) CGSize screenSize;
+
+/**
+ The scaled frame for the view being streamed to the connected display.
+*/
+@property (assign, nonatomic, readonly) CGRect screenFrame;
+
+- (instancetype)init NS_UNAVAILABLE;
+
+/**
+ Creates a default streaming video scale manager.
+
+ @return A default configuration that may be customized.
+ */
++ (instancetype)defaultConfiguration;
+
+/**
+ Convenience init for creating a scale manager with the scale and connecte display screen size.
+
+ @param scale The scale factor value to scale coordinates from one coordinate space to another
+ @param screenSize The current screen size of a connected display
+ @return A SDLStreamingVideoScaleManager object
+*/
+- (instancetype)initWithScale:(nullable NSNumber *)scale screenSize:(CGSize)screenSize;
/**
Scales the coordinates of the OnTouchEvent from the screen's coordinate sysytem to the view controller's coordinate system. If the scale value is less than 1.0, the touch events will not be scaled.
- @param onTouchEvent A SDLOnTouchEvent with coordinates.
- @param scaleAmount The amount to scale the touch event
+ @param onTouchEvent A touch event with coordinates
@return The touch event coordinates in the screen coordinate system
- */
-+ (SDLOnTouchEvent *)scaleTouchEventCoordinates:(SDLOnTouchEvent *)onTouchEvent scale:(float)scaleAmount;
+*/
+- (SDLOnTouchEvent *)scaleTouchEventCoordinates:(SDLOnTouchEvent *)onTouchEvent;
/**
Scales the haptic rectangle from the view controller coordinate system to the screen coordinate system. If the scale value is less than 1.0, the haptic rectangle will not be scaled.
- @param rectangle The position of the haptic rectangle in the view controller coordinate system
- @param scaleAmount The amount to scale the haptic rectangle
+ @param hapticRect A haptic rectangle
@return The position of the haptic rectangle in the screen coordinate system
*/
-+ (SDLRectangle *)scaleHapticRectangle:(CGRect)rectangle scale:(float)scaleAmount;
+- (SDLHapticRect *)scaleHapticRect:(SDLHapticRect *)hapticRect;
@end