summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamiano Galassi <[email protected]>2020-10-02 10:04:02 +0200
committerDamiano Galassi <[email protected]>2020-10-02 10:04:02 +0200
commit561977956f39858d81e4786565466e63f8ddd430 (patch)
treec74692e68fa49f6f48341eedf5519450b1baf03e
parent7efa7b80a2bd91ce4a64ac68ce8a8c40c6d2d4d5 (diff)
MacGui: add the 'allow upscaling' and 'use maximum size' checkbox to the dimensions tab.
-rw-r--r--macosx/Base.lproj/HBPictureViewController.xib74
-rw-r--r--macosx/HBJob+HBJobConversion.m2
-rw-r--r--macosx/HBPicture.h2
-rw-r--r--macosx/HBPicture.m100
4 files changed, 148 insertions, 30 deletions
diff --git a/macosx/Base.lproj/HBPictureViewController.xib b/macosx/Base.lproj/HBPictureViewController.xib
index 23bda5723..20cbb7388 100644
--- a/macosx/Base.lproj/HBPictureViewController.xib
+++ b/macosx/Base.lproj/HBPictureViewController.xib
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17503.1" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17503.1"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17505"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -20,16 +20,16 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<stackView distribution="equalSpacing" orientation="horizontal" alignment="top" spacing="23" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="OFE-0G-Zqz">
- <rect key="frame" x="20" y="178" width="736" height="143"/>
+ <rect key="frame" x="20" y="134" width="736" height="187"/>
<subviews>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zU5-gT-j2i">
- <rect key="frame" x="0.0" y="15" width="222" height="128"/>
+ <rect key="frame" x="0.0" y="59" width="222" height="128"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="firstBaseline" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Uev-zj-FIR">
<rect key="frame" x="0.0" y="112" width="163" height="16"/>
<subviews>
<textField horizontalHuggingPriority="752" verticalHuggingPriority="750" horizontalCompressionResistancePriority="752" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="400" translatesAutoresizingMaskIntoConstraints="NO" id="0rN-RP-Om4">
- <rect key="frame" x="-2" y="2" width="56" height="14"/>
+ <rect key="frame" x="-2" y="1" width="56" height="14"/>
<textFieldCell key="cell" controlSize="small" sendsActionOnEndEditing="YES" alignment="right" title="Rotation:" id="vb2-DA-Pgr">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -433,13 +433,13 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3sU-eh-1ja">
- <rect key="frame" x="245" y="0.0" width="252" height="143"/>
+ <rect key="frame" x="245" y="0.0" width="252" height="187"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="firstBaseline" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uO6-48-Dmb">
- <rect key="frame" x="0.0" y="127" width="223" height="16"/>
+ <rect key="frame" x="0.0" y="171" width="223" height="16"/>
<subviews>
<textField horizontalHuggingPriority="752" verticalHuggingPriority="750" horizontalCompressionResistancePriority="752" preferredMaxLayoutWidth="300" translatesAutoresizingMaskIntoConstraints="NO" id="PJL-Y6-9ZV">
- <rect key="frame" x="-2" y="2" width="92" height="14"/>
+ <rect key="frame" x="-2" y="1" width="92" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" alignment="right" title="Resolution Limit:" id="d0T-QG-WXU">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -487,7 +487,7 @@
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="horizontal" alignment="centerY" spacing="7" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QW6-1e-ZMT">
- <rect key="frame" x="96" y="100" width="128" height="19"/>
+ <rect key="frame" x="96" y="144" width="128" height="19"/>
<subviews>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="NRy-vc-8qX">
<rect key="frame" x="0.0" y="0.0" width="54" height="19"/>
@@ -546,6 +546,44 @@
</binding>
</connections>
</stackView>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ROS-UT-TiG">
+ <rect key="frame" x="95" y="121" width="105" height="16"/>
+ <buttonCell key="cell" type="check" title="Allow Upscaling" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="0kU-Uy-P4P">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="smallSystem"/>
+ </buttonCell>
+ <connections>
+ <binding destination="-2" name="enabled" keyPath="self.picture" id="Hwm-6X-gI5">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSIsNotNil</string>
+ </dictionary>
+ </binding>
+ <binding destination="-2" name="value" keyPath="self.picture.allowUpscaling" id="XAr-LD-Kzc"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="fjj-ZH-nqb">
+ <rect key="frame" x="95" y="99" width="120" height="16"/>
+ <buttonCell key="cell" type="check" title="Use Maximum Size" bezelStyle="regularSquare" imagePosition="left" controlSize="small" state="on" inset="2" id="FUA-5p-imC">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="smallSystem"/>
+ </buttonCell>
+ <connections>
+ <binding destination="-2" name="enabled2" keyPath="self.picture.allowUpscaling" previousBinding="6hS-sA-J2I" id="KA6-bo-mMk">
+ <dictionary key="options">
+ <integer key="NSMultipleValuesPlaceholder" value="-1"/>
+ <integer key="NSNoSelectionPlaceholder" value="-1"/>
+ <integer key="NSNotApplicablePlaceholder" value="-1"/>
+ <integer key="NSNullPlaceholder" value="-1"/>
+ </dictionary>
+ </binding>
+ <binding destination="-2" name="enabled" keyPath="self.picture" id="6hS-sA-J2I">
+ <dictionary key="options">
+ <string key="NSValueTransformerName">NSIsNotNil</string>
+ </dictionary>
+ </binding>
+ <binding destination="-2" name="value" keyPath="self.picture.useMaximumSize" id="hu9-Sk-Q4S"/>
+ </connections>
+ </button>
<stackView distribution="fill" orientation="horizontal" alignment="firstBaseline" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9ZE-cV-x9d">
<rect key="frame" x="0.0" y="73" width="252" height="19"/>
<subviews>
@@ -594,7 +632,7 @@
</textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FwZ-6T-zJe">
<rect key="frame" x="58" y="-2" width="15" height="22"/>
- <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="NP7-P2-Qga">
+ <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="2" minValue="64" maxValue="59" doubleValue="64" id="NP7-P2-Qga">
<font key="font" metaFont="smallSystem"/>
</stepperCell>
<accessibility description="Storage Width"/>
@@ -648,7 +686,7 @@
</textField>
<stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2s0-5k-fjU">
<rect key="frame" x="143" y="-2" width="15" height="22"/>
- <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="16" minValue="64" maxValue="59" doubleValue="64" id="MwK-aS-Oaf">
+ <stepperCell key="cell" controlSize="small" continuous="YES" alignment="left" increment="2" minValue="64" maxValue="59" doubleValue="64" id="MwK-aS-Oaf">
<font key="font" metaFont="smallSystem"/>
</stepperCell>
<accessibility description="Storage Height"/>
@@ -713,7 +751,7 @@
<rect key="frame" x="0.0" y="27" width="163" height="16"/>
<subviews>
<textField horizontalHuggingPriority="751" verticalHuggingPriority="750" horizontalCompressionResistancePriority="752" allowsCharacterPickerTouchBarItem="YES" preferredMaxLayoutWidth="300" translatesAutoresizingMaskIntoConstraints="NO" id="JBo-0E-AsU">
- <rect key="frame" x="-2" y="2" width="92" height="14"/>
+ <rect key="frame" x="-2" y="1" width="92" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Anamorphic:" id="8vS-Mw-bny">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
@@ -862,6 +900,8 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec
<constraints>
<constraint firstItem="PJL-Y6-9ZV" firstAttribute="width" secondItem="9oG-zm-Y0W" secondAttribute="width" id="AUU-G1-gDf"/>
<constraint firstItem="JBo-0E-AsU" firstAttribute="width" secondItem="9oG-zm-Y0W" secondAttribute="width" id="NjT-Pg-miH"/>
+ <constraint firstItem="fjj-ZH-nqb" firstAttribute="leading" secondItem="the-i1-S1D" secondAttribute="leading" id="ift-aJ-cvi"/>
+ <constraint firstItem="ROS-UT-TiG" firstAttribute="leading" secondItem="the-i1-S1D" secondAttribute="leading" id="lhU-j7-Agx"/>
<constraint firstItem="JBo-0E-AsU" firstAttribute="width" secondItem="hei-Cd-vcN" secondAttribute="width" id="lic-qU-sk5"/>
<constraint firstItem="QW6-1e-ZMT" firstAttribute="leading" secondItem="the-i1-S1D" secondAttribute="leading" id="npA-3w-7jD"/>
<constraint firstItem="6G0-MW-iVa" firstAttribute="leading" secondItem="9oG-zm-Y0W" secondAttribute="trailing" constant="8" id="pct-5r-gab"/>
@@ -873,6 +913,8 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec
<integer value="1000"/>
<integer value="1000"/>
<integer value="1000"/>
+ <integer value="1000"/>
+ <integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
@@ -881,16 +923,18 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
<real value="3.4028234663852886e+38"/>
+ <real value="3.4028234663852886e+38"/>
+ <real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="EGb-Zz-WQd">
- <rect key="frame" x="520" y="8" width="216" height="135"/>
+ <rect key="frame" x="520" y="52" width="216" height="135"/>
<subviews>
<stackView distribution="fill" orientation="horizontal" alignment="firstBaseline" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="i16-mF-pVp">
<rect key="frame" x="0.0" y="119" width="195" height="16"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="250" translatesAutoresizingMaskIntoConstraints="NO" id="omM-pe-wBc">
- <rect key="frame" x="-2" y="2" width="50" height="14"/>
+ <rect key="frame" x="-2" y="1" width="50" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" alignment="right" title="Padding:" id="iqM-GW-fCe">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -1151,7 +1195,7 @@ Custom allows manually setting all parameters. Useful for correcting an incorrec
<rect key="frame" x="0.0" y="27" width="121" height="16"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" preferredMaxLayoutWidth="250" translatesAutoresizingMaskIntoConstraints="NO" id="kJM-a0-qcw">
- <rect key="frame" x="-2" y="2" width="50" height="14"/>
+ <rect key="frame" x="-2" y="1" width="50" height="14"/>
<textFieldCell key="cell" controlSize="small" lineBreakMode="clipping" alignment="right" title="Color:" id="OCX-n7-THw">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
diff --git a/macosx/HBJob+HBJobConversion.m b/macosx/HBJob+HBJobConversion.m
index e2cc973c9..9675c5b40 100644
--- a/macosx/HBJob+HBJobConversion.m
+++ b/macosx/HBJob+HBJobConversion.m
@@ -559,7 +559,7 @@
self.picture.width + self.picture.paddingLeft + self.picture.paddingRight,
self.picture.height + self.picture.paddingTop + self.picture.paddingBottom,
color,
- self.picture.paddingRight,
+ self.picture.paddingLeft,
self.picture.paddingTop];
hb_dict_t *filter_dict = hb_generate_filter_settings(filter_id, NULL, NULL, settings.UTF8String);
diff --git a/macosx/HBPicture.h b/macosx/HBPicture.h
index 925bad615..7e614e6d6 100644
--- a/macosx/HBPicture.h
+++ b/macosx/HBPicture.h
@@ -63,6 +63,8 @@ extern NSString * const HBPictureChangedNotification;
@property (nonatomic, readwrite) HBPictureResolutionLimitMode resolutionLimitMode;
@property (nonatomic, readwrite) int maxWidth;
@property (nonatomic, readwrite) int maxHeight;
+@property (nonatomic, readwrite) BOOL allowUpscaling;
+@property (nonatomic, readwrite) BOOL useMaximumSize;
@property (nonatomic, readwrite) int width;
@property (nonatomic, readwrite) int height;
diff --git a/macosx/HBPicture.m b/macosx/HBPicture.m
index f480aef1d..9351414b1 100644
--- a/macosx/HBPicture.m
+++ b/macosx/HBPicture.m
@@ -141,8 +141,8 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
{
switch (resolutionLimit) {
case HBPictureResolutionLimitModeNone:
- self.maxWidth = 20480;
- self.maxHeight = 20480;
+ self.maxWidth = HB_MAX_WIDTH;
+ self.maxHeight = HB_MAX_HEIGHT;
break;
case HBPictureResolutionLimitMode8K:
self.maxWidth = 7680;
@@ -209,6 +209,34 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
}
}
+- (void)setAllowUpscaling:(BOOL)allowUpscaling
+{
+ if (allowUpscaling != _allowUpscaling)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setAllowUpscaling:_allowUpscaling];
+ }
+ _allowUpscaling = allowUpscaling;
+
+ if (!self.isValidating)
+ {
+ [self validateSettings];
+ }
+}
+
+- (void)setUseMaximumSize:(BOOL)useMaximumSize
+{
+ if (useMaximumSize != _useMaximumSize)
+ {
+ [[self.undo prepareWithInvocationTarget:self] setUseMaximumSize:_useMaximumSize];
+ }
+ _useMaximumSize = useMaximumSize;
+
+ if (!self.isValidating)
+ {
+ [self validateSettings];
+ }
+}
+
#pragma mark - Size
- (void)setWidth:(int)width
@@ -239,9 +267,9 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
{
*ioValue = @(self.maxWidth);
}
- else if (value <= 32)
+ else if (value <= HB_MIN_WIDTH)
{
- *ioValue = @32;
+ *ioValue = @(HB_MIN_WIDTH);
}
else if (value != roundedValue)
{
@@ -279,9 +307,9 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
{
*ioValue = @(self.maxHeight);
}
- else if (value <= 32)
+ else if (value <= HB_MIN_HEIGHT)
{
- *ioValue = @32;
+ *ioValue = @(HB_MIN_HEIGHT);
}
else if (value != roundedValue)
{
@@ -615,7 +643,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
- (int)maxTopCrop
{
- return self.sourceHeight - self.cropBottom - 32;
+ return self.sourceHeight - self.cropBottom - HB_MIN_HEIGHT;
}
+ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxBottomCrop
@@ -625,7 +653,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
- (int)maxBottomCrop
{
- return self.sourceHeight - self.cropTop - 32;
+ return self.sourceHeight - self.cropTop - HB_MIN_HEIGHT;
}
+ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxLeftCrop
@@ -635,7 +663,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
- (int)maxLeftCrop
{
- return self.sourceWidth - self.cropRight - 32;
+ return self.sourceWidth - self.cropRight - HB_MIN_WIDTH;
}
+ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxRightCrop
@@ -645,7 +673,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
- (int)maxRightCrop
{
- return self.sourceWidth - self.cropLeft - 32;
+ return self.sourceWidth - self.cropLeft - HB_MIN_WIDTH;
}
+ (NSSet<NSString *> *)keyPathsForValuesAffectingMaxTopPadding
@@ -733,12 +761,12 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
int crop[4] = {self.cropTop, self.cropBottom, self.cropLeft, self.cropRight};
memcpy(uiGeo.crop, crop, sizeof(int[4]));
- uiGeo.geometry.width = self.width;
- uiGeo.geometry.height = self.height;
+ uiGeo.geometry.width = self.useMaximumSize ? self.maxWidth : self.width;
+ uiGeo.geometry.height = self.useMaximumSize ? self.maxHeight : self.height;
// Modulus added to maxWidth/maxHeight to allow a small amount of
// upscaling to the next mod boundary.
- uiGeo.maxWidth = self.maxWidth ? self.maxWidth : self.sourceWidth - crop[2] - crop[3] + self.modulus - 1;
- uiGeo.maxHeight = self.maxHeight ? self.maxHeight : self.sourceHeight - crop[0] - crop[1] + self.modulus - 1;
+ uiGeo.maxWidth = self.allowUpscaling ? self.maxWidth : self.sourceWidth - crop[2] - crop[3] + self.modulus - 1;
+ uiGeo.maxHeight = self.allowUpscaling ? self.maxHeight : self.sourceHeight - crop[0] - crop[1] + self.modulus - 1;
hb_rational_t par = {self.parWidth, self.parHeight};
uiGeo.geometry.par = par;
@@ -760,6 +788,7 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
int maxPaddingX = self.maxWidth - self.width;
int maxPaddingY = self.maxHeight - self.height;
+
switch (self.paddingMode)
{
case HBPicturePaddingModeNone:
@@ -811,6 +840,9 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
copy->_resolutionLimitMode = _resolutionLimitMode;
copy->_maxWidth = _maxWidth;
copy->_maxHeight = _maxHeight;
+ copy->_allowUpscaling = _allowUpscaling;
+ copy->_useMaximumSize = _useMaximumSize;
+
copy->_width = _width;
copy->_height = _height;
@@ -868,6 +900,9 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
encodeInteger(_resolutionLimitMode);
encodeInt(_maxWidth);
encodeInt(_maxHeight);
+ encodeBool(_allowUpscaling);
+ encodeBool(_useMaximumSize);
+
encodeInt(_width);
encodeInt(_height);
@@ -917,6 +952,8 @@ NSString * const HBPictureChangedNotification = @"HBPictureChangedNotification";
}
decodeInt(_maxWidth); if (_maxWidth < 0) { goto fail; }
decodeInt(_maxHeight); if (_maxHeight < 0) { goto fail; }
+ decodeBool(_allowUpscaling);
+ decodeBool(_useMaximumSize);
decodeInt(_width); if (_width < 0) { goto fail; }
decodeInt(_height); if (_height < 0) { goto fail; }
@@ -981,6 +1018,9 @@ fail:
preset[@"PictureWidth"] = @(self.maxWidth);
preset[@"PictureHeight"] = @(self.maxHeight);
+ preset[@"PictureAllowUpscaling"] = @(self.allowUpscaling);
+ preset[@"PictureUseMaximumSize"] = @(self.useMaximumSize);
+
preset[@"PictureKeepRatio"] = @(self.keepDisplayAspect);
switch (self.anamorphicMode) {
@@ -1012,6 +1052,13 @@ fail:
preset[@"PictureBottomCrop"] = @(self.cropBottom);
preset[@"PictureLeftCrop"] = @(self.cropLeft);
preset[@"PictureRightCrop"] = @(self.cropRight);
+
+ // Padding
+ preset[@"PicturePadMode"] = @(self.paddingMode);
+ int width = self.width + self.paddingLeft + self.paddingRight;
+ int height = self.height + self.paddingTop + self.paddingBottom;
+ NSString *color = self.paddingColorCustom;
+ preset[@"PicturePad"] = [NSString stringWithFormat:@"width=%d:height=%d:color=%@:x=%d:y=%d", width, height, color, self.paddingLeft, self.paddingTop];
}
- (void)applyPreset:(HBPreset *)preset jobSettings:(NSDictionary *)settings
@@ -1043,6 +1090,9 @@ fail:
self.maxWidth = [preset[@"PictureWidth"] intValue];
self.maxHeight = [preset[@"PictureHeight"] intValue];
+ self.allowUpscaling = [preset[@"PictureAllowUpscaling"] boolValue];
+ self.useMaximumSize = [preset[@"PictureUseMaximumSize"] boolValue];
+
if (self.maxWidth == 0 && self.maxHeight == 0)
{
self.resolutionLimitMode = HBPictureResolutionLimitModeNone;
@@ -1133,6 +1183,28 @@ fail:
self.displayWidth = self.width * self.parWidth / self.parHeight;
}
+ // Padding
+ NSString *pad = preset[@"PicturePad"];
+ hb_dict_t *hbPadDict = hb_parse_filter_settings(pad.UTF8String);
+ NSDictionary *padDict = [[NSDictionary alloc] initWithHBDict:hbPadDict];
+ hb_value_free(&hbPadDict);
+
+ self.paddingMode = [preset[@"PicturePadMode"] intValue];
+ if (self.paddingMode == HBPicturePaddingModeCustom)
+ {
+ self.paddingLeft = [padDict[@"x"] intValue];
+ self.paddingRight = [padDict[@"width"] intValue] - self.width - self.paddingLeft;
+ self.paddingTop = [padDict[@"y"] intValue];
+ self.paddingBottom = [padDict[@"height"] intValue] - self.height - self.paddingTop;
+ }
+ else
+ {
+ self.paddingLeft = 0;
+ self.paddingRight = 0;
+ self.paddingTop = 0;
+ self.paddingBottom = 0;
+ }
+
self.validating = NO;
self.notificationsEnabled = YES;