Config Fill Modes
Usage Scenarios
The PAG fill mode is mainly used in the following two scenarios:
- When the rendered size (PAGView, PAGSurface size) is inconsistent with the size of the pag file
- When the size of the placeholder image n the pag file is inconsistent with the size of the filled image
The Effect of Fill Mode
PAG supports the following fill modes:
None: No scaling. Cropping starts at the upper left corner.
LetterBox: Black edge. Scaling to the available screen size of the device while maintaining aspect ratio ensures that the image does not deform. If the image size and filling area ratio are not consistent, black edges will appear, making it the default fill mode
Stretch: Filling without maintaining aspect ratio can cause deformation loss
Zoom: Cropping. Scaled to completely fill the available screen size while maintaining the aspect ratio
How to set fill mode
Settings in the Export Panel
The fill mode of placeholder images can be set in the AE export panel
API Settings
It can be set in PAGView, PAGImageView, PAGPlayer and PAGImage by the following method
- (void)setScaleMode:(PAGScaleMode)value
It can also be set through the system's built-in contentMode method in the PAGImageView on the iOS platform.
@property(nonatomic) UIViewContentMode contentMode;
If the above fill mode does not meet the requirements, it is supported to set the matrix of PAG rendering content or fill images through the following interface
// iOS
- (void)setMatrix:(CGAffineTransform)value;
// Android
void setMatrix(Matrix matrix);