diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers new file mode 120000 index 0000000..a177d2a --- /dev/null +++ b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/CocoaUtils.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/CocoaUtils.h deleted file mode 100644 index 44caf94..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/CocoaUtils.h +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef CocoaUtils_h -#define CocoaUtils_h - -#ifdef __APPLE__ -#include -#endif - -#if TARGET_OS_IPHONE -#import - -#define CocoaColor UIColor -#define CocoaTextureCacheRef CVOpenGLESTextureCacheRef -#define CocoaTextureRef CVOpenGLESTextureRef - -#elif TARGET_OS_MAC - -#import - -#define CocoaColor NSColor -#define CocoaTextureCacheRef CVOpenGLTextureCacheRef -#define CocoaTextureRef CVOpenGLTextureRef - -#endif - -#endif diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAG.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAG.h deleted file mode 100644 index b4a61e2..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAG.h +++ /dev/null @@ -1,35 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import - -#if !defined(PAG_API) -#if defined(PAG_DLL) -#define PAG_API __attribute__((visibility("default"))) -#else -#define PAG_API -#endif -#endif - -PAG_API @interface PAG : NSObject -/** - * Get SDK version information. - */ -+ (NSString*)SDKVersion; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGComposition.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGComposition.h deleted file mode 100644 index 582cb81..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGComposition.h +++ /dev/null @@ -1,153 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGLayer.h" - -PAG_API @interface PAGComposition : PAGLayer - -/** - * Make a empty PAGComposition with specified size. - */ -+ (PAGComposition*)Make:(CGSize)size; - -/** - * Returns the width of the Composition. - */ -- (NSInteger)width; - -/** - * Returns the height of the Composition. - */ -- (NSInteger)height; - -/** - * Set the size of the Composition. - */ -- (void)setContentSize:(CGSize)size; - -/** - * Returns the number of child layers of this composition. - */ -- (NSInteger)numChildren; - -/** - * Returns the child layer that exists at the specified index. - * @param index The index position of the child layer. - * @returns The child layer at the specified index position. - */ -- (PAGLayer*)getLayerAt:(int)index; - -/** - * Returns the index position of a child layer. - * @param child The layer instance to identify. - * @returns The index position of the child layer to identify. - */ -- (NSInteger)getLayerIndex:(PAGLayer*)child; - -/** - * Changes the position of an existing child in the container. This affects the layering of child - * layers. - * @param child The child layer for which you want to change the index number. - * @param index The resulting index number for the child layer. - */ -- (void)setLayerIndex:(NSInteger)index layer:(PAGLayer*)child; - -/** - Add PAGLayer to current PAGComposition at the top. - @param pagLayer specified PAGLayer to add - @return return YES if operation succeed, otherwise NO. - */ -- (BOOL)addLayer:(PAGLayer*)pagLayer; - -/** - Add PAGLayer to current PAGComposition at the specified index. - @param pagLayer specified PAGLayer to add - @param index specified index where to add - @return return YES if operation succeed,else NO. - */ -- (BOOL)addLayer:(PAGLayer*)pagLayer atIndex:(int)index; - -/** - Check whether current PAGComposition cotains the specified pagLayer. - @param pagLayer specified layer to check - @return return YES if the current PAGComposition contains the paglayer,else NO. - */ -- (BOOL)contains:(PAGLayer*)pagLayer; - -/** - Remove the specified PAGLayer from current PAGComposition. - @param pagLayer specified PAGLayer to remove - @return return the PAGLayer if remove successfully,else nil. - */ -- (PAGLayer*)removeLayer:(PAGLayer*)pagLayer; - -/** - Remove the PAGLayer at specified index from current PAGComposition. - - @param index specified index to remove - @return return the PAGLayer if remove successfully,else nil. - */ -- (PAGLayer*)removeLayerAt:(int)index; - -/** - Remove all PAGLayers from current PAGComposition. - */ -- (void)removeAllLayers; - -/** - Swap the layers. - @param pagLayer1 specified PAGLayer 1 to swap - @param pagLayer2 specified PAGLayer 2 to swap - */ -- (void)swapLayer:(PAGLayer*)pagLayer1 withLayer:(PAGLayer*)pagLayer2; - -/** - Swap the layers at the specified index. - @param index1 specified index 1 to swap - @param index2 specified index 2 to swap - */ -- (void)swapLayerAt:(int)index1 withIndex:(int)index2; - -/** - * Returns the audio data of this composition, which is an AAC audio in an MPEG-4 container. - */ -- (NSData*)audioBytes; - -/** - * Returns when the first frame of the audio plays in the composition's timeline. - */ -- (int64_t)audioStartTime; - -/** - * Returns the audio Markers of the composition. - */ -- (NSArray*)audioMarkers; - -/** - * Returns an array of layers that match the specified layer name. - */ -- (NSArray*)getLayersByName:(NSString*)layerName; - -/** - * Returns an array of layers that lie under the specified point. The point is in pixels and from - * this PAGComposition's local coordinates. - */ -- (NSArray*)getLayersUnderPoint:(CGPoint)point; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGDiskCache.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGDiskCache.h deleted file mode 100644 index f60d84f..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGDiskCache.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -/** - * Defines methods to manage the disk cache capabilities. - */ -PAG_API @interface PAGDiskCache : NSObject - -/** - * Returns the size limit of the disk cache in bytes. The default value is 1 GB. - */ -+ (size_t)MaxDiskSize; - -/** - * Sets the size limit of the disk cache in bytes, which will triggers the cache cleanup if the - * disk usage exceeds the limit. The opened files are not removed immediately, even if their disk - * usage exceeds the limit, and they will be rechecked after they are closed. - */ -+ (void)SetMaxDiskSize:(size_t)size; - -/** - * Removes all cached files from the disk. All the opened files will be also removed after they - * are closed. - */ -+ (void)RemoveAll; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGFile.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGFile.h deleted file mode 100644 index 5bdfdd0..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGFile.h +++ /dev/null @@ -1,135 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGComposition.h" -#import "PAGFont.h" -#import "PAGImage.h" -#import "PAGText.h" -#import "PAGTimeStretchMode.h" - -PAG_API @interface PAGFile : PAGComposition -/** - * The maximum tag level current SDK supports. - */ -+ (uint16_t)MaxSupportedTagLevel; - -/*** - * Load a pag file from the specified path, return null if the file does not exist or the data is - * not a pag file. Note: All PAGFiles loaded by the same path share the same internal cache. The - * internal cache is alive until all PAGFiles are released. Use '[PAGFile Load:size:]' instead if - * you don't want to load a PAGFile from the intenal caches. - */ -+ (PAGFile*)Load:(NSString*)path; - -/** - * Asynchronously load a PAG file from the specific path, a block with PAGFile will be called - * when loading is complete. - */ -+ (void)LoadAsync:(NSString*)path completionBlock:(void (^)(PAGFile*))callback; - -/** - * Load a pag file from byte data, return null if the bytes is empty or it's not a valid pag file. - */ -+ (PAGFile*)Load:(const void*)bytes size:(size_t)length; - -/** - * The tag level this pag file requires. - */ -- (uint16_t)tagLevel; - -/** - * The number of editable texts. - */ -- (int)numTexts; - -/** - * The number of replaceable images. - */ -- (int)numImages; - -/** - * The number of video compositions. - */ -- (int)numVideos; - -/** - * The path string of this file, returns empty string if the file is loaded from byte stream. - */ -- (NSString*)path; - -/** - * Get a text data of the specified index. The index ranges from 0 to numTexts - 1. - * Note: It always returns the default text data. - */ -- (PAGText*)getTextData:(int)editableTextIndex; - -/** - * Replace the text data of the specified index. The index ranges from 0 to PAGFile.numTexts - 1. - * Passing in null for the textData parameter will reset it to default text data. - */ -- (void)replaceText:(int)editableTextIndex data:(PAGText*)value; - -/** - * Replace the image data of the specified index. The index ranges from 0 to PAGFile.numImages - 1. - * Passing in null for the image parameter will reset it to default image data. - */ -- (void)replaceImage:(int)editableImageIndex data:(PAGImage*)value; - -/** - * Replace the image data of the specified layer name. - * Passing in null for the image parameter will reset it to default image data. - */ -- (void)replaceImageByName:(NSString*)layerName data:(PAGImage*)value; - -/** - * Return an array of layers by specified editable index and layer type. - */ -- (NSArray*)getLayersByEditableIndex:(int)index layerType:(PAGLayerType)type; - -/** - * Returns the indices of the editable layers in this PAGFile. - * If the editableIndex of a PAGLayer is not present in the returned indices, the PAGLayer should - * not be treated as editable. - */ -- (NSArray*)getEditableIndices:(PAGLayerType)layerType; - -/** - * Indicate how to stretch the original duration to fit target duration when file's duration is - * changed. The default value is PAGTimeStretchMode::Repeat. - */ -- (PAGTimeStretchMode)timeStretchMode; - -/** - * Set the timeStretchMode of this file. - */ -- (void)seTimeStretchMode:(PAGTimeStretchMode)value; - -/** - * Set the duration of this PAGFile. Passing a value less than or equal to 0 resets the duration to - * its default value. - */ -- (void)setDuration:(int64_t)duration; - -/** - * Make a copy of the original file, any modification to current file has no effect on the result - * file. - */ -- (PAGFile*)copyOriginal; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGFont.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGFont.h deleted file mode 100644 index 79aea8c..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGFont.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -PAG_API @interface PAGFont : NSObject - -/** - * A string with the name of the font family. - **/ -@property(nonatomic, copy) NSString* fontFamily; - -/** - * A string with the style information — e.g., “bold”, “italic”. - **/ -@property(nonatomic, copy) NSString* fontStyle; - -+ (PAGFont*)RegisterFont:(NSString*)fontPath; - -+ (PAGFont*)RegisterFont:(NSString*)fontPath - family:(NSString*)fontFamily - style:(NSString*)fontStyle; - -+ (PAGFont*)RegisterFont:(void*)data size:(size_t)length; - -+ (PAGFont*)RegisterFont:(void*)data - size:(size_t)length - family:(NSString*)fontFamily - style:(NSString*)fontStyle; - -+ (void)UnregisterFont:(PAGFont*)font; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGImage.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGImage.h deleted file mode 100644 index 815cb62..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGImage.h +++ /dev/null @@ -1,81 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import -#import -#import "PAG.h" -#import "PAGScaleMode.h" - -PAG_API @interface PAGImage : NSObject -/** - * Creates a PAGImage object from a CGImage object, return null if it's not valid CGImage object. - */ -+ (PAGImage*)FromCGImage:(CGImageRef)cgImage; - -/** - * Creates a PAGImage object from a path of a image file, return null if the file does not exist or - * it's not a valid image file. - */ -+ (PAGImage*)FromPath:(NSString*)path; - -/** - * Creates a PAGImage object from the specified byte data, return null if the bytes is empty or it's - * not a valid image file. - */ -+ (PAGImage*)FromBytes:(const void*)bytes size:(size_t)length; - -/** - * Creates a PAGImage object from the specified CVPixelBuffer, return null if the CVPixelBuffer is - * invalid. - */ -+ (PAGImage*)FromPixelBuffer:(CVPixelBufferRef)pixelBuffer; - -/** - * Returns the width in pixels of the image. - */ -- (NSInteger)width; - -/** - * Returns the height in pixels of the image. - */ -- (NSInteger)height; - -/** - * Returns the current scale mode. - */ -- (PAGScaleMode)scaleMode; - -/** - * Specifies the rule of how to scale the image content to fit the original image size. The matrix - * changes when this method is called. - */ -- (void)setScaleMode:(PAGScaleMode)value; - -/** - * Returns a copy of current matrix. - */ -- (CGAffineTransform)matrix; - -/** - * Set the transformation which will be applied to the image content. The scaleMode property - * will be set to PAGScaleMode::None when this method is called. - */ -- (void)setMatrix:(CGAffineTransform)value; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGImageLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGImageLayer.h deleted file mode 100644 index e41ff33..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGImageLayer.h +++ /dev/null @@ -1,68 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGLayer.h" -#import "PAGScaleMode.h" - -@class PAGImage; -@class PAGVideoRange; - -PAG_API @interface PAGImageLayer : PAGLayer -/** - * Make a PAGImageLayer with size and duration(in microseconds). - */ -+ (instancetype)Make:(CGSize)size duration:(int64_t)duration; - -/** - * Returns the time ranges of the source video for replacement. - */ -- (NSArray*)getVideoRanges; - -/** - * [Deprecated] - * Replace the original image content with the specified PAGImage object. - * Passing in null for the image parameter resets the layer to its default image content. - * The replaceImage() method modifies all associated PAGImageLayers that have the same - * editableIndex to this layer. - * - * @param image The PAGImage object to replace with. - */ -- (void)replaceImage:(PAGImage*)image DEPRECATED_MSG_ATTRIBUTE("Please use setImage:image instead"); - -/** - * Replace the original image content with the specified PAGImage object. - * Passing in null for the image parameter resets the layer to its default image content. - * The setImage() method only modifies the content of the calling PAGImageLayer. - * - * @param image The PAGImage object to replace with. - */ -- (void)setImage:(PAGImage*)image; - -/** - * Returns the content duration in microseconds, which indicates the minimal length required for - * replacement. - */ -- (int64_t)contentDuration; - -/** - * The default image data of this layer, which is webp format. - */ -- (NSData*)imageBytes; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGLayer.h deleted file mode 100644 index 555b4b0..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGLayer.h +++ /dev/null @@ -1,181 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import -#import "PAGMarker.h" - -typedef NS_ENUM(NSInteger, PAGLayerType) { - PAGLayerTypeUnknown, - PAGLayerTypeNull, - PAGLayerTypeSolid, - PAGLayerTypeText, - PAGLayerTypeShape, - PAGLayerTypeImage, - PAGLayerTypePreCompose, -}; - -@class PAGComposition; -@class PAGFile; - -PAG_API @interface PAGLayer : NSObject - -/** - * Returns the type of layer. - */ -- (PAGLayerType)layerType; - -/** - * Returns the name of the layer. - */ -- (NSString*)layerName; - -/** - * A matrix object containing values that alter the scaling, rotation, and translation of the layer. - * Altering it does not change the animation matrix, and it will be concatenated to current - * animation matrix for displaying. - */ -- (CGAffineTransform)matrix; - -- (void)setMatrix:(CGAffineTransform)matrix; - -/** - * Resets the matrix to its default value. - */ -- (void)resetMatrix; - -/** - * Returns the layer's display matrix by combining its matrix) property with the current animation - * matrix from the AE timeline. This does not include the parent layer's matrix. - * To calculate the final bounds relative to the PAGSurface, use the PAGPlayer::getBounds(PAGLayer - * layer) method directly. - */ -- (CGAffineTransform)getTotalMatrix; - -/** - * Whether or not the layer is visible. - */ -- (BOOL)visible; - -- (void)setVisible:(BOOL)visible; - -/** - * Ranges from 0 to PAGFile.numTexts - 1 if the layer type is text, or from 0 to PAGFile.numImages - * -1 if the layer type is image, otherwise returns -1. - */ -- (NSInteger)editableIndex; - -/** - * Indicates the PAGComposition instance that contains this PAGLayer instance. - */ -- (PAGComposition*)parent; - -/** - * Returns the markers of current PAGLayer. - */ -- (NSArray*)markers; - -/** - * Converts the time from the PAGLayer's (local) timeline to the PAGSurface (global) timeline. The - * time is in microseconds. - */ -- (int64_t)localTimeToGlobal:(int64_t)localTime; - -/** - * Converts the time from the PAGSurface (global) to the PAGLayer's (local) timeline timeline. The - * time is in microseconds. - */ -- (int64_t)globalToLocalTime:(int64_t)globalTime; - -/** - * The duration of the layer in microseconds, indicates the length of the visible range. - */ -- (int64_t)duration; - -/** - * Returns the frame rate of this layer. - */ -- (float)frameRate; - -/** - * The start time of the layer in microseconds, indicates the start position of the visible range. - * It could be a negative value. - */ -- (int64_t)startTime; - -/** - * Set the start time of the layer, in microseconds. - */ -- (void)setStartTime:(int64_t)time; - -/** - * The current time of the layer in microseconds, the layer is invisible if currentTime is not in - * the visible range (startTime <= currentTime < startTime + duration). - */ -- (int64_t)currentTime; - -/** - * Set the current time of the layer in microseconds. - */ -- (void)setCurrentTime:(int64_t)time; - -/** - * Returns the current progress of play position, the value is from 0.0 to 1.0. - */ -- (double)getProgress; - -/** - * Set the progress of play position, the value ranges from 0.0 to 1.0. A value of 0.0 represents - * the frame at startTime. A value of 1.0 represents the frame at the end of duration. - */ -- (void)setProgress:(double)value; - -/** - * Returns trackMatte layer of this layer. - */ -- (PAGLayer*)trackMatteLayer; - -/** - * Returns a rectangle int pixels that defines the original area of the layer, which is not - * transformed by the matrix. - */ -- (CGRect)getBounds; - -/** - * Indicate whether this layer is excluded from parent's timeline. If set to true, this layer's - * current time will not change when parent's current time changes. - */ -- (BOOL)excludedFromTimeline; - -/** - * Set the excludedFromTimeline flag of this layer. - */ -- (void)setExcludedFromTimeline:(BOOL)value; - -/** - * Returns the current alpha of the layer if previously set. - */ -- (float)alpha; - -/** - * Set the alpha of the layer, which will be concatenated to the current animation opacity for - * displaying. - */ -- (void)setAlpha:(float)value; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGMarker.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGMarker.h deleted file mode 100644 index 47a388b..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGMarker.h +++ /dev/null @@ -1,28 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -PAG_API @interface PAGMarker : NSObject - -@property(nonatomic) long long startTime; -@property(nonatomic) long long duration; -@property(nonatomic, copy) NSString* comment; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGPlayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGPlayer.h deleted file mode 100644 index c15bcc2..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGPlayer.h +++ /dev/null @@ -1,193 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGComposition.h" -#import "PAGFile.h" -#import "PAGImage.h" -#import "PAGScaleMode.h" -#import "PAGSurface.h" - -PAG_API @interface PAGPlayer : NSObject -/** - * Returns the current PAGComposition for PAGPlayer to render as content. - */ -- (PAGComposition*)getComposition; - -/** - * Sets a new PAGComposition for PAGPlayer to render as content. - * Note: If the composition is already added to another PAGPlayer, it will be removed from the - * previous PAGPlayer. - */ -- (void)setComposition:(PAGComposition*)newComposition; - -/** - * Returns the PAGSurface object for PAGPlayer to render onto. - */ -- (PAGSurface*)getSurface; - -/** - * Set the PAGSurface object for PAGPlayer to render onto. - */ -- (void)setSurface:(PAGSurface*)surface; - -/** - * If set to false, the player skips rendering for video composition. - */ -- (BOOL)videoEnabled; - -/** - * Set the value of videoEnabled property. - */ -- (void)setVideoEnabled:(BOOL)value; - -/** - * If set to true, PAGPlayer caches an internal bitmap representation of the static content for each - * layer. This caching can increase performance for layers that contain complex vector content. The - * execution speed can be significantly faster depending on the complexity of the content, but it - * requires extra graphics memory. The default value is true. - */ -- (BOOL)cacheEnabled; - -/** - * Set the value of cacheEnabled property. - */ -- (void)setCacheEnabled:(BOOL)value; - -/** - * If set to true, PAG will cache the associated rendering data into a disk file, such as the - * decoded image frames of video compositions. This can help reduce memory usage and improve - * rendering performance. - */ -- (BOOL)useDiskCache; - -/** - * Set the value of useDiskCache property. - */ -- (void)setUseDiskCache:(BOOL)value; - -/** - * This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0. The - * scale factors less than 1.0 may result in blurred output, but it can reduce the usage of graphics - * memory which leads to better performance. The default value is 1.0. - */ -- (float)cacheScale; - -/** - * Set the value of cacheScale property. - */ -- (void)setCacheScale:(float)value; - -/** - * The maximum frame rate for rendering, ranges from 1 to 60. If set to a value less than the actual - * frame rate from composition, it drops frames but increases performance. Otherwise, it has no - * effect. The default value is 60. - */ -- (float)maxFrameRate; - -/** - * Set the maximum frame rate for rendering. - */ -- (void)setMaxFrameRate:(float)value; - -/** - * Returns the current scale mode. - */ -- (PAGScaleMode)scaleMode; - -/** - * Specifies the rule of how to scale the pag content to fit the surface size. The matrix - * changes when this method is called. - */ -- (void)setScaleMode:(PAGScaleMode)value; - -/** - * Returns a copy of current matrix. - */ -- (CGAffineTransform)matrix; - -/** - * Set the transformation which will be applied to the composition. The scaleMode property - * will be set to PAGScaleMode::None when this method is called. - */ -- (void)setMatrix:(CGAffineTransform)value; - -/** - * The duration of current composition in microseconds. - */ -- (int64_t)duration; - -/** - * Returns the current progress of play position, the value is from 0.0 to 1.0. - */ -- (double)getProgress; - -/** - * Set the progress of play position, the value is from 0.0 to 1.0. - */ -- (void)setProgress:(double)value; - -/** - * Returns the current frame. - */ -- (int64_t)currentFrame; - -/** - * Prepares the player for the next flush() call. It collects all CPU tasks from the current - * progress of the composition and runs them asynchronously in parallel. It is usually used for - * speeding up the first frame rendering. - */ -- (void)prepare; - -/** - * Apply all pending changes to the target surface immediately. Returns true if the content has - * changed. - */ -- (BOOL)flush; - -/** - * Returns a rectangle in pixels that defines the displaying area of the specified layer, which is - * in the coordinate of the PAGSurface. - */ -- (CGRect)getBounds:(PAGLayer*)pagLayer; - -/** - * Returns an array of layers that lie under the specified point. The point is in pixels and from - * the surface's coordinates. - */ -- (NSArray*)getLayersUnderPoint:(CGPoint)point; - -/** - * Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point is - * in the coordinate space of the PAGSurface, not the PAGComposition that contains the PAGLayer. It - * always returns false if the PAGLayer or its parent (or parent's parent...) has not been added to - * this PAGPlayer. This method only check against the bounding box not the acual pixels. - */ -- (BOOL)hitTestPoint:(PAGLayer*)layer point:(CGPoint)point; - -/** - * Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point is - * in the coordinate space of the PAGSurface, not the PAGComposition that contains the PAGLayer. It - * always returns false if the PAGLayer or its parent (or parent's parent...) has not been added to - * this PAGPlayer. The pixelHitTest parameter indicates whether or not to check against the actual - * pixels of the object (true) or the bounding box (false). Returns true if the PAGLayer overlaps or - * intersects with the specified point. - */ -- (BOOL)hitTestPoint:(PAGLayer*)layer point:(CGPoint)point pixelHitTest:(BOOL)pixelHitTest; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGScaleMode.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGScaleMode.h deleted file mode 100644 index 396209a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGScaleMode.h +++ /dev/null @@ -1,31 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -typedef enum { - // The content is not scaled. - PAGScaleModeNone = 0, - // The content is stretched to fit. - PAGScaleModeStretch = 1, - // The content is scaled with respect to the original unscaled image's aspect ratio. This is the - // default value. - PAGScaleModeLetterBox = 2, - // The content is scaled to fit with respect to the original unscaled image's aspect ratio. This - // results in cropping - // on one axis. - PAGScaleModeZoom = 3, -} PAGScaleMode; diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGShapeLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGShapeLayer.h deleted file mode 100644 index b2cb470..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGShapeLayer.h +++ /dev/null @@ -1,24 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGLayer.h" - -PAG_API @interface PAGShapeLayer : PAGLayer - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGSolidLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGSolidLayer.h deleted file mode 100644 index eca4d62..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGSolidLayer.h +++ /dev/null @@ -1,35 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "CocoaUtils.h" -#import "PAGLayer.h" - -PAG_API @interface PAGSolidLayer : PAGLayer - -/** - * Returns the layer's solid color. - */ -- (CocoaColor*)solidColor; - -/** - * Set the the layer's solid color. - */ -- (void)setSolidColor:(CocoaColor*)color; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGSurface.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGSurface.h deleted file mode 100644 index 8c20d44..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGSurface.h +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import -#import -#import -#import -#import "PAGImageLayer.h" - -PAG_API @interface PAGSurface : NSObject - -+ (PAGSurface*)FromView:(NSView*)view; - -/** - * [Deprecated](Please use [PAGSurface MakeOffscreen] instead.) - * Creates an offscreen PAGSurface of the specified size for pixel reading. - */ -+ (PAGSurface*)MakeFromGPU:(CGSize)size - DEPRECATED_MSG_ATTRIBUTE("Please use [PAGSurface MakeOffscreen] instead."); - -/** - * Creates an offscreen PAGSurface of the specified size for pixel reading. - */ -+ (PAGSurface*)MakeOffscreen:(CGSize)size; - -/** - * The width of the surface. - */ -- (int)width; - -/** - * The height of the surface. - */ -- (int)height; - -/** - * Update the size of the surface, and reset the internal surface. - */ -- (void)updateSize; - -/** - * Erases all pixels of this surface with transparent color. Returns true if the content has - * changed. - */ -- (BOOL)clearAll; - -/** - * Free the cache created by the surface immediately. Can be called to reduce memory pressure. - */ -- (void)freeCache; - -/** - * Returns the internal CVPixelBuffer object associated with this PAGSurface, returns nil if this - * PAGSurface is created by [PAGSurface FromLayer]. - */ -- (CVPixelBufferRef)getCVPixelBuffer; - -/** - * Returns a CVPixelBuffer object capturing the contents of the PAGSurface. Subsequent rendering of - * the PAGSurface will not be captured. - */ -- (CVPixelBufferRef)makeSnapshot; -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGText.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGText.h deleted file mode 100644 index 6c7c40e..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGText.h +++ /dev/null @@ -1,138 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#include "CocoaUtils.h" -#import "PAG.h" - -enum { - PAGJustificationLeftJustify = 0, - PAGJustificationCenterJustify = 1, - PAGJustificationRightJustify = 2, - PAGJustificationFullJustifyLastLineLeft = 3, - PAGJustificationFullJustifyLastLineRight = 4, - PAGJustificationFullJustifyLastLineCenter = 5, - PAGJustificationFullJustifyLastLineFull = 6 -}; - -/** - * The PAGText object stores a value for a TextLayer's Source Text property. - */ -PAG_API @interface PAGText : NSObject - -/** - * When true, the text layer shows a fill. - */ -@property(nonatomic, assign) bool applyFill; - -/** - * When true, the text layer shows a stroke. - */ -@property(nonatomic, assign) bool applyStroke; -/** - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) float baselineShift; -/** - * When true, the text layer is paragraph (bounded) text. - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) bool boxText; - -/** - * For box text, the pixel boundary for the text bounds. - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) CGRect boxTextRect; -/** - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) float firstBaseLine; - -@property(nonatomic, assign) bool fauxBold; - -@property(nonatomic, assign) bool fauxItalic; - -/** - * The text layer’s fill color. - */ -@property(nonatomic, strong) CocoaColor* fillColor; - -/** - * A string with the name of the font family. - **/ -@property(nonatomic, copy) NSString* fontFamily; - -/** - * A string with the style information — e.g., “bold”, “italic”. - **/ -@property(nonatomic, copy) NSString* fontStyle; - -/** - * The text layer’s font size in pixels. - */ -@property(nonatomic, assign) float fontSize; - -/** - * The text layer’s stroke color. - */ -@property(nonatomic, strong) CocoaColor* strokeColor; - -/** - * Indicates the rendering order for the fill and stroke of a text layer. - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) bool strokeOverFill; - -/** - * The text layer’s stroke thickness. - */ -@property(nonatomic, assign) float strokeWidth; - -/** - * The text layer’s Source Text value. - */ -@property(nonatomic, copy) NSString* text; - -/** - * The paragraph justification for the text layer. Such as : PAGJustificationLeftJustify, - * PAGJustificationCenterJustify... - */ -@property(nonatomic, assign) uint8_t justification; - -/** - * The space between lines, 0 indicates 'auto', which is fontSize * 1.2 - */ -@property(nonatomic, assign) float leading; - -/** - * The text layer’s spacing between characters. - */ -@property(nonatomic, assign) float tracking; - -/** - * The text layer’s background color. - */ -@property(nonatomic, strong) CocoaColor* backgroundColor; - -/** - * The text layer’s background alpha. 0 = 100% transparent, 255 = 100% opaque. - */ -@property(nonatomic, assign) int backgroundAlpha; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGTextLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGTextLayer.h deleted file mode 100644 index 2f046ec..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGTextLayer.h +++ /dev/null @@ -1,82 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#include "CocoaUtils.h" -#import "PAGLayer.h" - -@class PAGFont; - -PAG_API @interface PAGTextLayer : PAGLayer - -/** - * Returns the TextLayer’s fill color. - */ -- (CocoaColor*)fillColor; - -/** - * Sets the TextLayer’s fill color. - */ -- (void)setFillColor:(CocoaColor*)color; - -/** - * Returns the TextLayer's font. - */ -- (PAGFont*)font; - -/** - * Sets the TextLayer's font. - */ -- (void)setFont:(PAGFont*)font; - -/** - * Returns the TextLayer's font size. - */ -- (CGFloat)fontSize; - -/** - * Sets the TextLayer's font size. - */ -- (void)setFontSize:(CGFloat)size; - -/** - * Returns the TextLayer's stroke color. - */ -- (CocoaColor*)strokeColor; - -/** - * Sets the TextLayer's stroke color. - */ -- (void)setStrokeColor:(CocoaColor*)color; - -/** - * Returns the TextLayer's text. - */ -- (NSString*)text; - -/** - * Set the TextLayer's text. - */ -- (void)setText:(NSString*)text; - -/** - * Reset the text layer to its default text data. - */ -- (void)reset; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGTimeStretchMode.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGTimeStretchMode.h deleted file mode 100644 index e77e4b7..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGTimeStretchMode.h +++ /dev/null @@ -1,33 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -typedef enum { - // Keep the original playing speed, and display the last frame if the content's duration is less - // than target duration. - PAGTimeStretchModeNone = 0, - // Change the playing speed of the content to fit target duration. - PAGTimeStretchModeScale = 1, - // Keep the original playing speed, but repeat the content if the content's duration is less than - // target duration. - // This is the default mode. - PAGTimeStretchModeRepeat = 2, - // Keep the original playing speed, but repeat the content in reversed if the content's duration - // is less than - // target duration. - PAGTimeStretchModeRepeatInverted = 3, -} PAGTimeStretchMode; diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGVideoDecoder.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGVideoDecoder.h deleted file mode 100644 index 7cd76e3..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGVideoDecoder.h +++ /dev/null @@ -1,34 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -PAG_API @interface PAGVideoDecoder : NSObject - -/** - * Register a software decoder factory to implement the decoder fallback mechanism. - */ -+ (void)RegisterSoftwareDecoderFactory:(void*)decoderFactory; - -/** - * Set the maximum number of hardware video decoders that can be create. - */ -+ (void)SetMaxHardwareDecoderCount:(int)maxCount; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGVideoRange.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGVideoRange.h deleted file mode 100644 index f302694..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGVideoRange.h +++ /dev/null @@ -1,44 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -/** - * Represents a time range from the content of PAGImageLayer. - */ -PAG_API @interface PAGVideoRange : NSObject - -/** - * The start time of the source video, in microseconds. - */ -@property(nonatomic) int64_t startTime; -/** - * The end time of the source video (not included), in microseconds. - */ -@property(nonatomic) int64_t endTime; -/** - * The duration for playing after applying speed. - */ -@property(nonatomic) int64_t playDuration; -/** - * Indicates whether the video should play backward. - */ -@property(nonatomic) int64_t reversed; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGView.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGView.h deleted file mode 100644 index e3ed000..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/PAGView.h +++ /dev/null @@ -1,245 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import "PAGFile.h" -#import "PAGImage.h" -#import "PAGLayer.h" - -@class PAGView; -@protocol PAGViewListener - -@optional -/** - * Notifies the beginning of the animation. It can be called from either the UI thread or the thread - * that calls the play method. - */ -- (void)onAnimationStart:(PAGView*)pagView; - -/** - * Notifies the end of the animation. It can only be called from the UI thread. - */ -- (void)onAnimationEnd:(PAGView*)pagView; - -/** - * Notifies the cancellation of the animation. It can be called from either the UI thread or the - * thread that calls the stop method. - */ -- (void)onAnimationCancel:(PAGView*)pagView; - -/** - * Notifies the repetition of the animation. It can only be called from the UI thread. - */ -- (void)onAnimationRepeat:(PAGView*)pagView; - -/** - * Notifies another frame of the animation has occurred. It may be called from an arbitrary - * thread if the animation is running asynchronously. - */ -- (void)onAnimationUpdate:(PAGView*)pagView; - -@end - -PAG_API @interface PAGView : NSView - -/** - * Adds a listener to the set of listeners that are sent events through the life of an animation, - * such as start, repeat, and end. PAGView only holds a weak reference to the listener. - */ -- (void)addListener:(id)listener; - -/** - * Removes a listener from the set listening to this animation. - */ -- (void)removeListener:(id)listener; - -/** - * The total number of times the animation is set to play. The default is 1, which means the - * animation will play only once. If the repeat count is set to 0 or a negative value, the - * animation will play infinity times. - */ -- (int)repeatCount; - -/** - * Set the number of times the animation to play. - */ -- (void)setRepeatCount:(int)repeatCount; - -/** - * Indicates whether this pag view is playing. - */ -- (BOOL)isPlaying; - -/** - * Starts to play the animation from the current position. Calling the play() method when the - * animation is already playing has no effect. The play() method does not alter the animation's - * current position. However, if the animation previously reached its end, it will restart from - * the beginning. - */ -- (void)play; - -/** - * Cancels the animation at the current position. Calling the play() method can resume the animation - * from the last paused position. - */ -- (void)pause; - -/** - * Cancels the animation at the current position. Currently, it has the same effect as pause(). - */ -- (void)stop; - -/** - * The path string of a pag file set by setPath. - */ -- (NSString*)getPath; - -/** - * Load a pag file from the specified path, returns false if the file does not exist or the data is - * not a pag file. Note: All PAGFiles loaded by the same path share the same internal cache. The - * internal cache is alive until all PAGFiles are released. Use '[PAGFile Load:size:]' instead if - * you don't want to load a PAGFile from the intenal caches. - */ -- (BOOL)setPath:(NSString*)filePath; - -/** - * Returns the current PAGComposition for PAGView to render as content. - */ -- (PAGComposition*)getComposition; - -/** - * Sets a new PAGComposition for PAGView to render as content. - * Note: If the composition is already added to another PAGView, it will be removed from the - * previous PAGView. - */ -- (void)setComposition:(PAGComposition*)newComposition; - -/** - * Return the value of videoEnabled property. - */ -- (BOOL)videoEnabled; - -/** - * If set false, will skip video layer drawing. - */ -- (void)setVideoEnabled:(BOOL)enable; - -/** - * If set to true, PAG renderer caches an internal bitmap representation of the static content for - * each layer. This caching can increase performance for layers that contain complex vector content. - * The execution speed can be significantly faster depending on the complexity of the content, but - * it requires extra graphics memory. The default value is true. - */ -- (BOOL)cacheEnabled; - -/** - * Set the value of cacheEnabled property. - */ -- (void)setCacheEnabled:(BOOL)value; - -/** - * This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0. The - * scale factors less than 1.0 may result in blurred output, but it can reduce the usage of graphics - * memory which leads to better performance. The default value is 1.0. - */ -- (float)cacheScale; - -/** - * Set the value of cacheScale property. - */ -- (void)setCacheScale:(float)value; - -/** - * The maximum frame rate for rendering. If set to a value less than the actual frame rate from - * PAGFile, it drops frames but increases performance. Otherwise, it has no effect. The default - * value is 60. - */ -- (float)maxFrameRate; - -/** - * Set the maximum frame rate for rendering. - */ -- (void)setMaxFrameRate:(float)value; - -/** - * Returns the current scale mode. - */ -- (PAGScaleMode)scaleMode; - -/** - * Specifies the rule of how to scale the pag content to fit the surface size. The matrix - * changes when this method is called. - */ -- (void)setScaleMode:(PAGScaleMode)value; - -/** - * Returns a copy of the current matrix. - */ -- (CGAffineTransform)matrix; - -/** - * Set the transformation which will be applied to the composition. The method is valid only - * when the scaleMode is PAGScaleMode.None. - */ -- (void)setMatrix:(CGAffineTransform)value; - -/** - * The duration of current composition in microseconds. - */ -- (int64_t)duration; - -/** - * Returns the current progress of play position, the value is from 0.0 to 1.0. It is applied only - * when the composition is not null. - */ -- (double)getProgress; - -/** - * Set the progress of play position, the value is from 0.0 to 1.0. - */ -- (void)setProgress:(double)value; - -/** - * Call this method to render current position immediately. If the play() method is already - * called, there is no need to call it. Returns true if the content has changed. - */ -- (BOOL)flush; - -/** - * Returns an array of layers that lie under the specified point. - * The point is in pixels, convert dp to pixel by multiply [UIScreen mainScreen].scale, eg: point.x - * * scale,point.y* scale. - */ -- (NSArray*)getLayersUnderPoint:(CGPoint)point; - -/** - * Free the cache created by the pag view immediately. Can be called to reduce memory pressure. - */ -- (void)freeCache; - -/** - * Returns a CVPixelBuffer object capturing the contents of the PAGView. Subsequent rendering of - * the PAGView will not be captured. Returns nil if the PAGView hasn't been presented yet. - */ -- (CVPixelBufferRef)makeSnapshot; - -/** - * Returns a rectangle in pixels that defines the displaying area of the specified layer, which is - * in the coordinate of the PAGView. - */ -- (CGRect)getBounds:(PAGLayer*)pagLayer; -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/libpag.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/libpag.h deleted file mode 100644 index dcb953a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/libpag.h +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -// This file is an umbrella header for libpag on macOS platform. -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import \ No newline at end of file diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/ext/egl/pag_egl_globals.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/ext/egl/pag_egl_globals.h deleted file mode 100644 index 9c7ac87..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/ext/egl/pag_egl_globals.h +++ /dev/null @@ -1,27 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag/c/pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API egl_globals* pag_egl_globals_get(); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/ext/pag_surface_ext.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/ext/pag_surface_ext.h deleted file mode 100644 index 0e6d11a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/ext/pag_surface_ext.h +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag/c/pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Create a new pag_surface for double-buffered off-screen rendering. - * Release it by pag_release. - */ -PAG_API pag_surface* pag_surface_make_offscreen_double_buffered(int width, int height, - bool tryHardware, - void* sharedContext); - -/** - * Returns the front texture of the surface. - */ -PAG_API pag_backend_texture* pag_surface_get_front_texture(pag_surface* surface); - -/** - * Returns the back texture of the surface. - */ -PAG_API pag_backend_texture* pag_surface_get_back_texture(pag_surface* surface); - -/** - * Returns the front hardware buffer of the surface. - */ -PAG_API void* pag_surface_get_front_hardware_buffer(pag_surface* surface); - -/** - * Returns the back hardware buffer of the surface. - */ -PAG_API void* pag_surface_get_back_hardware_buffer(pag_surface* surface); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag.h deleted file mode 100644 index 92fbc0d..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag.h +++ /dev/null @@ -1,37 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "ext/pag_surface_ext.h" -#include "pag_animator.h" -#include "pag_backend_semaphore.h" -#include "pag_backend_texture.h" -#include "pag_byte_data.h" -#include "pag_composition.h" -#include "pag_decoder.h" -#include "pag_disk_cache.h" -#include "pag_file.h" -#include "pag_font.h" -#include "pag_image.h" -#include "pag_image_layer.h" -#include "pag_layer.h" -#include "pag_player.h" -#include "pag_solid_layer.h" -#include "pag_surface.h" -#include "pag_text_document.h" diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_animator.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_animator.h deleted file mode 100644 index 3e89349..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_animator.h +++ /dev/null @@ -1,54 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_animator with the specified listener. Release it by pag_release. - */ -PAG_API pag_animator* pag_animator_create(pag_animator_listener* listener, void* user); - -PAG_API bool pag_animator_is_sync(pag_animator* animator); - -PAG_API void pag_animator_set_sync(pag_animator* animator, bool sync); - -PAG_API int64_t pag_animator_get_duration(pag_animator* animator); - -PAG_API void pag_animator_set_duration(pag_animator* animator, int64_t duration); - -PAG_API int pag_animator_get_repeat_count(pag_animator* animator); - -PAG_API void pag_animator_set_repeat_count(pag_animator* animator, int repeatCount); - -PAG_API double pag_animator_get_progress(pag_animator* animator); - -PAG_API void pag_animator_set_progress(pag_animator* animator, double progress); - -PAG_API bool pag_animator_is_running(pag_animator* animator); - -PAG_API void pag_animator_start(pag_animator* animator); - -PAG_API void pag_animator_cancel(pag_animator* animator); - -PAG_API void pag_animator_update(pag_animator* animator); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_backend_semaphore.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_backend_semaphore.h deleted file mode 100644 index fb40e2a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_backend_semaphore.h +++ /dev/null @@ -1,36 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_backend_semaphore. Release it by pag_release. - */ -PAG_API pag_backend_semaphore* pag_backend_semaphore_create(); - -PAG_API bool pag_backend_semaphore_is_initialized(pag_backend_semaphore* semaphore); - -PAG_API void pag_backend_semaphore_init_gl(pag_backend_semaphore* semaphore, void* glSync); - -PAG_API void* pag_backend_semaphore_get_gl_sync(pag_backend_semaphore* semaphore); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_backend_texture.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_backend_texture.h deleted file mode 100644 index f252aba..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_backend_texture.h +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_backend_texture with texture info, width and height. - * Release it by pag_release. - */ -PAG_API pag_backend_texture* pag_backend_texture_create_from_gl_texture_info( - pag_gl_texture_info textureInfo, int width, int height); - -PAG_API bool pag_backend_texture_get_gl_texture_info(pag_backend_texture* texture, - pag_gl_texture_info* textureInfo); - -PAG_API bool pag_backend_texture_get_vk_image_info(pag_backend_texture* texture, - pag_vk_image_info* imageInfo); - -PAG_API bool pag_backend_texture_get_mtl_texture_info(pag_backend_texture* texture, - pag_mtl_texture_info* mtl_texture_info); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_byte_data.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_byte_data.h deleted file mode 100644 index 34b2a15..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_byte_data.h +++ /dev/null @@ -1,30 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_byte_data and copy the bytes and length. Release it by pag_release. - */ -PAG_API pag_byte_data* pag_byte_data_copy(const void* bytes, size_t length); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_composition.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_composition.h deleted file mode 100644 index 760ef26..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_composition.h +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API int pag_composition_get_width(pag_composition* composition); - -PAG_API int pag_composition_get_height(pag_composition* composition); - -/** - * Returns an array of layers that match the specified layer name. Release it by pag_release. - */ -PAG_API pag_layer** pag_composition_get_layers_by_name(pag_composition* composition, - const char* layerName, size_t* count); - -/** - * Returns an array of layers that match the specified layer type. Release it by pag_release. - */ -PAG_API pag_layer** pag_composition_get_layers_by_type(pag_composition* composition, - pag_layer_type layerType, size_t* count); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_decoder.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_decoder.h deleted file mode 100644 index b7c77d6..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_decoder.h +++ /dev/null @@ -1,48 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_decoder with a pag_composition, a frame rate limit, and a scale factor for the - * decoded image size. Release it by pag_release. - */ -PAG_API pag_decoder* pag_decoder_create(pag_composition* composition, float maxFrameRate, - float scale); - -PAG_API int pag_decoder_get_width(pag_decoder* decoder); - -PAG_API int pag_decoder_get_height(pag_decoder* decoder); - -PAG_API int pag_decoder_get_num_frames(pag_decoder* decoder); - -PAG_API float pag_decoder_get_frame_rate(pag_decoder* decoder); - -PAG_API bool pag_decoder_check_frame_changed(pag_decoder* decoder, int index); - -PAG_API bool pag_decoder_read_frame(pag_decoder* decoder, int index, void* pixels, size_t rowBytes, - pag_color_type colorType, pag_alpha_type alphaType); - -PAG_API bool pag_decoder_read_frame_to_hardware_buffer(pag_decoder* decoder, int index, - void* buffer); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_disk_cache.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_disk_cache.h deleted file mode 100644 index d0b8519..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_disk_cache.h +++ /dev/null @@ -1,31 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API size_t pag_disk_cache_get_max_disk_size(); - -PAG_API void pag_disk_cache_set_max_disk_size(size_t maxDiskSize); - -PAG_API void pag_disk_cache_remove_all(); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_file.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_file.h deleted file mode 100644 index 725999f..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_file.h +++ /dev/null @@ -1,66 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Load a pag file from byte data, return null if the bytes is empty, or it's not a valid pag - * file. Release it by pag_release. - */ -PAG_API pag_file* pag_file_load(const void* bytes, size_t length, const char* filePath, - const char* password); - -PAG_API void pag_file_set_duration(pag_file* file, int64_t duration); - -PAG_API int pag_file_get_num_texts(pag_file* file); - -PAG_API int pag_file_get_num_images(pag_file* file); - -PAG_API int pag_file_get_num_videos(pag_file* file); - -PAG_API pag_time_stretch_mode pag_file_get_time_stretch_mode(pag_file* file); - -PAG_API void pag_file_set_time_stretch_mode(pag_file* file, pag_time_stretch_mode mode); - -/** - * Get a text data of the specified index. The index ranges from 0 to numTexts - 1. Release it by - * pag_release. - * Note: It always returns the default text data. - */ -PAG_API pag_text_document* pag_file_get_text_data(pag_file* file, int editableTextIndex); - -PAG_API void pag_file_replace_text(pag_file* file, int editableTextIndex, pag_text_document* text); - -PAG_API void pag_file_replace_image(pag_file* file, int editableImageIndex, pag_image* image); - -/** - * Return an array of layers by specified editable index and layer type. - * Release them by pag_release. - */ -PAG_API pag_layer** pag_file_get_layers_by_editable_index(pag_file* file, int editableIndex, - pag_layer_type layerType, - size_t* numLayers); - -PAG_API int* pag_file_get_editable_indices(pag_file* file, pag_layer_type layerType, - size_t* numIndexes); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_font.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_font.h deleted file mode 100644 index 82e5714..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_font.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Registers a font required by the text layers in pag files, so that they can be rendered as - * designed. Release it by pag_release. - */ -PAG_API pag_font* pag_font_register_from_path(const char* filePath, int ttcIndex, - const char* fontFamily, const char* fontStyle); -/** - * Registers a font required by the text layers in pag files, so that they can be rendered as - * designed. Release it by pag_release. - */ -PAG_API pag_font* pag_font_register_from_data(const void* data, size_t length, int ttcIndex, - const char* fontFamily, const char* fontStyle); - -PAG_API const char* pag_font_get_family(pag_font* font); - -PAG_API const char* pag_font_get_style(pag_font* font); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_image.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_image.h deleted file mode 100644 index 7362318..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_image.h +++ /dev/null @@ -1,44 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a pag_image object from an array of pixel data, return null if it's not valid pixels. - * Release it by pag_release. - */ -PAG_API pag_image* pag_image_from_pixels(const void* pixels, int width, int height, size_t rowBytes, - pag_color_type colorType, pag_alpha_type alphaType); -/** - * Creates a pag_image object from a hardware buffer. Release it by pag_release. - */ -PAG_API pag_image* pag_image_from_hardware_buffer(void* buffer); - -/** - * Creates a pag_image object from the specified backend texture, return null if the texture is - * invalid. Release it by pag_release. - */ -PAG_API pag_image* pag_image_from_backend_texture(pag_backend_texture* texture); - -PAG_API void pag_image_set_scale_mode(pag_image* image, pag_scale_mode mode); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_image_layer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_image_layer.h deleted file mode 100644 index 8c08889..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_image_layer.h +++ /dev/null @@ -1,28 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API uint8_t* pag_image_layer_get_image_rgba_data(pag_layer* imageLayer, size_t* count, - size_t* width, size_t* height); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_layer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_layer.h deleted file mode 100644 index 577255e..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_layer.h +++ /dev/null @@ -1,37 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API pag_layer_type pag_layer_get_layer_type(pag_layer* layer); - -PAG_API const char* pag_layer_get_layer_name(pag_layer* layer); - -PAG_API int64_t pag_layer_get_duration(pag_layer* layer); - -PAG_API float pag_layer_get_frame_rate(pag_layer* layer); - -PAG_API float pag_layer_get_alpha(pag_layer* layer); - -PAG_API void pag_layer_set_alpha(pag_layer* layer, float alpha); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_player.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_player.h deleted file mode 100644 index 14a7891..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_player.h +++ /dev/null @@ -1,57 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a pag_player object. Release it by pag_release. - */ -PAG_API pag_player* pag_player_create(); - -PAG_API void pag_player_set_composition(pag_player* player, pag_composition* composition); - -PAG_API void pag_player_set_surface(pag_player* player, pag_surface* surface); - -PAG_API bool pag_player_get_cache_enable(pag_player* player); - -PAG_API void pag_player_set_cache_enable(pag_player* player, bool cacheEnable); - -PAG_API double pag_player_get_progress(pag_player* player); - -PAG_API void pag_player_set_progress(pag_player* player, double progress); - -PAG_API bool pag_player_wait(pag_player* player, pag_backend_semaphore* semaphore); - -PAG_API bool pag_player_flush(pag_player* player); - -PAG_API bool pag_player_flush_and_signal_semaphore(pag_player* player, - pag_backend_semaphore* semaphore); - -PAG_API pag_scale_mode pag_player_get_scale_mode(pag_player* player); - -PAG_API void pag_player_set_scale_mode(pag_player* player, pag_scale_mode scaleMode); - -PAG_API int64_t pag_player_get_duration(pag_player* player); - -PAG_API int64_t pag_player_get_graphics_memory(pag_player* player); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_solid_layer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_solid_layer.h deleted file mode 100644 index 5ea36ee..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_solid_layer.h +++ /dev/null @@ -1,29 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API pag_color pag_solid_layer_get_solid_color(pag_solid_layer* layer); - -PAG_API void pag_solid_layer_set_solid_color(pag_solid_layer* layer, pag_color color); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_surface.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_surface.h deleted file mode 100644 index 6ec82c9..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_surface.h +++ /dev/null @@ -1,34 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_surface for off-screen rendering with the specified size. - * Release it by pag_release. - */ -PAG_API pag_surface* pag_surface_make_offscreen(int width, int height); - -PAG_API bool pag_surface_read_pixels(pag_surface* surface, pag_color_type colorType, - pag_alpha_type alphaType, void* dstPixels, size_t dstRowBytes); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_text_document.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_text_document.h deleted file mode 100644 index 71c1e6b..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_text_document.h +++ /dev/null @@ -1,119 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API bool pag_text_document_get_apply_fill(pag_text_document* document); - -PAG_API void pag_text_document_set_apply_fill(pag_text_document* document, bool applyFill); - -PAG_API bool pag_text_document_get_apply_stroke(pag_text_document* document); - -PAG_API void pag_text_document_set_apply_stroke(pag_text_document* document, bool applyStroke); - -PAG_API float pag_text_document_get_baseline_shift(pag_text_document* document); - -PAG_API void pag_text_document_set_baseline_shift(pag_text_document* document, float baselineShift); - -PAG_API bool pag_text_document_get_box_text(pag_text_document* document); - -PAG_API void pag_text_document_set_box_text(pag_text_document* document, bool boxText); - -PAG_API pag_point pag_text_document_get_box_text_pos(pag_text_document* document); - -PAG_API void pag_text_document_set_box_text_pos(pag_text_document* document, pag_point boxTextPos); - -PAG_API pag_point pag_text_document_get_box_text_size(pag_text_document* document); - -PAG_API void pag_text_document_set_box_text_size(pag_text_document* document, - pag_point boxTextSize); - -PAG_API float pag_text_document_get_first_baseline(pag_text_document* document); - -PAG_API void pag_text_document_set_first_baseline(pag_text_document* document, float firstBaseline); - -PAG_API bool pag_text_document_get_faux_bold(pag_text_document* document); - -PAG_API void pag_text_document_set_faux_bold(pag_text_document* document, bool fauxBold); - -PAG_API bool pag_text_document_get_faux_italic(pag_text_document* document); - -PAG_API void pag_text_document_set_faux_italic(pag_text_document* document, bool fauxItalic); - -PAG_API pag_color pag_text_document_get_fill_color(pag_text_document* document); - -PAG_API void pag_text_document_set_fill_color(pag_text_document* document, pag_color fillColor); - -PAG_API const char* pag_text_document_get_font_family(pag_text_document* document); - -PAG_API void pag_text_document_set_font_family(pag_text_document* document, const char* fontFamily); - -PAG_API const char* pag_text_document_get_font_style(pag_text_document* document); - -PAG_API void pag_text_document_set_font_style(pag_text_document* document, const char* fontStyle); - -PAG_API float pag_text_document_get_font_size(pag_text_document* document); - -PAG_API void pag_text_document_set_font_size(pag_text_document* document, float fontSize); - -PAG_API pag_color pag_text_document_get_stroke_color(pag_text_document* document); - -PAG_API void pag_text_document_set_stroke_color(pag_text_document* document, pag_color strokeColor); - -PAG_API bool pag_text_document_get_stroke_over_fill(pag_text_document* document); - -PAG_API void pag_text_document_set_stroke_over_fill(pag_text_document* document, - bool strokeOverFill); - -PAG_API float pag_text_document_get_stroke_width(pag_text_document* document); - -PAG_API void pag_text_document_set_stroke_width(pag_text_document* document, float strokeWidth); - -PAG_API const char* pag_text_document_get_text(pag_text_document* document); - -PAG_API void pag_text_document_set_text(pag_text_document* document, const char* text); - -PAG_API pag_paragraph_justification -pag_text_document_get_justification(pag_text_document* document); - -PAG_API void pag_text_document_set_justification(pag_text_document* document, - pag_paragraph_justification justification); - -PAG_API float pag_text_document_get_leading(pag_text_document* document); - -PAG_API void pag_text_document_set_leading(pag_text_document* document, float leading); - -PAG_API float pag_text_document_get_tracking(pag_text_document* document); - -PAG_API void pag_text_document_set_tracking(pag_text_document* document, float tracking); - -PAG_API pag_color pag_text_document_get_background_color(pag_text_document* document); - -PAG_API void pag_text_document_set_background_color(pag_text_document* document, - pag_color backgroundColor); - -PAG_API uint8_t pag_text_document_get_background_alpha(pag_text_document* document); - -PAG_API void pag_text_document_set_background_alpha(pag_text_document* document, - uint8_t backgroundAlpha); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_types.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_types.h deleted file mode 100644 index 4f2cd10..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/c/pag_types.h +++ /dev/null @@ -1,155 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "stddef.h" -#include "stdint.h" -#include "pag/defines.h" - -#ifdef __cplusplus -#define PAG_C_PLUS_PLUS_BEGIN_GUARD extern "C" { -#define PAG_C_PLUS_PLUS_END_GUARD } -#else -#define PAG_C_PLUS_PLUS_BEGIN_GUARD -#define PAG_C_PLUS_PLUS_END_GUARD -#endif - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -typedef enum { - pag_time_stretch_mode_none, - pag_time_stretch_mode_scale, - pag_time_stretch_mode_repeat, - pag_time_stretch_mode_repeat_inverted, -} pag_time_stretch_mode; - -typedef enum { - pag_color_type_unknown, - pag_color_type_alpha_8, - pag_color_type_rgba_8888, - pag_color_type_bgra_8888, - pag_color_type_rgb_565, - pag_color_type_gray_8, - pag_color_type_rgba_f16, - pag_color_type_rgba_101012, -} pag_color_type; - -typedef enum { - pag_alpha_type_unknown, - pag_alpha_type_opaque, - pag_alpha_type_premultiplied, - pag_alpha_type_unpremultiplied, -} pag_alpha_type; - -typedef enum { - pag_scale_mode_none, - pag_scale_mode_stretch, - pag_scale_mode_letter_box, - pag_scale_mode_zoom, -} pag_scale_mode; - -typedef enum { - pag_layer_type_unknown, - pag_layer_type_null, - pag_layer_type_solid, - pag_layer_type_text, - pag_layer_type_shape, - pag_layer_type_image, - pag_layer_type_pre_compose, - pag_layer_type_camera, -} pag_layer_type; - -typedef struct pag_gl_texture_info { - unsigned id = 0; - unsigned target = 0x0DE1; // GL_TEXTURE_2D; - unsigned format = 0x8058; // GL_RGBA8; -} pag_gl_texture_info; - -typedef struct pag_vk_image_info { - void* image = nullptr; -} pag_vk_image_info; - -typedef struct pag_mtl_texture_info { - void* texture = nullptr; -} pag_mtl_texture_info; - -typedef struct pag_point { - float x; - float y; -} pag_point; - -typedef struct pag_color { - uint8_t red; - uint8_t green; - uint8_t blue; -} pag_color; - -typedef enum { - pag_paragraph_justification_left_justify, - pag_paragraph_justification_center_justify, - pag_paragraph_justification_right_justify, - pag_paragraph_justification_full_justify_last_line_left, - pag_paragraph_justification_full_justify_last_line_right, - pag_paragraph_justification_full_justify_last_line_center, - pag_paragraph_justification_full_justify_last_line_full, -} pag_paragraph_justification; - -typedef struct pag_display_link_functions { - void* (*create)(void* user, void (*callback)(void* user)); - void (*start)(void* displayLink); - void (*stop)(void* displayLink); - void (*release)(void* displayLink); -} pag_display_link_functions; - -typedef struct pag_egl_globals { - void* display = nullptr; -} egl_globals; - -typedef const void* pag_object; -typedef struct pag_byte_data pag_byte_data; -typedef struct pag_text_document pag_text_document; -typedef struct pag_layer pag_layer; -typedef pag_layer pag_solid_layer; -typedef pag_layer pag_composition; -typedef pag_composition pag_file; -typedef struct pag_player pag_player; -typedef struct pag_surface pag_surface; -typedef struct pag_image pag_image; -typedef struct pag_font pag_font; -typedef struct pag_backend_texture pag_backend_texture; -typedef struct pag_backend_semaphore pag_backend_semaphore; -typedef struct pag_decoder PAGDecoder; -typedef struct pag_animator pag_animator; - -typedef struct pag_animator_listener { - void (*on_animation_start)(pag_animator* animator, void* user); - void (*on_animation_end)(pag_animator* animator, void* user); - void (*on_animation_cancel)(pag_animator* animator, void* user); - void (*on_animation_repeat)(pag_animator* animator, void* user); - void (*on_animation_update)(pag_animator* animator, void* user); -} pag_animator_listener; - -/** - * Release a pag_object. - */ -PAG_API void pag_release(pag_object object); - -PAG_API void pag_display_link_set_functions(pag_display_link_functions* functions); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/decoder.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/decoder.h deleted file mode 100644 index 326fd64..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/decoder.h +++ /dev/null @@ -1,132 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include - -namespace pag { -/** - * This structure describes decoded (raw) video data. - */ -struct YUVBuffer { - /** - * The YUV data, each value is a pointer to the picture planes. - */ - uint8_t* data[3]; - /** - * The size in bytes of each picture line. - */ - int lineSize[3]; -}; - -/** - * Codec specific data. For example: SPS (Sequence Parameter Sets) or PPS (Picture Parameter Sets). - */ -struct HeaderData { - /** - * The pointer of codec specific data - */ - uint8_t* data; - /** - * The size in bytes of codec specific data. - */ - size_t length; -}; - -/** - * Possible results of calling SoftwareDecoder's methods. - */ -enum class DecoderResult { - /** - * The calling is successful. - */ - Success = 0, - /** - * Output is not available in this state, need more input buffers. - */ - TryAgainLater = -1, - /** - * The calling fails. - */ - Error = -2 -}; - -/** - * Base class for interacting with software decoder created externally to PAG. - */ -class SoftwareDecoder { - public: - virtual ~SoftwareDecoder() = default; - - /** - * Configure the software decoder. - * @param headers Codec specific data. for example: {0 : sps, 1: pps} - * @param mimeType MIME type. for example: "video/avc" - * @param width video width - * @param height video height - * @return Return true if configure successfully. - */ - virtual bool onConfigure(const std::vector& headers, std::string mimeType, int width, - int height) = 0; - - /** - * Send a sample data of encoded video frame for decoding. - * @param bytes: The sample data for decoding. - * @param length: The size of sample data - * @param timestamp: The timestamp of this sample data. - */ - virtual DecoderResult onSendBytes(void* bytes, size_t length, int64_t timestamp) = 0; - - /** - * Try to decode a new frame from the pending frames sent by onSendBytes(). More input buffers - * need to be sent by onSendBytes() if SoftwareDecodeResult::TryAgainLater was returned. - */ - virtual DecoderResult onDecodeFrame() = 0; - - /** - * Called to notify there is no more sample data available. - */ - virtual DecoderResult onEndOfStream() = 0; - - /** - * Called when seeking happens to clear all pending frames. - */ - virtual void onFlush() = 0; - - /** - * Returns decoded video data to render. - */ - virtual std::unique_ptr onRenderFrame() = 0; -}; - -/** - * The factory of software decoder. - */ -class SoftwareDecoderFactory { - public: - virtual ~SoftwareDecoderFactory() = default; - - /** - * Create a software decoder - */ - virtual std::unique_ptr createSoftwareDecoder() = 0; -}; -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/defines.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/defines.h deleted file mode 100644 index 0b9a01a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/defines.h +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#if !defined(PAG_API) -#if defined(PAG_DLL) -#if defined(_MSC_VER) -#define PAG_API __declspec(dllexport) -#else -#define PAG_API __attribute__((visibility("default"))) -#endif -#else -#define PAG_API -#endif -#endif - -#if !defined(RTTR_AUTO_REGISTER_CLASS) -#define RTTR_AUTO_REGISTER_CLASS -#endif - -#if !defined(RTTR_SKIP_REGISTER_PROPERTY) -#define RTTR_SKIP_REGISTER_PROPERTY -#endif - -#if !defined(RTTR_REGISTER_FUNCTION_AS_PROPERTY) -#define RTTR_REGISTER_FUNCTION_AS_PROPERTY(propertyName, function) -#endif \ No newline at end of file diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/file.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/file.h deleted file mode 100644 index deb412f..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/file.h +++ /dev/null @@ -1,2584 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include "pag/types.h" - -#ifdef PAG_USE_RTTR -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" -#include "rttr/array_range.h" -#include "rttr/constructor.h" -#include "rttr/destructor.h" -#include "rttr/enum_flags.h" -#include "rttr/enumeration.h" -#include "rttr/library.h" -#include "rttr/method.h" -#include "rttr/property.h" -#include "rttr/rttr_cast.h" -#include "rttr/rttr_enable.h" -#include "rttr/type.h" -#pragma clang diagnostic pop -#else - -#define RTTR_ENABLE(...) - -#endif - -namespace pag { -/** - * The maximum number of type is 1023. It only allows to add new tag to the end before - * TagCode::Count. - */ -enum class RTTR_AUTO_REGISTER_CLASS TagCode { - End = 0, - FontTables = 1, - VectorCompositionBlock = 2, - CompositionAttributes = 3, - ImageTables = 4, - LayerBlock = 5, - LayerAttributes = 6, - SolidColor = 7, - TextSource = 8, - TextMoreOption = 10, - ImageReference = 11, - CompositionReference = 12, - Transform2D = 13, - MaskBlock = 14, - ShapeGroup = 15, - Rectangle = 16, - Ellipse = 17, - PolyStar = 18, - ShapePath = 19, - Fill = 20, - Stroke = 21, - GradientFill = 22, - GradientStroke = 23, - MergePaths = 24, - TrimPaths = 25, - Repeater = 26, - RoundCorners = 27, - Performance = 28, - DropShadowStyle = 29, - CachePolicy = 30, - FileAttributes = 31, - TimeStretchMode = 32, - Mp4Header = 33, - - // 34 ~ 44 are preserved - - BitmapCompositionBlock = 45, - BitmapSequence = 46, - ImageBytes = 47, - ImageBytesV2 = 48, // with scaleFactor - ImageBytesV3 = 49, // width transparent border stripped. - - VideoCompositionBlock = 50, - VideoSequence = 51, - - LayerAttributesV2 = 52, - MarkerList = 53, - ImageFillRule = 54, - AudioBytes = 55, - MotionTileEffect = 56, - LevelsIndividualEffect = 57, - CornerPinEffect = 58, - BulgeEffect = 59, - FastBlurEffect = 60, - GlowEffect = 61, - - LayerAttributesV3 = 62, - LayerAttributesExtra = 63, - - TextSourceV2 = 64, - - DropShadowStyleV2 = 65, - DisplacementMapEffect = 66, - ImageFillRuleV2 = 67, - - TextSourceV3 = 68, - TextPathOption = 69, - - TextAnimator = 70, - TextRangeSelector = 71, - TextAnimatorPropertiesTrackingType = 72, - TextAnimatorPropertiesTrackingAmount = 73, - TextAnimatorPropertiesFillColor = 74, - TextAnimatorPropertiesStrokeColor = 75, - TextAnimatorPropertiesPosition = 76, - TextAnimatorPropertiesScale = 77, - TextAnimatorPropertiesRotation = 78, - TextAnimatorPropertiesOpacity = 79, - TextWigglySelector = 80, - - RadialBlurEffect = 81, - MosaicEffect = 82, - EditableIndices = 83, - MaskBlockV2 = 84, - GradientOverlayStyle = 85, - BrightnessContrastEffect = 86, - HueSaturationEffect = 87, - - LayerAttributesExtraV2 = 88, // add PreserveAlpha - EncryptedData = 89, - Transform3D = 90, - CameraOption = 91, - - StrokeStyle = 92, - OuterGlowStyle = 93, - ImageScaleModes = 94, - - // add new tags here... - - Count -}; - -struct RTTR_AUTO_REGISTER_CLASS Ratio { - float value() const { - return static_cast(numerator) / denominator; - } - - int32_t numerator; - uint32_t denominator; -}; - -inline bool operator==(const Ratio& left, const Ratio& right) { - return left.numerator == right.numerator && - (left.numerator == 0 || left.denominator == right.denominator); -} - -inline bool operator!=(const Ratio& left, const Ratio& right) { - return !(left == right); -} - -static constexpr Ratio DefaultRatio = {1, 1}; - -enum class RTTR_AUTO_REGISTER_CLASS PathDataVerb { MoveTo, LineTo, CurveTo, Close }; - -/** - * The Path object encapsulates information describing a path in a shape layer, or the outline path - * of a Mask. - */ -class PAG_API PathData { - public: - std::vector verbs; - std::vector points; - void moveTo(float x, float y); - void lineTo(float x, float y); - void cubicTo(float controlX1, float controlY1, float controlX2, float controlY2, float x, - float y); - /** - * If the last point does not equal with the last moveTo point, add a lineTo verb and then close - * the path. - */ - void close(); - bool isClosed() const; - void reverse(); - void clear(); - void interpolate(const PathData& path, PathData* result, float t); - - private: - Point lastMoveTo = {}; -}; - -typedef std::shared_ptr PathHandle; - -enum class PAG_API KeyframeInterpolationType : uint8_t { - None = 0, - Linear = 1, - Bezier = 2, - Hold = 3 -}; - -template -class RTTR_AUTO_REGISTER_CLASS Keyframe { - public: - virtual ~Keyframe() = default; - - virtual void initialize() { - } - - virtual T getValueAt(Frame) { - return startValue; - } - - bool containsTime(Frame time) const { - return time >= startTime && time < endTime; - } - - T startValue; - T endValue; - Frame startTime = ZeroFrame; - Frame endTime = ZeroFrame; - KeyframeInterpolationType interpolationType = KeyframeInterpolationType::Hold; - std::vector bezierOut; - std::vector bezierIn; - Point3D spatialOut = Point3D::Zero(); - Point3D spatialIn = Point3D::Zero(); -}; - -/** - * The Property object contains value information about a particular AE property of a layer. - */ -template -class RTTR_AUTO_REGISTER_CLASS Property { - public: - T value; - Property() = default; - - explicit Property(const T& value) : value(value) { - } - - virtual ~Property() = default; - - virtual bool animatable() const { - return false; - } - - virtual T getValueAt(Frame) { - return value; - } - - virtual void excludeVaryingRanges(std::vector*) const { - } - - RTTR_ENABLE() -}; - -Frame PAG_API ConvertFrameByStaticTimeRanges(const std::vector& timeRanges, Frame frame); -void PAG_API SubtractFromTimeRanges(std::vector* timeRanges, Frame startTime, - Frame endTime); -void PAG_API SplitTimeRangesAt(std::vector* timeRanges, Frame startTime); -void PAG_API MergeTimeRanges(std::vector* timeRanges, - const std::vector* otherRanges); -std::vector PAG_API OffsetTimeRanges(const std::vector& timeRanges, - Frame offsetTime); -bool PAG_API HasVaryingTimeRange(const std::vector* staticTimeRanges, Frame startTime, - Frame duration); -TimeRange PAG_API GetTimeRangeContains(const std::vector& timeRanges, Frame frame); - -template -class RTTR_AUTO_REGISTER_CLASS AnimatableProperty : public Property { - public: - explicit AnimatableProperty(const std::vector*>& keyframes) - : keyframes(keyframes), lastKeyframeIndex(0) { - this->value = keyframes[0]->startValue; - for (Keyframe* keyframe : keyframes) { - keyframe->initialize(); - } - } - - ~AnimatableProperty() override { - for (auto& keyframe : keyframes) { - delete keyframe; - } - } - - bool animatable() const override { - return true; - } - - void excludeVaryingRanges(std::vector* timeRanges) const override { - for (Keyframe* keyframe : keyframes) { - switch (keyframe->interpolationType) { - case KeyframeInterpolationType::Bezier: - case KeyframeInterpolationType::Linear: - SubtractFromTimeRanges(timeRanges, keyframe->startTime, keyframe->endTime - 1); - break; - default: - SplitTimeRangesAt(timeRanges, keyframe->startTime); - SplitTimeRangesAt(timeRanges, keyframe->endTime); - break; - } - } - } - - T getValueAt(Frame frame) override { - T result; - size_t lastKeyframeIndexInternal = lastKeyframeIndex; - Keyframe* lastKeyframe = keyframes[lastKeyframeIndexInternal]; - if (lastKeyframe->containsTime(frame)) { - return lastKeyframe->getValueAt(frame); - } - if (frame < lastKeyframe->startTime) { - while (lastKeyframeIndexInternal > 0) { - lastKeyframeIndexInternal--; - if (keyframes[lastKeyframeIndexInternal]->containsTime(frame)) { - break; - } - } - } else { - while (lastKeyframeIndexInternal < keyframes.size() - 1) { - lastKeyframeIndexInternal++; - if (keyframes[lastKeyframeIndexInternal]->containsTime(frame)) { - break; - } - } - } - lastKeyframe = keyframes[lastKeyframeIndexInternal]; - if (frame <= lastKeyframe->startTime) { - result = lastKeyframe->startValue; - } else if (frame >= lastKeyframe->endTime) { - result = lastKeyframe->endValue; - } else { - result = lastKeyframe->getValueAt(frame); - } - lastKeyframeIndex = lastKeyframeIndexInternal; - return result; - } - - /** - * The keyframe list in this property. - */ - std::vector*> keyframes; - - private: - std::atomic_size_t lastKeyframeIndex; - - RTTR_ENABLE(Property) -}; - -class PAG_API Transform2D { - public: - static std::unique_ptr MakeDefault(); - ~Transform2D(); - - Property* anchorPoint = nullptr; // spatial - Property* position = nullptr; // spatial - Property* xPosition = nullptr; - Property* yPosition = nullptr; - Property* scale = nullptr; // multidimensional - Property* rotation = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class PAG_API Transform3D { - public: - ~Transform3D(); - - Property* anchorPoint = nullptr; // spatial - Property* position = nullptr; // spatial - Property* xPosition = nullptr; - Property* yPosition = nullptr; - Property* zPosition = nullptr; - Property* scale = nullptr; // multidimensional - Property* orientation = nullptr; - Property* xRotation = nullptr; - Property* yRotation = nullptr; - Property* zRotation = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class PAG_API MaskMode : uint8_t { - None = 0, // mask shape does nothing - Add = 1, // shape is added into mask (normal behavior (really screen!)) - Subtract = 2, - Intersect = 3, - Lighten = 4, - Darken = 5, - Difference = 6, - Accum = 7 // real add, not screen (not exposed in UI!) -}; - -class PAG_API MaskData { - public: - ~MaskData(); - - ID id = ZeroID; - bool inverted = false; - MaskMode maskMode = MaskMode::Add; - Property* maskPath = nullptr; - Property* maskFeather = nullptr; - Property* maskOpacity = nullptr; - Property* maskExpansion = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class RTTR_AUTO_REGISTER_CLASS EffectType { - Unknown, - Fill, - MotionTile, - LevelsIndividual, - CornerPin, - Bulge, - FastBlur, - Glow, - DisplacementMap, - RadialBlur, - Mosaic, - BrightnessContrast, - HueSaturation, -}; - -class PAG_API Effect { - public: - Effect(); - - virtual ~Effect(); - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - - virtual EffectType type() const { - return EffectType::Unknown; - } - - /** - * Indicate whether this effect process only the visible area of the input texture. - */ - virtual bool processVisibleAreaOnly() const { - return false; - } - - /** - * Check whether or not this effect is visible at the specified frame. - */ - virtual bool visibleAt(Frame) const { - return false; - } - - /** - * Calculate the bounds after this effect being applied. - */ - virtual void transformBounds(Rect*, const Point&, Frame) const { - } - - virtual Point getMaxScaleFactor(const Rect&) const { - return Point::Make(1.f, 1.f); - } - - virtual void excludeVaryingRanges(std::vector* timeRanges) const; - - virtual bool verify() const; - - Property* effectOpacity = nullptr; - std::vector maskReferences; // mask reference - - RTTR_ENABLE() -}; - -class PAG_API MotionTileEffect : public Effect { - public: - ~MotionTileEffect() override; - - EffectType type() const override { - return EffectType::MotionTile; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* tileCenter = nullptr; // spatial - Property* tileWidth = nullptr; - Property* tileHeight = nullptr; - Property* outputWidth = nullptr; - Property* outputHeight = nullptr; - Property* mirrorEdges = nullptr; - Property* phase = nullptr; - Property* horizontalPhaseShift = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API LevelsIndividualEffect : public Effect { - public: - ~LevelsIndividualEffect() override; - - EffectType type() const override { - return EffectType::LevelsIndividual; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - // RGB - Property* inputBlack = nullptr; - Property* inputWhite = nullptr; - Property* gamma = nullptr; - Property* outputBlack = nullptr; - Property* outputWhite = nullptr; - - // Red - Property* redInputBlack = nullptr; - Property* redInputWhite = nullptr; - Property* redGamma = nullptr; - Property* redOutputBlack = nullptr; - Property* redOutputWhite = nullptr; - - // green - Property* greenInputBlack = nullptr; - Property* greenInputWhite = nullptr; - Property* greenGamma = nullptr; - Property* greenOutputBlack = nullptr; - Property* greenOutputWhite = nullptr; - - // blue - Property* blueInputBlack = nullptr; - Property* blueInputWhite = nullptr; - Property* blueGamma = nullptr; - Property* blueOutputBlack = nullptr; - Property* blueOutputWhite = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API CornerPinEffect : public Effect { - public: - ~CornerPinEffect() override; - - EffectType type() const override { - return EffectType::CornerPin; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - Point getMaxScaleFactor(const Rect& bounds) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* upperLeft = nullptr; // spatial - Property* upperRight = nullptr; // spatial - Property* lowerLeft = nullptr; // spatial - Property* lowerRight = nullptr; // spatial - - RTTR_ENABLE(Effect) -}; - -class PAG_API BulgeEffect : public Effect { - public: - ~BulgeEffect() override; - - EffectType type() const override { - return EffectType::Bulge; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* horizontalRadius = nullptr; - Property* verticalRadius = nullptr; - Property* bulgeCenter = nullptr; // spatial - Property* bulgeHeight = nullptr; - Property* taperRadius = nullptr; - Property* pinning = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class PAG_API BlurDimensionsDirection : uint8_t { - All = 0, - Horizontal = 1, - Vertical = 2 -}; - -class PAG_API FastBlurEffect : public Effect { - public: - ~FastBlurEffect() override; - - EffectType type() const override { - return EffectType::FastBlur; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blurriness = nullptr; - Property* blurDimensions = nullptr; - Property* repeatEdgePixels = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API GlowEffect : public Effect { - public: - ~GlowEffect() override; - - EffectType type() const override { - return EffectType::Glow; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* glowThreshold = nullptr; - Property* glowRadius = nullptr; - Property* glowIntensity = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class PAG_API DisplacementMapSource : uint8_t { - Red = 0, - Green = 1, - Blue = 2, - Alpha = 3, - Luminance = 4, - Hue = 5, - Lightness = 6, - Saturation = 7, - Full = 8, - Half = 9, - Off = 10 -}; - -enum class RTTR_AUTO_REGISTER_CLASS DisplacementMapBehavior : uint8_t { - CenterMap = 0, - StretchMapToFit = 1, - TileMap = 2 -}; - -class Layer; - -class PAG_API DisplacementMapEffect : public Effect { - public: - ~DisplacementMapEffect() override; - - EffectType type() const override { - return EffectType::DisplacementMap; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Layer* RTTR_SKIP_REGISTER_PROPERTY displacementMapLayer = nullptr; // ref layer - Property* useForHorizontalDisplacement = nullptr; - Property* maxHorizontalDisplacement = nullptr; - Property* useForVerticalDisplacement = nullptr; - Property* maxVerticalDisplacement = nullptr; - Property* displacementMapBehavior = nullptr; - Property* edgeBehavior = nullptr; - Property* expandOutput = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class PAG_API RadialBlurMode : uint8_t { - Spin = 0, - Zoom = 1 -}; - -enum class PAG_API RadialBlurAntialias : uint8_t { - Low = 0, - High = 1 -}; - -class PAG_API RadialBlurEffect : public Effect { - public: - ~RadialBlurEffect() override; - - EffectType type() const override { - return EffectType::RadialBlur; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* amount = nullptr; - Property* center = nullptr; // spatial - Property* mode = nullptr; - Property* antialias = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API MosaicEffect : public Effect { - public: - ~MosaicEffect() override; - - EffectType type() const override { - return EffectType::Mosaic; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* horizontalBlocks = nullptr; - Property* verticalBlocks = nullptr; // spatial - Property* sharpColors = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API BrightnessContrastEffect : public Effect { - public: - ~BrightnessContrastEffect() override; - - EffectType type() const override { - return EffectType::BrightnessContrast; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* brightness = nullptr; - Property* contrast = nullptr; - Property* useOldVersion = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class PAG_API ChannelControlType : uint8_t { - Master = 0, - Reds = 1, - Yellows = 2, - Greens = 3, - Cyans = 4, - Blues = 5, - Magentas = 6, - Count = 7 -}; - -class PAG_API HueSaturationEffect : public Effect { - public: - ~HueSaturationEffect() override; - - EffectType type() const override { - return EffectType::HueSaturation; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - ChannelControlType channelControl = ChannelControlType::Master; - std::vector hue = std::vector(static_cast(ChannelControlType::Count), 0.0f); - std::vector saturation = std::vector(static_cast(ChannelControlType::Count), 0.0f); - std::vector lightness = std::vector(static_cast(ChannelControlType::Count), 0.0f); - bool colorize = false; - Property* colorizeHue = nullptr; - Property* colorizeSaturation = nullptr; - Property* colorizeLightness = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class RTTR_AUTO_REGISTER_CLASS LayerStyleType { Unknown, DropShadow, Stroke, GradientOverlay, OuterGlow }; - -enum class RTTR_AUTO_REGISTER_CLASS LayerStylePosition { Above, Blow }; - -class PAG_API LayerStyle { - public: - LayerStyle(); - - virtual ~LayerStyle() = default; - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - - virtual LayerStyleType type() const { - return LayerStyleType::Unknown; - } - - virtual LayerStylePosition drawPosition() const { - return LayerStylePosition::Blow; - } - - /** - * Check whether or not this layer style is visible at the specified frame. - */ - virtual bool visibleAt(Frame) const { - return false; - } - - /** - * Calculate the bounds after this layerStyle being applied. - */ - virtual void transformBounds(Rect*, const Point&, Frame) const { - } - - virtual void excludeVaryingRanges(std::vector*) const { - } - - virtual bool verify() const { - return true; - } - - RTTR_ENABLE() -}; - -enum class PAG_API StrokePosition : uint8_t { - Outside = 0, - Inside = 1, - Center = 2, - Invalid = 255 -}; - -enum class PAG_API GlowColorType : uint8_t { - SingleColor = 0, - Gradient = 1 -}; - -enum class PAG_API GlowTechniqueType : uint8_t { - Softer = 0, - Precise = 1 -}; - -enum class PAG_API LineCap : uint8_t { - Butt = 0, - Round = 1, - Square = 2 -}; - -enum class PAG_API LineJoin : uint8_t { - Miter = 0, - Round = 1, - Bevel = 2 -}; - -enum class PAG_API FillRule : uint8_t { - NonZeroWinding = 0, - EvenOdd = 1 -}; - -enum class PAG_API GradientFillType : uint8_t { - Linear = 0, - Radial = 1, - Angle = 2, - Reflected = 3, - Diamond = 4 // not supported yet -}; - -class PAG_API DropShadowStyle : public LayerStyle { - public: - ~DropShadowStyle() override; - - LayerStyleType type() const override { - return LayerStyleType::DropShadow; - } - - LayerStylePosition drawPosition() const override { - return LayerStylePosition::Blow; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blendMode = nullptr; - Property* color = nullptr; - Property* opacity = nullptr; - Property* angle = nullptr; - Property* distance = nullptr; - Property* size = nullptr; - Property* spread = nullptr; - - RTTR_ENABLE(LayerStyle) -}; - -class PAG_API StrokeStyle : public LayerStyle { - public: - ~StrokeStyle() override; - - LayerStyleType type() const override { - return LayerStyleType::Stroke; - } - - LayerStylePosition drawPosition() const override { - return LayerStylePosition::Above; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blendMode = nullptr; - Property* color = nullptr; - Property* size = nullptr; - Property* opacity = nullptr; - Property* position = nullptr; - - RTTR_ENABLE(LayerStyle) -}; - -struct AlphaStop { - float position = 0.0f; - float midpoint = 0.5f; - Opacity opacity = Opaque; -}; - -struct ColorStop { - float position = 0.0f; - float midpoint = 0.5f; - Color color = Black; -}; - -class PAG_API GradientColor { - public: - std::vector alphaStops; - std::vector colorStops; - - void interpolate(const GradientColor& other, GradientColor* result, float t); -}; - -typedef std::shared_ptr GradientColorHandle; - -class PAG_API GradientOverlayStyle : public LayerStyle { - public: - ~GradientOverlayStyle() override; - - LayerStyleType type() const override { - return LayerStyleType::GradientOverlay; - } - - LayerStylePosition drawPosition() const override { - return LayerStylePosition::Above; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blendMode = nullptr; - Property* opacity = nullptr; - Property* colors = nullptr; - Property* gradientSmoothness = nullptr; - Property* angle = nullptr; - Property* style = nullptr; - Property* reverse = nullptr; - Property* alignWithLayer = nullptr; - Property* scale = nullptr; - Property* offset = nullptr; - - RTTR_ENABLE(LayerStyle) -}; - -class PAG_API OuterGlowStyle : public LayerStyle { - public: - ~OuterGlowStyle() override; - - LayerStyleType type() const override { - return LayerStyleType::OuterGlow; - } - - LayerStylePosition drawPosition() const override { - return LayerStylePosition::Blow; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blendMode = nullptr; - Property* opacity = nullptr; - Property* noise = nullptr; - Property* colorType = nullptr; - Property* color = nullptr; - Property* colors = nullptr; - Property* gradientSmoothness = nullptr; - Property* technique = nullptr; - Property* spread = nullptr; - Property* size = nullptr; - Property* range = nullptr; - Property* jitter = nullptr; - - RTTR_ENABLE(LayerStyle) -}; - -class PAG_API TextPathOptions { - public: - ~TextPathOptions(); - - MaskData* path = nullptr; // mask reference - Property* reversedPath = nullptr; - Property* perpendicularToPath = nullptr; - Property* forceAlignment = nullptr; - Property* firstMargin = nullptr; - Property* lastMargin = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class PAG_API AnchorPointGrouping : uint8_t{ - Character = 0, - Word = 1, - Line = 2, - All = 3 -}; - -class PAG_API TextMoreOptions { - public: - ~TextMoreOptions(); - - AnchorPointGrouping anchorPointGrouping = AnchorPointGrouping::Character; - Property* groupingAlignment = nullptr; // multidimensional Percent - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class PAG_API TextRangeSelectorUnits : uint8_t { - Percentage = 0, - Index = 1 -}; - -enum class PAG_API TextSelectorBasedOn : uint8_t { - Characters = 0, - CharactersExcludingSpaces = 1, - Words = 2, - Lines = 3 -}; - -enum class PAG_API TextSelectorMode : uint8_t { - None = 0, - Add = 1, - Subtract = 2, - Intersect = 3, - Min = 4, - Max = 5, - Difference = 6 -}; - -enum class PAG_API TextRangeSelectorShape : uint8_t { - Square = 0, - RampUp = 1, - RampDown = 2, - Triangle = 3, - Round = 4, - Smooth = 5 -}; - -enum class PAG_API TextAnimatorTrackingType : uint8_t { - BeforeAndAfter = 0, - Before = 1, - After = 2 -}; - -enum class PAG_API TextSelectorType : uint8_t { - Range = 0, - Wiggly = 1, - Expression = 2 -}; - -class PAG_API TextSelector { - public: - virtual ~TextSelector() { - } - - virtual uint8_t type() const = 0; - - virtual void excludeVaryingRanges(std::vector*) const = 0; - - virtual bool verify() const = 0; -}; - -class PAG_API TextRangeSelector : public TextSelector { - public: - ~TextRangeSelector(); - - uint8_t type() const override { - return static_cast(TextSelectorType::Range); - }; - - Property* start = nullptr; - Property* end = nullptr; - Property* offset = nullptr; - TextRangeSelectorUnits units = TextRangeSelectorUnits::Percentage; - TextSelectorBasedOn basedOn = TextSelectorBasedOn::Characters; - Property* mode = nullptr; - Property* amount = nullptr; - TextRangeSelectorShape shape = TextRangeSelectorShape::Square; - Property* smoothness = nullptr; - Property* easeHigh = nullptr; - Property* easeLow = nullptr; - bool randomizeOrder = false; - Property* randomSeed = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; -}; - -class PAG_API TextWigglySelector : public TextSelector { - public: - ~TextWigglySelector(); - - uint8_t type() const override { - return static_cast(TextSelectorType::Wiggly); - } - - Property* mode = nullptr; - Property* maxAmount = nullptr; - Property* minAmount = nullptr; - TextSelectorBasedOn basedOn = TextSelectorBasedOn::Characters; - Property* wigglesPerSecond = nullptr; - Property* correlation = nullptr; - Property* temporalPhase = nullptr; - Property* spatialPhase = nullptr; - Property* lockDimensions = nullptr; - Property* randomSeed = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; -}; - -class PAG_API TextAnimatorColorProperties { - public: - ~TextAnimatorColorProperties(); - - Property* fillColor = nullptr; - Property* strokeColor = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class PAG_API TextAnimatorTypographyProperties { - public: - ~TextAnimatorTypographyProperties(); - - Property* trackingType = nullptr; - Property* trackingAmount = nullptr; - Property* position = nullptr; // spatial - Property* scale = nullptr; // multidimensional - Property* rotation = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class PAG_API TextAnimator { - public: - ~TextAnimator(); - - // Text Animator selectors - std::vector selectors; - - // Text Animator Properties - TextAnimatorColorProperties* colorProperties = nullptr; - TextAnimatorTypographyProperties* typographyProperties = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class PAG_API ShapeTransform { - public: - ~ShapeTransform(); - - Property* anchorPoint = nullptr; // spatial - Property* position = nullptr; // spatial - Property* scale = nullptr; // multidimensional - Property* skew = nullptr; - Property* skewAxis = nullptr; - Property* rotation = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class RTTR_AUTO_REGISTER_CLASS ShapeType { - Unknown, - ShapeGroup, - Rectangle, - Ellipse, - PolyStar, - ShapePath, - Fill, - Stroke, - GradientFill, - GradientStroke, - MergePaths, - TrimPaths, - Repeater, - RoundCorners -}; - -class PAG_API ShapeElement { - public: - virtual ~ShapeElement() = default; - - virtual ShapeType type() const { - return ShapeType::Unknown; - } - - virtual void excludeVaryingRanges(std::vector*) const { - } - - virtual bool verify() const { - return true; - } - - RTTR_ENABLE() -}; - -class PAG_API ShapeGroupElement : public ShapeElement { - public: - ~ShapeGroupElement() override; - - ShapeType type() const override { - return ShapeType::ShapeGroup; - } - - BlendMode blendMode = BlendMode::Normal; - ShapeTransform* transform = nullptr; - std::vector elements; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API RectangleElement : public ShapeElement { - public: - ~RectangleElement() override; - - ShapeType type() const override { - return ShapeType::Rectangle; - } - - bool reversed = false; - Property* size = nullptr; // multidimensional - Property* position = nullptr; // spatial - Property* roundness = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API EllipseElement : public ShapeElement { - public: - ~EllipseElement() override; - - ShapeType type() const override { - return ShapeType::Ellipse; - } - - bool reversed = false; - Property* size = nullptr; // multidimensional - Property* position = nullptr; // spatial - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API PolyStarType : uint8_t { - Star = 0, - Polygon = 1 -}; - -class PAG_API PolyStarElement : public ShapeElement { - public: - ~PolyStarElement() override; - - ShapeType type() const override { - return ShapeType::PolyStar; - } - - bool reversed = false; - PolyStarType polyType = PolyStarType::Star; - Property* points = nullptr; - Property* position = nullptr; // spatial - Property* rotation = nullptr; - Property* innerRadius = nullptr; - Property* outerRadius = nullptr; - Property* innerRoundness = nullptr; - Property* outerRoundness = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API ShapePathElement : public ShapeElement { - public: - ~ShapePathElement() override; - - ShapeType type() const override { - return ShapeType::ShapePath; - } - - Property* shapePath = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API CompositeOrder : uint8_t { - BelowPreviousInSameGroup = 0, - AbovePreviousInSameGroup = 1 -}; - -class PAG_API FillElement : public ShapeElement { - public: - ~FillElement() override; - - ShapeType type() const override { - return ShapeType::Fill; - } - - BlendMode blendMode = BlendMode::Normal; - CompositeOrder composite = CompositeOrder::BelowPreviousInSameGroup; - FillRule fillRule = FillRule::NonZeroWinding; - Property* color = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API StrokeElement : public ShapeElement { - public: - ~StrokeElement() override; - - ShapeType type() const override { - return ShapeType::Stroke; - } - - BlendMode blendMode = BlendMode::Normal; - CompositeOrder composite = CompositeOrder::BelowPreviousInSameGroup; - Property* color = nullptr; - Property* opacity = nullptr; - Property* strokeWidth = nullptr; - LineCap lineCap = LineCap::Butt; - LineJoin lineJoin = LineJoin::Miter; - Property* miterLimit = nullptr; - Property* dashOffset = nullptr; - std::vector*> dashes; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API GradientFillElement : public ShapeElement { - public: - ~GradientFillElement() override; - - ShapeType type() const override { - return ShapeType::GradientFill; - } - - BlendMode blendMode = BlendMode::Normal; - CompositeOrder composite = CompositeOrder::BelowPreviousInSameGroup; - FillRule fillRule = FillRule::NonZeroWinding; - GradientFillType fillType = GradientFillType::Linear; - Property* opacity = nullptr; - Property* startPoint = nullptr; // spatial - Property* endPoint = nullptr; // spatial - Property* colors = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API GradientStrokeElement : public ShapeElement { - public: - ~GradientStrokeElement() override; - - ShapeType type() const override { - return ShapeType::GradientStroke; - } - - BlendMode blendMode = BlendMode::Normal; - CompositeOrder composite = CompositeOrder::BelowPreviousInSameGroup; - GradientFillType fillType = GradientFillType::Linear; - LineCap lineCap = LineCap::Butt; - LineJoin lineJoin = LineJoin::Miter; - Property* miterLimit = nullptr; - Property* startPoint = nullptr; // spatial - Property* endPoint = nullptr; // spatial - Property* colors = nullptr; - Property* opacity = nullptr; - Property* strokeWidth = nullptr; - Property* dashOffset = nullptr; - std::vector*> dashes; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API MergePathsMode : uint8_t { - Merge = 0, - Add = 1, - Subtract = 2, - Intersect = 3, - ExcludeIntersections = 4 -}; - -class PAG_API MergePathsElement : public ShapeElement { - public: - ShapeType type() const override { - return ShapeType::MergePaths; - } - - MergePathsMode mode = MergePathsMode::Add; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API TrimPathsType : uint8_t { - Simultaneously = 0, - Individually = 1 -}; - -class PAG_API TrimPathsElement : public ShapeElement { - public: - ~TrimPathsElement() override; - - ShapeType type() const override { - return ShapeType::TrimPaths; - } - - Property* start = nullptr; - Property* end = nullptr; - Property* offset = nullptr; - TrimPathsType trimType = TrimPathsType::Simultaneously; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API RepeaterTransform { - public: - ~RepeaterTransform(); - - Property* anchorPoint = nullptr; // spatial - Property* position = nullptr; // spatial - Property* scale = nullptr; // multidimensional - Property* rotation = nullptr; - Property* startOpacity = nullptr; - Property* endOpacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class PAG_API RepeaterOrder : uint8_t { - Below = 0, - Above = 1 -}; - -class PAG_API RepeaterElement : public ShapeElement { - public: - ~RepeaterElement() override; - - ShapeType type() const override { - return ShapeType::Repeater; - } - - Property* copies = nullptr; - Property* offset = nullptr; - RepeaterOrder composite = RepeaterOrder::Below; - RepeaterTransform* transform = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API RoundCornersElement : public ShapeElement { - public: - ~RoundCornersElement() override; - - ShapeType type() const override { - return ShapeType::RoundCorners; - } - - Property* radius = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API IrisShapeType : uint8_t { - FastRectangle = 0, - Triangle = 1, - Square = 2, - Pentagon = 3, - Hexagon = 4, - Heptagon = 5, - Octagon = 6, - Nonagon = 7, - Decagon = 8 -}; - -class PAG_API CameraOption { - public: - ~CameraOption(); - - Property* zoom = nullptr; - Property* depthOfField = nullptr; - Property* focusDistance = nullptr; - Property* aperture = nullptr; - Property* blurLevel = nullptr; - Property* irisShape = nullptr; - Property* irisRotation = nullptr; - Property* irisRoundness = nullptr; - Property* irisAspectRatio = nullptr; - Property* irisDiffractionFringe = nullptr; - Property* highlightGain = nullptr; - Property* highlightThreshold = nullptr; - Property* highlightSaturation = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class Composition; - -class VectorComposition; - -class BitmapComposition; - -class ImageBytes; - -class PAG_API Cache { - public: - virtual ~Cache() = default; -}; - -enum class PAG_API TrackMatteType : uint8_t { - None = 0, - Alpha = 1, - AlphaInverted = 2, - Luma = 3, - LumaInverted = 4 -}; - -enum class PAG_API CachePolicy : uint8_t { - Auto = 0, - Enable = 1, - Disable = 2 -}; - -/** - * The Layer object provides access to layers within compositions. - */ -class PAG_API Layer { - public: - Layer(); - - virtual ~Layer(); - - /** - * The type of the layer. - */ - virtual LayerType type() const { - return LayerType::Unknown; - } - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - - /** - * The id of this layer. - */ - ID id = 0; - /** - * The parent of this layer. - */ - Layer* RTTR_SKIP_REGISTER_PROPERTY parent = nullptr; // layer reference - - VectorComposition* RTTR_SKIP_REGISTER_PROPERTY containingComposition = nullptr; // composition reference - - /** - * The name of the layer. - */ - std::string name = ""; - /** - * The time stretch percentage of the layer. - */ - Ratio stretch = DefaultRatio; - /** - * The start time of the layer, indicates the start position of the visible range. It could be a - * negative value. - */ - Frame startTime = ZeroFrame; - /** - * The duration of the layer, indicates the length of the visible range. - */ - Frame duration = ZeroFrame; - /** - * When true, the layer' automatic orientation is enabled. - */ - bool autoOrientation = false; - /** - * When true, the layer' motion blur is enabled. - */ - bool motionBlur = false; - /** - * The 2D transformation of the layer. - */ - Transform2D* transform = nullptr; - /** - * The 3D transformation of the layer. - */ - Transform3D* transform3D = nullptr; - /** - * When false, the layer should be skipped during the rendering loop. - */ - bool isActive = true; - /** - * The blending mode of the layer. - */ - BlendMode blendMode = BlendMode::Normal; - /** - * If layer has a track matte, specifies the way it is applied. - */ - TrackMatteType trackMatteType = TrackMatteType::None; - Layer* trackMatteLayer = nullptr; - Property* timeRemap = nullptr; - std::vector masks; - std::vector effects; - std::vector layerStyles; - std::vector markers; - CachePolicy cachePolicy = CachePolicy::Auto; - - Cache* RTTR_SKIP_REGISTER_PROPERTY cache = nullptr; - std::mutex locker = {}; - - virtual void excludeVaryingRanges(std::vector* timeRanges); - virtual bool verify() const; - Point getMaxScaleFactor(); - std::pair getScaleFactor(); - TimeRange visibleRange(); - virtual Rect getBounds() const; - - private: - bool verifyExtra() const; - - RTTR_ENABLE() -}; - -class PAG_API NullLayer : public Layer { - public: - /** - * The type of the layer. - */ - LayerType type() const override { - return LayerType::Null; - }; - - RTTR_ENABLE(Layer) -}; - -class PAG_API SolidLayer : public Layer { - public: - LayerType type() const override { - return LayerType::Solid; - }; - /** - * The background color of the solid layer. - */ - Color solidColor = Black; - /** - * The width of the SolidLayer. - */ - int32_t width = 0; - /** - * The height of the SolidLayer. - */ - int32_t height = 0; - - bool verify() const override; - - Rect getBounds() const override; - - RTTR_ENABLE(Layer) -}; - -class PAG_API TextLayer : public Layer { - public: - ~TextLayer() override; - - LayerType type() const override { - return LayerType::Text; - }; - - Property* sourceText = nullptr; - TextPathOptions* pathOption = nullptr; - TextMoreOptions* moreOption = nullptr; - std::vector animators; - - void excludeVaryingRanges(std::vector* timeRanges) override; - bool verify() const override; - - Rect getBounds() const override; - - std::shared_ptr getTextDocument(); - - RTTR_ENABLE(Layer) -}; - -class PAG_API ShapeLayer : public Layer { - public: - ~ShapeLayer() override; - - LayerType type() const override { - return LayerType::Shape; - }; - - std::vector contents; - - void excludeVaryingRanges(std::vector* timeRanges) override; - bool verify() const override; - - Rect getBounds() const override; - - RTTR_ENABLE(Layer) -}; - -class PAG_API ImageFillRule { - public: - ~ImageFillRule(); - - PAGScaleMode scaleMode = PAGScaleMode::LetterBox; - - // timeRemap基于composition时间轴 - Property* timeRemap = nullptr; -}; - -class PAG_API ImageLayer : public Layer { - public: - ~ImageLayer() override; - - LayerType type() const override { - return LayerType::Image; - }; - - // it is owned by the PAG file, there is no need to delete it. - ImageBytes* imageBytes = nullptr; - - ImageFillRule* imageFillRule = nullptr; - - bool verify() const override; - - Rect getBounds() const override; - - RTTR_ENABLE(Layer) -}; - -class PAG_API PreComposeLayer : public Layer { - public: - static std::unique_ptr Wrap(Composition* composition); - - LayerType type() const override { - return LayerType::PreCompose; - }; - - Composition* composition = nullptr; // composition reference - - /** - * Indicates when the first frame of the composition shows in the layer's timeline. It could be a - * negative value. It is in layer's frame rate. - */ - Frame compositionStartTime = ZeroFrame; - - void excludeVaryingRanges(std::vector* timeRanges) override; - bool verify() const override; - std::vector getContentStaticTimeRanges() const; - Frame getCompositionFrame(Frame layerFrame); - Rect getBounds() const override; - - RTTR_ENABLE(Layer) -}; - -class PAG_API CameraLayer : public Layer { - public: - ~CameraLayer() override; - - LayerType type() const override { - return LayerType::Camera; - }; - - void excludeVaryingRanges(std::vector* timeRanges) override; - bool verify() const override; - - Rect getBounds() const override; - - CameraOption* cameraOption = nullptr; - - RTTR_ENABLE(Layer) -}; - -/** - * Compositions are always one of the following types. - */ -enum class RTTR_AUTO_REGISTER_CLASS CompositionType { Unknown, Vector, Bitmap, Video }; - -class PAG_API Composition { - public: - Composition(); - - virtual ~Composition(); - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - /** - * A unique identifier for this item. - */ - ID id = ZeroID; - /** - * The width of the Composition. - */ - int32_t width = 0; - /** - * The height of the item. - */ - int32_t height = 0; - /** - * The total duration of the item. - */ - Frame duration = ZeroFrame; - /** - * The frame rate of the Composition. - */ - float frameRate = 30; - /** - * The background color of the composition. - */ - Color backgroundColor = White; - - /** - * The audio data of this composition, which is an AAC audio in an MPEG-4 container. - */ - ByteData* audioBytes = nullptr; - std::vector audioMarkers; - - /** - * Indicates when the first frame of the audio plays in the composition's timeline. - */ - Frame audioStartTime = ZeroFrame; - - /** - * [FrameStart, FrameEnd(included)], [FrameStar, FrameEnd]... - */ - std::vector staticTimeRanges; - Cache* RTTR_SKIP_REGISTER_PROPERTY cache = nullptr; - std::mutex locker = {}; - - bool staticContent() const; - - /** - * The type of the Composition. - */ - virtual CompositionType type() const; - - /** - * Returns true if this composition contains ImageLayers, BitmapCompositions or VideoCompositions. - */ - virtual bool hasImageContent() const; - - virtual bool verify() const; - - protected: - // Called by Codec. - virtual void updateStaticTimeRanges(); - - private: - bool staticTimeRangeUpdated = false; - - friend class Codec; - - friend class VectorComposition; - - RTTR_ENABLE() -}; - -class PAG_API VectorComposition : public Composition { - public: - ~VectorComposition() override; - /** - * The layers of the composition. - */ - std::vector layers; - - /** - * The type of the Composition. - */ - CompositionType type() const override; - - bool hasImageContent() const override; - - bool verify() const override; - - protected: - void updateStaticTimeRanges() override; - - RTTR_ENABLE(Composition) -}; - -class PAG_API ImageBytes { - public: - ImageBytes(); - - ~ImageBytes(); - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - /** - * The id for this image bytes. - */ - ID id = ZeroID; - /** - * The width of the image. It is set when the image is stripped of its transparent border, - * otherwise the value would be 0. - */ - int32_t width = 0; - /** - * The height of the image. It is set when the image is stripped of its transparent border, - * otherwise the value would be 0. - */ - int32_t height = 0; - /** - * The anchor x of the image. It is set when the image is stripped of its transparent border. - */ - int32_t anchorX = 0; - /** - * The anchor y of the image. It is set when the image is stripped of its transparent border. - */ - int32_t anchorY = 0; - /** - * The scale factor of image, ranges from 0.0 to 1.0. - */ - float scaleFactor = 1.0f; - /** - * The file data of this image bytes. - */ - ByteData* fileBytes = nullptr; - - bool verify() const; - - Cache* RTTR_SKIP_REGISTER_PROPERTY cache = nullptr; - std::mutex locker = {}; - - private: - bool encrypted = false; - - friend class ImageBytesCache; - friend class EncryptedCodec; -}; - -class PAG_API BitmapRect { - public: - ~BitmapRect(); - - /** - * The x position of the bitmap rect. - */ - int32_t x = 0; - /** - * The y position of the bitmap rect. - */ - int32_t y = 0; - /** - * The file bytes of the image. - */ - ByteData* fileBytes = nullptr; -}; - -class PAG_API Sequence { - public: - /** - * Returns the sequence in specified composition, returns nullptr if the type of composition is - * not video or bitmap. - */ - static Sequence* Get(Composition* composition); - - virtual ~Sequence() = default; - /** - * The Composition which owns this Sequence. - */ - Composition* RTTR_SKIP_REGISTER_PROPERTY composition = nullptr; - /** - * The width of the sequence. - */ - int32_t width = 0; - /** - * The height of the sequence. - */ - int32_t height = 0; - /** - * The frame rate of sequence. - */ - float frameRate = 30; - /** - * The total duration of the item. - */ - virtual Frame duration() const = 0; - - virtual bool verify() const; - - Frame toSequenceFrame(Frame compositionFrame); - - RTTR_ENABLE() -}; - -class PAG_API BitmapFrame { - public: - ~BitmapFrame(); - /** - * Indicates whether or not it is a key frame. - */ - bool isKeyframe = false; - /** - * The image bytes need to be drawn onto. - */ - std::vector bitmaps; - - bool verify() const; -}; - -class PAG_API BitmapSequence : public Sequence { - public: - ~BitmapSequence() override; - /** - * The bitmap frames of the Composition. - */ - std::vector frames; - - virtual bool isEmptyBitmapFrame(size_t frameIndex); - - Frame duration() const override { - return static_cast(frames.size()); - } - - bool verify() const override; - - RTTR_ENABLE(Sequence) -}; - -class PAG_API BitmapComposition : public Composition { - public: - ~BitmapComposition() override; - /** - * The type of the Composition. - */ - CompositionType type() const override; - /** - * The bitmap frames of the Composition. It is sorted in ascending order. - */ - std::vector sequences; - - bool hasImageContent() const override; - - bool verify() const override; - - protected: - void updateStaticTimeRanges() override; - - RTTR_ENABLE(Composition) -}; - -class PAG_API VideoFrame { - public: - ~VideoFrame(); - /** - * Indicates whether or not it is a key frame. - */ - bool isKeyframe = false; - - /** - * The presentation frame index. - */ - Frame frame = 0; - - /** - * The file bytes of the video frame. - */ - ByteData* fileBytes = nullptr; -}; - -class PAG_API VideoSequence : public Sequence { - public: - ~VideoSequence() override; - /** - * The x position of the alpha start point. - */ - int32_t alphaStartX = 0; - /** - * The y position of the alpha start point. - */ - int32_t alphaStartY = 0; - /** - * The video frames of the Composition. - */ - std::vector frames; - /** - * Codec specific data. - */ - std::vector headers; - - std::vector staticTimeRanges; - - ByteData* MP4Header = nullptr; - - Frame duration() const override { - return static_cast(frames.size()); - } - - bool verify() const override; - - int32_t getVideoWidth() const; - - int32_t getVideoHeight() const; - - RTTR_ENABLE(Sequence) -}; - -class PAG_API VideoComposition : public Composition { - public: - ~VideoComposition() override; - /** - * The type of the Composition. - */ - CompositionType type() const override; - - /** - * The video frames of the Composition. It is sorted in ascending order. - */ - std::vector sequences; - - bool hasImageContent() const override; - - bool verify() const override; - - protected: - void updateStaticTimeRanges() override; - - RTTR_ENABLE(Composition) -}; - -class PAG_API FontData { - public: - FontData(std::string fontFamily, std::string fontStyle) - : fontFamily(std::move(fontFamily)), fontStyle(std::move(fontStyle)) { - } - - const std::string fontFamily; - const std::string fontStyle; -}; - -class PAG_API FileAttributes { - public: - bool empty() const { - return timestamp == 0 && pluginVersion.empty() && aeVersion.empty() && systemVersion.empty() && - author.empty() && scene.empty() && warnings.empty(); - } - - int64_t timestamp = 0; - std::string pluginVersion = ""; - std::string aeVersion = ""; - std::string systemVersion = ""; - std::string author = ""; - std::string scene = ""; - std::vector warnings; -}; - -struct PerformanceData { - /** - * The time cost by rendering in microseconds. - */ - int64_t renderingTime; - - /** - * The time cost by image decoding in microseconds. - */ - int64_t imageDecodingTime; - - /** - * The time cost by presenting in microseconds. - */ - int64_t presentingTime; - - /** - * The memory cost by graphics in bytes. - */ - int64_t graphicsMemory; -}; - -class PAG_API File { - public: - /** - * The maximum tag level current SDK supports. - */ - static uint16_t MaxSupportedTagLevel(); - /** - * Load a pag file from byte data, return null if the bytes is empty or it's not a valid pag - * file. - */ - static std::shared_ptr Load(const void* bytes, size_t length, - const std::string& filePath = "", - const std::string& password = ""); - /** - * Load a pag file from path, return null if the file does not exist or the data is not a pag - * file. - */ - static std::shared_ptr Load(const std::string& filePath, const std::string& password = ""); - - ~File(); - - /** - * Return the duration of the pag file in frames. - */ - int64_t duration() const; - - /** - * The frame rate of the pag file. - */ - float frameRate() const; - - /** - * Return the original display width in pixels of pag file. - */ - int32_t width() const; - - /** - * Return the original display height in pixels of pag file. - */ - int32_t height() const; - - /** - * The tag level this pag file requires. - */ - uint16_t tagLevel() const; - - /** - * The background color of the pag file. - */ - Color backgroundColor() const; - - /** - * The number of replaceable texts. - */ - int numTexts() const; - - /** - * The number of replaceable images. - */ - int numImages() const; - - /** - * The number of video compositions. - */ - int numVideos() const; - - /** - * The 'total' number of layers in this pag file, for profiling only. - */ - int numLayers() const; - - /** - * Get a text data of the specified index. The index ranges from 0 to numTexts - 1. - */ - TextDocumentHandle getTextData(int index) const; - - PreComposeLayer* getRootLayer() const; - - TextLayer* getTextAt(int index) const; - - std::vector getImageAt(int index) const; - - int getEditableIndex(TextLayer* textLayer) const; - - int getEditableIndex(ImageLayer* imageLayer) const; - - bool hasScaledTimeRange() const; - - /** - * Indicates how to stretch the duration of File when rendering. - */ - PAGTimeStretchMode timeStretchMode = PAGTimeStretchMode::Repeat; - TimeRange scaledTimeRange = {}; - FileAttributes fileAttributes = {}; - std::string path = ""; - std::vector images; - std::vector compositions; - - std::vector* editableImages = nullptr; - std::vector* editableTexts = nullptr; - std::vector* imageScaleModes = nullptr; - - RTTR_REGISTER_FUNCTION_AS_PROPERTY("duration", duration) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("frameRate", frameRate) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("width", width) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("height", height) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("tagLevel", tagLevel) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("backgroundColor", backgroundColor) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("numTexts", numTexts) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("numImages", numImages) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("numVideos", numVideos) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("numLayers", numLayers) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("rootLayer", getRootLayer) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("hasScaledTimeRange", hasScaledTimeRange) - - private: - PreComposeLayer* rootLayer = nullptr; - Composition* mainComposition = nullptr; - uint16_t _tagLevel = 1; - int _numLayers = 0; - bool encrypted = false; - - // Just references, no need to delete them. - std::vector textLayers = {}; - - // Just references, no need to delete them. - std::vector> imageLayers = {}; - - File(std::vector compositionList, std::vector imageList); - void updateEditables(Composition* composition); - - friend class Codec; - friend class SequenceInfo; - friend class EncryptedCodec; -}; - -/** - * Calculate the memory cost by graphics of file in bytes. - */ -int64_t PAG_API CalculateGraphicsMemory(std::shared_ptr file); - -class CodecContext; - -class PAG_API Codec { - public: - /** - * Return the maximum supported tag level. - */ - static uint16_t MaxSupportedTagLevel(); - - /** - * Replace all temporary mask with real references. - */ - static void InstallReferences(Layer* layer); - - /** - * Replace all temporary layer with real references. - */ - static void InstallReferences(const std::vector& layers); - - /** - * Replace all temporary composition with real references. - */ - static void InstallReferences(const std::vector& compositions); - - /** - * Return null if the the specified data are not valid to create a pag file. - */ - static std::shared_ptr VerifyAndMake(const std::vector& compositions, - const std::vector& images); - - /** - * Decode a pag file from the specified byte data, return null if the bytes is empty or it's not a - * valid pag file. - */ - static std::shared_ptr Decode(const void* bytes, uint32_t byteLength, - const std::string& path); - - /** - * Encode a pag file to byte data, return null if the file is null. - */ - static std::unique_ptr Encode(std::shared_ptr file); - - /** - * Encode a pag file with the corresponding performance data to byte data, return null if the file - * is null. - */ - static std::unique_ptr Encode(std::shared_ptr pagFile, - std::shared_ptr performanceData); - - /** - * Read the performance data from the specified byte data, return null if the byte data contains - * no performance data. - */ - static std::shared_ptr ReadPerformanceData(const void* bytes, - uint32_t byteLength); - - protected: - static void UpdateFileAttributes(std::shared_ptr file, CodecContext* context, - const std::string& filePath); -}; -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/gpu.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/gpu.h deleted file mode 100644 index 1b1da6c..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/gpu.h +++ /dev/null @@ -1,326 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include -#include "pag/defines.h" - -#if defined(__ANDROID__) || defined(ANDROID) -struct AHardwareBuffer; -#elif defined(__OHOS__) -struct OH_NativeBuffer; -#elif defined(__APPLE__) -struct __CVBuffer; -#endif - -namespace pag { -#if defined(__ANDROID__) || defined(ANDROID) -typedef AHardwareBuffer* HardwareBufferRef; -#elif defined(__APPLE__) -// __CVBuffer == CVPixelBufferRef -typedef __CVBuffer* HardwareBufferRef; -#elif defined(__OHOS__) -typedef OH_NativeBuffer* HardwareBufferRef; -#else -typedef void* HardwareBufferRef; -#endif - -/** - * Possible GPU backend APIs that may be used by PAG. - */ -enum class Backend { - /** - * Mock is a backend that does not draw anything. It is used for unit tests and to measure CPU - * overhead. - */ - MOCK, - OPENGL, - METAL, - VULKAN, -}; - -/** - * Textures and FrameBuffers can be stored such that (0, 0) in texture space may correspond to - * either the top-left or bottom-left content pixel. - */ -enum class ImageOrigin { - /** - * The default origin of the native coordinate system in the GPU backend. For example, the - * ImageOrigin::TopLeft is actually the bottom-left origin in the OpenGL coordinate system for - * textures. Textures newly created by the backend API for off-screen rendering usually have an - * ImageOrigin::TopLeft origin. - */ - TopLeft, - - /** - * Use this origin to flip the content on the y-axis if the GPU backend has a different origin to - * your system views. It is usually used for on-screen rendering. - */ - BottomLeft -}; - -/** - * Types for interacting with GL textures created externally to PAG. - */ -struct GLTextureInfo { - /** - * the id of this texture. - */ - unsigned id = 0; - /** - * The target of this texture. - */ - unsigned target = 0x0DE1; // GL_TEXTURE_2D; - /** - * The pixel format of this texture. - */ - unsigned format = 0x8058; // GL_RGBA8; -}; - -/** - * Types for interacting with GL frame buffers created externally to PAG. - */ -struct GLFrameBufferInfo { - /** - * The id of this frame buffer. - */ - unsigned id = 0; - - /** - * The pixel format of this frame buffer. - */ - unsigned format = 0x8058; // GL_RGBA8; -}; - -/** - * Types for interacting with Metal resources created externally to PAG. Holds the MTLTexture as a - * void*. - */ -struct MtlTextureInfo { - /** - * Pointer to MTLTexture. - */ - void* texture = nullptr; -}; - -/** - * Types for interacting with Vulkan resources created externally to PAG. Holds the VkImage as a - * void*. - */ -struct VkImageInfo { - /** - * Pointer to VkImage. - */ - void* image = nullptr; -}; - -class PAG_API BackendTexture { - public: - /** - * Creates an invalid backend texture. - */ - BackendTexture() : _width(0), _height(0) { - } - - /** - * Creates an OpenGL backend texture. - */ - BackendTexture(const GLTextureInfo& glInfo, int width, int height); - - /** - * Creates a Metal backend texture. - */ - BackendTexture(const MtlTextureInfo& mtlInfo, int width, int height); - - /** - * Creates a Vulkan backend texture. - */ - BackendTexture(const VkImageInfo& vkInfo, int width, int height); - - BackendTexture(const BackendTexture& that); - - BackendTexture& operator=(const BackendTexture& that); - - /** - * Returns true if the backend texture has been initialized. - */ - bool isValid() const { - return _width > 0 && _height > 0; - } - - /** - * Returns the width of this texture. - */ - int width() const { - return _width; - } - - /** - * Returns the height of this texture. - */ - int height() const { - return _height; - } - - /** - * Returns the backend API of this texture. - */ - Backend backend() const { - return _backend; - } - - /** - * If the backend API is GL, copies a snapshot of the GLTextureInfo struct into the passed in - * pointer and returns true. Otherwise returns false if the backend API is not GL. - */ - bool getGLTextureInfo(GLTextureInfo* glTextureInfo) const; - - /** - * If the backend API is Metal, copies a snapshot of the GrMtlTextureInfo struct into the passed - * in pointer and returns true. Otherwise returns false if the backend API is not Metal. - */ - bool getMtlTextureInfo(MtlTextureInfo* mtlTextureInfo) const; - - /** - * If the backend API is Vulkan, copies a snapshot of the VkImageInfo struct into the passed - * in pointer and returns true. Otherwise, returns false if the backend API is not Vulkan. - */ - bool getVkImageInfo(VkImageInfo* vkImageInfo) const; - - private: - Backend _backend = Backend::MOCK; - int _width = 0; - int _height = 0; - - union { - GLTextureInfo glInfo; - MtlTextureInfo mtlInfo; - VkImageInfo vkInfo; - }; -}; - -class PAG_API BackendRenderTarget { - public: - /** - * Creates an invalid backend render target. - */ - BackendRenderTarget() : _width(0), _height(0) { - } - - /** - * Creates an OpenGL backend render target. - */ - BackendRenderTarget(const GLFrameBufferInfo& glInfo, int width, int height); - - /** - * Creates an Metal backend render target. - */ - BackendRenderTarget(const MtlTextureInfo& mtlInfo, int width, int height); - - /** - * Creates a Vulkan backend render target. - */ - BackendRenderTarget(const VkImageInfo& vkInfo, int width, int height); - - BackendRenderTarget(const BackendRenderTarget& that); - - BackendRenderTarget& operator=(const BackendRenderTarget&); - - /** - * Returns true if the backend texture has been initialized. - */ - bool isValid() const { - return _width > 0 && _height > 0; - } - - /** - * Returns the width of this render target. - */ - int width() const { - return _width; - } - - /** - * Returns the height of this render target. - */ - int height() const { - return _height; - } - - /** - * Returns the backend API of this render target. - */ - Backend backend() const { - return _backend; - } - - /** - * If the backend API is GL, copies a snapshot of the GLFramebufferInfo struct into the passed - * in pointer and returns true. Otherwise returns false if the backend API is not GL. - */ - bool getGLFramebufferInfo(GLFrameBufferInfo* glFrameBufferInfo) const; - - /** - * If the backend API is Metal, copies a snapshot of the MtlTextureInfo struct into the passed - * in pointer and returns true. Otherwise returns false if the backend API is not Metal. - */ - bool getMtlTextureInfo(MtlTextureInfo* mtlTextureInfo) const; - - /** - * If the backend API is Vulkan, copies a snapshot of the VkImageInfo struct into the passed - * in pointer and returns true. Otherwise, returns false if the backend API is not Vulkan. - */ - bool getVkImageInfo(VkImageInfo* vkImageInfo) const; - - private: - Backend _backend = Backend::MOCK; - int _width = 0; - int _height = 0; - union { - GLFrameBufferInfo glInfo; - MtlTextureInfo mtlInfo; - VkImageInfo vkInfo; - }; -}; - -/** - * Wrapper class for passing into and receiving data from PAG about a backend semaphore object. - */ -class PAG_API BackendSemaphore { - public: - BackendSemaphore(); - - bool isInitialized() const { - return _isInitialized; - } - - void initGL(void* sync); - - void* glSync() const; - - private: - Backend _backend = Backend::MOCK; - union { - void* _glSync; - }; - bool _isInitialized; -}; -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/pag.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/pag.h deleted file mode 100644 index 85e6825..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/pag.h +++ /dev/null @@ -1,1722 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include // for windows -#include -#include "pag/decoder.h" -#include "pag/gpu.h" -#include "pag/types.h" - -namespace tgfx { -struct Rect; -class Context; -class Surface; -class ImageInfo; -} // namespace tgfx - -namespace pag { -class Recorder; - -class RenderCache; - -class Drawable; - -class Content { - public: - virtual ~Content() = default; - - protected: - virtual void measureBounds(tgfx::Rect* bounds) = 0; - - virtual void draw(Recorder* recorder) = 0; - - friend class FilterRenderer; - - friend class LayerRenderer; - - friend class MemoryCalculator; - - friend class TrackMatteRenderer; - - friend class RenderCache; - - friend class PAGLayer; - - friend class PAGComposition; - - friend class PAGTextLayer; -}; - -class Graphic; - -class PAGLayer; - -/** - * An image used to replace the contents of PAGImageLayers in a PAGFile. - */ -class PAG_API PAGImage { - public: - /** - * Creates a PAGImage object from a path of an image file, return null if the file does not exist, - * or it's not a valid image file. - */ - static std::shared_ptr FromPath(const std::string& filePath); - - /** - * Creates a PAGImage object from the specified file bytes, return null if the bytes is empty or - * it's not a valid image file. - */ - static std::shared_ptr FromBytes(const void* bytes, size_t length); - - /** - * Creates a PAGImage object from an array of pixel data, return null if it's not valid pixels. - * @param pixels The pixel data to copy from. - * @param width The width of the pixel data. - * @param height The height of the pixel data. - * @param rowBytes The number of bytes between subsequent rows of the pixel data. - * @param colorType Describes how to interpret the components of a pixel. - * @param alphaType Describes how to interpret the alpha component of a pixel. - */ - static std::shared_ptr FromPixels(const void* pixels, int width, int height, - size_t rowBytes, ColorType colorType, - AlphaType alphaType); - - /** - * Creates a PAGImage object from the specified backend texture, return null if the texture is - * invalid. - */ - static std::shared_ptr FromTexture(const BackendTexture& texture, ImageOrigin origin); - - virtual ~PAGImage() = default; - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID() const { - return _uniqueID; - } - - /** - * Returns the width in pixels. - */ - int width() const { - return _width; - } - - /** - * Returns the height in pixels. - */ - int height() const { - return _height; - } - - /** - * Returns the current scale mode. The default value is PAGScaleMode::LetterBox. - */ - PAGScaleMode scaleMode() const; - - /** - * Specifies the rule of how to scale the content to fit the image layer's original size. - * The matrix changes when this method is called. - */ - void setScaleMode(PAGScaleMode mode); - - /** - * Returns a copy of the current matrix. - */ - Matrix matrix() const; - - /** - * Set the transformation which will be applied to the content. - * The scaleMode property will be set to PAGScaleMode::None when this method is called. - */ - void setMatrix(const Matrix& matrix); - - protected: - PAGImage(int width, int height); - - virtual std::shared_ptr getGraphic(Frame frame) const = 0; - - virtual bool isStill() const = 0; - - virtual Frame getContentFrame(int64_t time) const = 0; - - private: - mutable std::mutex locker = {}; - ID _uniqueID = 0; - int _width = 0; - int _height = 0; - PAGScaleMode _scaleMode = PAGScaleMode::LetterBox; - Matrix _matrix = Matrix::I(); - bool hasSetScaleMode = false; - - Matrix getContentMatrix(PAGScaleMode defaultScaleMode, int contentWidth, int contentHeight); - - friend class ImageReplacement; - - friend class PAGImageLayer; - - friend class PAGFile; - - friend class RenderCache; - - friend class AudioClip; -}; - -class PAGComposition; - -class PAGImageLayer; - -class PAGStage; - -class PAG_API PAGFont { - public: - /** - * Registers a font required by the text layers in pag files, so that they can be rendered as - * designed. - */ - static PAGFont RegisterFont(const std::string& fontPath, int ttcIndex, - const std::string& fontFamily = "", - const std::string& fontStyle = ""); - /** - * Registers a font required by the text layers in pag files, so that they can be rendered as - * designed. - */ - static PAGFont RegisterFont(const void* data, size_t length, int ttcIndex, - const std::string& fontFamily = "", - const std::string& fontStyle = ""); - - /** - * Unregister a font. - */ - static void UnregisterFont(const PAGFont& font); - - /** - * Resets the fallback font names. It should be called only once when the application is being - * initialized. - */ - static void SetFallbackFontNames(const std::vector& fontNames); - - /** - * Resets the fallback font paths. It should be called only once when the application is being - * initialized. - */ - static void SetFallbackFontPaths(const std::vector& fontPaths, - const std::vector& ttcIndices); - - PAGFont(std::string fontFamily, std::string fontStyle) - : fontFamily(std::move(fontFamily)), fontStyle(std::move(fontStyle)) { - } - - /** - * A string with the name of the font family. - **/ - const std::string fontFamily; - /** - * A string with the style information — e.g., “bold”, “italic”. - **/ - const std::string fontStyle; -}; - -class File; - -class Layer; - -class LayerCache; - -class Content; - -class Transform; - -class PAGFile; - -class ContentVersion; - -class PAG_API PAGLayer : public Content { - public: - PAGLayer(std::shared_ptr file, Layer* layer); - - ~PAGLayer() override; - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID() const; - - /** - * Returns the type of layer. - */ - LayerType layerType() const; - - /** - * Returns the name of the layer. - */ - std::string layerName() const; - - /** - * A matrix object containing values that alter the scaling, rotation, and translation of the - * layer. Altering it does not change the animation matrix, and it will be concatenated to current - * animation matrix for displaying. - */ - Matrix matrix() const; - - void setMatrix(const Matrix& value); - - /** - * Resets the matrix to its default value. - */ - void resetMatrix(); - - /** - * Returns the layer's display matrix by combining its matrix) property with the current animation - * matrix from the AE timeline. This does not include the parent layer's matrix. - * To calculate the final bounds relative to the PAGSurface, use the PAGPlayer::getBounds(PAGLayer layer) - * method directly. - */ - Matrix getTotalMatrix(); - - /** - * Returns the current alpha of the layer if previously set. - */ - float alpha() const; - - /** - * Set the alpha of the layer, which will be concatenated to the current animation opacity for - * displaying. - */ - void setAlpha(float value); - - /** - * Whether or not the layer is visible. - */ - bool visible() const; - - /** - * Set the visible of the layer. - */ - void setVisible(bool value); - - /** - * Ranges from 0 to PAGFile.numTexts - 1 if the layer type is text, or from 0 to PAGFile.numImages - * -1 if the layer type is image, otherwise returns -1. - */ - int editableIndex() const; - - /** - * Returns the parent PAGComposition of current PAGLayer. - */ - - std::shared_ptr parent() const; - - /** - * Returns the markers of this layer. - */ - std::vector markers() const; - - /** - * Converts the time from the PAGLayer's (local) timeline to the PAGSurface (global) timeline. The - * time is in microseconds. - */ - int64_t localTimeToGlobal(int64_t localTime) const; - - /** - * Converts the time from the PAGSurface (global) to the PAGLayer's (local) timeline timeline. The - * time is in microseconds. - */ - int64_t globalToLocalTime(int64_t globalTime) const; - - /** - * The duration of the layer in microseconds, indicates the length of the visible range. - */ - int64_t duration() const; - - /** - * Returns the frame rate of this layer. - */ - float frameRate() const; - - /** - * The start time of the layer in microseconds, indicates the start position of the visible range - * in parent composition. It could be negative value. - */ - int64_t startTime() const; - - /** - * Set the start time of the layer, in microseconds. - */ - void setStartTime(int64_t time); - - /** - * The current time of the layer in microseconds, the layer is invisible if currentTime is not in - * the visible range (startTime <= currentTime < startTime + duration). - */ - int64_t currentTime() const; - - /** - * Set the current time of the layer, in microseconds. - */ - void setCurrentTime(int64_t time); - - /** - * Returns the current progress of play position, the value ranges from 0.0 to 1.0. - */ - double getProgress(); - - /** - * Set the progress of play position, the value ranges from 0.0 to 1.0. A value of 0.0 represents - * the frame at startTime. A value of 1.0 represents the frame at the end of duration. - */ - void setProgress(double percent); - - /** - * Set the progress of play position to the previous frame. - */ - void preFrame(); - - /** - * Set the progress of play position to the next frame. - */ - void nextFrame(); - - /** - * Returns a rectangle in pixels that defines the original area of the layer, which is not - * transformed by the matrix. - */ - Rect getBounds(); - - /** - * Returns trackMatte layer of this layer. - */ - std::shared_ptr trackMatteLayer() const; - - /** - * Indicate whether this layer is excluded from parent's timeline. If set to true, this layer's - * current time will not change when parent's current time changes. - */ - bool excludedFromTimeline() const; - - /** - * Set the excludedFromTimeline flag of this layer. - */ - void setExcludedFromTimeline(bool value); - - /** - * Returns true if this layer is a PAGFile. - */ - virtual bool isPAGFile() const; - - // internal use only. - void* externalHandle = nullptr; - std::shared_ptr getFile() const; - void notifyAudioModified(); - - protected: - std::shared_ptr rootLocker = nullptr; - Layer* layer = nullptr; - LayerCache* layerCache = nullptr; - PAGStage* stage = nullptr; - PAGComposition* _parent = nullptr; - Frame startFrame = 0; - Frame contentFrame = 0; - // It could be nullptr when the layer is created by PAGComposition(width, height), - // check before using it! - std::shared_ptr file = nullptr; - PAGFile* rootFile = nullptr; - std::weak_ptr weakThis; - Matrix layerMatrix = {}; - float layerAlpha = 1.0f; - PAGLayer* trackMatteOwner = nullptr; - - const Layer* getLayer() const; - const PAGStage* getStage() const; - Frame localFrameToGlobal(Frame localFrame) const; - Frame globalToLocalFrame(Frame globalFrame) const; - Point globalToLocalPoint(float stageX, float stageY); - void draw(Recorder* recorder) override; - void measureBounds(tgfx::Rect* bounds) override; - Matrix getTotalMatrixInternal(); - virtual void setMatrixInternal(const Matrix& matrix); - virtual float frameRateInternal() const; - double getProgressInternal(); - void setProgressInternal(double percent); - void preFrameInternal(); - void nextFrameInternal(); - virtual bool gotoTime(int64_t layerTime); - virtual Frame childFrameToLocal(Frame childFrame, float childFrameRate) const; - virtual Frame localFrameToChild(Frame localFrame, float childFrameRate) const; - - /** - * Marks the content of parent (and parent's parent...) changed. It also marks this layer's - * content changed if you pass true in the contentChanged parameter. - */ - void notifyModified(bool contentChanged = false); - virtual bool contentModified() const; - virtual bool cacheFilters() const; - virtual Frame frameDuration() const; - virtual Frame stretchedFrameDuration() const; - virtual Frame stretchedContentFrame() const; - virtual int64_t durationInternal() const; - virtual int64_t startTimeInternal() const; - virtual Content* getContent(); - virtual void invalidateCacheScale(); - virtual void onAddToStage(PAGStage* pagStage); - virtual void onRemoveFromStage(); - virtual void onAddToRootFile(PAGFile* pagFile); - virtual void onRemoveFromRootFile(); - virtual void onTimelineChanged(); - virtual void updateRootLocker(std::shared_ptr locker); - - private: - ID _uniqueID = 0; - bool layerVisible = true; - bool _excludedFromTimeline = false; - std::shared_ptr _trackMatteLayer = nullptr; - int _editableIndex = -1; - uint32_t contentVersion = 0; - std::atomic audioVersion = {0}; - - void setVisibleInternal(bool value); - void setStartTimeInternal(int64_t time); - int64_t currentTimeInternal() const; - Frame currentFrameInternal() const; - bool setCurrentTimeInternal(int64_t time); - bool frameVisible() const; - void removeFromParentOrOwner(); - void attachToTree(std::shared_ptr newLocker, PAGStage* newStage); - void detachFromTree(); - PAGLayer* getTimelineOwner() const; - PAGLayer* getParentOrOwner() const; - bool getTransform(Transform* transform); - bool gotoTimeAndNotifyChanged(int64_t targetTime); - - friend class PAGComposition; - - friend class PAGFile; - - friend class TrackMatteRenderer; - - friend class FilterModifier; - - friend class RenderCache; - - friend class PAGStage; - - friend class PAGPlayer; - - friend class FileReporter; - - friend class PAGImageLayer; - - friend class SequenceImageQueue; - - friend class PAGAudioReader; - - friend class AudioClip; - - friend class ContentVersion; - - friend class PAGDecoder; -}; - -class SolidLayer; - -class PAG_API PAGSolidLayer : public PAGLayer { - public: - static std::shared_ptr Make(int64_t duration, int32_t width, int32_t height, - Color solidColor, Opacity opacity = 255); - - PAGSolidLayer(std::shared_ptr file, SolidLayer* layer); - - ~PAGSolidLayer() override; - - /** - * Returns the layer's solid color. - */ - Color solidColor(); - - /** - * Set the layer's solid color. - */ - void setSolidColor(const Color& value); - - protected: - Content* getContent() override; - bool contentModified() const override; - - private: - SolidLayer* emptySolidLayer = nullptr; - Content* replacement = nullptr; - Color _solidColor = White; -}; - -class TextLayer; - -class TextReplacement; - -class PAG_API PAGTextLayer : public PAGLayer { - public: - static std::shared_ptr Make(int64_t duration, std::string text, float fontSize = 24, - std::string fontFamily = "", - std::string fontStyle = ""); - - static std::shared_ptr Make(int64_t duration, - std::shared_ptr textDocumentHandle); - - PAGTextLayer(std::shared_ptr file, TextLayer* layer); - ~PAGTextLayer() override; - - /** - * Returns the text layer’s fill color. - */ - Color fillColor() const; - - /** - * Set the text layer’s fill color. - */ - void setFillColor(const Color& value); - - /** - * Returns the text layer's font. - */ - PAGFont font() const; - - /** - * Set the text layer's font. - */ - void setFont(const PAGFont& font); - - /** - * Returns the text layer's font size. - */ - float fontSize() const; - - /** - * Set the text layer's font size. - */ - void setFontSize(float size); - - /** - * Returns the text layer's stroke color. - */ - Color strokeColor() const; - - /** - * Set the text layer's stroke color. - */ - void setStrokeColor(const Color& color); - - /** - * Returns the text layer's text. - */ - std::string text() const; - - /** - * Set the text layer's text. - */ - void setText(const std::string& text); - - /** - * Reset the text layer to its default text data. - */ - void reset(); - - protected: - void replaceTextInternal(std::shared_ptr textData); - void setMatrixInternal(const Matrix& matrix) override; - Content* getContent() override; - bool contentModified() const override; - - private: - TextLayer* emptyTextLayer = nullptr; - - TextReplacement* replacement = nullptr; - - const TextDocument* textDocumentForRead() const; - - TextDocument* textDocumentForWrite(); - - friend class PAGFile; - - friend class TextReplacement; -}; - -class ShapeLayer; - -class PAG_API PAGShapeLayer : public PAGLayer { - public: - PAGShapeLayer(std::shared_ptr file, ShapeLayer* layer); -}; - -/** - * Represents a time range from the content of PAGImageLayer. - */ -class PAG_API PAGVideoRange { - public: - PAGVideoRange(int64_t startTime, int64_t endTime, int64_t playDuration) - : _startTime(startTime), _endTime(endTime), _playDuration(playDuration) { - } - - /** - * The start time of the source video, in microseconds. - */ - int64_t startTime() const { - return _startTime < _endTime ? _startTime : _endTime; - } - - /** - * The end time of the source video (not included), in microseconds. - */ - int64_t endTime() const { - return _startTime < _endTime ? _endTime : _startTime; - } - - /** - * The duration for playing after applying speed. - */ - int64_t playDuration() const { - return _playDuration; - } - - /** - * Indicates whether the video should play backward. - */ - bool reversed() const { - return _startTime > _endTime; - } - - private: - int64_t _startTime; - int64_t _endTime; - int64_t _playDuration; -}; - -class ImageLayer; - -class ImageReplacement; - -template -class Property; - -template -class AnimatableProperty; - -class PAG_API PAGImageLayer : public PAGLayer { - public: - /** - * Make a PAGImageLayer with width, height and duration(in microseconds). - */ - static std::shared_ptr Make(int width, int height, int64_t duration); - - PAGImageLayer(std::shared_ptr file, ImageLayer* layer); - - ~PAGImageLayer() override; - - /** - * Returns the content duration in microseconds, which indicates the minimal length required for - * replacement. - */ - int64_t contentDuration(); - - /** - * Returns the time ranges of the source video for replacement. - */ - std::vector getVideoRanges() const; - - /** - * [Deprecated] - * Replace the original image content with the specified PAGImage object. - * Passing in null for the image parameter resets the layer to its default image content. - * The replaceImage() method modifies all associated PAGImageLayers that have the same - * editableIndex to this layer. - * - * @param image The PAGImage object to replace with. - */ - void replaceImage(std::shared_ptr image); - - /** - * Replace the original image content with the specified PAGImage object. - * Passing in null for the image parameter resets the layer to its default image content. - * The setImage() method only modifies the content of the calling PAGImageLayer. - * - * @param image The PAGImage object to replace with. - */ - void setImage(std::shared_ptr image); - - /** - * Converts the time from the PAGImageLayer's timeline to the replacement content's timeline. The - * time is in microseconds. - */ - int64_t layerTimeToContent(int64_t layerTime); - - /** - * Converts the time from the replacement content's timeline to the PAGLayer's timeline. The time - * is in microseconds. - */ - int64_t contentTimeToLayer(int64_t contentTime); - - /** - * The default image data of this layer, which is webp format. - */ - ByteData* imageBytes() const; - - protected: - bool gotoTime(int64_t layerTime) override; - void setImageInternal(std::shared_ptr image); - int64_t getCurrentContentTime(int64_t layerTime); - Property* getContentTimeRemap(); - bool contentVisible(); - Content* getContent() override; - bool contentModified() const override; - bool cacheFilters() const override; - void onRemoveFromRootFile() override; - void onTimelineChanged() override; - int64_t localFrameToFileFrame(int64_t localFrame) const; - int64_t fileFrameToLocalFrame(int64_t fileFrame) const; - - private: - ImageLayer* emptyImageLayer = nullptr; - ImageReplacement* replacement = nullptr; - std::unique_ptr> contentTimeRemap; - - PAGImageLayer(int width, int height, int64_t duration); - bool hasPAGImage() const; - std::shared_ptr getPAGImage() const; - std::unique_ptr> copyContentTimeRemap(); - TimeRange getVisibleRangeInFile(); - static void BuildContentTimeRemap(AnimatableProperty* property, PAGFile* fileOwner, - const TimeRange& visibleRange, double frameScale); - static void ExpandPropertyByRepeat(AnimatableProperty* property, PAGFile* fileOwner, - Frame contentDuration); - static Frame ScaleTimeRemap(AnimatableProperty* property, const TimeRange& visibleRange, - double frameScale, Frame fileEndFrame); - Frame getFrameFromTimeRemap(Frame value); - void measureBounds(tgfx::Rect* bounds) override; - int64_t contentDurationInternal(); - PAGScaleMode getDefaultScaleMode(); - - friend class RenderCache; - - friend class PAGStage; - - friend class PAGFile; - - friend class AudioClip; -}; - -class PreComposeLayer; - -class VectorComposition; - -class PAG_API PAGComposition : public PAGLayer { - public: - /** - * Make an empty PAGComposition with specified size. - */ - static std::shared_ptr Make(int width, int height); - - PAGComposition(std::shared_ptr file, PreComposeLayer* layer); - - ~PAGComposition() override; - - /** - * Returns the width of the Composition. - */ - int width() const; - - /** - * Returns the height of the Composition. - */ - int height() const; - - /** - * Set the width and height of the Composition. - */ - void setContentSize(int width, int height); - - /** - * Returns the number of child layers of this composition. - */ - int numChildren() const; - - /** - * Returns the child layer that exists at the specified index. - * @param index The index position of the child layer. - * @returns The child layer at the specified index position. - */ - std::shared_ptr getLayerAt(int index) const; - - /** - * Returns the index position of a child layer. - * @param pagLayer The layer instance to identify. - * @returns The index position of the child layer to identify. - */ - int getLayerIndex(std::shared_ptr pagLayer) const; - - /** - * Changes the position of an existing child layer in the composition. This affects the layering - * of child layers. - * @param pagLayer The child layer for which you want to change the index number. - * @param index The resulting index number for the child layer. - */ - void setLayerIndex(std::shared_ptr pagLayer, int index); - - /** - * Add a PAGLayer to the current PAGComposition at the top. If you add a layer that already has a - * different PAGComposition object as a parent, the layer is removed from the other PAGComposition - * object. - */ - bool addLayer(std::shared_ptr pagLayer); - - /** - * Add a PAGLayer to the current PAGComposition at the specified index. If you add a layer that - * already has a different PAGComposition object as a parent, the layer is removed from the other - * PAGComposition object. - */ - bool addLayerAt(std::shared_ptr pagLayer, int index); - - /** - * Check whether the current PAGComposition contains the specified pagLayer. - */ - bool contains(std::shared_ptr pagLayer) const; - - /** - * Remove the specified PAGLayer from the current PAGComposition. - */ - std::shared_ptr removeLayer(std::shared_ptr pagLayer); - - /** - * Remove the PAGLayer at specified index from current PAGComposition. - */ - std::shared_ptr removeLayerAt(int index); - - /** - * Remove all PAGLayers from current PAGComposition. - */ - void removeAllLayers(); - - /** - * Swap the layers. - */ - void swapLayer(std::shared_ptr pagLayer1, std::shared_ptr pagLayer2); - - /** - * Swap the layers at the specified index. - */ - void swapLayerAt(int index1, int index2); - - /** - * The audio data of this composition, which is an AAC audio in an MPEG-4 container. - */ - ByteData* audioBytes() const; - - /** - * Returns the audio markers of this composition. - */ - std::vector audioMarkers() const; - - /** - * Indicates when the first frame of the audio plays in the composition's timeline. - */ - int64_t audioStartTime() const; - - /** - * Returns an array of layers that match the specified layer name. - */ - std::vector> getLayersByName(const std::string& layerName); - - /** - * Returns an array of layers that lie under the specified point. The point is in pixels and from - * this PAGComposition's local coordinates. - */ - std::vector> getLayersUnderPoint(float localX, float localY); - - protected: - int _width = 0; - int _height = 0; - int64_t _frameDuration = 1; - float _frameRate = 60; - std::vector> layers; - - PAGComposition(int width, int height); - std::vector> getLayersBy( - std::function filterFunc); - float frameRateInternal() const override; - bool gotoTime(int64_t layerTime) override; - Frame childFrameToLocal(Frame childFrame, float childFrameRate) const override; - Frame localFrameToChild(Frame localFrame, float childFrameRate) const override; - int widthInternal() const; - int heightInternal() const; - void setContentSizeInternal(int width, int height); - void draw(Recorder* recorder) override; - void measureBounds(tgfx::Rect* bounds) override; - bool hasClip() const; - Frame frameDuration() const override; - bool cacheFilters() const override; - void invalidateCacheScale() override; - void onAddToStage(PAGStage* pagStage) override; - void onRemoveFromStage() override; - void onAddToRootFile(PAGFile* pagFile) override; - void onRemoveFromRootFile() override; - void onTimelineChanged() override; - void updateRootLocker(std::shared_ptr locker) override; - virtual bool doAddLayer(std::shared_ptr pagLayer, int index); - virtual std::shared_ptr doRemoveLayer(int index); - - private: - VectorComposition* emptyComposition = nullptr; - - static void FindLayers(std::function filterFunc, - std::vector>* result, - std::shared_ptr pagLayer); - static void MeasureChildLayer(tgfx::Rect* bounds, PAGLayer* childLayer); - static void DrawChildLayer(Recorder* recorder, PAGLayer* childLayer); - static bool GetTrackMatteLayerAtPoint(PAGLayer* childLayer, float x, float y, - std::vector>* results); - static bool GetChildLayerAtPoint(PAGLayer* childLayer, float x, float y, - std::vector>* results); - - bool getLayersUnderPointInternal(float x, float y, - std::vector>* results); - int getLayerIndexInternal(std::shared_ptr child) const; - void doSwapLayerAt(int index1, int index2); - void doSetLayerIndex(std::shared_ptr pagLayer, int index); - bool doContains(PAGLayer* layer) const; - void updateDurationAndFrameRate(); - - friend class PAGLayer; - - friend class PAGFile; - - friend class RenderCache; - - friend class PAGStage; - - friend class PAGPlayer; - - friend class PAGImageLayer; - - friend class FileReporter; - - friend class AudioClip; - - friend class PAGDecoder; -}; - -class PAG_API PAGFile : public PAGComposition { - public: - /** - * The maximum tag level current SDK supports. - */ - static uint16_t MaxSupportedTagLevel(); - /** - * Load a pag file from byte data, return null if the bytes is empty or it's not a valid pag - * file. - */ - static std::shared_ptr Load(const void* bytes, size_t length, - const std::string& filePath = "", - const std::string& password = ""); - /** - * Load a pag file from path, return null if the file does not exist or the data is not a pag - * file. - */ - static std::shared_ptr Load(const std::string& filePath, - const std::string& password = ""); - - PAGFile(std::shared_ptr file, PreComposeLayer* layer); - - /** - * The tag level this pag file requires. - */ - uint16_t tagLevel(); - - /** - * The number of replaceable texts. - */ - int numTexts(); - - /** - * The number of replaceable images. - */ - int numImages(); - - /** - * The number of video compositions. - */ - int numVideos(); - - /** - * The path string of this file, returns empty string if the file is loaded from byte stream. - */ - std::string path() const; - - /** - * Get a text data of the specified index. The index ranges from 0 to numTexts - 1. - * Note: It always returns the default text data. - */ - std::shared_ptr getTextData(int editableTextIndex); - - /** - * Replace the text data of the specified index. The index ranges from 0 to PAGFile.numTexts - 1. - * Passing in null for the textData parameter will reset it to default text data. - */ - void replaceText(int editableTextIndex, std::shared_ptr textData); - - /** - * Replace file's image content of the specified index with a PAGImage object. The index ranges from - * 0 to PAGFile.numImages - 1. Passing in null for the image parameter will reset it to default - * image content. - */ - void replaceImage(int editableImageIndex, std::shared_ptr image); - - /** - * Replace file's image content of the specified layer name with a PAGImage object. - * Passing in null for the image parameter will reset it to default image content. - */ - void replaceImageByName(const std::string& layerName, std::shared_ptr image); - - /** - * Return an array of layers by specified editable index and layer type. - */ - std::vector> getLayersByEditableIndex(int editableIndex, - LayerType layerType); - - /** - * Returns the indices of the editable layers in this PAGFile. - * If the editableIndex of a PAGLayer is not present in the returned indices, the PAGLayer should - * not be treated as editable. - */ - std::vector getEditableIndices(LayerType layerType); - - /** - * Indicate how to stretch the original duration to fit target duration when file's duration is - * changed. The default value is PAGTimeStretchMode::Repeat. - */ - PAGTimeStretchMode timeStretchMode() const; - - /** - * Set the timeStretchMode of this file. - */ - void setTimeStretchMode(PAGTimeStretchMode value); - - /** - * Set the duration of this PAGFile. Passing a value less than or equal to 0 resets the duration - * to its default value. - */ - void setDuration(int64_t duration); - - /** - * Make a copy of the original file, any modification to current file has no effect on the result - * file. - */ - std::shared_ptr copyOriginal(); - - bool isPAGFile() const override; - - protected: - bool gotoTime(int64_t layerTime) override; - Frame childFrameToLocal(Frame childFrame, float childFrameRate) const override; - Frame localFrameToChild(Frame localFrame, float childFrameRate) const override; - std::vector> getLayersByEditableIndexInternal(int editableIndex, - LayerType layerType); - Frame stretchedFrameDuration() const override; - Frame stretchedContentFrame() const override; - - private: - static std::shared_ptr MakeFrom(std::shared_ptr file); - static std::shared_ptr BuildPAGLayer(std::shared_ptr file, pag::Layer* layer); - - void setDurationInternal(int64_t duration); - Frame stretchedFrameToFileFrame(Frame stretchedFrame) const; - int64_t stretchedTimeToFileTime(int64_t stretchedTime) const; - Frame scaledFrameToFileFrame(Frame scaledFrame, const TimeRange& scaledTimeRange) const; - Frame fileFrameToStretchedFrame(Frame fileFrame) const; - Frame fileFrameToScaledFrame(Frame fileFrame, const TimeRange& scaledTimeRange) const; - void replaceTextInternal(const std::vector>& textLayers, - std::shared_ptr textData); - void replaceImageInternal(const std::vector>& imageLayers, - std::shared_ptr image); - PAGTimeStretchMode timeStretchModeInternal() const; - - Frame _stretchedContentFrame = 0; - Frame _stretchedFrameDuration = 1; - PAGTimeStretchMode _timeStretchMode = PAGTimeStretchMode::Repeat; - - friend class PAGImageLayer; - - friend class LayerRenderer; - - friend class AudioClip; - - friend class HardwareDecoder; -}; - -class Composition; - -class PAGPlayer; - -class GLRestorer; - -class PAG_API PAGSurface { - public: - /** - * Creates a new PAGSurface from specified Drawable, Returns nullptr if drawable is nullptr. - */ - static std::shared_ptr MakeFrom(std::shared_ptr drawable); - - /** - * Creates a new PAGSurface from specified backend render target and origin. The PAGSurface uses - * the GPU context on the calling thread directly. Returns null if the render target is invalid. - */ - static std::shared_ptr MakeFrom(const BackendRenderTarget& renderTarget, - ImageOrigin origin); - - /** - * Creates a new PAGSurface from specified backend texture and origin. Note, the texture must not - * be bound to any frame buffer. Passes true in the forAsyncThread parameter if the returned - * PAGSurface needs to be used for asynchronous rendering. If passing true, the PAGSurface - * internally creates an independent GPU context, and the caller can use semaphore objects to - * synchronize content (see flushAndSignalSemaphore() and wait()), otherwise, it uses the GPU - * context on the calling thread directly. Returns null if the texture is invalid. - */ - static std::shared_ptr MakeFrom(const BackendTexture& texture, ImageOrigin origin, - bool forAsyncThread = false); - - /** - * Creates a new PAGSurface for off-screen rendering. Allocates memory for pixels, based on the - * width and height, which can be accessed by readPixels(). Returns null if the specified size - * is not valid. - */ - static std::shared_ptr MakeOffscreen(int width, int height); - - /** - * Creates a new PAGSurface from specified hardware buffer. Returns null if the hardware buffer - * is invalid. - */ - static std::shared_ptr MakeFrom(HardwareBufferRef hardwareBuffer); - - virtual ~PAGSurface() = default; - - /** - * Returns the width in pixels of the surface. - */ - int width(); - - /** - * Returns the height in pixels of the surface. - */ - int height(); - - /** - * Update the size of the surface, and reset the internal surface. - */ - void updateSize(); - - /** - * Erases all pixels of the surface with transparent color. Returns true if the content has - * changed. - */ - bool clearAll(); - - /** - * Free the cache created by the surface immediately. Can be called to reduce memory pressure. - */ - void freeCache(); - - /** - * Retrieves the backing hardware buffer. This method does not acquire any additional reference to - * the returned hardware buffer. Returns nullptr if the PAGSurface is not created from a hardware - * buffer. - */ - HardwareBufferRef getHardwareBuffer(); - - /** - * Copies pixels from current PAGSurface to dstPixels with specified color type, alpha type and - * row bytes. Returns true if pixels are copied to dstPixels. - */ - bool readPixels(ColorType colorType, AlphaType alphaType, void* dstPixels, size_t dstRowBytes); - - protected: - explicit PAGSurface(std::shared_ptr drawable, bool externalContext = false); - - virtual void onDraw(std::shared_ptr graphic, std::shared_ptr surface, - RenderCache* cache); - virtual void onFreeCache(); - - private: - uint32_t contentVersion = 0; - PAGPlayer* pagPlayer = nullptr; - std::shared_ptr rootLocker = nullptr; - std::shared_ptr drawable = nullptr; - bool externalContext = false; - GLRestorer* glRestorer = nullptr; - - bool draw(RenderCache* cache, std::shared_ptr graphic, BackendSemaphore* signalSemaphore, - bool autoClear = true); - bool prepare(RenderCache* cache, std::shared_ptr graphic); - bool hitTest(RenderCache* cache, std::shared_ptr graphic, float x, float y); - tgfx::Context* lockContext(); - void unlockContext(); - bool wait(const BackendSemaphore& waitSemaphore); - - BackendTexture getFrontTexture(); - BackendTexture getBackTexture(); - HardwareBufferRef getFrontHardwareBuffer(); - HardwareBufferRef getBackHardwareBuffer(); - - friend class PAGPlayer; - - friend class FileReporter; - - friend class PAGSurfaceExt; -}; - -class FileReporter; - -class PAG_API PAGPlayer { - public: - PAGPlayer(); - - virtual ~PAGPlayer(); - - /** - * Returns the current PAGComposition for PAGPlayer to render as content. - */ - std::shared_ptr getComposition(); - - /** - * Sets a new PAGComposition for PAGPlayer to render as content. - * Note: If the composition is already added to another PAGPlayer, it will be removed from the - * previous PAGPlayer. - */ - void setComposition(std::shared_ptr newComposition); - - /** - * Returns the PAGSurface object for PAGPlayer to render onto. - */ - std::shared_ptr getSurface(); - - /** - * Set the PAGSurface object for PAGPlayer to render onto. - */ - void setSurface(std::shared_ptr newSurface); - - /** - * If set to false, PAGPlayer skips rendering for video composition. - */ - bool videoEnabled(); - - /** - * Set the value of videoEnabled property. - */ - void setVideoEnabled(bool value); - - /** - * If set to true, PAGPlayer caches an internal bitmap representation of the static content for - * each layer. This caching can increase performance for layers that contain complex vector - * content. The execution speed can be significantly faster depending on the complexity of the - * content, but it requires extra graphics memory. The default value is true. - */ - bool cacheEnabled(); - - /** - * Set the value of cacheEnabled property. - */ - void setCacheEnabled(bool value); - - /** - * If set to true, PAG will cache the associated rendering data into a disk file, such as the - * decoded image frames of video compositions. This can help reduce memory usage and improve - * rendering performance. - */ - bool useDiskCache(); - - /** - * Set the value of useDiskCache property. - */ - void setUseDiskCache(bool value); - - /** - * This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0. The - * scale factors less than 1.0 may result in blurred output, but it can reduce the usage of - * graphics memory which leads to better performance. The default value is 1.0. - */ - float cacheScale(); - - /** - * Set the value of cacheScale property. - */ - void setCacheScale(float value); - - /** - * The maximum frame rate for rendering, ranges from 1 to 60. If set to a value less than the - * actual frame rate from composition, it drops frames but increases performance. Otherwise, it - * has no effect. The default value is 60. - */ - float maxFrameRate(); - - /** - * Sets the maximum frame rate for rendering. - */ - void setMaxFrameRate(float value); - - /** - * Returns the current scale mode. - */ - PAGScaleMode scaleMode(); - - /** - * Specifies the rule of how to scale the pag content to fit the surface size. The matrix - * changes when this method is called. - */ - void setScaleMode(PAGScaleMode mode); - - /** - * Returns a copy of the current matrix. - */ - Matrix matrix(); - - /** - * Sets the transformation which will be applied to the composition. The scaleMode property - * will be set to PAGScaleMode::None when this method is called. - */ - void setMatrix(const Matrix& matrix); - - /** - * The duration of composition in microseconds. - */ - int64_t duration(); - - /** - * Set the progress of play position to next frame. It is applied only when the composition is not - * null. - */ - void nextFrame(); - - /** - * Set the progress of play position to previous frame. It is applied only when the composition is - * not null. - */ - void preFrame(); - - /** - * Returns the current progress of play position, the value is from 0.0 to 1.0. - */ - double getProgress(); - - /** - * Sets the progress of play position, the value ranges from 0.0 to 1.0. It is applied only when - * the composition is not null. - */ - void setProgress(double percent); - - /** - * Returns the current frame. - */ - Frame currentFrame() const; - - /** - * If true, PAGPlayer clears the whole content of PAGSurface before drawing anything new to it. - * The default value is true. - */ - bool autoClear(); - - /** - * Sets the autoClear property. - */ - void setAutoClear(bool value); - - /** - * Prepares the player for the next flush() call. It collects all CPU tasks from the current - * progress of the composition and runs them asynchronously in parallel. It is usually used for - * speeding up the first frame rendering. - */ - void prepare(); - - /** - * Inserts a GPU semaphore that the current GPU-backed API must wait on before executing any more - * commands on the GPU for this player. It is usually called before PAGPlayer.flush(). PAG will - * take ownership of the underlying semaphore and delete it once it has been signaled and waited - * on. If this call returns false, then the GPU back-end will not wait on the passed semaphore, - * and the client will still own the semaphore. Returns true if GPU is waiting on the semaphore. - * It is used when we need to draw a PAGImage which is made from a BackendTexture. - * - * @param waitSemaphore semaphore container - * @returns true if GPU is waiting on semaphore - */ - bool wait(const BackendSemaphore& waitSemaphore); - - /** - * Apply all pending changes to the target surface immediately. Returns true if the content has - * changed. - */ - bool flush(); - - /** - * Apply all pending changes to the target surface immediately. Returns true if the content has - * changed. After issuing all commands, the signalSemaphore will be signaled by the GPU. - * - * If the signalSemaphore is not null and uninitialized, a new semaphore is created and - * initializes BackendSemaphore. - * - * The caller must delete the semaphore returned in signalSemaphore. - * BackendSemaphore can be deleted as soon as this function returns. - * - * If the back-end API is OpenGL only uninitialized backend semaphores are supported. - * - * If signalSemaphore is uninitialized, the GPU back-end did not create or add a semaphore to - * signal on the GPU; the caller should not instruct the GPU to wait on the semaphore. - * - * It is used when the PAGSurface is made from a BackendRenderTarget or BackendTexture. - * - * @param signalSemaphore semaphore container - */ - bool flushAndSignalSemaphore(BackendSemaphore* signalSemaphore); - - /** - * Returns a rectangle in pixels that defines the displaying area of the specified layer, which - * is in the coordinate of the PAGSurface. - */ - Rect getBounds(std::shared_ptr pagLayer); - - /** - * Returns an array of layers that lie under the specified point. The point is in the coordinate - * space of the PAGSurface. - */ - std::vector> getLayersUnderPoint(float surfaceX, float surfaceY); - - /** - * Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point - * is in the coordinate space of the PAGSurface, not the PAGComposition that contains the - * PAGLayer. It always returns false if the PAGLayer or its parent (or parent's parent...) has not - * been added to this PAGPlayer. The pixelHitTest parameter indicates whether or not to check - * against the actual pixels of the object (true) or the bounding box (false). Returns true if the - * PAGLayer overlaps or intersects with the specified point. - */ - bool hitTestPoint(std::shared_ptr pagLayer, float surfaceX, float surfaceY, - bool pixelHitTest = false); - - /** - * The time cost by rendering in microseconds. - */ - int64_t renderingTime(); - - /** - * The time cost by image decoding in microseconds. - */ - int64_t imageDecodingTime(); - - /** - * The time cost by presenting in microseconds. - */ - int64_t presentingTime(); - - /** - * The memory cost by graphics in bytes. - */ - int64_t graphicsMemory(); - - protected: - std::shared_ptr rootLocker = nullptr; - std::shared_ptr stage = nullptr; - RenderCache* renderCache = nullptr; - std::shared_ptr pagSurface = nullptr; - uint32_t contentVersion = 0; - std::shared_ptr lastGraphic = nullptr; - - virtual void updateScaleModeIfNeed(); - virtual bool flushInternal(BackendSemaphore* signalSemaphore); - - private: - FileReporter* reporter = nullptr; - float _maxFrameRate = 60; - PAGScaleMode _scaleMode = PAGScaleMode::LetterBox; - bool _autoClear = true; - - bool updateStageSize(); - void setSurfaceInternal(std::shared_ptr newSurface); - int64_t getTimeStampInternal(); - void prepareInternal(); - int64_t durationInternal(); - - friend class PAGSurface; -}; - -class SequenceFile; -class CompositionReader; -class BitmapBuffer; - -/** - * PAGDecoder provides a utility to read image frames directly from a PAGComposition, and caches the - * image frames as a sequence file on the disk, which may significantly speed up the reading process - * depending on the complexity of the PAG files. You can use the PAGDiskCache::SetMaxDiskSize() - * method to manage the cache limit of the disk usage. - */ -class PAG_API PAGDecoder { - public: - /** - * Creates a PAGDecoder with a PAGComposition, a frame rate limit, and a scale factor for the - * decoded image size. Please only keep an external reference to the PAGComposition if you need to - * modify it in the feature. Otherwise, the internal composition will not be released - * automatically after the associated disk cache is complete, which may cost more memory than - * necessary. Returns nullptr if the composition is nullptr. Note that the returned PAGDecoder may - * become invalid if the associated PAGComposition is added to a PAGPlayer or another PAGDecoder. - */ - static std::shared_ptr MakeFrom(std::shared_ptr composition, - float maxFrameRate = 30.0f, float scale = 1.0f); - - ~PAGDecoder(); - - /** - * Returns the width of decoded image frames. - */ - int width() const { - return _width; - } - - /** - * Returns the height of decoded image frames. - */ - int height() const { - return _height; - } - - /** - * Returns the number of frames in the PAGDecoder. Note that the value may change if the - * associated PAGComposition was modified. - */ - int numFrames(); - - /** - * Returns the frame rate of decoded image frames. The value may change if the associated - * PAGComposition was modified. - */ - float frameRate(); - - /** - * Returns true if the frame at the given index has changed since the last readFrame() call. The - * caller should skip the corresponding reading call if the frame has not changed. - */ - bool checkFrameChanged(int index); - - /** - * Reads pixels of the image frame at the given index into the specified memory address. Returns - * false if failed. Note that caller must ensure that colorType, alphaType, and dstRowBytes stay - * the same throughout every reading call. Otherwise, it may return false. - */ - bool readFrame(int index, void* pixels, size_t rowBytes, - ColorType colorType = ColorType::RGBA_8888, - AlphaType alphaType = AlphaType::Premultiplied); - - /** - * Reads pixels of the image frame at the given index into the specified HardwareBuffer. Returns - * false if failed. Reading image frames into HardwareBuffer usually has better performance than - * reading into memory. - */ - bool readFrame(int index, HardwareBufferRef hardwareBuffer); - - private: - std::mutex locker = {}; - int _width = 0; - int _height = 0; - int _numFrames = 0; - float _frameRate = 30.0f; - float maxFrameRate = 30.0f; - int lastReadIndex = -1; - tgfx::ImageInfo* lastImageInfo = nullptr; - uint32_t lastContentVersion = 0; - std::shared_ptr container = nullptr; - std::shared_ptr sequenceFile = nullptr; - std::shared_ptr reader = nullptr; - std::vector staticTimeRanges = {}; - std::function)> cacheKeyGeneratorFun = - nullptr; - - static Composition* GetSingleComposition(std::shared_ptr pagComposition); - static std::pair GetFrameCountAndRate(std::shared_ptr pagComposition, - float maxFrameRate); - static std::vector GetStaticTimeRange(std::shared_ptr composition, - int numFrames); - - PAGDecoder(std::shared_ptr composition, int width, int height, int numFrames, - float frameRate, float maxFrameRate); - - bool readFrameInternal(int index, std::shared_ptr bitmap); - bool renderFrame(std::shared_ptr composition, int index, - std::shared_ptr bitmap); - bool checkSequenceFile(std::shared_ptr composition, const tgfx::ImageInfo& info); - void checkCompositionChange(std::shared_ptr composition); - std::string generateCacheKey(std::shared_ptr composition); - std::shared_ptr getComposition(); - void setCacheKeyGeneratorFun( - std::function)> fun); - friend class DiskSequenceReader; -}; - -/** - * Defines methods to manage the disk cache capabilities. - */ -class PAG_API PAGDiskCache { - public: - /** - * Returns the size limit of the disk cache in bytes. The default value is 1 GB. - */ - static size_t MaxDiskSize(); - - /** - * Sets the size limit of the disk cache in bytes, which will triggers the cache cleanup if the - * disk usage exceeds the limit. The opened files are not removed immediately, even if their disk - * usage exceeds the limit, and they will be rechecked after they are closed. - */ - static void SetMaxDiskSize(size_t size); - - /** - * Removes all cached files from the disk. All the opened files will be also removed after they - * are closed. - */ - static void RemoveAll(); -}; - -/** - * Defines methods to control video decoding capabilities of PAG. - */ -class PAG_API PAGVideoDecoder { - public: - /** - * Set the maximum number of hardware video decoders that PAG can create. - */ - static void SetMaxHardwareDecoderCount(int count); - - /** - * Register a software decoder factory to PAG, which can be used to create video decoders for - * decoding video sequences from a pag file, if hardware decoders are not available. - */ - static void RegisterSoftwareDecoderFactory(SoftwareDecoderFactory* decoderFactory); -}; - -class PAG_API PAG { - public: - /** - * Get SDK version information. - */ - static std::string SDKVersion(); -}; - -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/types.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/types.h deleted file mode 100644 index 9a6ed8d..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Headers/pag/types.h +++ /dev/null @@ -1,1730 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "pag/defines.h" - -namespace pag { - -typedef uint32_t ID; -typedef float Percent; // in the range [0 - 1] -typedef uint8_t Opacity; // in the range [0 - 255] -typedef int64_t Frame; - -static constexpr ID ZeroID = 0; -static constexpr Frame ZeroFrame = 0; -static constexpr Opacity Opaque = 255; -static constexpr Opacity Transparent = 0; - -/** - * Concatenates two opacity values. - */ -inline Opacity PAG_API OpacityConcat(Opacity a, Opacity b) { - return static_cast(a * b / 255); -} - -struct RTTR_AUTO_REGISTER_CLASS Color { - uint8_t red, green, blue; // in the range [0 - 255] -}; - -inline bool operator==(const Color& left, const Color& right) { - return left.red == right.red && left.green == right.green && left.blue == right.blue; -} - -inline bool operator!=(const Color& left, const Color& right) { - return !(left == right); -} - -static constexpr Color Black = {0, 0, 0}; -static constexpr Color White = {255, 255, 255}; -static constexpr Color Red = {255, 0, 0}; -static constexpr Color Green = {0, 255, 0}; -static constexpr Color Blue = {0, 0, 255}; - -/** - * TimeRange represents a range of frames. - */ -struct RTTR_AUTO_REGISTER_CLASS TimeRange { - /** - * The start frame of the time range, which is included. - */ - Frame start; - /** - * The end frame of the time range, which is also included. - */ - Frame end; - - Frame duration() const { - return end - start + 1; - } - - bool isValid() const { - return 0 <= start && start <= end; - } - - bool contains(Frame frame) const { - return start <= frame && frame <= end; - } -}; - -/** - * Point holds two 32-bit floating point coordinates. - */ -struct PAG_API Point { - /** - * x-axis value. - */ - float x; - /** - * y-axis value. - */ - float y; - - /** - * Creates a Point set to (0, 0). - */ - static const Point& Zero() { - static const Point zero = Point::Make(0, 0); - return zero; - } - - /** - * Creates a Point with specified x and y value. - */ - static constexpr Point Make(float x, float y) { - return {x, y}; - } - - /** - * Creates a Point with specified x and y value. - */ - static constexpr Point Make(int x, int y) { - return {static_cast(x), static_cast(y)}; - } - - /** - * Returns true if x and y are both zero. - */ - bool isZero() const { - return (0 == x) & (0 == y); - } - - /** - * Sets xValue to x and yValue to y. - */ - void set(float xValue, float yValue) { - x = xValue; - y = yValue; - } - - /** - * Adds offset (dx, dy) to Point. - */ - void offset(float dx, float dy) { - x += dx; - y += dy; - } - - /** - * Returns the Euclidean distance from origin. - */ - float length() const { - return Point::Length(x, y); - } - - /** - * Returns true if a is equivalent to b. - */ - friend bool operator==(const Point& a, const Point& b) { - return a.x == b.x && a.y == b.y; - } - - /** - * Returns true if a is not equivalent to b. - */ - friend bool operator!=(const Point& a, const Point& b) { - return a.x != b.x || a.y != b.y; - } - - /** - * Returns a Point from b to a; computed as (a.fX - b.fX, a.fY - b.fY). - */ - friend Point operator-(const Point& a, const Point& b) { - return {a.x - b.x, a.y - b.y}; - } - - /** - * Returns Point resulting from Point a offset by Point b, computed as: - * (a.fX + b.fX, a.fY + b.fY). - */ - friend Point operator+(const Point& a, const Point& b) { - return {a.x + b.x, a.y + b.y}; - } - - /** - * Returns the Euclidean distance from origin. - */ - static float Length(float x, float y) { - return sqrt(x * x + y * y); - } - - /** - * Returns the Euclidean distance between a and b. - */ - static float Distance(const Point& a, const Point& b) { - return Length(a.x - b.x, a.y - b.y); - } -}; - -/** - * Point holds three 32-bit floating point coordinates. - */ -struct PAG_API Point3D { - /** - * x-axis value. - */ - float x; - /** - * y-axis value. - */ - float y; - /** - * z-axis value. - */ - float z; - - /** - * Creates a Point set to (0, 0, 0). - */ - static const Point3D& Zero() { - static const Point3D zero = Point3D::Make(0, 0, 0); - return zero; - } - - /** - * Creates a Point with specified x y z value. - */ - static constexpr Point3D Make(float x, float y, float z) { - return {x, y, z}; - } - - /** - * Returns true if x y z are all zero. - */ - bool isZero() const { - return (0 == x) & (0 == y) & (0 == z); - } - - /** - * Sets xValue to x, yValue to y and zValue to z. - */ - void set(float xValue, float yValue, float zValue) { - x = xValue; - y = yValue; - z = zValue; - } - - /** - * Adds offset (dx, dy, dz) to Point. - */ - void offset(float dx, float dy, float dz) { - x += dx; - y += dy; - z += dz; - } - - /** - * Returns the Euclidean distance from origin. - */ - float length() const { - return Point3D::Length(x, y, z); - } - - /** - * Returns true if a is equivalent to b. - */ - friend bool operator==(const Point3D& a, const Point3D& b) { - return a.x == b.x && a.y == b.y && a.z == b.z; - } - - /** - * Returns true if a is not equivalent to b. - */ - friend bool operator!=(const Point3D& a, const Point3D& b) { - return a.x != b.x || a.y != b.y || a.z != b.z; - } - - /** - * Returns a Point from b to a; computed as (a.fX - b.fX, a.fY - b.fY, a.fZ - b.fZ). - */ - friend Point3D operator-(const Point3D& a, const Point3D& b) { - return {a.x - b.x, a.y - b.y, a.z - b.z}; - } - - /** - * Returns Point resulting from Point a offset by Point b, computed as: - * (a.x + b.x, a.y + b.y, a.z + b.z). - */ - friend Point3D operator+(const Point3D& a, const Point3D& b) { - return {a.x + b.x, a.y + b.y, a.z + b.z}; - } - - /** - * Returns the Euclidean distance from origin. - */ - static float Length(float x, float y, float z) { - return sqrt(x * x + y * y + z * z); - } - - /** - * Returns the Euclidean distance between a and b. - */ - static float Distance(const Point3D& a, const Point3D& b) { - return Length(a.x - b.x, a.y - b.y, a.z - b.z); - } -}; - -/** - * Rect holds four float coordinates describing the upper and lower bounds of a rectangle. Rect may - * be created from outer bounds or from position, width, and height. Rect describes an area; if its - * right is less than or equal to its left, or if its bottom is less than or equal to its top, it is - * considered empty. - */ -struct PAG_API Rect { - /** - * smaller x-axis bounds. - */ - float left; - /** - * smaller y-axis bounds. - */ - float top; - /** - * larger x-axis bounds. - */ - float right; - /** - * larger y-axis bounds. - */ - float bottom; - - /** - * Returns constructed Rect set to (0, 0, 0, 0). - */ - static constexpr Rect MakeEmpty() { - return {0, 0, 0, 0}; - } - - /** - * Returns constructed Rect set to float values (0, 0, w, h). Does not validate input; w or h may - * be negative. - */ - static constexpr Rect MakeWH(float w, float h) { - return {0, 0, w, h}; - } - - /** - * Returns constructed Rect set to float values (0, 0, w, h). Does not validate input; w or h may - * be negative. - */ - static constexpr Rect MakeWH(int w, int h) { - return {0, 0, static_cast(w), static_cast(h)}; - } - - /** - * Returns constructed Rect set to (l, t, r, b). Does not sort input; Rect may result in left - * greater than right, or top greater than bottom. - */ - static constexpr Rect MakeLTRB(float l, float t, float r, float b) { - return {l, t, r, b}; - } - - /** - * Returns constructed Rect set to (x, y, x + w, y + h). Does not validate input; w or h may be - * negative. - */ - static constexpr Rect MakeXYWH(float x, float y, float w, float h) { - return {x, y, x + w, y + h}; - } - - /** - * Returns true if left is equal to or greater than right, or if top is equal to or greater - * than bottom. Call sort() to reverse rectangles with negative width() or height(). - */ - bool isEmpty() const { - // We write it as the NOT of a non-empty rect, so we will return true if any values - // are NaN. - return !(left < right && top < bottom); - } - - /** - * Returns true if left is equal to or less than right, or if top is equal to or less than - * bottom. Call sort() to reverse rectangles with negative width() or height(). - */ - bool isSorted() const { - return left <= right && top <= bottom; - } - - /** - * Returns left edge of Rect, if sorted. Call isSorted() to see if Rect is valid. Call sort() to - * reverse left and right if needed. - */ - float x() const { - return left; - } - - /** - * Returns top edge of Rect, if sorted. Call isEmpty() to see if Rect may be invalid, and sort() - * to reverse top and bottom if needed. - */ - float y() const { - return top; - } - - /** - * Returns span on the x-axis. This does not check if Rect is sorted, or if result fits in 32-bit - * float; result may be negative or infinity. - */ - float width() const { - return right - left; - } - - /** - * Returns span on the y-axis. This does not check if Rect is sorted, or if result fits in 32-bit - * float; result may be negative or infinity. - */ - float height() const { - return bottom - top; - } - - /** - * Returns average of left edge and right edge. Result does not change if Rect is sorted. - */ - float centerX() const { - // don't use (left + bottom) * 0.5f as that might overflow before the 0.5f - return left * 0.5f + right * 0.5f; - } - - /** - * Returns average of top edge and bottom edge. Result does not change if Rect is sorted. - */ - float centerY() const { - // don't use (top + bottom) * 0.5f as that might overflow before the 0.5f - return top * 0.5f + bottom * 0.5f; - } - - /** - * Returns true if all members in a: left, top, right, and bottom; are equal to the - * corresponding members in b. - * a and b are not equal if either contain NaN. a and b are equal if members contain zeroes with - * different signs. - */ - friend bool operator==(const Rect& a, const Rect& b) { - return a.left == b.left && a.right == b.right && a.top == b.top && a.bottom == b.bottom; - } - - /** - * Returns true if any in a: left, top, right, and bottom; does not equal the corresponding - * members in b. - * a and b are not equal if either contain NaN. a and b are equal if members contain zeroes with - * different signs. - */ - friend bool operator!=(const Rect& a, const Rect& b) { - return a.left != b.left || a.right != b.right || a.top != b.top || a.bottom != b.bottom; - } - - /** - * Sets Rect to (0, 0, 0, 0). - */ - void setEmpty() { - *this = MakeEmpty(); - } - - /** - * Sets Rect to (left, top, right, bottom). left and right are not sorted; left is not necessarily - * less than right. top and bottom are not sorted; top is not necessarily less than bottom. - */ - void setLTRB(float l, float t, float r, float b) { - left = l; - top = t; - right = r; - bottom = b; - } - - /** - * Sets to bounds of Point array with count entries. Returns false if count is zero or smaller, or - * if Point array contains an infinity or NaN; in these cases sets Rect to (0, 0, 0, 0). - * Result is either empty or sorted: left is less than or equal to right, and top is less than - * or equal to bottom. - */ - bool setBounds(const Point pts[], int count); - - /** - * Sets Rect to (x, y, x + width, y + height). Does not validate input; width or height may be - * negative. - */ - void setXYWH(float x, float y, float width, float height) { - left = x; - top = y; - right = x + width; - bottom = y + height; - } - - /** - * Sets Rect to (0, 0, width, height). Does not validate input, width or height may be negative. - */ - void setWH(float width, float height) { - left = 0; - top = 0; - right = width; - bottom = height; - } - - /** - * Returns Rect offset by (dx, dy). - * If dx is negative, Rect returned is moved to the left. - * If dx is positive, Rect returned is moved to the right. - * If dy is negative, Rect returned is moved upward. - * If dy is positive, Rect returned is moved downward. - */ - Rect makeOffset(float dx, float dy) const { - return MakeLTRB(left + dx, top + dy, right + dx, bottom + dy); - } - - /** - * Returns Rect, inset by (dx, dy). - * If dx is negative, Rect returned is wider. - * If dx is positive, Rect returned is narrower. - * If dy is negative, Rect returned is taller. - * If dy is positive, Rect returned is shorter. - */ - Rect makeInset(float dx, float dy) const { - return MakeLTRB(left + dx, top + dy, right - dx, bottom - dy); - } - - /** - * Returns Rect, outset by (dx, dy). - * If dx is negative, Rect returned is narrower. - * If dx is positive, Rect returned is wider. - * If dy is negative, Rect returned is shorter. - * If dy is positive, Rect returned is taller. - */ - Rect makeOutset(float dx, float dy) const { - return MakeLTRB(left - dx, top - dy, right + dx, bottom + dy); - } - - /** - * Offsets Rect by adding dx to left, right; and by adding dy to top, bottom. - * If dx is negative, moves Rect to the left. - * If dx is positive, moves Rect to the right. - * If dy is negative, moves Rect upward. - * If dy is positive, moves Rect downward. - */ - void offset(float dx, float dy) { - left += dx; - top += dy; - right += dx; - bottom += dy; - } - - /** - * Offsets Rect by adding delta.fX to left, right; and by adding delta.y to top, bottom. - * If delta.x is negative, moves Rect to the left. - * If delta.x is positive, moves Rect to the right. - * If delta.y is negative, moves Rect upward. - * If delta.y is positive, moves Rect downward. - */ - void offset(const Point& delta) { - this->offset(delta.x, delta.y); - } - - /** - * Offsets Rect so that left equals newX, and top equals newY. width and height are unchanged. - */ - void offsetTo(float newX, float newY) { - right += newX - left; - bottom += newY - top; - left = newX; - top = newY; - } - - /** - * Insets Rect by (dx, dy). - * If dx is positive, makes Rect narrower. - * If dx is negative, makes Rect wider. - * If dy is positive, makes Rect shorter. - * If dy is negative, makes Rect taller. - */ - void inset(float dx, float dy) { - left += dx; - top += dy; - right -= dx; - bottom -= dy; - } - - /** - * Outsets Rect by (dx, dy). - * If dx is positive, makes Rect wider. - * If dx is negative, makes Rect narrower. - * If dy is positive, makes Rect taller. - * If dy is negative, makes Rect shorter. - */ - void outset(float dx, float dy) { - this->inset(-dx, -dy); - } - - /** - * Scale the rectangle by scaleX and scaleY. - */ - void scale(float scaleX, float scaleY); - - /** - * Returns true if Rect intersects r, and sets Rect to intersection. Returns false if Rect does - * not intersect r, and leaves Rect unchanged. Returns false if either r or Rect is empty, leaving - * Rect unchanged. - */ - bool intersect(const Rect& r) { - return this->intersect(r.left, r.top, r.right, r.bottom); - } - - /** - * Constructs Rect to intersect from (left, top, right, bottom). Does not sort construction. - * Returns true if Rect intersects construction, and sets Rect to intersection. - * Returns false if Rect does not intersect construction, and leaves Rect unchanged. - * Returns false if either construction or Rect is empty, leaving Rect unchanged. - */ - bool intersect(float l, float t, float r, float b); - - /** - * Returns true if a intersects b, and sets Rect to intersection. - * Returns false if a does not intersect b, and leaves Rect unchanged. - * Returns false if either a or b is empty, leaving Rect unchanged. - */ - bool intersect(const Rect& a, const Rect& b); - - /** - * Constructs Rect to intersect from (left, top, right, bottom). Does not sort construction. - * Returns true if Rect intersects construction. - * Returns false if either construction or Rect is empty, or do not intersect. - */ - bool intersects(float l, float t, float r, float b) const; - - /** - * Returns true if Rect intersects r. Returns false if either r or Rect is empty, or do not - * intersect. - */ - bool intersects(const Rect& r) const; - - /** - * Returns true if a intersects b. Returns false if either a or b is empty, or do not intersect. - */ - static bool Intersects(const Rect& a, const Rect& b); - - /** - * Constructs Rect to intersect from (left, top, right, bottom). Does not sort construction. - * Sets Rect to the union of itself and the construction. Has no effect if construction is empty. - * Otherwise, if Rect is empty, sets Rect to construction. - */ - void join(float l, float t, float r, float b); - - /** - * Sets Rect to the union of itself and r. Has no effect if r is empty. Otherwise, if Rect is - * empty, sets Rect to r. - */ - void join(const Rect& r) { - this->join(r.left, r.top, r.right, r.bottom); - } - - /** - * Returns true if: left <= x < right && top <= y < bottom. Returns false if Rect is empty. - */ - bool contains(float x, float y) const { - return x >= left && x < right && y >= top && y < bottom; - } - - /** - * Returns true if Rect contains r. Returns false if Rect is empty or r is empty. Rect contains r - * when Rect area completely includes r area. - */ - bool contains(const Rect& r) const { - return left <= r.left && top <= r.top && right >= r.right && bottom >= r.bottom; - } - - /** - * Sets Rect by discarding the fractional portion of left and top; and rounding up right and - * bottom. - */ - void roundOut(); - - /** - * Sets Rect by rounding of left, top, right and bottom. - */ - void round(); - - /** - * Swaps left and right if left is greater than right; and swaps top and bottom if top is - * greater than bottom. Result may be empty; and width() and height() will be zero or positive. - */ - void sort(); - - /** - * Returns Rect with left and right swapped if left is greater than right, and with top and - * bottom swapped if top is greater than bottom. Result may be empty, and width() and height() - * will be zero or positive. - */ - Rect makeSorted() const; -}; - -/*** - * Matrix holds a 3x3 matrix for transforming coordinates. This allows mapping Point and vectors - * with translation, scaling, skewing, rotation, and perspective. - * Matrix elements are in row major order. Matrix does not have a constructor, so it must be - * explicitly initialized. setIdentity() initializes Matrix so it has no effect. - * setTranslate(), setScale(), setSkew(), setRotate(), set9 and setAll() initializes all Matrix - * elements with the corresponding mapping. - */ -class PAG_API Matrix { - public: - /** - * Sets Matrix to scale by (sx, sy). Returned matrix is: - * - * | sx 0 0 | - * | 0 sy 0 | - * | 0 0 1 | - * - * @param sx horizontal scale factor - * @param sy vertical scale factor - * @return Matrix with the scale factors. - */ - static Matrix MakeScale(float sx, float sy) { - Matrix m = {}; - m.setScale(sx, sy); - return m; - } - - /** - * Sets Matrix to scale by (scale, scale). Returned matrix is: - * - * | scale 0 0 | - * | 0 scale 0 | - * | 0 0 1 | - * - * @param scale horizontal and vertical scale factor - * @return Matrix with the scale factors. - */ - static Matrix MakeScale(float scale) { - Matrix m = {}; - m.setScale(scale, scale); - return m; - } - - /** - * Sets Matrix to translate by (dx, dy). Returned matrix is: - * - * | 1 0 dx | - * | 0 1 dy | - * | 0 0 1 | - * - * @param dx horizontal translation - * @param dy vertical translation - * @return Matrix with translation - */ - static Matrix MakeTrans(float dx, float dy) { - Matrix m = {}; - m.setTranslate(dx, dy); - return m; - } - - /** - * Sets Matrix to: - * - * | scaleX skewX transX | - * | skewY scaleY transY | - * | pers0 pers1 pers2 | - * - * @param scaleX horizontal scale factor - * @param skewX horizontal skew factor - * @param transX horizontal translation - * @param skewY vertical skew factor - * @param scaleY vertical scale factor - * @param transY vertical translation - * @param pers0 input x-axis perspective factor - * @param pers1 input y-axis perspective factor - * @param pers2 perspective scale factor - * @return Matrix constructed from parameters - */ - static Matrix MakeAll(float scaleX, float skewX, float transX, float skewY, float scaleY, - float transY, float pers0, float pers1, float pers2) { - Matrix m = {}; - m.setAll(scaleX, skewX, transX, skewY, scaleY, transY, pers0, pers1, pers2); - return m; - } - - /** - * Returns true if Matrix is identity. The identity matrix is: - * - * | 1 0 0 | - * | 0 1 0 | - * | 0 0 1 | - * - * @return Returns true if the Matrix has no effect - */ - bool isIdentity() const; - - /** - * Returns one matrix value. - */ - float operator[](int index) const; - - /** - * Returns one matrix value. - */ - float get(int index) const; - - /** - * Returns the scale factor multiplied by x-axis input, contributing to x-axis output. With - * mapPoints(), scales Point along the x-axis. - * @return horizontal scale factor - */ - float getScaleX() const { - return values[SCALE_X]; - } - - /** - * Returns the scale factor multiplied by y-axis input, contributing to y-axis output. With - * mapPoints(), scales Point along the y-axis. - * @return vertical scale factor - */ - float getScaleY() const { - return values[SCALE_Y]; - } - - /** - * Returns the scale factor multiplied by x-axis input, contributing to y-axis output. With - * mapPoints(), skews Point along the y-axis. Skewing both axes can rotate Point. - * @return vertical skew factor - */ - float getSkewY() const { - return values[SKEW_Y]; - } - - /** - * Returns the scale factor multiplied by y-axis input, contributing to x-axis output. With - * mapPoints(), skews Point along the x-axis. Skewing both axes can rotate Point. - * @return horizontal scale factor - */ - float getSkewX() const { - return values[SKEW_X]; - } - - /** - * Returns translation contributing to x-axis output. With mapPoints(), moves Point along the - * x-axis. - * @return horizontal translation factor - */ - float getTranslateX() const { - return values[TRANS_X]; - } - - /** - * Returns translation contributing to y-axis output. With mapPoints(), moves Point along the - * y-axis. - * @return vertical translation factor - */ - float getTranslateY() const { - return values[TRANS_Y]; - } - - /** - * Returns writable Matrix value. - */ - float& operator[](int index); - - /** - * Sets Matrix value. - */ - void set(int index, float value); - - /** - * Sets horizontal scale factor. - * @param v horizontal scale factor to store - */ - void setScaleX(float v); - - /** - * Sets the vertical scale factor. - * @param v vertical scale factor to store - */ - void setScaleY(float v); - - /** - * Sets vertical skew factor. - * @param v vertical skew factor to store - */ - void setSkewY(float v); - - /** - * Sets the horizontal skew factor. - * @param v horizontal skew factor to store - */ - void setSkewX(float v); - - /** - * Sets horizontal translation. - * @param v horizontal translation to store - */ - void setTranslateX(float v); - - /** - * Sets vertical translation. - * @param v vertical translation to store - */ - void setTranslateY(float v); - - /** - * Sets all values from parameters. Sets matrix to: - * - * | scaleX skewX transX | - * | skewY scaleY transY | - * | persp0 persp1 persp2 | - * - * @param scaleX horizontal scale factor to store - * @param skewX horizontal skew factor to store - * @param transX horizontal translation to store - * @param skewY vertical skew factor to store - * @param scaleY vertical scale factor to store - * @param transY vertical translation to store - * @param persp0 input x-axis values perspective factor to store - * @param persp1 input y-axis values perspective factor to store - * @param persp2 perspective scale factor to store - */ - void setAll(float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, - float persp0, float persp1, float persp2); - - /** - * Sets the Matrix to affine values, passed in column major order: - * - * | a c tx | - * | b d ty | - * | 0 1 | - * - * @param a horizontal scale factor - * @param b vertical skew factor - * @param c horizontal skew factor - * @param d vertical scale factor - * @param tx horizontal translation - * @param ty vertical translation - */ - void setAffine(float a, float b, float c, float d, float tx, float ty); - - /** - * Copies nine scalar values contained by Matrix into buffer, in member value ascending order: - * ScaleX, SkewX, TransX, SkewY, ScaleY, TransY, Persp0, Persp1, Persp2. - * @param buffer storage for nine scalar values - */ - void get9(float buffer[9]) const; - - /** - * Sets Matrix to nine scalar values in buffer, in member value ascending order: ScaleX, - * SkewX, TransX, SkewY, ScaleY, TransY, Persp0, Persp1, Persp2. - * - * Sets matrix to: - * - * | buffer[0] buffer[1] buffer[2] | - * | buffer[3] buffer[4] buffer[5] | - * | buffer[6] buffer[7] buffer[8] | - * - * @param buffer nine scalar values - */ - void set9(const float buffer[9]); - - /** - * Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to: - * - * | 1 0 0 | - * | 0 1 0 | - * | 0 0 1 | - * - * Also called setIdentity(); use the one that provides better inline documentation. - */ - void reset(); - - /** - * Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to: - * - * | 1 0 0 | - * | 0 1 0 | - * | 0 0 1 | - * - * Also called reset(); use the one that provides better inline documentation. - */ - void setIdentity() { - this->reset(); - } - - /** - * Sets Matrix to translate by (dx, dy). - * @param dx horizontal translation - * @param dy vertical translation - */ - void setTranslate(float dx, float dy); - - /** - * Sets Matrix to scale by sx and sy, about a pivot point at (px, py). The pivot point is - * unchanged when mapped with Matrix. - * @param sx horizontal scale factor - * @param sy vertical scale factor - * @param px pivot on x-axis - * @param py pivot on y-axis - */ - void setScale(float sx, float sy, float px, float py); - - /** - * Sets Matrix to scale by sx and sy about at pivot point at (0, 0). - * @param sx horizontal scale factor - * @param sy vertical scale factor - */ - void setScale(float sx, float sy); - - /** - * Sets Matrix to rotate by degrees about a pivot point at (px, py). The pivot point is - * unchanged when mapped with Matrix. Positive degrees rotates clockwise. - * @param degrees angle of axes relative to upright axes - * @param px pivot on x-axis - * @param py pivot on y-axis - */ - void setRotate(float degrees, float px, float py); - - /** - * Sets Matrix to rotate by degrees about a pivot point at (0, 0). Positive degrees rotates - * clockwise. - * @param degrees angle of axes relative to upright axes - */ - void setRotate(float degrees); - - /** - * Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (px, py). - * The pivot point is unchanged when mapped with Matrix. - * Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). - * Vector length specifies the scale factor. - */ - void setSinCos(float sinV, float cosV, float px, float py); - - /** - * Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (0, 0). - * Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). - * Vector length specifies the scale factor. - */ - void setSinCos(float sinV, float cosV); - - /** - * Sets Matrix to skew by kx and ky, about a pivot point at (px, py). The pivot point is - * unchanged when mapped with Matrix. - * @param kx horizontal skew factor - * @param ky vertical skew factor - * @param px pivot on x-axis - * @param py pivot on y-axis - */ - void setSkew(float kx, float ky, float px, float py); - - /** - * Sets Matrix to skew by kx and ky, about a pivot point at (0, 0). - * @param kx horizontal skew factor - * @param ky vertical skew factor - */ - void setSkew(float kx, float ky); - - /** - * Sets Matrix to Matrix a multiplied by Matrix b. Either a or b may be this. - * - * Given: - * - * | A B C | | J K L | - * a = | D E F |, b = | M N O | - * | G H I | | P Q R | - * - * sets Matrix to: - * - * | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | - * a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | - * | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | - * - * @param a Matrix on the left side of multiply expression - * @param b Matrix on the right side of multiply expression - */ - void setConcat(const Matrix& a, const Matrix& b); - - /** - * Preconcats the matrix with the specified scale. M' = M * S(sx, sy) - */ - void preTranslate(float dx, float dy); - - /** - * Postconcats the matrix with the specified scale. M' = S(sx, sy, px, py) * M - */ - void preScale(float sx, float sy, float px, float py); - - /** - * Preconcats the matrix with the specified scale. M' = M * S(sx, sy) - */ - void preScale(float sx, float sy); - - /** - * Preconcats the matrix with the specified rotation. M' = M * R(degrees, px, py) - */ - void preRotate(float degrees, float px, float py); - - /** - * Preconcats the matrix with the specified rotation. M' = M * R(degrees) - */ - void preRotate(float degrees); - - /** - * Preconcats the matrix with the specified skew. M' = M * K(kx, ky, px, py) - */ - void preSkew(float kx, float ky, float px, float py); - - /** - * Preconcats the matrix with the specified skew. M' = M * K(kx, ky) - */ - void preSkew(float kx, float ky); - - /** - * Preconcats the matrix with the specified matrix. M' = M * other - */ - void preConcat(const Matrix& other); - - /** - * Postconcats the matrix with the specified translation. M' = T(dx, dy) * M - */ - void postTranslate(float dx, float dy); - - /** - * Postconcats the matrix with the specified scale. M' = S(sx, sy, px, py) * M - */ - void postScale(float sx, float sy, float px, float py); - - /** - * Postconcats the matrix with the specified scale. M' = S(sx, sy) * M - */ - void postScale(float sx, float sy); - - /** - * Postconcats the matrix with the specified rotation. M' = R(degrees, px, py) * M - */ - void postRotate(float degrees, float px, float py); - - /** - * Postconcats the matrix with the specified rotation. M' = R(degrees) * M - */ - void postRotate(float degrees); - - /** - * Postconcats the matrix with the specified skew. M' = K(kx, ky, px, py) * M - */ - void postSkew(float kx, float ky, float px, float py); - - /** - * Postconcats the matrix with the specified skew. M' = K(kx, ky) * M - */ - void postSkew(float kx, float ky); - - /** - * Postconcats the matrix with the specified matrix. M' = other * M - */ - void postConcat(const Matrix& other); - - /** - * If this matrix can be inverted, return true and if the inverse is not null, set inverse to be - * the inverse of this matrix. If this matrix cannot be inverted, ignore the inverse and return false. - */ - bool invert(Matrix* inverse) const; - - /** - * Returns true if the Matrix is invertible. - * @return - */ - bool invertible() const; - - /** - * Maps src Point array of length count to dst Point array of equal or greater length. Points are - * mapped by multiplying each Point by Matrix. Given: - * - * | A B C | | x | - * Matrix = | D E F |, pt = | y | - * | G H I | | 1 | - * - * where - * - * for (i = 0; i < count; ++i) { - * x = src[i].fX - * y = src[i].fY - * } - * - * each dst Point is computed as: - * - * |A B C| |x| Ax+By+C Dx+Ey+F - * Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - * |G H I| |1| Gx+Hy+I Gx+Hy+I - * - * src and dst may point to the same storage. - * - * @param dst storage for mapped Point - * @param src Point to transform - * @param count number of Points to transform - */ - void mapPoints(Point dst[], const Point src[], int count) const; - - /** - * Maps pts Point array of length count in place. Point are mapped by multiplying each Point by - * Matrix. Given: - * - * | A B C | | x | - * Matrix = | D E F |, pt = | y | - * | G H I | | 1 | - * - * where - * - * for (i = 0; i < count; ++i) { - * x = pts[i].fX - * y = pts[i].fY - * } - * - * each resulting pts Point is computed as: - * - * |A B C| |x| Ax+By+C Dx+Ey+F - * Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - * |G H I| |1| Gx+Hy+I Gx+Hy+I - * - * @param pts storage for mapped Point - * @param count number of Points to transform - */ - void mapPoints(Point pts[], int count) const { - this->mapPoints(pts, pts, count); - } - - /** - * Maps Point (x, y) to result. Point is mapped by multiplying by Matrix. Given: - * - * | A B C | | x | - * Matrix = | D E F |, pt = | y | - * | G H I | | 1 | - * - * the result is computed as: - * - * |A B C| |x| Ax+By+C Dx+Ey+F - * Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - * |G H I| |1| Gx+Hy+I Gx+Hy+I - * - * @param x x-axis value of Point to map - * @param y y-axis value of Point to map - * @param result storage for mapped Point - */ - void mapXY(float x, float y, Point* result) const; - - /** - * Returns Point (x, y) multiplied by Matrix. Given: - * - * | A B C | | x | - * Matrix = | D E F |, pt = | y | - * | G H I | | 1 | - * - * the result is computed as: - * - * |A B C| |x| Ax+By+C Dx+Ey+F - * Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - * |G H I| |1| Gx+Hy+I Gx+Hy+I - * - * @param x x-axis value of Point to map - * @param y y-axis value of Point to map - * @return mapped Point - */ - Point mapXY(float x, float y) const { - Point result = {}; - this->mapXY(x, y, &result); - return result; - } - - /** - * Sets dst to bounds of src corners mapped by Matrix. - */ - void mapRect(Rect* dst, const Rect& src) const; - - /** - * Sets rect to bounds of rect corners mapped by Matrix. Returns true if mapped corners are - * computed rect corners. - */ - void mapRect(Rect* rect) const { - mapRect(rect, *rect); - } - - /** - * Returns bounds of src corners mapped by Matrix. - */ - Rect mapRect(const Rect& src) const { - Rect dst = {}; - mapRect(&dst, src); - return dst; - } - - /** Compares a and b; returns true if a and b are numerically equal. Returns true even if sign - * of zero values are different. Returns false if either Matrix contains NaN, even if the other - * Matrix also contains NaN. - */ - friend PAG_API bool operator==(const Matrix& a, const Matrix& b); - - /** - * Compares a and b; returns true if a and b are not numerically equal. Returns false even if - * sign of zero values are different. Returns true if either Matrix contains NaN, even if the - * other Matrix also contains NaN. - */ - friend bool operator!=(const Matrix& a, const Matrix& b) { - return !(a == b); - } - - /** - * Returns the minimum scaling factor of the Matrix by decomposing the scaling and skewing - * elements. Returns -1 if scale factor overflows. - */ - float getMinScale() const; - - /** - * Returns the maximum scaling factor of the Matrix by decomposing the scaling and skewing - * elements. Returns -1 if scale factor overflows. - */ - float getMaxScale() const; - - /** - * Returns true if all elements of the matrix are finite. Returns false if any element is - * infinity, or NaN. - */ - bool isFinite() const; - - /** - * Returns reference to const identity Matrix. Returned Matrix is set to: - * - * | 1 0 0 | - * | 0 1 0 | - * | 0 0 1 | - * - * @return const identity Matrix - */ - static const Matrix& I(); - - /** - * Returns reference to a const Matrix with invalid values. Returned Matrix is set to: - * - * | FLT_MAX FLT_MAX FLT_MAX | - * | FLT_MAX FLT_MAX FLT_MAX | - * | 0 0 1 | - * - * @return const invalid Matrix - */ - static const Matrix& Invalid(); - - private: -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-private-field" - float values[6]; - mutable int32_t typeMask; - /** - * Matrix organizes its values in row order. These members correspond to each value in Matrix. - */ - static constexpr int SCALE_X = 0; //!< horizontal scale factor - static constexpr int SKEW_X = 1; //!< horizontal skew factor - static constexpr int TRANS_X = 2; //!< horizontal translation - static constexpr int SKEW_Y = 3; //!< vertical skew factor - static constexpr int SCALE_Y = 4; //!< vertical scale factor - static constexpr int TRANS_Y = 5; //!< vertical translation -#pragma clang diagnostic pop -}; - -/** - * Layers are always one of the following types. - */ -enum class RTTR_AUTO_REGISTER_CLASS LayerType { - Unknown, - Null, - Solid, - Text, - Shape, - Image, - PreCompose, - Camera, -}; - -/** - * Defines the rules on how to scale the content to fit the specified area. - */ -enum class PAG_API PAGScaleMode : uint8_t { - /** - * The content is not scaled. - */ - None = 0, - /** - * The content is stretched to fit. - */ - Stretch = 1, - /** - * The content is scaled with respect to the original unscaled image's aspect ratio. - * This is the default value. - */ - LetterBox = 2, - /** - * The content is scaled to fit with respect to the original unscaled image's aspect ratio. - * This results in cropping on one axis. - */ - Zoom = 3 -}; - -/** - * Defines the rules on how to stretch the timeline of content to fit the specified duration. - */ -enum class PAG_API PAGTimeStretchMode : uint8_t { - /** - * Keep the original playing speed, and display the last frame if the content's duration is less - * than target duration. - */ - None = 0, - /* - * Change the playing speed of the content to fit target duration. - */ - Scale = 1, - /** - * Keep the original playing speed, but repeat the content if the content's duration is less than - * target duration. This is the default mode. - */ - Repeat = 2, - /** - * Keep the original playing speed, but repeat the content in reversed if the content's duration - * is less than target duration. - */ - RepeatInverted = 3 -}; - -enum class PAG_API ParagraphJustification : uint8_t { - LeftJustify = 0, - CenterJustify = 1, - RightJustify = 2, - FullJustifyLastLineLeft = 3, - FullJustifyLastLineRight = 4, - FullJustifyLastLineCenter = 5, - FullJustifyLastLineFull = 6 -}; - -enum class PAG_API TextDirection : uint8_t { - Default = 0, - Horizontal = 1, - Vertical = 2 -}; - -/** - * The Text object stores a value for a TextLayer's Source Text property. - */ -class PAG_API TextDocument { - public: - /** - * When true, the text layer shows a fill. - */ - bool applyFill = true; - - /** - * When true, the text layer shows a stroke. - */ - bool applyStroke = false; - - /** - * Readonly, external modifications are not valid. - */ - float baselineShift = 0; - - /** - * When true, the text layer is paragraph (bounded) text. - * Readonly, external modifications are not valid. - */ - bool boxText = false; - - /** - * Readonly, external modifications are not valid. - */ - Point boxTextPos = Point::Zero(); - - /** - * For box text, the pixel dimensions for the text bounds. - * Readonly, external modifications are not valid. - */ - Point boxTextSize = Point::Zero(); - - /** - * Readonly, external modifications are not valid. - */ - float firstBaseLine = 0; - - bool fauxBold = false; - - bool fauxItalic = false; - /** - * The text layer’s fill color. - */ - Color fillColor = Black; - - /** - * A string with the name of the font family. - **/ - std::string fontFamily = ""; - - /** - * A string with the style information — e.g., “bold”, “italic”. - **/ - std::string fontStyle = ""; - - /** - * The text layer’s font size in pixels. - */ - float fontSize = 24; - - /** - * The text layer’s stroke color. - */ - Color strokeColor = Black; - - /** - * Indicates the rendering order for the fill and stroke of a text layer. - * Readonly, external modifications are not valid. - */ - bool strokeOverFill = true; - - /** - * The text layer’s stroke thickness. - */ - float strokeWidth = 1; - - /** - * The text layer’s Source Text value. - */ - std::string text = ""; - - /** - * The paragraph justification for the text layer. - */ - ParagraphJustification justification = ParagraphJustification::LeftJustify; - - /** - * The space between lines, 0 indicates 'auto', which is fontSize * 1.2 - */ - float leading = 0; - - /** - * The text layer’s spacing between characters. - */ - float tracking = 0; - - /** - * The text layer’s background color - */ - Color backgroundColor = White; - /** - * The text layer’s background alpha. 0 = 100% transparent, 255 = 100% opaque. - */ - uint8_t backgroundAlpha = 0; - - TextDirection direction = TextDirection::Default; -}; - -typedef std::shared_ptr TextDocumentHandle; - -/** - * Marker stores comments and other metadata and mark important times in a composition or layer. - */ -struct RTTR_AUTO_REGISTER_CLASS Marker { - Frame startTime = 0; - Frame duration = 0; - std::string comment; -}; - -/** - * A container for data of bytes. - */ -class PAG_API ByteData { - public: - /** - * Creates a ByteData object from the specified file path. - */ - static std::unique_ptr FromPath(const std::string& filePath); - /** - * Creates a ByteData object and copy the specified data into it. - */ - static std::unique_ptr MakeCopy(const void* data, size_t length); - /** - * Call this when the data parameter is already const and will outlive the lifetime of the - * ByteData. Suitable for with const globals. - */ - static std::unique_ptr MakeWithoutCopy(void* data, size_t length); - /** - * Creates a ByteData object and take ownership of the specified data. The specified data will be - * deleted when the returned ByteData is released. - * Set releaseCallback to release outer data, and default protocol is to call 'delete[] data', - * if data is created by 'malloc', you need send a function to call 'free(data)'. - */ - static std::unique_ptr MakeAdopted( - uint8_t* data, size_t length, std::function releaseCallback = DeleteCallback); - /** - * Creates a ByteData object with specified length. - */ - static std::unique_ptr Make(size_t length); - - ~ByteData() { - if (_releaseCallback) { - _releaseCallback(_data); - } - } - - /** - * Returns the memory address of byte data. - */ - uint8_t* data() const { - return _data; - } - - /** - * Returns the byte size. - */ - size_t length() const { - return _length; - } - - private: - static void DeleteCallback(uint8_t* data) { - if (data) delete[] data; - } - - ByteData(uint8_t* data, size_t length, - std::function releaseCallback = DeleteCallback) - : _data(data), _length(length), _releaseCallback(std::move(releaseCallback)) { - } - - uint8_t* _data; - size_t _length; - const std::function _releaseCallback; -}; - -/** - * Describes how to interpret the alpha component of a pixel. - */ -enum class AlphaType { - /** - * uninitialized. - */ - Unknown, - /** - * pixel is opaque. - */ - Opaque, - /** - * pixel components are premultiplied by alpha. - */ - Premultiplied, - /** - * pixel components are independent of alpha. - */ - Unpremultiplied, -}; - -/** - * Describes how pixel bits encode color. These values match up with the enum in Bitmap.Config on - * Android platform. - */ -enum class ColorType { - /** - * uninitialized. - */ - Unknown, - /** - * Each pixel is stored as a single translucency (alpha) channel. This is very useful for - * storing masks efficiently, for instance. No color information is stored. With this - * configuration, each pixel requires 1 byte of memory. - */ - ALPHA_8, - /** - * Each pixel is stored on 4 bytes. Each channel (RGB and alpha for translucency) is stored with 8 - * bits of precision (256 possible values). The channel order is: red, green, blue, alpha. - */ - RGBA_8888, - /** - * Each pixel is stored on 4 bytes. Each channel (RGB and alpha for translucency) is stored with 8 - * bits of precision (256 possible values). The channel order is: blue, green, red, alpha. - */ - BGRA_8888, - /** - * Each pixel is stored on 2 bytes, and only the RGB channels are encoded: red is stored with 5 - * bits of precision (32 possible values), green is stored with 6 bits of precision (64 possible - * values), and blue is stored with 5 bits of precision. - */ - RGB_565, - /** - * Each pixel is stored as a single grayscale level. No color information is stored. With this - * configuration, each pixel requires 1 byte of memory. - */ - Gray_8, - /** - * Each pixel is stored on 8 bytes. Each channel (RGB and alpha for translucency) is stored as a - * half-precision floating point value. This configuration is particularly suited for wide-gamut - * and HDR content. - */ - RGBA_F16, - /** - * Each pixel is stored on 4 bytes. Each RGB channel is stored with 10 bits of precision (1024 - * possible values). There is an additional alpha channel that is stored with 2 bits of precision - * (4 possible values). This configuration is suited for wide-gamut and HDR content which does not - * require alpha blending, such that the memory cost is the same as RGBA_8888 while enabling - * higher color precision. - */ - RGBA_1010102 -}; - -enum class PAG_API BlendMode : uint8_t { - Normal = 0, - Multiply = 1, - Screen = 2, - Overlay = 3, - Darken = 4, - Lighten = 5, - ColorDodge = 6, - ColorBurn = 7, - HardLight = 8, - SoftLight = 9, - Difference = 10, - Exclusion = 11, - Hue = 12, - Saturation = 13, - Color = 14, - Luminosity = 15, - Add = 16 -}; - -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Resources b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Resources new file mode 120000 index 0000000..953ee36 --- /dev/null +++ b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Resources @@ -0,0 +1 @@ +Versions/Current/Resources \ No newline at end of file diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Resources/Info.plist b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Resources/Info.plist deleted file mode 100644 index d6fa5fa..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Resources/Info.plist +++ /dev/null @@ -1,48 +0,0 @@ - - - - - BuildMachineOSBuild - 24F74 - CFBundleDevelopmentRegion - English - CFBundleExecutable - libpag - CFBundleIdentifier - com.tencent.libpag - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleShortVersionString - 4.5.2 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 4.5.2 - CSResourcesFileMapped - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 24C94 - DTPlatformName - macosx - DTPlatformVersion - 15.2 - DTSDKBuild - 24C94 - DTSDKName - macosx15.2 - DTXcode - 1620 - DTXcodeBuild - 16C5032a - LSMinimumSystemVersion - 11.0 - - diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current new file mode 120000 index 0000000..8c7e5a6 --- /dev/null +++ b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/CocoaUtils.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/CocoaUtils.h deleted file mode 100644 index 44caf94..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/CocoaUtils.h +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#ifndef CocoaUtils_h -#define CocoaUtils_h - -#ifdef __APPLE__ -#include -#endif - -#if TARGET_OS_IPHONE -#import - -#define CocoaColor UIColor -#define CocoaTextureCacheRef CVOpenGLESTextureCacheRef -#define CocoaTextureRef CVOpenGLESTextureRef - -#elif TARGET_OS_MAC - -#import - -#define CocoaColor NSColor -#define CocoaTextureCacheRef CVOpenGLTextureCacheRef -#define CocoaTextureRef CVOpenGLTextureRef - -#endif - -#endif diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAG.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAG.h deleted file mode 100644 index b4a61e2..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAG.h +++ /dev/null @@ -1,35 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import - -#if !defined(PAG_API) -#if defined(PAG_DLL) -#define PAG_API __attribute__((visibility("default"))) -#else -#define PAG_API -#endif -#endif - -PAG_API @interface PAG : NSObject -/** - * Get SDK version information. - */ -+ (NSString*)SDKVersion; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGComposition.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGComposition.h deleted file mode 100644 index 582cb81..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGComposition.h +++ /dev/null @@ -1,153 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGLayer.h" - -PAG_API @interface PAGComposition : PAGLayer - -/** - * Make a empty PAGComposition with specified size. - */ -+ (PAGComposition*)Make:(CGSize)size; - -/** - * Returns the width of the Composition. - */ -- (NSInteger)width; - -/** - * Returns the height of the Composition. - */ -- (NSInteger)height; - -/** - * Set the size of the Composition. - */ -- (void)setContentSize:(CGSize)size; - -/** - * Returns the number of child layers of this composition. - */ -- (NSInteger)numChildren; - -/** - * Returns the child layer that exists at the specified index. - * @param index The index position of the child layer. - * @returns The child layer at the specified index position. - */ -- (PAGLayer*)getLayerAt:(int)index; - -/** - * Returns the index position of a child layer. - * @param child The layer instance to identify. - * @returns The index position of the child layer to identify. - */ -- (NSInteger)getLayerIndex:(PAGLayer*)child; - -/** - * Changes the position of an existing child in the container. This affects the layering of child - * layers. - * @param child The child layer for which you want to change the index number. - * @param index The resulting index number for the child layer. - */ -- (void)setLayerIndex:(NSInteger)index layer:(PAGLayer*)child; - -/** - Add PAGLayer to current PAGComposition at the top. - @param pagLayer specified PAGLayer to add - @return return YES if operation succeed, otherwise NO. - */ -- (BOOL)addLayer:(PAGLayer*)pagLayer; - -/** - Add PAGLayer to current PAGComposition at the specified index. - @param pagLayer specified PAGLayer to add - @param index specified index where to add - @return return YES if operation succeed,else NO. - */ -- (BOOL)addLayer:(PAGLayer*)pagLayer atIndex:(int)index; - -/** - Check whether current PAGComposition cotains the specified pagLayer. - @param pagLayer specified layer to check - @return return YES if the current PAGComposition contains the paglayer,else NO. - */ -- (BOOL)contains:(PAGLayer*)pagLayer; - -/** - Remove the specified PAGLayer from current PAGComposition. - @param pagLayer specified PAGLayer to remove - @return return the PAGLayer if remove successfully,else nil. - */ -- (PAGLayer*)removeLayer:(PAGLayer*)pagLayer; - -/** - Remove the PAGLayer at specified index from current PAGComposition. - - @param index specified index to remove - @return return the PAGLayer if remove successfully,else nil. - */ -- (PAGLayer*)removeLayerAt:(int)index; - -/** - Remove all PAGLayers from current PAGComposition. - */ -- (void)removeAllLayers; - -/** - Swap the layers. - @param pagLayer1 specified PAGLayer 1 to swap - @param pagLayer2 specified PAGLayer 2 to swap - */ -- (void)swapLayer:(PAGLayer*)pagLayer1 withLayer:(PAGLayer*)pagLayer2; - -/** - Swap the layers at the specified index. - @param index1 specified index 1 to swap - @param index2 specified index 2 to swap - */ -- (void)swapLayerAt:(int)index1 withIndex:(int)index2; - -/** - * Returns the audio data of this composition, which is an AAC audio in an MPEG-4 container. - */ -- (NSData*)audioBytes; - -/** - * Returns when the first frame of the audio plays in the composition's timeline. - */ -- (int64_t)audioStartTime; - -/** - * Returns the audio Markers of the composition. - */ -- (NSArray*)audioMarkers; - -/** - * Returns an array of layers that match the specified layer name. - */ -- (NSArray*)getLayersByName:(NSString*)layerName; - -/** - * Returns an array of layers that lie under the specified point. The point is in pixels and from - * this PAGComposition's local coordinates. - */ -- (NSArray*)getLayersUnderPoint:(CGPoint)point; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGDiskCache.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGDiskCache.h deleted file mode 100644 index f60d84f..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGDiskCache.h +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -/** - * Defines methods to manage the disk cache capabilities. - */ -PAG_API @interface PAGDiskCache : NSObject - -/** - * Returns the size limit of the disk cache in bytes. The default value is 1 GB. - */ -+ (size_t)MaxDiskSize; - -/** - * Sets the size limit of the disk cache in bytes, which will triggers the cache cleanup if the - * disk usage exceeds the limit. The opened files are not removed immediately, even if their disk - * usage exceeds the limit, and they will be rechecked after they are closed. - */ -+ (void)SetMaxDiskSize:(size_t)size; - -/** - * Removes all cached files from the disk. All the opened files will be also removed after they - * are closed. - */ -+ (void)RemoveAll; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGFile.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGFile.h deleted file mode 100644 index 5bdfdd0..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGFile.h +++ /dev/null @@ -1,135 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGComposition.h" -#import "PAGFont.h" -#import "PAGImage.h" -#import "PAGText.h" -#import "PAGTimeStretchMode.h" - -PAG_API @interface PAGFile : PAGComposition -/** - * The maximum tag level current SDK supports. - */ -+ (uint16_t)MaxSupportedTagLevel; - -/*** - * Load a pag file from the specified path, return null if the file does not exist or the data is - * not a pag file. Note: All PAGFiles loaded by the same path share the same internal cache. The - * internal cache is alive until all PAGFiles are released. Use '[PAGFile Load:size:]' instead if - * you don't want to load a PAGFile from the intenal caches. - */ -+ (PAGFile*)Load:(NSString*)path; - -/** - * Asynchronously load a PAG file from the specific path, a block with PAGFile will be called - * when loading is complete. - */ -+ (void)LoadAsync:(NSString*)path completionBlock:(void (^)(PAGFile*))callback; - -/** - * Load a pag file from byte data, return null if the bytes is empty or it's not a valid pag file. - */ -+ (PAGFile*)Load:(const void*)bytes size:(size_t)length; - -/** - * The tag level this pag file requires. - */ -- (uint16_t)tagLevel; - -/** - * The number of editable texts. - */ -- (int)numTexts; - -/** - * The number of replaceable images. - */ -- (int)numImages; - -/** - * The number of video compositions. - */ -- (int)numVideos; - -/** - * The path string of this file, returns empty string if the file is loaded from byte stream. - */ -- (NSString*)path; - -/** - * Get a text data of the specified index. The index ranges from 0 to numTexts - 1. - * Note: It always returns the default text data. - */ -- (PAGText*)getTextData:(int)editableTextIndex; - -/** - * Replace the text data of the specified index. The index ranges from 0 to PAGFile.numTexts - 1. - * Passing in null for the textData parameter will reset it to default text data. - */ -- (void)replaceText:(int)editableTextIndex data:(PAGText*)value; - -/** - * Replace the image data of the specified index. The index ranges from 0 to PAGFile.numImages - 1. - * Passing in null for the image parameter will reset it to default image data. - */ -- (void)replaceImage:(int)editableImageIndex data:(PAGImage*)value; - -/** - * Replace the image data of the specified layer name. - * Passing in null for the image parameter will reset it to default image data. - */ -- (void)replaceImageByName:(NSString*)layerName data:(PAGImage*)value; - -/** - * Return an array of layers by specified editable index and layer type. - */ -- (NSArray*)getLayersByEditableIndex:(int)index layerType:(PAGLayerType)type; - -/** - * Returns the indices of the editable layers in this PAGFile. - * If the editableIndex of a PAGLayer is not present in the returned indices, the PAGLayer should - * not be treated as editable. - */ -- (NSArray*)getEditableIndices:(PAGLayerType)layerType; - -/** - * Indicate how to stretch the original duration to fit target duration when file's duration is - * changed. The default value is PAGTimeStretchMode::Repeat. - */ -- (PAGTimeStretchMode)timeStretchMode; - -/** - * Set the timeStretchMode of this file. - */ -- (void)seTimeStretchMode:(PAGTimeStretchMode)value; - -/** - * Set the duration of this PAGFile. Passing a value less than or equal to 0 resets the duration to - * its default value. - */ -- (void)setDuration:(int64_t)duration; - -/** - * Make a copy of the original file, any modification to current file has no effect on the result - * file. - */ -- (PAGFile*)copyOriginal; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGFont.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGFont.h deleted file mode 100644 index 79aea8c..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGFont.h +++ /dev/null @@ -1,49 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -PAG_API @interface PAGFont : NSObject - -/** - * A string with the name of the font family. - **/ -@property(nonatomic, copy) NSString* fontFamily; - -/** - * A string with the style information — e.g., “bold”, “italic”. - **/ -@property(nonatomic, copy) NSString* fontStyle; - -+ (PAGFont*)RegisterFont:(NSString*)fontPath; - -+ (PAGFont*)RegisterFont:(NSString*)fontPath - family:(NSString*)fontFamily - style:(NSString*)fontStyle; - -+ (PAGFont*)RegisterFont:(void*)data size:(size_t)length; - -+ (PAGFont*)RegisterFont:(void*)data - size:(size_t)length - family:(NSString*)fontFamily - style:(NSString*)fontStyle; - -+ (void)UnregisterFont:(PAGFont*)font; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGImage.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGImage.h deleted file mode 100644 index 815cb62..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGImage.h +++ /dev/null @@ -1,81 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import -#import -#import "PAG.h" -#import "PAGScaleMode.h" - -PAG_API @interface PAGImage : NSObject -/** - * Creates a PAGImage object from a CGImage object, return null if it's not valid CGImage object. - */ -+ (PAGImage*)FromCGImage:(CGImageRef)cgImage; - -/** - * Creates a PAGImage object from a path of a image file, return null if the file does not exist or - * it's not a valid image file. - */ -+ (PAGImage*)FromPath:(NSString*)path; - -/** - * Creates a PAGImage object from the specified byte data, return null if the bytes is empty or it's - * not a valid image file. - */ -+ (PAGImage*)FromBytes:(const void*)bytes size:(size_t)length; - -/** - * Creates a PAGImage object from the specified CVPixelBuffer, return null if the CVPixelBuffer is - * invalid. - */ -+ (PAGImage*)FromPixelBuffer:(CVPixelBufferRef)pixelBuffer; - -/** - * Returns the width in pixels of the image. - */ -- (NSInteger)width; - -/** - * Returns the height in pixels of the image. - */ -- (NSInteger)height; - -/** - * Returns the current scale mode. - */ -- (PAGScaleMode)scaleMode; - -/** - * Specifies the rule of how to scale the image content to fit the original image size. The matrix - * changes when this method is called. - */ -- (void)setScaleMode:(PAGScaleMode)value; - -/** - * Returns a copy of current matrix. - */ -- (CGAffineTransform)matrix; - -/** - * Set the transformation which will be applied to the image content. The scaleMode property - * will be set to PAGScaleMode::None when this method is called. - */ -- (void)setMatrix:(CGAffineTransform)value; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGImageLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGImageLayer.h deleted file mode 100644 index e41ff33..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGImageLayer.h +++ /dev/null @@ -1,68 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGLayer.h" -#import "PAGScaleMode.h" - -@class PAGImage; -@class PAGVideoRange; - -PAG_API @interface PAGImageLayer : PAGLayer -/** - * Make a PAGImageLayer with size and duration(in microseconds). - */ -+ (instancetype)Make:(CGSize)size duration:(int64_t)duration; - -/** - * Returns the time ranges of the source video for replacement. - */ -- (NSArray*)getVideoRanges; - -/** - * [Deprecated] - * Replace the original image content with the specified PAGImage object. - * Passing in null for the image parameter resets the layer to its default image content. - * The replaceImage() method modifies all associated PAGImageLayers that have the same - * editableIndex to this layer. - * - * @param image The PAGImage object to replace with. - */ -- (void)replaceImage:(PAGImage*)image DEPRECATED_MSG_ATTRIBUTE("Please use setImage:image instead"); - -/** - * Replace the original image content with the specified PAGImage object. - * Passing in null for the image parameter resets the layer to its default image content. - * The setImage() method only modifies the content of the calling PAGImageLayer. - * - * @param image The PAGImage object to replace with. - */ -- (void)setImage:(PAGImage*)image; - -/** - * Returns the content duration in microseconds, which indicates the minimal length required for - * replacement. - */ -- (int64_t)contentDuration; - -/** - * The default image data of this layer, which is webp format. - */ -- (NSData*)imageBytes; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGLayer.h deleted file mode 100644 index 555b4b0..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGLayer.h +++ /dev/null @@ -1,181 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import -#import "PAGMarker.h" - -typedef NS_ENUM(NSInteger, PAGLayerType) { - PAGLayerTypeUnknown, - PAGLayerTypeNull, - PAGLayerTypeSolid, - PAGLayerTypeText, - PAGLayerTypeShape, - PAGLayerTypeImage, - PAGLayerTypePreCompose, -}; - -@class PAGComposition; -@class PAGFile; - -PAG_API @interface PAGLayer : NSObject - -/** - * Returns the type of layer. - */ -- (PAGLayerType)layerType; - -/** - * Returns the name of the layer. - */ -- (NSString*)layerName; - -/** - * A matrix object containing values that alter the scaling, rotation, and translation of the layer. - * Altering it does not change the animation matrix, and it will be concatenated to current - * animation matrix for displaying. - */ -- (CGAffineTransform)matrix; - -- (void)setMatrix:(CGAffineTransform)matrix; - -/** - * Resets the matrix to its default value. - */ -- (void)resetMatrix; - -/** - * Returns the layer's display matrix by combining its matrix) property with the current animation - * matrix from the AE timeline. This does not include the parent layer's matrix. - * To calculate the final bounds relative to the PAGSurface, use the PAGPlayer::getBounds(PAGLayer - * layer) method directly. - */ -- (CGAffineTransform)getTotalMatrix; - -/** - * Whether or not the layer is visible. - */ -- (BOOL)visible; - -- (void)setVisible:(BOOL)visible; - -/** - * Ranges from 0 to PAGFile.numTexts - 1 if the layer type is text, or from 0 to PAGFile.numImages - * -1 if the layer type is image, otherwise returns -1. - */ -- (NSInteger)editableIndex; - -/** - * Indicates the PAGComposition instance that contains this PAGLayer instance. - */ -- (PAGComposition*)parent; - -/** - * Returns the markers of current PAGLayer. - */ -- (NSArray*)markers; - -/** - * Converts the time from the PAGLayer's (local) timeline to the PAGSurface (global) timeline. The - * time is in microseconds. - */ -- (int64_t)localTimeToGlobal:(int64_t)localTime; - -/** - * Converts the time from the PAGSurface (global) to the PAGLayer's (local) timeline timeline. The - * time is in microseconds. - */ -- (int64_t)globalToLocalTime:(int64_t)globalTime; - -/** - * The duration of the layer in microseconds, indicates the length of the visible range. - */ -- (int64_t)duration; - -/** - * Returns the frame rate of this layer. - */ -- (float)frameRate; - -/** - * The start time of the layer in microseconds, indicates the start position of the visible range. - * It could be a negative value. - */ -- (int64_t)startTime; - -/** - * Set the start time of the layer, in microseconds. - */ -- (void)setStartTime:(int64_t)time; - -/** - * The current time of the layer in microseconds, the layer is invisible if currentTime is not in - * the visible range (startTime <= currentTime < startTime + duration). - */ -- (int64_t)currentTime; - -/** - * Set the current time of the layer in microseconds. - */ -- (void)setCurrentTime:(int64_t)time; - -/** - * Returns the current progress of play position, the value is from 0.0 to 1.0. - */ -- (double)getProgress; - -/** - * Set the progress of play position, the value ranges from 0.0 to 1.0. A value of 0.0 represents - * the frame at startTime. A value of 1.0 represents the frame at the end of duration. - */ -- (void)setProgress:(double)value; - -/** - * Returns trackMatte layer of this layer. - */ -- (PAGLayer*)trackMatteLayer; - -/** - * Returns a rectangle int pixels that defines the original area of the layer, which is not - * transformed by the matrix. - */ -- (CGRect)getBounds; - -/** - * Indicate whether this layer is excluded from parent's timeline. If set to true, this layer's - * current time will not change when parent's current time changes. - */ -- (BOOL)excludedFromTimeline; - -/** - * Set the excludedFromTimeline flag of this layer. - */ -- (void)setExcludedFromTimeline:(BOOL)value; - -/** - * Returns the current alpha of the layer if previously set. - */ -- (float)alpha; - -/** - * Set the alpha of the layer, which will be concatenated to the current animation opacity for - * displaying. - */ -- (void)setAlpha:(float)value; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGMarker.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGMarker.h deleted file mode 100644 index 47a388b..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGMarker.h +++ /dev/null @@ -1,28 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -PAG_API @interface PAGMarker : NSObject - -@property(nonatomic) long long startTime; -@property(nonatomic) long long duration; -@property(nonatomic, copy) NSString* comment; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGPlayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGPlayer.h deleted file mode 100644 index c15bcc2..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGPlayer.h +++ /dev/null @@ -1,193 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGComposition.h" -#import "PAGFile.h" -#import "PAGImage.h" -#import "PAGScaleMode.h" -#import "PAGSurface.h" - -PAG_API @interface PAGPlayer : NSObject -/** - * Returns the current PAGComposition for PAGPlayer to render as content. - */ -- (PAGComposition*)getComposition; - -/** - * Sets a new PAGComposition for PAGPlayer to render as content. - * Note: If the composition is already added to another PAGPlayer, it will be removed from the - * previous PAGPlayer. - */ -- (void)setComposition:(PAGComposition*)newComposition; - -/** - * Returns the PAGSurface object for PAGPlayer to render onto. - */ -- (PAGSurface*)getSurface; - -/** - * Set the PAGSurface object for PAGPlayer to render onto. - */ -- (void)setSurface:(PAGSurface*)surface; - -/** - * If set to false, the player skips rendering for video composition. - */ -- (BOOL)videoEnabled; - -/** - * Set the value of videoEnabled property. - */ -- (void)setVideoEnabled:(BOOL)value; - -/** - * If set to true, PAGPlayer caches an internal bitmap representation of the static content for each - * layer. This caching can increase performance for layers that contain complex vector content. The - * execution speed can be significantly faster depending on the complexity of the content, but it - * requires extra graphics memory. The default value is true. - */ -- (BOOL)cacheEnabled; - -/** - * Set the value of cacheEnabled property. - */ -- (void)setCacheEnabled:(BOOL)value; - -/** - * If set to true, PAG will cache the associated rendering data into a disk file, such as the - * decoded image frames of video compositions. This can help reduce memory usage and improve - * rendering performance. - */ -- (BOOL)useDiskCache; - -/** - * Set the value of useDiskCache property. - */ -- (void)setUseDiskCache:(BOOL)value; - -/** - * This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0. The - * scale factors less than 1.0 may result in blurred output, but it can reduce the usage of graphics - * memory which leads to better performance. The default value is 1.0. - */ -- (float)cacheScale; - -/** - * Set the value of cacheScale property. - */ -- (void)setCacheScale:(float)value; - -/** - * The maximum frame rate for rendering, ranges from 1 to 60. If set to a value less than the actual - * frame rate from composition, it drops frames but increases performance. Otherwise, it has no - * effect. The default value is 60. - */ -- (float)maxFrameRate; - -/** - * Set the maximum frame rate for rendering. - */ -- (void)setMaxFrameRate:(float)value; - -/** - * Returns the current scale mode. - */ -- (PAGScaleMode)scaleMode; - -/** - * Specifies the rule of how to scale the pag content to fit the surface size. The matrix - * changes when this method is called. - */ -- (void)setScaleMode:(PAGScaleMode)value; - -/** - * Returns a copy of current matrix. - */ -- (CGAffineTransform)matrix; - -/** - * Set the transformation which will be applied to the composition. The scaleMode property - * will be set to PAGScaleMode::None when this method is called. - */ -- (void)setMatrix:(CGAffineTransform)value; - -/** - * The duration of current composition in microseconds. - */ -- (int64_t)duration; - -/** - * Returns the current progress of play position, the value is from 0.0 to 1.0. - */ -- (double)getProgress; - -/** - * Set the progress of play position, the value is from 0.0 to 1.0. - */ -- (void)setProgress:(double)value; - -/** - * Returns the current frame. - */ -- (int64_t)currentFrame; - -/** - * Prepares the player for the next flush() call. It collects all CPU tasks from the current - * progress of the composition and runs them asynchronously in parallel. It is usually used for - * speeding up the first frame rendering. - */ -- (void)prepare; - -/** - * Apply all pending changes to the target surface immediately. Returns true if the content has - * changed. - */ -- (BOOL)flush; - -/** - * Returns a rectangle in pixels that defines the displaying area of the specified layer, which is - * in the coordinate of the PAGSurface. - */ -- (CGRect)getBounds:(PAGLayer*)pagLayer; - -/** - * Returns an array of layers that lie under the specified point. The point is in pixels and from - * the surface's coordinates. - */ -- (NSArray*)getLayersUnderPoint:(CGPoint)point; - -/** - * Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point is - * in the coordinate space of the PAGSurface, not the PAGComposition that contains the PAGLayer. It - * always returns false if the PAGLayer or its parent (or parent's parent...) has not been added to - * this PAGPlayer. This method only check against the bounding box not the acual pixels. - */ -- (BOOL)hitTestPoint:(PAGLayer*)layer point:(CGPoint)point; - -/** - * Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point is - * in the coordinate space of the PAGSurface, not the PAGComposition that contains the PAGLayer. It - * always returns false if the PAGLayer or its parent (or parent's parent...) has not been added to - * this PAGPlayer. The pixelHitTest parameter indicates whether or not to check against the actual - * pixels of the object (true) or the bounding box (false). Returns true if the PAGLayer overlaps or - * intersects with the specified point. - */ -- (BOOL)hitTestPoint:(PAGLayer*)layer point:(CGPoint)point pixelHitTest:(BOOL)pixelHitTest; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGScaleMode.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGScaleMode.h deleted file mode 100644 index 396209a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGScaleMode.h +++ /dev/null @@ -1,31 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -typedef enum { - // The content is not scaled. - PAGScaleModeNone = 0, - // The content is stretched to fit. - PAGScaleModeStretch = 1, - // The content is scaled with respect to the original unscaled image's aspect ratio. This is the - // default value. - PAGScaleModeLetterBox = 2, - // The content is scaled to fit with respect to the original unscaled image's aspect ratio. This - // results in cropping - // on one axis. - PAGScaleModeZoom = 3, -} PAGScaleMode; diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGShapeLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGShapeLayer.h deleted file mode 100644 index b2cb470..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGShapeLayer.h +++ /dev/null @@ -1,24 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAGLayer.h" - -PAG_API @interface PAGShapeLayer : PAGLayer - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGSolidLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGSolidLayer.h deleted file mode 100644 index eca4d62..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGSolidLayer.h +++ /dev/null @@ -1,35 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "CocoaUtils.h" -#import "PAGLayer.h" - -PAG_API @interface PAGSolidLayer : PAGLayer - -/** - * Returns the layer's solid color. - */ -- (CocoaColor*)solidColor; - -/** - * Set the the layer's solid color. - */ -- (void)setSolidColor:(CocoaColor*)color; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGSurface.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGSurface.h deleted file mode 100644 index 8c20d44..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGSurface.h +++ /dev/null @@ -1,79 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import -#import -#import -#import -#import "PAGImageLayer.h" - -PAG_API @interface PAGSurface : NSObject - -+ (PAGSurface*)FromView:(NSView*)view; - -/** - * [Deprecated](Please use [PAGSurface MakeOffscreen] instead.) - * Creates an offscreen PAGSurface of the specified size for pixel reading. - */ -+ (PAGSurface*)MakeFromGPU:(CGSize)size - DEPRECATED_MSG_ATTRIBUTE("Please use [PAGSurface MakeOffscreen] instead."); - -/** - * Creates an offscreen PAGSurface of the specified size for pixel reading. - */ -+ (PAGSurface*)MakeOffscreen:(CGSize)size; - -/** - * The width of the surface. - */ -- (int)width; - -/** - * The height of the surface. - */ -- (int)height; - -/** - * Update the size of the surface, and reset the internal surface. - */ -- (void)updateSize; - -/** - * Erases all pixels of this surface with transparent color. Returns true if the content has - * changed. - */ -- (BOOL)clearAll; - -/** - * Free the cache created by the surface immediately. Can be called to reduce memory pressure. - */ -- (void)freeCache; - -/** - * Returns the internal CVPixelBuffer object associated with this PAGSurface, returns nil if this - * PAGSurface is created by [PAGSurface FromLayer]. - */ -- (CVPixelBufferRef)getCVPixelBuffer; - -/** - * Returns a CVPixelBuffer object capturing the contents of the PAGSurface. Subsequent rendering of - * the PAGSurface will not be captured. - */ -- (CVPixelBufferRef)makeSnapshot; -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGText.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGText.h deleted file mode 100644 index 6c7c40e..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGText.h +++ /dev/null @@ -1,138 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#include "CocoaUtils.h" -#import "PAG.h" - -enum { - PAGJustificationLeftJustify = 0, - PAGJustificationCenterJustify = 1, - PAGJustificationRightJustify = 2, - PAGJustificationFullJustifyLastLineLeft = 3, - PAGJustificationFullJustifyLastLineRight = 4, - PAGJustificationFullJustifyLastLineCenter = 5, - PAGJustificationFullJustifyLastLineFull = 6 -}; - -/** - * The PAGText object stores a value for a TextLayer's Source Text property. - */ -PAG_API @interface PAGText : NSObject - -/** - * When true, the text layer shows a fill. - */ -@property(nonatomic, assign) bool applyFill; - -/** - * When true, the text layer shows a stroke. - */ -@property(nonatomic, assign) bool applyStroke; -/** - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) float baselineShift; -/** - * When true, the text layer is paragraph (bounded) text. - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) bool boxText; - -/** - * For box text, the pixel boundary for the text bounds. - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) CGRect boxTextRect; -/** - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) float firstBaseLine; - -@property(nonatomic, assign) bool fauxBold; - -@property(nonatomic, assign) bool fauxItalic; - -/** - * The text layer’s fill color. - */ -@property(nonatomic, strong) CocoaColor* fillColor; - -/** - * A string with the name of the font family. - **/ -@property(nonatomic, copy) NSString* fontFamily; - -/** - * A string with the style information — e.g., “bold”, “italic”. - **/ -@property(nonatomic, copy) NSString* fontStyle; - -/** - * The text layer’s font size in pixels. - */ -@property(nonatomic, assign) float fontSize; - -/** - * The text layer’s stroke color. - */ -@property(nonatomic, strong) CocoaColor* strokeColor; - -/** - * Indicates the rendering order for the fill and stroke of a text layer. - * Readonly, external modifications are not valid. - */ -@property(nonatomic, assign) bool strokeOverFill; - -/** - * The text layer’s stroke thickness. - */ -@property(nonatomic, assign) float strokeWidth; - -/** - * The text layer’s Source Text value. - */ -@property(nonatomic, copy) NSString* text; - -/** - * The paragraph justification for the text layer. Such as : PAGJustificationLeftJustify, - * PAGJustificationCenterJustify... - */ -@property(nonatomic, assign) uint8_t justification; - -/** - * The space between lines, 0 indicates 'auto', which is fontSize * 1.2 - */ -@property(nonatomic, assign) float leading; - -/** - * The text layer’s spacing between characters. - */ -@property(nonatomic, assign) float tracking; - -/** - * The text layer’s background color. - */ -@property(nonatomic, strong) CocoaColor* backgroundColor; - -/** - * The text layer’s background alpha. 0 = 100% transparent, 255 = 100% opaque. - */ -@property(nonatomic, assign) int backgroundAlpha; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGTextLayer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGTextLayer.h deleted file mode 100644 index 2f046ec..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGTextLayer.h +++ /dev/null @@ -1,82 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#include "CocoaUtils.h" -#import "PAGLayer.h" - -@class PAGFont; - -PAG_API @interface PAGTextLayer : PAGLayer - -/** - * Returns the TextLayer’s fill color. - */ -- (CocoaColor*)fillColor; - -/** - * Sets the TextLayer’s fill color. - */ -- (void)setFillColor:(CocoaColor*)color; - -/** - * Returns the TextLayer's font. - */ -- (PAGFont*)font; - -/** - * Sets the TextLayer's font. - */ -- (void)setFont:(PAGFont*)font; - -/** - * Returns the TextLayer's font size. - */ -- (CGFloat)fontSize; - -/** - * Sets the TextLayer's font size. - */ -- (void)setFontSize:(CGFloat)size; - -/** - * Returns the TextLayer's stroke color. - */ -- (CocoaColor*)strokeColor; - -/** - * Sets the TextLayer's stroke color. - */ -- (void)setStrokeColor:(CocoaColor*)color; - -/** - * Returns the TextLayer's text. - */ -- (NSString*)text; - -/** - * Set the TextLayer's text. - */ -- (void)setText:(NSString*)text; - -/** - * Reset the text layer to its default text data. - */ -- (void)reset; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGTimeStretchMode.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGTimeStretchMode.h deleted file mode 100644 index e77e4b7..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGTimeStretchMode.h +++ /dev/null @@ -1,33 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -typedef enum { - // Keep the original playing speed, and display the last frame if the content's duration is less - // than target duration. - PAGTimeStretchModeNone = 0, - // Change the playing speed of the content to fit target duration. - PAGTimeStretchModeScale = 1, - // Keep the original playing speed, but repeat the content if the content's duration is less than - // target duration. - // This is the default mode. - PAGTimeStretchModeRepeat = 2, - // Keep the original playing speed, but repeat the content in reversed if the content's duration - // is less than - // target duration. - PAGTimeStretchModeRepeatInverted = 3, -} PAGTimeStretchMode; diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGVideoDecoder.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGVideoDecoder.h deleted file mode 100644 index 7cd76e3..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGVideoDecoder.h +++ /dev/null @@ -1,34 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -PAG_API @interface PAGVideoDecoder : NSObject - -/** - * Register a software decoder factory to implement the decoder fallback mechanism. - */ -+ (void)RegisterSoftwareDecoderFactory:(void*)decoderFactory; - -/** - * Set the maximum number of hardware video decoders that can be create. - */ -+ (void)SetMaxHardwareDecoderCount:(int)maxCount; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGVideoRange.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGVideoRange.h deleted file mode 100644 index f302694..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGVideoRange.h +++ /dev/null @@ -1,44 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import -#import "PAG.h" - -/** - * Represents a time range from the content of PAGImageLayer. - */ -PAG_API @interface PAGVideoRange : NSObject - -/** - * The start time of the source video, in microseconds. - */ -@property(nonatomic) int64_t startTime; -/** - * The end time of the source video (not included), in microseconds. - */ -@property(nonatomic) int64_t endTime; -/** - * The duration for playing after applying speed. - */ -@property(nonatomic) int64_t playDuration; -/** - * Indicates whether the video should play backward. - */ -@property(nonatomic) int64_t reversed; - -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGView.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGView.h deleted file mode 100644 index e3ed000..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/PAGView.h +++ /dev/null @@ -1,245 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#import "PAGFile.h" -#import "PAGImage.h" -#import "PAGLayer.h" - -@class PAGView; -@protocol PAGViewListener - -@optional -/** - * Notifies the beginning of the animation. It can be called from either the UI thread or the thread - * that calls the play method. - */ -- (void)onAnimationStart:(PAGView*)pagView; - -/** - * Notifies the end of the animation. It can only be called from the UI thread. - */ -- (void)onAnimationEnd:(PAGView*)pagView; - -/** - * Notifies the cancellation of the animation. It can be called from either the UI thread or the - * thread that calls the stop method. - */ -- (void)onAnimationCancel:(PAGView*)pagView; - -/** - * Notifies the repetition of the animation. It can only be called from the UI thread. - */ -- (void)onAnimationRepeat:(PAGView*)pagView; - -/** - * Notifies another frame of the animation has occurred. It may be called from an arbitrary - * thread if the animation is running asynchronously. - */ -- (void)onAnimationUpdate:(PAGView*)pagView; - -@end - -PAG_API @interface PAGView : NSView - -/** - * Adds a listener to the set of listeners that are sent events through the life of an animation, - * such as start, repeat, and end. PAGView only holds a weak reference to the listener. - */ -- (void)addListener:(id)listener; - -/** - * Removes a listener from the set listening to this animation. - */ -- (void)removeListener:(id)listener; - -/** - * The total number of times the animation is set to play. The default is 1, which means the - * animation will play only once. If the repeat count is set to 0 or a negative value, the - * animation will play infinity times. - */ -- (int)repeatCount; - -/** - * Set the number of times the animation to play. - */ -- (void)setRepeatCount:(int)repeatCount; - -/** - * Indicates whether this pag view is playing. - */ -- (BOOL)isPlaying; - -/** - * Starts to play the animation from the current position. Calling the play() method when the - * animation is already playing has no effect. The play() method does not alter the animation's - * current position. However, if the animation previously reached its end, it will restart from - * the beginning. - */ -- (void)play; - -/** - * Cancels the animation at the current position. Calling the play() method can resume the animation - * from the last paused position. - */ -- (void)pause; - -/** - * Cancels the animation at the current position. Currently, it has the same effect as pause(). - */ -- (void)stop; - -/** - * The path string of a pag file set by setPath. - */ -- (NSString*)getPath; - -/** - * Load a pag file from the specified path, returns false if the file does not exist or the data is - * not a pag file. Note: All PAGFiles loaded by the same path share the same internal cache. The - * internal cache is alive until all PAGFiles are released. Use '[PAGFile Load:size:]' instead if - * you don't want to load a PAGFile from the intenal caches. - */ -- (BOOL)setPath:(NSString*)filePath; - -/** - * Returns the current PAGComposition for PAGView to render as content. - */ -- (PAGComposition*)getComposition; - -/** - * Sets a new PAGComposition for PAGView to render as content. - * Note: If the composition is already added to another PAGView, it will be removed from the - * previous PAGView. - */ -- (void)setComposition:(PAGComposition*)newComposition; - -/** - * Return the value of videoEnabled property. - */ -- (BOOL)videoEnabled; - -/** - * If set false, will skip video layer drawing. - */ -- (void)setVideoEnabled:(BOOL)enable; - -/** - * If set to true, PAG renderer caches an internal bitmap representation of the static content for - * each layer. This caching can increase performance for layers that contain complex vector content. - * The execution speed can be significantly faster depending on the complexity of the content, but - * it requires extra graphics memory. The default value is true. - */ -- (BOOL)cacheEnabled; - -/** - * Set the value of cacheEnabled property. - */ -- (void)setCacheEnabled:(BOOL)value; - -/** - * This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0. The - * scale factors less than 1.0 may result in blurred output, but it can reduce the usage of graphics - * memory which leads to better performance. The default value is 1.0. - */ -- (float)cacheScale; - -/** - * Set the value of cacheScale property. - */ -- (void)setCacheScale:(float)value; - -/** - * The maximum frame rate for rendering. If set to a value less than the actual frame rate from - * PAGFile, it drops frames but increases performance. Otherwise, it has no effect. The default - * value is 60. - */ -- (float)maxFrameRate; - -/** - * Set the maximum frame rate for rendering. - */ -- (void)setMaxFrameRate:(float)value; - -/** - * Returns the current scale mode. - */ -- (PAGScaleMode)scaleMode; - -/** - * Specifies the rule of how to scale the pag content to fit the surface size. The matrix - * changes when this method is called. - */ -- (void)setScaleMode:(PAGScaleMode)value; - -/** - * Returns a copy of the current matrix. - */ -- (CGAffineTransform)matrix; - -/** - * Set the transformation which will be applied to the composition. The method is valid only - * when the scaleMode is PAGScaleMode.None. - */ -- (void)setMatrix:(CGAffineTransform)value; - -/** - * The duration of current composition in microseconds. - */ -- (int64_t)duration; - -/** - * Returns the current progress of play position, the value is from 0.0 to 1.0. It is applied only - * when the composition is not null. - */ -- (double)getProgress; - -/** - * Set the progress of play position, the value is from 0.0 to 1.0. - */ -- (void)setProgress:(double)value; - -/** - * Call this method to render current position immediately. If the play() method is already - * called, there is no need to call it. Returns true if the content has changed. - */ -- (BOOL)flush; - -/** - * Returns an array of layers that lie under the specified point. - * The point is in pixels, convert dp to pixel by multiply [UIScreen mainScreen].scale, eg: point.x - * * scale,point.y* scale. - */ -- (NSArray*)getLayersUnderPoint:(CGPoint)point; - -/** - * Free the cache created by the pag view immediately. Can be called to reduce memory pressure. - */ -- (void)freeCache; - -/** - * Returns a CVPixelBuffer object capturing the contents of the PAGView. Subsequent rendering of - * the PAGView will not be captured. Returns nil if the PAGView hasn't been presented yet. - */ -- (CVPixelBufferRef)makeSnapshot; - -/** - * Returns a rectangle in pixels that defines the displaying area of the specified layer, which is - * in the coordinate of the PAGView. - */ -- (CGRect)getBounds:(PAGLayer*)pagLayer; -@end diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/libpag.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/libpag.h deleted file mode 100644 index dcb953a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/libpag.h +++ /dev/null @@ -1,39 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -// This file is an umbrella header for libpag on macOS platform. -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import \ No newline at end of file diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/ext/egl/pag_egl_globals.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/ext/egl/pag_egl_globals.h deleted file mode 100644 index 9c7ac87..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/ext/egl/pag_egl_globals.h +++ /dev/null @@ -1,27 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag/c/pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API egl_globals* pag_egl_globals_get(); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/ext/pag_surface_ext.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/ext/pag_surface_ext.h deleted file mode 100644 index 0e6d11a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/ext/pag_surface_ext.h +++ /dev/null @@ -1,53 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag/c/pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Create a new pag_surface for double-buffered off-screen rendering. - * Release it by pag_release. - */ -PAG_API pag_surface* pag_surface_make_offscreen_double_buffered(int width, int height, - bool tryHardware, - void* sharedContext); - -/** - * Returns the front texture of the surface. - */ -PAG_API pag_backend_texture* pag_surface_get_front_texture(pag_surface* surface); - -/** - * Returns the back texture of the surface. - */ -PAG_API pag_backend_texture* pag_surface_get_back_texture(pag_surface* surface); - -/** - * Returns the front hardware buffer of the surface. - */ -PAG_API void* pag_surface_get_front_hardware_buffer(pag_surface* surface); - -/** - * Returns the back hardware buffer of the surface. - */ -PAG_API void* pag_surface_get_back_hardware_buffer(pag_surface* surface); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag.h deleted file mode 100644 index 92fbc0d..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag.h +++ /dev/null @@ -1,37 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "ext/pag_surface_ext.h" -#include "pag_animator.h" -#include "pag_backend_semaphore.h" -#include "pag_backend_texture.h" -#include "pag_byte_data.h" -#include "pag_composition.h" -#include "pag_decoder.h" -#include "pag_disk_cache.h" -#include "pag_file.h" -#include "pag_font.h" -#include "pag_image.h" -#include "pag_image_layer.h" -#include "pag_layer.h" -#include "pag_player.h" -#include "pag_solid_layer.h" -#include "pag_surface.h" -#include "pag_text_document.h" diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_animator.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_animator.h deleted file mode 100644 index 3e89349..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_animator.h +++ /dev/null @@ -1,54 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_animator with the specified listener. Release it by pag_release. - */ -PAG_API pag_animator* pag_animator_create(pag_animator_listener* listener, void* user); - -PAG_API bool pag_animator_is_sync(pag_animator* animator); - -PAG_API void pag_animator_set_sync(pag_animator* animator, bool sync); - -PAG_API int64_t pag_animator_get_duration(pag_animator* animator); - -PAG_API void pag_animator_set_duration(pag_animator* animator, int64_t duration); - -PAG_API int pag_animator_get_repeat_count(pag_animator* animator); - -PAG_API void pag_animator_set_repeat_count(pag_animator* animator, int repeatCount); - -PAG_API double pag_animator_get_progress(pag_animator* animator); - -PAG_API void pag_animator_set_progress(pag_animator* animator, double progress); - -PAG_API bool pag_animator_is_running(pag_animator* animator); - -PAG_API void pag_animator_start(pag_animator* animator); - -PAG_API void pag_animator_cancel(pag_animator* animator); - -PAG_API void pag_animator_update(pag_animator* animator); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_backend_semaphore.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_backend_semaphore.h deleted file mode 100644 index fb40e2a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_backend_semaphore.h +++ /dev/null @@ -1,36 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_backend_semaphore. Release it by pag_release. - */ -PAG_API pag_backend_semaphore* pag_backend_semaphore_create(); - -PAG_API bool pag_backend_semaphore_is_initialized(pag_backend_semaphore* semaphore); - -PAG_API void pag_backend_semaphore_init_gl(pag_backend_semaphore* semaphore, void* glSync); - -PAG_API void* pag_backend_semaphore_get_gl_sync(pag_backend_semaphore* semaphore); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_backend_texture.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_backend_texture.h deleted file mode 100644 index f252aba..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_backend_texture.h +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_backend_texture with texture info, width and height. - * Release it by pag_release. - */ -PAG_API pag_backend_texture* pag_backend_texture_create_from_gl_texture_info( - pag_gl_texture_info textureInfo, int width, int height); - -PAG_API bool pag_backend_texture_get_gl_texture_info(pag_backend_texture* texture, - pag_gl_texture_info* textureInfo); - -PAG_API bool pag_backend_texture_get_vk_image_info(pag_backend_texture* texture, - pag_vk_image_info* imageInfo); - -PAG_API bool pag_backend_texture_get_mtl_texture_info(pag_backend_texture* texture, - pag_mtl_texture_info* mtl_texture_info); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_byte_data.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_byte_data.h deleted file mode 100644 index 34b2a15..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_byte_data.h +++ /dev/null @@ -1,30 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_byte_data and copy the bytes and length. Release it by pag_release. - */ -PAG_API pag_byte_data* pag_byte_data_copy(const void* bytes, size_t length); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_composition.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_composition.h deleted file mode 100644 index 760ef26..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_composition.h +++ /dev/null @@ -1,41 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API int pag_composition_get_width(pag_composition* composition); - -PAG_API int pag_composition_get_height(pag_composition* composition); - -/** - * Returns an array of layers that match the specified layer name. Release it by pag_release. - */ -PAG_API pag_layer** pag_composition_get_layers_by_name(pag_composition* composition, - const char* layerName, size_t* count); - -/** - * Returns an array of layers that match the specified layer type. Release it by pag_release. - */ -PAG_API pag_layer** pag_composition_get_layers_by_type(pag_composition* composition, - pag_layer_type layerType, size_t* count); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_decoder.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_decoder.h deleted file mode 100644 index b7c77d6..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_decoder.h +++ /dev/null @@ -1,48 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_decoder with a pag_composition, a frame rate limit, and a scale factor for the - * decoded image size. Release it by pag_release. - */ -PAG_API pag_decoder* pag_decoder_create(pag_composition* composition, float maxFrameRate, - float scale); - -PAG_API int pag_decoder_get_width(pag_decoder* decoder); - -PAG_API int pag_decoder_get_height(pag_decoder* decoder); - -PAG_API int pag_decoder_get_num_frames(pag_decoder* decoder); - -PAG_API float pag_decoder_get_frame_rate(pag_decoder* decoder); - -PAG_API bool pag_decoder_check_frame_changed(pag_decoder* decoder, int index); - -PAG_API bool pag_decoder_read_frame(pag_decoder* decoder, int index, void* pixels, size_t rowBytes, - pag_color_type colorType, pag_alpha_type alphaType); - -PAG_API bool pag_decoder_read_frame_to_hardware_buffer(pag_decoder* decoder, int index, - void* buffer); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_disk_cache.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_disk_cache.h deleted file mode 100644 index d0b8519..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_disk_cache.h +++ /dev/null @@ -1,31 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API size_t pag_disk_cache_get_max_disk_size(); - -PAG_API void pag_disk_cache_set_max_disk_size(size_t maxDiskSize); - -PAG_API void pag_disk_cache_remove_all(); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_file.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_file.h deleted file mode 100644 index 725999f..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_file.h +++ /dev/null @@ -1,66 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Load a pag file from byte data, return null if the bytes is empty, or it's not a valid pag - * file. Release it by pag_release. - */ -PAG_API pag_file* pag_file_load(const void* bytes, size_t length, const char* filePath, - const char* password); - -PAG_API void pag_file_set_duration(pag_file* file, int64_t duration); - -PAG_API int pag_file_get_num_texts(pag_file* file); - -PAG_API int pag_file_get_num_images(pag_file* file); - -PAG_API int pag_file_get_num_videos(pag_file* file); - -PAG_API pag_time_stretch_mode pag_file_get_time_stretch_mode(pag_file* file); - -PAG_API void pag_file_set_time_stretch_mode(pag_file* file, pag_time_stretch_mode mode); - -/** - * Get a text data of the specified index. The index ranges from 0 to numTexts - 1. Release it by - * pag_release. - * Note: It always returns the default text data. - */ -PAG_API pag_text_document* pag_file_get_text_data(pag_file* file, int editableTextIndex); - -PAG_API void pag_file_replace_text(pag_file* file, int editableTextIndex, pag_text_document* text); - -PAG_API void pag_file_replace_image(pag_file* file, int editableImageIndex, pag_image* image); - -/** - * Return an array of layers by specified editable index and layer type. - * Release them by pag_release. - */ -PAG_API pag_layer** pag_file_get_layers_by_editable_index(pag_file* file, int editableIndex, - pag_layer_type layerType, - size_t* numLayers); - -PAG_API int* pag_file_get_editable_indices(pag_file* file, pag_layer_type layerType, - size_t* numIndexes); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_font.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_font.h deleted file mode 100644 index 82e5714..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_font.h +++ /dev/null @@ -1,42 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Registers a font required by the text layers in pag files, so that they can be rendered as - * designed. Release it by pag_release. - */ -PAG_API pag_font* pag_font_register_from_path(const char* filePath, int ttcIndex, - const char* fontFamily, const char* fontStyle); -/** - * Registers a font required by the text layers in pag files, so that they can be rendered as - * designed. Release it by pag_release. - */ -PAG_API pag_font* pag_font_register_from_data(const void* data, size_t length, int ttcIndex, - const char* fontFamily, const char* fontStyle); - -PAG_API const char* pag_font_get_family(pag_font* font); - -PAG_API const char* pag_font_get_style(pag_font* font); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_image.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_image.h deleted file mode 100644 index 7362318..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_image.h +++ /dev/null @@ -1,44 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a pag_image object from an array of pixel data, return null if it's not valid pixels. - * Release it by pag_release. - */ -PAG_API pag_image* pag_image_from_pixels(const void* pixels, int width, int height, size_t rowBytes, - pag_color_type colorType, pag_alpha_type alphaType); -/** - * Creates a pag_image object from a hardware buffer. Release it by pag_release. - */ -PAG_API pag_image* pag_image_from_hardware_buffer(void* buffer); - -/** - * Creates a pag_image object from the specified backend texture, return null if the texture is - * invalid. Release it by pag_release. - */ -PAG_API pag_image* pag_image_from_backend_texture(pag_backend_texture* texture); - -PAG_API void pag_image_set_scale_mode(pag_image* image, pag_scale_mode mode); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_image_layer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_image_layer.h deleted file mode 100644 index 8c08889..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_image_layer.h +++ /dev/null @@ -1,28 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API uint8_t* pag_image_layer_get_image_rgba_data(pag_layer* imageLayer, size_t* count, - size_t* width, size_t* height); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_layer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_layer.h deleted file mode 100644 index 577255e..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_layer.h +++ /dev/null @@ -1,37 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API pag_layer_type pag_layer_get_layer_type(pag_layer* layer); - -PAG_API const char* pag_layer_get_layer_name(pag_layer* layer); - -PAG_API int64_t pag_layer_get_duration(pag_layer* layer); - -PAG_API float pag_layer_get_frame_rate(pag_layer* layer); - -PAG_API float pag_layer_get_alpha(pag_layer* layer); - -PAG_API void pag_layer_set_alpha(pag_layer* layer, float alpha); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_player.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_player.h deleted file mode 100644 index 14a7891..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_player.h +++ /dev/null @@ -1,57 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a pag_player object. Release it by pag_release. - */ -PAG_API pag_player* pag_player_create(); - -PAG_API void pag_player_set_composition(pag_player* player, pag_composition* composition); - -PAG_API void pag_player_set_surface(pag_player* player, pag_surface* surface); - -PAG_API bool pag_player_get_cache_enable(pag_player* player); - -PAG_API void pag_player_set_cache_enable(pag_player* player, bool cacheEnable); - -PAG_API double pag_player_get_progress(pag_player* player); - -PAG_API void pag_player_set_progress(pag_player* player, double progress); - -PAG_API bool pag_player_wait(pag_player* player, pag_backend_semaphore* semaphore); - -PAG_API bool pag_player_flush(pag_player* player); - -PAG_API bool pag_player_flush_and_signal_semaphore(pag_player* player, - pag_backend_semaphore* semaphore); - -PAG_API pag_scale_mode pag_player_get_scale_mode(pag_player* player); - -PAG_API void pag_player_set_scale_mode(pag_player* player, pag_scale_mode scaleMode); - -PAG_API int64_t pag_player_get_duration(pag_player* player); - -PAG_API int64_t pag_player_get_graphics_memory(pag_player* player); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_solid_layer.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_solid_layer.h deleted file mode 100644 index 5ea36ee..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_solid_layer.h +++ /dev/null @@ -1,29 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API pag_color pag_solid_layer_get_solid_color(pag_solid_layer* layer); - -PAG_API void pag_solid_layer_set_solid_color(pag_solid_layer* layer, pag_color color); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_surface.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_surface.h deleted file mode 100644 index 6ec82c9..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_surface.h +++ /dev/null @@ -1,34 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -/** - * Creates a new pag_surface for off-screen rendering with the specified size. - * Release it by pag_release. - */ -PAG_API pag_surface* pag_surface_make_offscreen(int width, int height); - -PAG_API bool pag_surface_read_pixels(pag_surface* surface, pag_color_type colorType, - pag_alpha_type alphaType, void* dstPixels, size_t dstRowBytes); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_text_document.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_text_document.h deleted file mode 100644 index 71c1e6b..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_text_document.h +++ /dev/null @@ -1,119 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "pag_types.h" - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -PAG_API bool pag_text_document_get_apply_fill(pag_text_document* document); - -PAG_API void pag_text_document_set_apply_fill(pag_text_document* document, bool applyFill); - -PAG_API bool pag_text_document_get_apply_stroke(pag_text_document* document); - -PAG_API void pag_text_document_set_apply_stroke(pag_text_document* document, bool applyStroke); - -PAG_API float pag_text_document_get_baseline_shift(pag_text_document* document); - -PAG_API void pag_text_document_set_baseline_shift(pag_text_document* document, float baselineShift); - -PAG_API bool pag_text_document_get_box_text(pag_text_document* document); - -PAG_API void pag_text_document_set_box_text(pag_text_document* document, bool boxText); - -PAG_API pag_point pag_text_document_get_box_text_pos(pag_text_document* document); - -PAG_API void pag_text_document_set_box_text_pos(pag_text_document* document, pag_point boxTextPos); - -PAG_API pag_point pag_text_document_get_box_text_size(pag_text_document* document); - -PAG_API void pag_text_document_set_box_text_size(pag_text_document* document, - pag_point boxTextSize); - -PAG_API float pag_text_document_get_first_baseline(pag_text_document* document); - -PAG_API void pag_text_document_set_first_baseline(pag_text_document* document, float firstBaseline); - -PAG_API bool pag_text_document_get_faux_bold(pag_text_document* document); - -PAG_API void pag_text_document_set_faux_bold(pag_text_document* document, bool fauxBold); - -PAG_API bool pag_text_document_get_faux_italic(pag_text_document* document); - -PAG_API void pag_text_document_set_faux_italic(pag_text_document* document, bool fauxItalic); - -PAG_API pag_color pag_text_document_get_fill_color(pag_text_document* document); - -PAG_API void pag_text_document_set_fill_color(pag_text_document* document, pag_color fillColor); - -PAG_API const char* pag_text_document_get_font_family(pag_text_document* document); - -PAG_API void pag_text_document_set_font_family(pag_text_document* document, const char* fontFamily); - -PAG_API const char* pag_text_document_get_font_style(pag_text_document* document); - -PAG_API void pag_text_document_set_font_style(pag_text_document* document, const char* fontStyle); - -PAG_API float pag_text_document_get_font_size(pag_text_document* document); - -PAG_API void pag_text_document_set_font_size(pag_text_document* document, float fontSize); - -PAG_API pag_color pag_text_document_get_stroke_color(pag_text_document* document); - -PAG_API void pag_text_document_set_stroke_color(pag_text_document* document, pag_color strokeColor); - -PAG_API bool pag_text_document_get_stroke_over_fill(pag_text_document* document); - -PAG_API void pag_text_document_set_stroke_over_fill(pag_text_document* document, - bool strokeOverFill); - -PAG_API float pag_text_document_get_stroke_width(pag_text_document* document); - -PAG_API void pag_text_document_set_stroke_width(pag_text_document* document, float strokeWidth); - -PAG_API const char* pag_text_document_get_text(pag_text_document* document); - -PAG_API void pag_text_document_set_text(pag_text_document* document, const char* text); - -PAG_API pag_paragraph_justification -pag_text_document_get_justification(pag_text_document* document); - -PAG_API void pag_text_document_set_justification(pag_text_document* document, - pag_paragraph_justification justification); - -PAG_API float pag_text_document_get_leading(pag_text_document* document); - -PAG_API void pag_text_document_set_leading(pag_text_document* document, float leading); - -PAG_API float pag_text_document_get_tracking(pag_text_document* document); - -PAG_API void pag_text_document_set_tracking(pag_text_document* document, float tracking); - -PAG_API pag_color pag_text_document_get_background_color(pag_text_document* document); - -PAG_API void pag_text_document_set_background_color(pag_text_document* document, - pag_color backgroundColor); - -PAG_API uint8_t pag_text_document_get_background_alpha(pag_text_document* document); - -PAG_API void pag_text_document_set_background_alpha(pag_text_document* document, - uint8_t backgroundAlpha); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_types.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_types.h deleted file mode 100644 index 4f2cd10..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/c/pag_types.h +++ /dev/null @@ -1,155 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2023 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "stddef.h" -#include "stdint.h" -#include "pag/defines.h" - -#ifdef __cplusplus -#define PAG_C_PLUS_PLUS_BEGIN_GUARD extern "C" { -#define PAG_C_PLUS_PLUS_END_GUARD } -#else -#define PAG_C_PLUS_PLUS_BEGIN_GUARD -#define PAG_C_PLUS_PLUS_END_GUARD -#endif - -PAG_C_PLUS_PLUS_BEGIN_GUARD - -typedef enum { - pag_time_stretch_mode_none, - pag_time_stretch_mode_scale, - pag_time_stretch_mode_repeat, - pag_time_stretch_mode_repeat_inverted, -} pag_time_stretch_mode; - -typedef enum { - pag_color_type_unknown, - pag_color_type_alpha_8, - pag_color_type_rgba_8888, - pag_color_type_bgra_8888, - pag_color_type_rgb_565, - pag_color_type_gray_8, - pag_color_type_rgba_f16, - pag_color_type_rgba_101012, -} pag_color_type; - -typedef enum { - pag_alpha_type_unknown, - pag_alpha_type_opaque, - pag_alpha_type_premultiplied, - pag_alpha_type_unpremultiplied, -} pag_alpha_type; - -typedef enum { - pag_scale_mode_none, - pag_scale_mode_stretch, - pag_scale_mode_letter_box, - pag_scale_mode_zoom, -} pag_scale_mode; - -typedef enum { - pag_layer_type_unknown, - pag_layer_type_null, - pag_layer_type_solid, - pag_layer_type_text, - pag_layer_type_shape, - pag_layer_type_image, - pag_layer_type_pre_compose, - pag_layer_type_camera, -} pag_layer_type; - -typedef struct pag_gl_texture_info { - unsigned id = 0; - unsigned target = 0x0DE1; // GL_TEXTURE_2D; - unsigned format = 0x8058; // GL_RGBA8; -} pag_gl_texture_info; - -typedef struct pag_vk_image_info { - void* image = nullptr; -} pag_vk_image_info; - -typedef struct pag_mtl_texture_info { - void* texture = nullptr; -} pag_mtl_texture_info; - -typedef struct pag_point { - float x; - float y; -} pag_point; - -typedef struct pag_color { - uint8_t red; - uint8_t green; - uint8_t blue; -} pag_color; - -typedef enum { - pag_paragraph_justification_left_justify, - pag_paragraph_justification_center_justify, - pag_paragraph_justification_right_justify, - pag_paragraph_justification_full_justify_last_line_left, - pag_paragraph_justification_full_justify_last_line_right, - pag_paragraph_justification_full_justify_last_line_center, - pag_paragraph_justification_full_justify_last_line_full, -} pag_paragraph_justification; - -typedef struct pag_display_link_functions { - void* (*create)(void* user, void (*callback)(void* user)); - void (*start)(void* displayLink); - void (*stop)(void* displayLink); - void (*release)(void* displayLink); -} pag_display_link_functions; - -typedef struct pag_egl_globals { - void* display = nullptr; -} egl_globals; - -typedef const void* pag_object; -typedef struct pag_byte_data pag_byte_data; -typedef struct pag_text_document pag_text_document; -typedef struct pag_layer pag_layer; -typedef pag_layer pag_solid_layer; -typedef pag_layer pag_composition; -typedef pag_composition pag_file; -typedef struct pag_player pag_player; -typedef struct pag_surface pag_surface; -typedef struct pag_image pag_image; -typedef struct pag_font pag_font; -typedef struct pag_backend_texture pag_backend_texture; -typedef struct pag_backend_semaphore pag_backend_semaphore; -typedef struct pag_decoder PAGDecoder; -typedef struct pag_animator pag_animator; - -typedef struct pag_animator_listener { - void (*on_animation_start)(pag_animator* animator, void* user); - void (*on_animation_end)(pag_animator* animator, void* user); - void (*on_animation_cancel)(pag_animator* animator, void* user); - void (*on_animation_repeat)(pag_animator* animator, void* user); - void (*on_animation_update)(pag_animator* animator, void* user); -} pag_animator_listener; - -/** - * Release a pag_object. - */ -PAG_API void pag_release(pag_object object); - -PAG_API void pag_display_link_set_functions(pag_display_link_functions* functions); - -PAG_C_PLUS_PLUS_END_GUARD diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/decoder.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/decoder.h deleted file mode 100644 index 326fd64..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/decoder.h +++ /dev/null @@ -1,132 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include - -namespace pag { -/** - * This structure describes decoded (raw) video data. - */ -struct YUVBuffer { - /** - * The YUV data, each value is a pointer to the picture planes. - */ - uint8_t* data[3]; - /** - * The size in bytes of each picture line. - */ - int lineSize[3]; -}; - -/** - * Codec specific data. For example: SPS (Sequence Parameter Sets) or PPS (Picture Parameter Sets). - */ -struct HeaderData { - /** - * The pointer of codec specific data - */ - uint8_t* data; - /** - * The size in bytes of codec specific data. - */ - size_t length; -}; - -/** - * Possible results of calling SoftwareDecoder's methods. - */ -enum class DecoderResult { - /** - * The calling is successful. - */ - Success = 0, - /** - * Output is not available in this state, need more input buffers. - */ - TryAgainLater = -1, - /** - * The calling fails. - */ - Error = -2 -}; - -/** - * Base class for interacting with software decoder created externally to PAG. - */ -class SoftwareDecoder { - public: - virtual ~SoftwareDecoder() = default; - - /** - * Configure the software decoder. - * @param headers Codec specific data. for example: {0 : sps, 1: pps} - * @param mimeType MIME type. for example: "video/avc" - * @param width video width - * @param height video height - * @return Return true if configure successfully. - */ - virtual bool onConfigure(const std::vector& headers, std::string mimeType, int width, - int height) = 0; - - /** - * Send a sample data of encoded video frame for decoding. - * @param bytes: The sample data for decoding. - * @param length: The size of sample data - * @param timestamp: The timestamp of this sample data. - */ - virtual DecoderResult onSendBytes(void* bytes, size_t length, int64_t timestamp) = 0; - - /** - * Try to decode a new frame from the pending frames sent by onSendBytes(). More input buffers - * need to be sent by onSendBytes() if SoftwareDecodeResult::TryAgainLater was returned. - */ - virtual DecoderResult onDecodeFrame() = 0; - - /** - * Called to notify there is no more sample data available. - */ - virtual DecoderResult onEndOfStream() = 0; - - /** - * Called when seeking happens to clear all pending frames. - */ - virtual void onFlush() = 0; - - /** - * Returns decoded video data to render. - */ - virtual std::unique_ptr onRenderFrame() = 0; -}; - -/** - * The factory of software decoder. - */ -class SoftwareDecoderFactory { - public: - virtual ~SoftwareDecoderFactory() = default; - - /** - * Create a software decoder - */ - virtual std::unique_ptr createSoftwareDecoder() = 0; -}; -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/defines.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/defines.h deleted file mode 100644 index 0b9a01a..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/defines.h +++ /dev/null @@ -1,43 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#if !defined(PAG_API) -#if defined(PAG_DLL) -#if defined(_MSC_VER) -#define PAG_API __declspec(dllexport) -#else -#define PAG_API __attribute__((visibility("default"))) -#endif -#else -#define PAG_API -#endif -#endif - -#if !defined(RTTR_AUTO_REGISTER_CLASS) -#define RTTR_AUTO_REGISTER_CLASS -#endif - -#if !defined(RTTR_SKIP_REGISTER_PROPERTY) -#define RTTR_SKIP_REGISTER_PROPERTY -#endif - -#if !defined(RTTR_REGISTER_FUNCTION_AS_PROPERTY) -#define RTTR_REGISTER_FUNCTION_AS_PROPERTY(propertyName, function) -#endif \ No newline at end of file diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/file.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/file.h deleted file mode 100644 index deb412f..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/file.h +++ /dev/null @@ -1,2584 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include "pag/types.h" - -#ifdef PAG_USE_RTTR -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-parameter" -#include "rttr/array_range.h" -#include "rttr/constructor.h" -#include "rttr/destructor.h" -#include "rttr/enum_flags.h" -#include "rttr/enumeration.h" -#include "rttr/library.h" -#include "rttr/method.h" -#include "rttr/property.h" -#include "rttr/rttr_cast.h" -#include "rttr/rttr_enable.h" -#include "rttr/type.h" -#pragma clang diagnostic pop -#else - -#define RTTR_ENABLE(...) - -#endif - -namespace pag { -/** - * The maximum number of type is 1023. It only allows to add new tag to the end before - * TagCode::Count. - */ -enum class RTTR_AUTO_REGISTER_CLASS TagCode { - End = 0, - FontTables = 1, - VectorCompositionBlock = 2, - CompositionAttributes = 3, - ImageTables = 4, - LayerBlock = 5, - LayerAttributes = 6, - SolidColor = 7, - TextSource = 8, - TextMoreOption = 10, - ImageReference = 11, - CompositionReference = 12, - Transform2D = 13, - MaskBlock = 14, - ShapeGroup = 15, - Rectangle = 16, - Ellipse = 17, - PolyStar = 18, - ShapePath = 19, - Fill = 20, - Stroke = 21, - GradientFill = 22, - GradientStroke = 23, - MergePaths = 24, - TrimPaths = 25, - Repeater = 26, - RoundCorners = 27, - Performance = 28, - DropShadowStyle = 29, - CachePolicy = 30, - FileAttributes = 31, - TimeStretchMode = 32, - Mp4Header = 33, - - // 34 ~ 44 are preserved - - BitmapCompositionBlock = 45, - BitmapSequence = 46, - ImageBytes = 47, - ImageBytesV2 = 48, // with scaleFactor - ImageBytesV3 = 49, // width transparent border stripped. - - VideoCompositionBlock = 50, - VideoSequence = 51, - - LayerAttributesV2 = 52, - MarkerList = 53, - ImageFillRule = 54, - AudioBytes = 55, - MotionTileEffect = 56, - LevelsIndividualEffect = 57, - CornerPinEffect = 58, - BulgeEffect = 59, - FastBlurEffect = 60, - GlowEffect = 61, - - LayerAttributesV3 = 62, - LayerAttributesExtra = 63, - - TextSourceV2 = 64, - - DropShadowStyleV2 = 65, - DisplacementMapEffect = 66, - ImageFillRuleV2 = 67, - - TextSourceV3 = 68, - TextPathOption = 69, - - TextAnimator = 70, - TextRangeSelector = 71, - TextAnimatorPropertiesTrackingType = 72, - TextAnimatorPropertiesTrackingAmount = 73, - TextAnimatorPropertiesFillColor = 74, - TextAnimatorPropertiesStrokeColor = 75, - TextAnimatorPropertiesPosition = 76, - TextAnimatorPropertiesScale = 77, - TextAnimatorPropertiesRotation = 78, - TextAnimatorPropertiesOpacity = 79, - TextWigglySelector = 80, - - RadialBlurEffect = 81, - MosaicEffect = 82, - EditableIndices = 83, - MaskBlockV2 = 84, - GradientOverlayStyle = 85, - BrightnessContrastEffect = 86, - HueSaturationEffect = 87, - - LayerAttributesExtraV2 = 88, // add PreserveAlpha - EncryptedData = 89, - Transform3D = 90, - CameraOption = 91, - - StrokeStyle = 92, - OuterGlowStyle = 93, - ImageScaleModes = 94, - - // add new tags here... - - Count -}; - -struct RTTR_AUTO_REGISTER_CLASS Ratio { - float value() const { - return static_cast(numerator) / denominator; - } - - int32_t numerator; - uint32_t denominator; -}; - -inline bool operator==(const Ratio& left, const Ratio& right) { - return left.numerator == right.numerator && - (left.numerator == 0 || left.denominator == right.denominator); -} - -inline bool operator!=(const Ratio& left, const Ratio& right) { - return !(left == right); -} - -static constexpr Ratio DefaultRatio = {1, 1}; - -enum class RTTR_AUTO_REGISTER_CLASS PathDataVerb { MoveTo, LineTo, CurveTo, Close }; - -/** - * The Path object encapsulates information describing a path in a shape layer, or the outline path - * of a Mask. - */ -class PAG_API PathData { - public: - std::vector verbs; - std::vector points; - void moveTo(float x, float y); - void lineTo(float x, float y); - void cubicTo(float controlX1, float controlY1, float controlX2, float controlY2, float x, - float y); - /** - * If the last point does not equal with the last moveTo point, add a lineTo verb and then close - * the path. - */ - void close(); - bool isClosed() const; - void reverse(); - void clear(); - void interpolate(const PathData& path, PathData* result, float t); - - private: - Point lastMoveTo = {}; -}; - -typedef std::shared_ptr PathHandle; - -enum class PAG_API KeyframeInterpolationType : uint8_t { - None = 0, - Linear = 1, - Bezier = 2, - Hold = 3 -}; - -template -class RTTR_AUTO_REGISTER_CLASS Keyframe { - public: - virtual ~Keyframe() = default; - - virtual void initialize() { - } - - virtual T getValueAt(Frame) { - return startValue; - } - - bool containsTime(Frame time) const { - return time >= startTime && time < endTime; - } - - T startValue; - T endValue; - Frame startTime = ZeroFrame; - Frame endTime = ZeroFrame; - KeyframeInterpolationType interpolationType = KeyframeInterpolationType::Hold; - std::vector bezierOut; - std::vector bezierIn; - Point3D spatialOut = Point3D::Zero(); - Point3D spatialIn = Point3D::Zero(); -}; - -/** - * The Property object contains value information about a particular AE property of a layer. - */ -template -class RTTR_AUTO_REGISTER_CLASS Property { - public: - T value; - Property() = default; - - explicit Property(const T& value) : value(value) { - } - - virtual ~Property() = default; - - virtual bool animatable() const { - return false; - } - - virtual T getValueAt(Frame) { - return value; - } - - virtual void excludeVaryingRanges(std::vector*) const { - } - - RTTR_ENABLE() -}; - -Frame PAG_API ConvertFrameByStaticTimeRanges(const std::vector& timeRanges, Frame frame); -void PAG_API SubtractFromTimeRanges(std::vector* timeRanges, Frame startTime, - Frame endTime); -void PAG_API SplitTimeRangesAt(std::vector* timeRanges, Frame startTime); -void PAG_API MergeTimeRanges(std::vector* timeRanges, - const std::vector* otherRanges); -std::vector PAG_API OffsetTimeRanges(const std::vector& timeRanges, - Frame offsetTime); -bool PAG_API HasVaryingTimeRange(const std::vector* staticTimeRanges, Frame startTime, - Frame duration); -TimeRange PAG_API GetTimeRangeContains(const std::vector& timeRanges, Frame frame); - -template -class RTTR_AUTO_REGISTER_CLASS AnimatableProperty : public Property { - public: - explicit AnimatableProperty(const std::vector*>& keyframes) - : keyframes(keyframes), lastKeyframeIndex(0) { - this->value = keyframes[0]->startValue; - for (Keyframe* keyframe : keyframes) { - keyframe->initialize(); - } - } - - ~AnimatableProperty() override { - for (auto& keyframe : keyframes) { - delete keyframe; - } - } - - bool animatable() const override { - return true; - } - - void excludeVaryingRanges(std::vector* timeRanges) const override { - for (Keyframe* keyframe : keyframes) { - switch (keyframe->interpolationType) { - case KeyframeInterpolationType::Bezier: - case KeyframeInterpolationType::Linear: - SubtractFromTimeRanges(timeRanges, keyframe->startTime, keyframe->endTime - 1); - break; - default: - SplitTimeRangesAt(timeRanges, keyframe->startTime); - SplitTimeRangesAt(timeRanges, keyframe->endTime); - break; - } - } - } - - T getValueAt(Frame frame) override { - T result; - size_t lastKeyframeIndexInternal = lastKeyframeIndex; - Keyframe* lastKeyframe = keyframes[lastKeyframeIndexInternal]; - if (lastKeyframe->containsTime(frame)) { - return lastKeyframe->getValueAt(frame); - } - if (frame < lastKeyframe->startTime) { - while (lastKeyframeIndexInternal > 0) { - lastKeyframeIndexInternal--; - if (keyframes[lastKeyframeIndexInternal]->containsTime(frame)) { - break; - } - } - } else { - while (lastKeyframeIndexInternal < keyframes.size() - 1) { - lastKeyframeIndexInternal++; - if (keyframes[lastKeyframeIndexInternal]->containsTime(frame)) { - break; - } - } - } - lastKeyframe = keyframes[lastKeyframeIndexInternal]; - if (frame <= lastKeyframe->startTime) { - result = lastKeyframe->startValue; - } else if (frame >= lastKeyframe->endTime) { - result = lastKeyframe->endValue; - } else { - result = lastKeyframe->getValueAt(frame); - } - lastKeyframeIndex = lastKeyframeIndexInternal; - return result; - } - - /** - * The keyframe list in this property. - */ - std::vector*> keyframes; - - private: - std::atomic_size_t lastKeyframeIndex; - - RTTR_ENABLE(Property) -}; - -class PAG_API Transform2D { - public: - static std::unique_ptr MakeDefault(); - ~Transform2D(); - - Property* anchorPoint = nullptr; // spatial - Property* position = nullptr; // spatial - Property* xPosition = nullptr; - Property* yPosition = nullptr; - Property* scale = nullptr; // multidimensional - Property* rotation = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class PAG_API Transform3D { - public: - ~Transform3D(); - - Property* anchorPoint = nullptr; // spatial - Property* position = nullptr; // spatial - Property* xPosition = nullptr; - Property* yPosition = nullptr; - Property* zPosition = nullptr; - Property* scale = nullptr; // multidimensional - Property* orientation = nullptr; - Property* xRotation = nullptr; - Property* yRotation = nullptr; - Property* zRotation = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class PAG_API MaskMode : uint8_t { - None = 0, // mask shape does nothing - Add = 1, // shape is added into mask (normal behavior (really screen!)) - Subtract = 2, - Intersect = 3, - Lighten = 4, - Darken = 5, - Difference = 6, - Accum = 7 // real add, not screen (not exposed in UI!) -}; - -class PAG_API MaskData { - public: - ~MaskData(); - - ID id = ZeroID; - bool inverted = false; - MaskMode maskMode = MaskMode::Add; - Property* maskPath = nullptr; - Property* maskFeather = nullptr; - Property* maskOpacity = nullptr; - Property* maskExpansion = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class RTTR_AUTO_REGISTER_CLASS EffectType { - Unknown, - Fill, - MotionTile, - LevelsIndividual, - CornerPin, - Bulge, - FastBlur, - Glow, - DisplacementMap, - RadialBlur, - Mosaic, - BrightnessContrast, - HueSaturation, -}; - -class PAG_API Effect { - public: - Effect(); - - virtual ~Effect(); - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - - virtual EffectType type() const { - return EffectType::Unknown; - } - - /** - * Indicate whether this effect process only the visible area of the input texture. - */ - virtual bool processVisibleAreaOnly() const { - return false; - } - - /** - * Check whether or not this effect is visible at the specified frame. - */ - virtual bool visibleAt(Frame) const { - return false; - } - - /** - * Calculate the bounds after this effect being applied. - */ - virtual void transformBounds(Rect*, const Point&, Frame) const { - } - - virtual Point getMaxScaleFactor(const Rect&) const { - return Point::Make(1.f, 1.f); - } - - virtual void excludeVaryingRanges(std::vector* timeRanges) const; - - virtual bool verify() const; - - Property* effectOpacity = nullptr; - std::vector maskReferences; // mask reference - - RTTR_ENABLE() -}; - -class PAG_API MotionTileEffect : public Effect { - public: - ~MotionTileEffect() override; - - EffectType type() const override { - return EffectType::MotionTile; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* tileCenter = nullptr; // spatial - Property* tileWidth = nullptr; - Property* tileHeight = nullptr; - Property* outputWidth = nullptr; - Property* outputHeight = nullptr; - Property* mirrorEdges = nullptr; - Property* phase = nullptr; - Property* horizontalPhaseShift = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API LevelsIndividualEffect : public Effect { - public: - ~LevelsIndividualEffect() override; - - EffectType type() const override { - return EffectType::LevelsIndividual; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - // RGB - Property* inputBlack = nullptr; - Property* inputWhite = nullptr; - Property* gamma = nullptr; - Property* outputBlack = nullptr; - Property* outputWhite = nullptr; - - // Red - Property* redInputBlack = nullptr; - Property* redInputWhite = nullptr; - Property* redGamma = nullptr; - Property* redOutputBlack = nullptr; - Property* redOutputWhite = nullptr; - - // green - Property* greenInputBlack = nullptr; - Property* greenInputWhite = nullptr; - Property* greenGamma = nullptr; - Property* greenOutputBlack = nullptr; - Property* greenOutputWhite = nullptr; - - // blue - Property* blueInputBlack = nullptr; - Property* blueInputWhite = nullptr; - Property* blueGamma = nullptr; - Property* blueOutputBlack = nullptr; - Property* blueOutputWhite = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API CornerPinEffect : public Effect { - public: - ~CornerPinEffect() override; - - EffectType type() const override { - return EffectType::CornerPin; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - Point getMaxScaleFactor(const Rect& bounds) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* upperLeft = nullptr; // spatial - Property* upperRight = nullptr; // spatial - Property* lowerLeft = nullptr; // spatial - Property* lowerRight = nullptr; // spatial - - RTTR_ENABLE(Effect) -}; - -class PAG_API BulgeEffect : public Effect { - public: - ~BulgeEffect() override; - - EffectType type() const override { - return EffectType::Bulge; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* horizontalRadius = nullptr; - Property* verticalRadius = nullptr; - Property* bulgeCenter = nullptr; // spatial - Property* bulgeHeight = nullptr; - Property* taperRadius = nullptr; - Property* pinning = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class PAG_API BlurDimensionsDirection : uint8_t { - All = 0, - Horizontal = 1, - Vertical = 2 -}; - -class PAG_API FastBlurEffect : public Effect { - public: - ~FastBlurEffect() override; - - EffectType type() const override { - return EffectType::FastBlur; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blurriness = nullptr; - Property* blurDimensions = nullptr; - Property* repeatEdgePixels = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API GlowEffect : public Effect { - public: - ~GlowEffect() override; - - EffectType type() const override { - return EffectType::Glow; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* glowThreshold = nullptr; - Property* glowRadius = nullptr; - Property* glowIntensity = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class PAG_API DisplacementMapSource : uint8_t { - Red = 0, - Green = 1, - Blue = 2, - Alpha = 3, - Luminance = 4, - Hue = 5, - Lightness = 6, - Saturation = 7, - Full = 8, - Half = 9, - Off = 10 -}; - -enum class RTTR_AUTO_REGISTER_CLASS DisplacementMapBehavior : uint8_t { - CenterMap = 0, - StretchMapToFit = 1, - TileMap = 2 -}; - -class Layer; - -class PAG_API DisplacementMapEffect : public Effect { - public: - ~DisplacementMapEffect() override; - - EffectType type() const override { - return EffectType::DisplacementMap; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Layer* RTTR_SKIP_REGISTER_PROPERTY displacementMapLayer = nullptr; // ref layer - Property* useForHorizontalDisplacement = nullptr; - Property* maxHorizontalDisplacement = nullptr; - Property* useForVerticalDisplacement = nullptr; - Property* maxVerticalDisplacement = nullptr; - Property* displacementMapBehavior = nullptr; - Property* edgeBehavior = nullptr; - Property* expandOutput = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class PAG_API RadialBlurMode : uint8_t { - Spin = 0, - Zoom = 1 -}; - -enum class PAG_API RadialBlurAntialias : uint8_t { - Low = 0, - High = 1 -}; - -class PAG_API RadialBlurEffect : public Effect { - public: - ~RadialBlurEffect() override; - - EffectType type() const override { - return EffectType::RadialBlur; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* amount = nullptr; - Property* center = nullptr; // spatial - Property* mode = nullptr; - Property* antialias = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API MosaicEffect : public Effect { - public: - ~MosaicEffect() override; - - EffectType type() const override { - return EffectType::Mosaic; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* horizontalBlocks = nullptr; - Property* verticalBlocks = nullptr; // spatial - Property* sharpColors = nullptr; - - RTTR_ENABLE(Effect) -}; - -class PAG_API BrightnessContrastEffect : public Effect { - public: - ~BrightnessContrastEffect() override; - - EffectType type() const override { - return EffectType::BrightnessContrast; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* brightness = nullptr; - Property* contrast = nullptr; - Property* useOldVersion = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class PAG_API ChannelControlType : uint8_t { - Master = 0, - Reds = 1, - Yellows = 2, - Greens = 3, - Cyans = 4, - Blues = 5, - Magentas = 6, - Count = 7 -}; - -class PAG_API HueSaturationEffect : public Effect { - public: - ~HueSaturationEffect() override; - - EffectType type() const override { - return EffectType::HueSaturation; - } - - bool processVisibleAreaOnly() const override { - return true; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - ChannelControlType channelControl = ChannelControlType::Master; - std::vector hue = std::vector(static_cast(ChannelControlType::Count), 0.0f); - std::vector saturation = std::vector(static_cast(ChannelControlType::Count), 0.0f); - std::vector lightness = std::vector(static_cast(ChannelControlType::Count), 0.0f); - bool colorize = false; - Property* colorizeHue = nullptr; - Property* colorizeSaturation = nullptr; - Property* colorizeLightness = nullptr; - - RTTR_ENABLE(Effect) -}; - -enum class RTTR_AUTO_REGISTER_CLASS LayerStyleType { Unknown, DropShadow, Stroke, GradientOverlay, OuterGlow }; - -enum class RTTR_AUTO_REGISTER_CLASS LayerStylePosition { Above, Blow }; - -class PAG_API LayerStyle { - public: - LayerStyle(); - - virtual ~LayerStyle() = default; - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - - virtual LayerStyleType type() const { - return LayerStyleType::Unknown; - } - - virtual LayerStylePosition drawPosition() const { - return LayerStylePosition::Blow; - } - - /** - * Check whether or not this layer style is visible at the specified frame. - */ - virtual bool visibleAt(Frame) const { - return false; - } - - /** - * Calculate the bounds after this layerStyle being applied. - */ - virtual void transformBounds(Rect*, const Point&, Frame) const { - } - - virtual void excludeVaryingRanges(std::vector*) const { - } - - virtual bool verify() const { - return true; - } - - RTTR_ENABLE() -}; - -enum class PAG_API StrokePosition : uint8_t { - Outside = 0, - Inside = 1, - Center = 2, - Invalid = 255 -}; - -enum class PAG_API GlowColorType : uint8_t { - SingleColor = 0, - Gradient = 1 -}; - -enum class PAG_API GlowTechniqueType : uint8_t { - Softer = 0, - Precise = 1 -}; - -enum class PAG_API LineCap : uint8_t { - Butt = 0, - Round = 1, - Square = 2 -}; - -enum class PAG_API LineJoin : uint8_t { - Miter = 0, - Round = 1, - Bevel = 2 -}; - -enum class PAG_API FillRule : uint8_t { - NonZeroWinding = 0, - EvenOdd = 1 -}; - -enum class PAG_API GradientFillType : uint8_t { - Linear = 0, - Radial = 1, - Angle = 2, - Reflected = 3, - Diamond = 4 // not supported yet -}; - -class PAG_API DropShadowStyle : public LayerStyle { - public: - ~DropShadowStyle() override; - - LayerStyleType type() const override { - return LayerStyleType::DropShadow; - } - - LayerStylePosition drawPosition() const override { - return LayerStylePosition::Blow; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blendMode = nullptr; - Property* color = nullptr; - Property* opacity = nullptr; - Property* angle = nullptr; - Property* distance = nullptr; - Property* size = nullptr; - Property* spread = nullptr; - - RTTR_ENABLE(LayerStyle) -}; - -class PAG_API StrokeStyle : public LayerStyle { - public: - ~StrokeStyle() override; - - LayerStyleType type() const override { - return LayerStyleType::Stroke; - } - - LayerStylePosition drawPosition() const override { - return LayerStylePosition::Above; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blendMode = nullptr; - Property* color = nullptr; - Property* size = nullptr; - Property* opacity = nullptr; - Property* position = nullptr; - - RTTR_ENABLE(LayerStyle) -}; - -struct AlphaStop { - float position = 0.0f; - float midpoint = 0.5f; - Opacity opacity = Opaque; -}; - -struct ColorStop { - float position = 0.0f; - float midpoint = 0.5f; - Color color = Black; -}; - -class PAG_API GradientColor { - public: - std::vector alphaStops; - std::vector colorStops; - - void interpolate(const GradientColor& other, GradientColor* result, float t); -}; - -typedef std::shared_ptr GradientColorHandle; - -class PAG_API GradientOverlayStyle : public LayerStyle { - public: - ~GradientOverlayStyle() override; - - LayerStyleType type() const override { - return LayerStyleType::GradientOverlay; - } - - LayerStylePosition drawPosition() const override { - return LayerStylePosition::Above; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blendMode = nullptr; - Property* opacity = nullptr; - Property* colors = nullptr; - Property* gradientSmoothness = nullptr; - Property* angle = nullptr; - Property* style = nullptr; - Property* reverse = nullptr; - Property* alignWithLayer = nullptr; - Property* scale = nullptr; - Property* offset = nullptr; - - RTTR_ENABLE(LayerStyle) -}; - -class PAG_API OuterGlowStyle : public LayerStyle { - public: - ~OuterGlowStyle() override; - - LayerStyleType type() const override { - return LayerStyleType::OuterGlow; - } - - LayerStylePosition drawPosition() const override { - return LayerStylePosition::Blow; - } - - bool visibleAt(Frame layerFrame) const override; - - void transformBounds(Rect* contentBounds, const Point& filterScale, - Frame layerFrame) const override; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - Property* blendMode = nullptr; - Property* opacity = nullptr; - Property* noise = nullptr; - Property* colorType = nullptr; - Property* color = nullptr; - Property* colors = nullptr; - Property* gradientSmoothness = nullptr; - Property* technique = nullptr; - Property* spread = nullptr; - Property* size = nullptr; - Property* range = nullptr; - Property* jitter = nullptr; - - RTTR_ENABLE(LayerStyle) -}; - -class PAG_API TextPathOptions { - public: - ~TextPathOptions(); - - MaskData* path = nullptr; // mask reference - Property* reversedPath = nullptr; - Property* perpendicularToPath = nullptr; - Property* forceAlignment = nullptr; - Property* firstMargin = nullptr; - Property* lastMargin = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class PAG_API AnchorPointGrouping : uint8_t{ - Character = 0, - Word = 1, - Line = 2, - All = 3 -}; - -class PAG_API TextMoreOptions { - public: - ~TextMoreOptions(); - - AnchorPointGrouping anchorPointGrouping = AnchorPointGrouping::Character; - Property* groupingAlignment = nullptr; // multidimensional Percent - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class PAG_API TextRangeSelectorUnits : uint8_t { - Percentage = 0, - Index = 1 -}; - -enum class PAG_API TextSelectorBasedOn : uint8_t { - Characters = 0, - CharactersExcludingSpaces = 1, - Words = 2, - Lines = 3 -}; - -enum class PAG_API TextSelectorMode : uint8_t { - None = 0, - Add = 1, - Subtract = 2, - Intersect = 3, - Min = 4, - Max = 5, - Difference = 6 -}; - -enum class PAG_API TextRangeSelectorShape : uint8_t { - Square = 0, - RampUp = 1, - RampDown = 2, - Triangle = 3, - Round = 4, - Smooth = 5 -}; - -enum class PAG_API TextAnimatorTrackingType : uint8_t { - BeforeAndAfter = 0, - Before = 1, - After = 2 -}; - -enum class PAG_API TextSelectorType : uint8_t { - Range = 0, - Wiggly = 1, - Expression = 2 -}; - -class PAG_API TextSelector { - public: - virtual ~TextSelector() { - } - - virtual uint8_t type() const = 0; - - virtual void excludeVaryingRanges(std::vector*) const = 0; - - virtual bool verify() const = 0; -}; - -class PAG_API TextRangeSelector : public TextSelector { - public: - ~TextRangeSelector(); - - uint8_t type() const override { - return static_cast(TextSelectorType::Range); - }; - - Property* start = nullptr; - Property* end = nullptr; - Property* offset = nullptr; - TextRangeSelectorUnits units = TextRangeSelectorUnits::Percentage; - TextSelectorBasedOn basedOn = TextSelectorBasedOn::Characters; - Property* mode = nullptr; - Property* amount = nullptr; - TextRangeSelectorShape shape = TextRangeSelectorShape::Square; - Property* smoothness = nullptr; - Property* easeHigh = nullptr; - Property* easeLow = nullptr; - bool randomizeOrder = false; - Property* randomSeed = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; -}; - -class PAG_API TextWigglySelector : public TextSelector { - public: - ~TextWigglySelector(); - - uint8_t type() const override { - return static_cast(TextSelectorType::Wiggly); - } - - Property* mode = nullptr; - Property* maxAmount = nullptr; - Property* minAmount = nullptr; - TextSelectorBasedOn basedOn = TextSelectorBasedOn::Characters; - Property* wigglesPerSecond = nullptr; - Property* correlation = nullptr; - Property* temporalPhase = nullptr; - Property* spatialPhase = nullptr; - Property* lockDimensions = nullptr; - Property* randomSeed = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; -}; - -class PAG_API TextAnimatorColorProperties { - public: - ~TextAnimatorColorProperties(); - - Property* fillColor = nullptr; - Property* strokeColor = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class PAG_API TextAnimatorTypographyProperties { - public: - ~TextAnimatorTypographyProperties(); - - Property* trackingType = nullptr; - Property* trackingAmount = nullptr; - Property* position = nullptr; // spatial - Property* scale = nullptr; // multidimensional - Property* rotation = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class PAG_API TextAnimator { - public: - ~TextAnimator(); - - // Text Animator selectors - std::vector selectors; - - // Text Animator Properties - TextAnimatorColorProperties* colorProperties = nullptr; - TextAnimatorTypographyProperties* typographyProperties = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class PAG_API ShapeTransform { - public: - ~ShapeTransform(); - - Property* anchorPoint = nullptr; // spatial - Property* position = nullptr; // spatial - Property* scale = nullptr; // multidimensional - Property* skew = nullptr; - Property* skewAxis = nullptr; - Property* rotation = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class RTTR_AUTO_REGISTER_CLASS ShapeType { - Unknown, - ShapeGroup, - Rectangle, - Ellipse, - PolyStar, - ShapePath, - Fill, - Stroke, - GradientFill, - GradientStroke, - MergePaths, - TrimPaths, - Repeater, - RoundCorners -}; - -class PAG_API ShapeElement { - public: - virtual ~ShapeElement() = default; - - virtual ShapeType type() const { - return ShapeType::Unknown; - } - - virtual void excludeVaryingRanges(std::vector*) const { - } - - virtual bool verify() const { - return true; - } - - RTTR_ENABLE() -}; - -class PAG_API ShapeGroupElement : public ShapeElement { - public: - ~ShapeGroupElement() override; - - ShapeType type() const override { - return ShapeType::ShapeGroup; - } - - BlendMode blendMode = BlendMode::Normal; - ShapeTransform* transform = nullptr; - std::vector elements; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API RectangleElement : public ShapeElement { - public: - ~RectangleElement() override; - - ShapeType type() const override { - return ShapeType::Rectangle; - } - - bool reversed = false; - Property* size = nullptr; // multidimensional - Property* position = nullptr; // spatial - Property* roundness = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API EllipseElement : public ShapeElement { - public: - ~EllipseElement() override; - - ShapeType type() const override { - return ShapeType::Ellipse; - } - - bool reversed = false; - Property* size = nullptr; // multidimensional - Property* position = nullptr; // spatial - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API PolyStarType : uint8_t { - Star = 0, - Polygon = 1 -}; - -class PAG_API PolyStarElement : public ShapeElement { - public: - ~PolyStarElement() override; - - ShapeType type() const override { - return ShapeType::PolyStar; - } - - bool reversed = false; - PolyStarType polyType = PolyStarType::Star; - Property* points = nullptr; - Property* position = nullptr; // spatial - Property* rotation = nullptr; - Property* innerRadius = nullptr; - Property* outerRadius = nullptr; - Property* innerRoundness = nullptr; - Property* outerRoundness = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API ShapePathElement : public ShapeElement { - public: - ~ShapePathElement() override; - - ShapeType type() const override { - return ShapeType::ShapePath; - } - - Property* shapePath = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API CompositeOrder : uint8_t { - BelowPreviousInSameGroup = 0, - AbovePreviousInSameGroup = 1 -}; - -class PAG_API FillElement : public ShapeElement { - public: - ~FillElement() override; - - ShapeType type() const override { - return ShapeType::Fill; - } - - BlendMode blendMode = BlendMode::Normal; - CompositeOrder composite = CompositeOrder::BelowPreviousInSameGroup; - FillRule fillRule = FillRule::NonZeroWinding; - Property* color = nullptr; - Property* opacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API StrokeElement : public ShapeElement { - public: - ~StrokeElement() override; - - ShapeType type() const override { - return ShapeType::Stroke; - } - - BlendMode blendMode = BlendMode::Normal; - CompositeOrder composite = CompositeOrder::BelowPreviousInSameGroup; - Property* color = nullptr; - Property* opacity = nullptr; - Property* strokeWidth = nullptr; - LineCap lineCap = LineCap::Butt; - LineJoin lineJoin = LineJoin::Miter; - Property* miterLimit = nullptr; - Property* dashOffset = nullptr; - std::vector*> dashes; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API GradientFillElement : public ShapeElement { - public: - ~GradientFillElement() override; - - ShapeType type() const override { - return ShapeType::GradientFill; - } - - BlendMode blendMode = BlendMode::Normal; - CompositeOrder composite = CompositeOrder::BelowPreviousInSameGroup; - FillRule fillRule = FillRule::NonZeroWinding; - GradientFillType fillType = GradientFillType::Linear; - Property* opacity = nullptr; - Property* startPoint = nullptr; // spatial - Property* endPoint = nullptr; // spatial - Property* colors = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API GradientStrokeElement : public ShapeElement { - public: - ~GradientStrokeElement() override; - - ShapeType type() const override { - return ShapeType::GradientStroke; - } - - BlendMode blendMode = BlendMode::Normal; - CompositeOrder composite = CompositeOrder::BelowPreviousInSameGroup; - GradientFillType fillType = GradientFillType::Linear; - LineCap lineCap = LineCap::Butt; - LineJoin lineJoin = LineJoin::Miter; - Property* miterLimit = nullptr; - Property* startPoint = nullptr; // spatial - Property* endPoint = nullptr; // spatial - Property* colors = nullptr; - Property* opacity = nullptr; - Property* strokeWidth = nullptr; - Property* dashOffset = nullptr; - std::vector*> dashes; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API MergePathsMode : uint8_t { - Merge = 0, - Add = 1, - Subtract = 2, - Intersect = 3, - ExcludeIntersections = 4 -}; - -class PAG_API MergePathsElement : public ShapeElement { - public: - ShapeType type() const override { - return ShapeType::MergePaths; - } - - MergePathsMode mode = MergePathsMode::Add; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API TrimPathsType : uint8_t { - Simultaneously = 0, - Individually = 1 -}; - -class PAG_API TrimPathsElement : public ShapeElement { - public: - ~TrimPathsElement() override; - - ShapeType type() const override { - return ShapeType::TrimPaths; - } - - Property* start = nullptr; - Property* end = nullptr; - Property* offset = nullptr; - TrimPathsType trimType = TrimPathsType::Simultaneously; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API RepeaterTransform { - public: - ~RepeaterTransform(); - - Property* anchorPoint = nullptr; // spatial - Property* position = nullptr; // spatial - Property* scale = nullptr; // multidimensional - Property* rotation = nullptr; - Property* startOpacity = nullptr; - Property* endOpacity = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -enum class PAG_API RepeaterOrder : uint8_t { - Below = 0, - Above = 1 -}; - -class PAG_API RepeaterElement : public ShapeElement { - public: - ~RepeaterElement() override; - - ShapeType type() const override { - return ShapeType::Repeater; - } - - Property* copies = nullptr; - Property* offset = nullptr; - RepeaterOrder composite = RepeaterOrder::Below; - RepeaterTransform* transform = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -class PAG_API RoundCornersElement : public ShapeElement { - public: - ~RoundCornersElement() override; - - ShapeType type() const override { - return ShapeType::RoundCorners; - } - - Property* radius = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const override; - - bool verify() const override; - - RTTR_ENABLE(ShapeElement) -}; - -enum class PAG_API IrisShapeType : uint8_t { - FastRectangle = 0, - Triangle = 1, - Square = 2, - Pentagon = 3, - Hexagon = 4, - Heptagon = 5, - Octagon = 6, - Nonagon = 7, - Decagon = 8 -}; - -class PAG_API CameraOption { - public: - ~CameraOption(); - - Property* zoom = nullptr; - Property* depthOfField = nullptr; - Property* focusDistance = nullptr; - Property* aperture = nullptr; - Property* blurLevel = nullptr; - Property* irisShape = nullptr; - Property* irisRotation = nullptr; - Property* irisRoundness = nullptr; - Property* irisAspectRatio = nullptr; - Property* irisDiffractionFringe = nullptr; - Property* highlightGain = nullptr; - Property* highlightThreshold = nullptr; - Property* highlightSaturation = nullptr; - - void excludeVaryingRanges(std::vector* timeRanges) const; - - bool verify() const; -}; - -class Composition; - -class VectorComposition; - -class BitmapComposition; - -class ImageBytes; - -class PAG_API Cache { - public: - virtual ~Cache() = default; -}; - -enum class PAG_API TrackMatteType : uint8_t { - None = 0, - Alpha = 1, - AlphaInverted = 2, - Luma = 3, - LumaInverted = 4 -}; - -enum class PAG_API CachePolicy : uint8_t { - Auto = 0, - Enable = 1, - Disable = 2 -}; - -/** - * The Layer object provides access to layers within compositions. - */ -class PAG_API Layer { - public: - Layer(); - - virtual ~Layer(); - - /** - * The type of the layer. - */ - virtual LayerType type() const { - return LayerType::Unknown; - } - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - - /** - * The id of this layer. - */ - ID id = 0; - /** - * The parent of this layer. - */ - Layer* RTTR_SKIP_REGISTER_PROPERTY parent = nullptr; // layer reference - - VectorComposition* RTTR_SKIP_REGISTER_PROPERTY containingComposition = nullptr; // composition reference - - /** - * The name of the layer. - */ - std::string name = ""; - /** - * The time stretch percentage of the layer. - */ - Ratio stretch = DefaultRatio; - /** - * The start time of the layer, indicates the start position of the visible range. It could be a - * negative value. - */ - Frame startTime = ZeroFrame; - /** - * The duration of the layer, indicates the length of the visible range. - */ - Frame duration = ZeroFrame; - /** - * When true, the layer' automatic orientation is enabled. - */ - bool autoOrientation = false; - /** - * When true, the layer' motion blur is enabled. - */ - bool motionBlur = false; - /** - * The 2D transformation of the layer. - */ - Transform2D* transform = nullptr; - /** - * The 3D transformation of the layer. - */ - Transform3D* transform3D = nullptr; - /** - * When false, the layer should be skipped during the rendering loop. - */ - bool isActive = true; - /** - * The blending mode of the layer. - */ - BlendMode blendMode = BlendMode::Normal; - /** - * If layer has a track matte, specifies the way it is applied. - */ - TrackMatteType trackMatteType = TrackMatteType::None; - Layer* trackMatteLayer = nullptr; - Property* timeRemap = nullptr; - std::vector masks; - std::vector effects; - std::vector layerStyles; - std::vector markers; - CachePolicy cachePolicy = CachePolicy::Auto; - - Cache* RTTR_SKIP_REGISTER_PROPERTY cache = nullptr; - std::mutex locker = {}; - - virtual void excludeVaryingRanges(std::vector* timeRanges); - virtual bool verify() const; - Point getMaxScaleFactor(); - std::pair getScaleFactor(); - TimeRange visibleRange(); - virtual Rect getBounds() const; - - private: - bool verifyExtra() const; - - RTTR_ENABLE() -}; - -class PAG_API NullLayer : public Layer { - public: - /** - * The type of the layer. - */ - LayerType type() const override { - return LayerType::Null; - }; - - RTTR_ENABLE(Layer) -}; - -class PAG_API SolidLayer : public Layer { - public: - LayerType type() const override { - return LayerType::Solid; - }; - /** - * The background color of the solid layer. - */ - Color solidColor = Black; - /** - * The width of the SolidLayer. - */ - int32_t width = 0; - /** - * The height of the SolidLayer. - */ - int32_t height = 0; - - bool verify() const override; - - Rect getBounds() const override; - - RTTR_ENABLE(Layer) -}; - -class PAG_API TextLayer : public Layer { - public: - ~TextLayer() override; - - LayerType type() const override { - return LayerType::Text; - }; - - Property* sourceText = nullptr; - TextPathOptions* pathOption = nullptr; - TextMoreOptions* moreOption = nullptr; - std::vector animators; - - void excludeVaryingRanges(std::vector* timeRanges) override; - bool verify() const override; - - Rect getBounds() const override; - - std::shared_ptr getTextDocument(); - - RTTR_ENABLE(Layer) -}; - -class PAG_API ShapeLayer : public Layer { - public: - ~ShapeLayer() override; - - LayerType type() const override { - return LayerType::Shape; - }; - - std::vector contents; - - void excludeVaryingRanges(std::vector* timeRanges) override; - bool verify() const override; - - Rect getBounds() const override; - - RTTR_ENABLE(Layer) -}; - -class PAG_API ImageFillRule { - public: - ~ImageFillRule(); - - PAGScaleMode scaleMode = PAGScaleMode::LetterBox; - - // timeRemap基于composition时间轴 - Property* timeRemap = nullptr; -}; - -class PAG_API ImageLayer : public Layer { - public: - ~ImageLayer() override; - - LayerType type() const override { - return LayerType::Image; - }; - - // it is owned by the PAG file, there is no need to delete it. - ImageBytes* imageBytes = nullptr; - - ImageFillRule* imageFillRule = nullptr; - - bool verify() const override; - - Rect getBounds() const override; - - RTTR_ENABLE(Layer) -}; - -class PAG_API PreComposeLayer : public Layer { - public: - static std::unique_ptr Wrap(Composition* composition); - - LayerType type() const override { - return LayerType::PreCompose; - }; - - Composition* composition = nullptr; // composition reference - - /** - * Indicates when the first frame of the composition shows in the layer's timeline. It could be a - * negative value. It is in layer's frame rate. - */ - Frame compositionStartTime = ZeroFrame; - - void excludeVaryingRanges(std::vector* timeRanges) override; - bool verify() const override; - std::vector getContentStaticTimeRanges() const; - Frame getCompositionFrame(Frame layerFrame); - Rect getBounds() const override; - - RTTR_ENABLE(Layer) -}; - -class PAG_API CameraLayer : public Layer { - public: - ~CameraLayer() override; - - LayerType type() const override { - return LayerType::Camera; - }; - - void excludeVaryingRanges(std::vector* timeRanges) override; - bool verify() const override; - - Rect getBounds() const override; - - CameraOption* cameraOption = nullptr; - - RTTR_ENABLE(Layer) -}; - -/** - * Compositions are always one of the following types. - */ -enum class RTTR_AUTO_REGISTER_CLASS CompositionType { Unknown, Vector, Bitmap, Video }; - -class PAG_API Composition { - public: - Composition(); - - virtual ~Composition(); - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - /** - * A unique identifier for this item. - */ - ID id = ZeroID; - /** - * The width of the Composition. - */ - int32_t width = 0; - /** - * The height of the item. - */ - int32_t height = 0; - /** - * The total duration of the item. - */ - Frame duration = ZeroFrame; - /** - * The frame rate of the Composition. - */ - float frameRate = 30; - /** - * The background color of the composition. - */ - Color backgroundColor = White; - - /** - * The audio data of this composition, which is an AAC audio in an MPEG-4 container. - */ - ByteData* audioBytes = nullptr; - std::vector audioMarkers; - - /** - * Indicates when the first frame of the audio plays in the composition's timeline. - */ - Frame audioStartTime = ZeroFrame; - - /** - * [FrameStart, FrameEnd(included)], [FrameStar, FrameEnd]... - */ - std::vector staticTimeRanges; - Cache* RTTR_SKIP_REGISTER_PROPERTY cache = nullptr; - std::mutex locker = {}; - - bool staticContent() const; - - /** - * The type of the Composition. - */ - virtual CompositionType type() const; - - /** - * Returns true if this composition contains ImageLayers, BitmapCompositions or VideoCompositions. - */ - virtual bool hasImageContent() const; - - virtual bool verify() const; - - protected: - // Called by Codec. - virtual void updateStaticTimeRanges(); - - private: - bool staticTimeRangeUpdated = false; - - friend class Codec; - - friend class VectorComposition; - - RTTR_ENABLE() -}; - -class PAG_API VectorComposition : public Composition { - public: - ~VectorComposition() override; - /** - * The layers of the composition. - */ - std::vector layers; - - /** - * The type of the Composition. - */ - CompositionType type() const override; - - bool hasImageContent() const override; - - bool verify() const override; - - protected: - void updateStaticTimeRanges() override; - - RTTR_ENABLE(Composition) -}; - -class PAG_API ImageBytes { - public: - ImageBytes(); - - ~ImageBytes(); - /** - * Returns a globally unique id for this object. - */ - ID uniqueID = 0; - /** - * The id for this image bytes. - */ - ID id = ZeroID; - /** - * The width of the image. It is set when the image is stripped of its transparent border, - * otherwise the value would be 0. - */ - int32_t width = 0; - /** - * The height of the image. It is set when the image is stripped of its transparent border, - * otherwise the value would be 0. - */ - int32_t height = 0; - /** - * The anchor x of the image. It is set when the image is stripped of its transparent border. - */ - int32_t anchorX = 0; - /** - * The anchor y of the image. It is set when the image is stripped of its transparent border. - */ - int32_t anchorY = 0; - /** - * The scale factor of image, ranges from 0.0 to 1.0. - */ - float scaleFactor = 1.0f; - /** - * The file data of this image bytes. - */ - ByteData* fileBytes = nullptr; - - bool verify() const; - - Cache* RTTR_SKIP_REGISTER_PROPERTY cache = nullptr; - std::mutex locker = {}; - - private: - bool encrypted = false; - - friend class ImageBytesCache; - friend class EncryptedCodec; -}; - -class PAG_API BitmapRect { - public: - ~BitmapRect(); - - /** - * The x position of the bitmap rect. - */ - int32_t x = 0; - /** - * The y position of the bitmap rect. - */ - int32_t y = 0; - /** - * The file bytes of the image. - */ - ByteData* fileBytes = nullptr; -}; - -class PAG_API Sequence { - public: - /** - * Returns the sequence in specified composition, returns nullptr if the type of composition is - * not video or bitmap. - */ - static Sequence* Get(Composition* composition); - - virtual ~Sequence() = default; - /** - * The Composition which owns this Sequence. - */ - Composition* RTTR_SKIP_REGISTER_PROPERTY composition = nullptr; - /** - * The width of the sequence. - */ - int32_t width = 0; - /** - * The height of the sequence. - */ - int32_t height = 0; - /** - * The frame rate of sequence. - */ - float frameRate = 30; - /** - * The total duration of the item. - */ - virtual Frame duration() const = 0; - - virtual bool verify() const; - - Frame toSequenceFrame(Frame compositionFrame); - - RTTR_ENABLE() -}; - -class PAG_API BitmapFrame { - public: - ~BitmapFrame(); - /** - * Indicates whether or not it is a key frame. - */ - bool isKeyframe = false; - /** - * The image bytes need to be drawn onto. - */ - std::vector bitmaps; - - bool verify() const; -}; - -class PAG_API BitmapSequence : public Sequence { - public: - ~BitmapSequence() override; - /** - * The bitmap frames of the Composition. - */ - std::vector frames; - - virtual bool isEmptyBitmapFrame(size_t frameIndex); - - Frame duration() const override { - return static_cast(frames.size()); - } - - bool verify() const override; - - RTTR_ENABLE(Sequence) -}; - -class PAG_API BitmapComposition : public Composition { - public: - ~BitmapComposition() override; - /** - * The type of the Composition. - */ - CompositionType type() const override; - /** - * The bitmap frames of the Composition. It is sorted in ascending order. - */ - std::vector sequences; - - bool hasImageContent() const override; - - bool verify() const override; - - protected: - void updateStaticTimeRanges() override; - - RTTR_ENABLE(Composition) -}; - -class PAG_API VideoFrame { - public: - ~VideoFrame(); - /** - * Indicates whether or not it is a key frame. - */ - bool isKeyframe = false; - - /** - * The presentation frame index. - */ - Frame frame = 0; - - /** - * The file bytes of the video frame. - */ - ByteData* fileBytes = nullptr; -}; - -class PAG_API VideoSequence : public Sequence { - public: - ~VideoSequence() override; - /** - * The x position of the alpha start point. - */ - int32_t alphaStartX = 0; - /** - * The y position of the alpha start point. - */ - int32_t alphaStartY = 0; - /** - * The video frames of the Composition. - */ - std::vector frames; - /** - * Codec specific data. - */ - std::vector headers; - - std::vector staticTimeRanges; - - ByteData* MP4Header = nullptr; - - Frame duration() const override { - return static_cast(frames.size()); - } - - bool verify() const override; - - int32_t getVideoWidth() const; - - int32_t getVideoHeight() const; - - RTTR_ENABLE(Sequence) -}; - -class PAG_API VideoComposition : public Composition { - public: - ~VideoComposition() override; - /** - * The type of the Composition. - */ - CompositionType type() const override; - - /** - * The video frames of the Composition. It is sorted in ascending order. - */ - std::vector sequences; - - bool hasImageContent() const override; - - bool verify() const override; - - protected: - void updateStaticTimeRanges() override; - - RTTR_ENABLE(Composition) -}; - -class PAG_API FontData { - public: - FontData(std::string fontFamily, std::string fontStyle) - : fontFamily(std::move(fontFamily)), fontStyle(std::move(fontStyle)) { - } - - const std::string fontFamily; - const std::string fontStyle; -}; - -class PAG_API FileAttributes { - public: - bool empty() const { - return timestamp == 0 && pluginVersion.empty() && aeVersion.empty() && systemVersion.empty() && - author.empty() && scene.empty() && warnings.empty(); - } - - int64_t timestamp = 0; - std::string pluginVersion = ""; - std::string aeVersion = ""; - std::string systemVersion = ""; - std::string author = ""; - std::string scene = ""; - std::vector warnings; -}; - -struct PerformanceData { - /** - * The time cost by rendering in microseconds. - */ - int64_t renderingTime; - - /** - * The time cost by image decoding in microseconds. - */ - int64_t imageDecodingTime; - - /** - * The time cost by presenting in microseconds. - */ - int64_t presentingTime; - - /** - * The memory cost by graphics in bytes. - */ - int64_t graphicsMemory; -}; - -class PAG_API File { - public: - /** - * The maximum tag level current SDK supports. - */ - static uint16_t MaxSupportedTagLevel(); - /** - * Load a pag file from byte data, return null if the bytes is empty or it's not a valid pag - * file. - */ - static std::shared_ptr Load(const void* bytes, size_t length, - const std::string& filePath = "", - const std::string& password = ""); - /** - * Load a pag file from path, return null if the file does not exist or the data is not a pag - * file. - */ - static std::shared_ptr Load(const std::string& filePath, const std::string& password = ""); - - ~File(); - - /** - * Return the duration of the pag file in frames. - */ - int64_t duration() const; - - /** - * The frame rate of the pag file. - */ - float frameRate() const; - - /** - * Return the original display width in pixels of pag file. - */ - int32_t width() const; - - /** - * Return the original display height in pixels of pag file. - */ - int32_t height() const; - - /** - * The tag level this pag file requires. - */ - uint16_t tagLevel() const; - - /** - * The background color of the pag file. - */ - Color backgroundColor() const; - - /** - * The number of replaceable texts. - */ - int numTexts() const; - - /** - * The number of replaceable images. - */ - int numImages() const; - - /** - * The number of video compositions. - */ - int numVideos() const; - - /** - * The 'total' number of layers in this pag file, for profiling only. - */ - int numLayers() const; - - /** - * Get a text data of the specified index. The index ranges from 0 to numTexts - 1. - */ - TextDocumentHandle getTextData(int index) const; - - PreComposeLayer* getRootLayer() const; - - TextLayer* getTextAt(int index) const; - - std::vector getImageAt(int index) const; - - int getEditableIndex(TextLayer* textLayer) const; - - int getEditableIndex(ImageLayer* imageLayer) const; - - bool hasScaledTimeRange() const; - - /** - * Indicates how to stretch the duration of File when rendering. - */ - PAGTimeStretchMode timeStretchMode = PAGTimeStretchMode::Repeat; - TimeRange scaledTimeRange = {}; - FileAttributes fileAttributes = {}; - std::string path = ""; - std::vector images; - std::vector compositions; - - std::vector* editableImages = nullptr; - std::vector* editableTexts = nullptr; - std::vector* imageScaleModes = nullptr; - - RTTR_REGISTER_FUNCTION_AS_PROPERTY("duration", duration) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("frameRate", frameRate) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("width", width) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("height", height) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("tagLevel", tagLevel) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("backgroundColor", backgroundColor) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("numTexts", numTexts) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("numImages", numImages) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("numVideos", numVideos) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("numLayers", numLayers) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("rootLayer", getRootLayer) - RTTR_REGISTER_FUNCTION_AS_PROPERTY("hasScaledTimeRange", hasScaledTimeRange) - - private: - PreComposeLayer* rootLayer = nullptr; - Composition* mainComposition = nullptr; - uint16_t _tagLevel = 1; - int _numLayers = 0; - bool encrypted = false; - - // Just references, no need to delete them. - std::vector textLayers = {}; - - // Just references, no need to delete them. - std::vector> imageLayers = {}; - - File(std::vector compositionList, std::vector imageList); - void updateEditables(Composition* composition); - - friend class Codec; - friend class SequenceInfo; - friend class EncryptedCodec; -}; - -/** - * Calculate the memory cost by graphics of file in bytes. - */ -int64_t PAG_API CalculateGraphicsMemory(std::shared_ptr file); - -class CodecContext; - -class PAG_API Codec { - public: - /** - * Return the maximum supported tag level. - */ - static uint16_t MaxSupportedTagLevel(); - - /** - * Replace all temporary mask with real references. - */ - static void InstallReferences(Layer* layer); - - /** - * Replace all temporary layer with real references. - */ - static void InstallReferences(const std::vector& layers); - - /** - * Replace all temporary composition with real references. - */ - static void InstallReferences(const std::vector& compositions); - - /** - * Return null if the the specified data are not valid to create a pag file. - */ - static std::shared_ptr VerifyAndMake(const std::vector& compositions, - const std::vector& images); - - /** - * Decode a pag file from the specified byte data, return null if the bytes is empty or it's not a - * valid pag file. - */ - static std::shared_ptr Decode(const void* bytes, uint32_t byteLength, - const std::string& path); - - /** - * Encode a pag file to byte data, return null if the file is null. - */ - static std::unique_ptr Encode(std::shared_ptr file); - - /** - * Encode a pag file with the corresponding performance data to byte data, return null if the file - * is null. - */ - static std::unique_ptr Encode(std::shared_ptr pagFile, - std::shared_ptr performanceData); - - /** - * Read the performance data from the specified byte data, return null if the byte data contains - * no performance data. - */ - static std::shared_ptr ReadPerformanceData(const void* bytes, - uint32_t byteLength); - - protected: - static void UpdateFileAttributes(std::shared_ptr file, CodecContext* context, - const std::string& filePath); -}; -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/gpu.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/gpu.h deleted file mode 100644 index 1b1da6c..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/gpu.h +++ /dev/null @@ -1,326 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include -#include "pag/defines.h" - -#if defined(__ANDROID__) || defined(ANDROID) -struct AHardwareBuffer; -#elif defined(__OHOS__) -struct OH_NativeBuffer; -#elif defined(__APPLE__) -struct __CVBuffer; -#endif - -namespace pag { -#if defined(__ANDROID__) || defined(ANDROID) -typedef AHardwareBuffer* HardwareBufferRef; -#elif defined(__APPLE__) -// __CVBuffer == CVPixelBufferRef -typedef __CVBuffer* HardwareBufferRef; -#elif defined(__OHOS__) -typedef OH_NativeBuffer* HardwareBufferRef; -#else -typedef void* HardwareBufferRef; -#endif - -/** - * Possible GPU backend APIs that may be used by PAG. - */ -enum class Backend { - /** - * Mock is a backend that does not draw anything. It is used for unit tests and to measure CPU - * overhead. - */ - MOCK, - OPENGL, - METAL, - VULKAN, -}; - -/** - * Textures and FrameBuffers can be stored such that (0, 0) in texture space may correspond to - * either the top-left or bottom-left content pixel. - */ -enum class ImageOrigin { - /** - * The default origin of the native coordinate system in the GPU backend. For example, the - * ImageOrigin::TopLeft is actually the bottom-left origin in the OpenGL coordinate system for - * textures. Textures newly created by the backend API for off-screen rendering usually have an - * ImageOrigin::TopLeft origin. - */ - TopLeft, - - /** - * Use this origin to flip the content on the y-axis if the GPU backend has a different origin to - * your system views. It is usually used for on-screen rendering. - */ - BottomLeft -}; - -/** - * Types for interacting with GL textures created externally to PAG. - */ -struct GLTextureInfo { - /** - * the id of this texture. - */ - unsigned id = 0; - /** - * The target of this texture. - */ - unsigned target = 0x0DE1; // GL_TEXTURE_2D; - /** - * The pixel format of this texture. - */ - unsigned format = 0x8058; // GL_RGBA8; -}; - -/** - * Types for interacting with GL frame buffers created externally to PAG. - */ -struct GLFrameBufferInfo { - /** - * The id of this frame buffer. - */ - unsigned id = 0; - - /** - * The pixel format of this frame buffer. - */ - unsigned format = 0x8058; // GL_RGBA8; -}; - -/** - * Types for interacting with Metal resources created externally to PAG. Holds the MTLTexture as a - * void*. - */ -struct MtlTextureInfo { - /** - * Pointer to MTLTexture. - */ - void* texture = nullptr; -}; - -/** - * Types for interacting with Vulkan resources created externally to PAG. Holds the VkImage as a - * void*. - */ -struct VkImageInfo { - /** - * Pointer to VkImage. - */ - void* image = nullptr; -}; - -class PAG_API BackendTexture { - public: - /** - * Creates an invalid backend texture. - */ - BackendTexture() : _width(0), _height(0) { - } - - /** - * Creates an OpenGL backend texture. - */ - BackendTexture(const GLTextureInfo& glInfo, int width, int height); - - /** - * Creates a Metal backend texture. - */ - BackendTexture(const MtlTextureInfo& mtlInfo, int width, int height); - - /** - * Creates a Vulkan backend texture. - */ - BackendTexture(const VkImageInfo& vkInfo, int width, int height); - - BackendTexture(const BackendTexture& that); - - BackendTexture& operator=(const BackendTexture& that); - - /** - * Returns true if the backend texture has been initialized. - */ - bool isValid() const { - return _width > 0 && _height > 0; - } - - /** - * Returns the width of this texture. - */ - int width() const { - return _width; - } - - /** - * Returns the height of this texture. - */ - int height() const { - return _height; - } - - /** - * Returns the backend API of this texture. - */ - Backend backend() const { - return _backend; - } - - /** - * If the backend API is GL, copies a snapshot of the GLTextureInfo struct into the passed in - * pointer and returns true. Otherwise returns false if the backend API is not GL. - */ - bool getGLTextureInfo(GLTextureInfo* glTextureInfo) const; - - /** - * If the backend API is Metal, copies a snapshot of the GrMtlTextureInfo struct into the passed - * in pointer and returns true. Otherwise returns false if the backend API is not Metal. - */ - bool getMtlTextureInfo(MtlTextureInfo* mtlTextureInfo) const; - - /** - * If the backend API is Vulkan, copies a snapshot of the VkImageInfo struct into the passed - * in pointer and returns true. Otherwise, returns false if the backend API is not Vulkan. - */ - bool getVkImageInfo(VkImageInfo* vkImageInfo) const; - - private: - Backend _backend = Backend::MOCK; - int _width = 0; - int _height = 0; - - union { - GLTextureInfo glInfo; - MtlTextureInfo mtlInfo; - VkImageInfo vkInfo; - }; -}; - -class PAG_API BackendRenderTarget { - public: - /** - * Creates an invalid backend render target. - */ - BackendRenderTarget() : _width(0), _height(0) { - } - - /** - * Creates an OpenGL backend render target. - */ - BackendRenderTarget(const GLFrameBufferInfo& glInfo, int width, int height); - - /** - * Creates an Metal backend render target. - */ - BackendRenderTarget(const MtlTextureInfo& mtlInfo, int width, int height); - - /** - * Creates a Vulkan backend render target. - */ - BackendRenderTarget(const VkImageInfo& vkInfo, int width, int height); - - BackendRenderTarget(const BackendRenderTarget& that); - - BackendRenderTarget& operator=(const BackendRenderTarget&); - - /** - * Returns true if the backend texture has been initialized. - */ - bool isValid() const { - return _width > 0 && _height > 0; - } - - /** - * Returns the width of this render target. - */ - int width() const { - return _width; - } - - /** - * Returns the height of this render target. - */ - int height() const { - return _height; - } - - /** - * Returns the backend API of this render target. - */ - Backend backend() const { - return _backend; - } - - /** - * If the backend API is GL, copies a snapshot of the GLFramebufferInfo struct into the passed - * in pointer and returns true. Otherwise returns false if the backend API is not GL. - */ - bool getGLFramebufferInfo(GLFrameBufferInfo* glFrameBufferInfo) const; - - /** - * If the backend API is Metal, copies a snapshot of the MtlTextureInfo struct into the passed - * in pointer and returns true. Otherwise returns false if the backend API is not Metal. - */ - bool getMtlTextureInfo(MtlTextureInfo* mtlTextureInfo) const; - - /** - * If the backend API is Vulkan, copies a snapshot of the VkImageInfo struct into the passed - * in pointer and returns true. Otherwise, returns false if the backend API is not Vulkan. - */ - bool getVkImageInfo(VkImageInfo* vkImageInfo) const; - - private: - Backend _backend = Backend::MOCK; - int _width = 0; - int _height = 0; - union { - GLFrameBufferInfo glInfo; - MtlTextureInfo mtlInfo; - VkImageInfo vkInfo; - }; -}; - -/** - * Wrapper class for passing into and receiving data from PAG about a backend semaphore object. - */ -class PAG_API BackendSemaphore { - public: - BackendSemaphore(); - - bool isInitialized() const { - return _isInitialized; - } - - void initGL(void* sync); - - void* glSync() const; - - private: - Backend _backend = Backend::MOCK; - union { - void* _glSync; - }; - bool _isInitialized; -}; -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/pag.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/pag.h deleted file mode 100644 index 85e6825..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/pag.h +++ /dev/null @@ -1,1722 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include // for windows -#include -#include "pag/decoder.h" -#include "pag/gpu.h" -#include "pag/types.h" - -namespace tgfx { -struct Rect; -class Context; -class Surface; -class ImageInfo; -} // namespace tgfx - -namespace pag { -class Recorder; - -class RenderCache; - -class Drawable; - -class Content { - public: - virtual ~Content() = default; - - protected: - virtual void measureBounds(tgfx::Rect* bounds) = 0; - - virtual void draw(Recorder* recorder) = 0; - - friend class FilterRenderer; - - friend class LayerRenderer; - - friend class MemoryCalculator; - - friend class TrackMatteRenderer; - - friend class RenderCache; - - friend class PAGLayer; - - friend class PAGComposition; - - friend class PAGTextLayer; -}; - -class Graphic; - -class PAGLayer; - -/** - * An image used to replace the contents of PAGImageLayers in a PAGFile. - */ -class PAG_API PAGImage { - public: - /** - * Creates a PAGImage object from a path of an image file, return null if the file does not exist, - * or it's not a valid image file. - */ - static std::shared_ptr FromPath(const std::string& filePath); - - /** - * Creates a PAGImage object from the specified file bytes, return null if the bytes is empty or - * it's not a valid image file. - */ - static std::shared_ptr FromBytes(const void* bytes, size_t length); - - /** - * Creates a PAGImage object from an array of pixel data, return null if it's not valid pixels. - * @param pixels The pixel data to copy from. - * @param width The width of the pixel data. - * @param height The height of the pixel data. - * @param rowBytes The number of bytes between subsequent rows of the pixel data. - * @param colorType Describes how to interpret the components of a pixel. - * @param alphaType Describes how to interpret the alpha component of a pixel. - */ - static std::shared_ptr FromPixels(const void* pixels, int width, int height, - size_t rowBytes, ColorType colorType, - AlphaType alphaType); - - /** - * Creates a PAGImage object from the specified backend texture, return null if the texture is - * invalid. - */ - static std::shared_ptr FromTexture(const BackendTexture& texture, ImageOrigin origin); - - virtual ~PAGImage() = default; - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID() const { - return _uniqueID; - } - - /** - * Returns the width in pixels. - */ - int width() const { - return _width; - } - - /** - * Returns the height in pixels. - */ - int height() const { - return _height; - } - - /** - * Returns the current scale mode. The default value is PAGScaleMode::LetterBox. - */ - PAGScaleMode scaleMode() const; - - /** - * Specifies the rule of how to scale the content to fit the image layer's original size. - * The matrix changes when this method is called. - */ - void setScaleMode(PAGScaleMode mode); - - /** - * Returns a copy of the current matrix. - */ - Matrix matrix() const; - - /** - * Set the transformation which will be applied to the content. - * The scaleMode property will be set to PAGScaleMode::None when this method is called. - */ - void setMatrix(const Matrix& matrix); - - protected: - PAGImage(int width, int height); - - virtual std::shared_ptr getGraphic(Frame frame) const = 0; - - virtual bool isStill() const = 0; - - virtual Frame getContentFrame(int64_t time) const = 0; - - private: - mutable std::mutex locker = {}; - ID _uniqueID = 0; - int _width = 0; - int _height = 0; - PAGScaleMode _scaleMode = PAGScaleMode::LetterBox; - Matrix _matrix = Matrix::I(); - bool hasSetScaleMode = false; - - Matrix getContentMatrix(PAGScaleMode defaultScaleMode, int contentWidth, int contentHeight); - - friend class ImageReplacement; - - friend class PAGImageLayer; - - friend class PAGFile; - - friend class RenderCache; - - friend class AudioClip; -}; - -class PAGComposition; - -class PAGImageLayer; - -class PAGStage; - -class PAG_API PAGFont { - public: - /** - * Registers a font required by the text layers in pag files, so that they can be rendered as - * designed. - */ - static PAGFont RegisterFont(const std::string& fontPath, int ttcIndex, - const std::string& fontFamily = "", - const std::string& fontStyle = ""); - /** - * Registers a font required by the text layers in pag files, so that they can be rendered as - * designed. - */ - static PAGFont RegisterFont(const void* data, size_t length, int ttcIndex, - const std::string& fontFamily = "", - const std::string& fontStyle = ""); - - /** - * Unregister a font. - */ - static void UnregisterFont(const PAGFont& font); - - /** - * Resets the fallback font names. It should be called only once when the application is being - * initialized. - */ - static void SetFallbackFontNames(const std::vector& fontNames); - - /** - * Resets the fallback font paths. It should be called only once when the application is being - * initialized. - */ - static void SetFallbackFontPaths(const std::vector& fontPaths, - const std::vector& ttcIndices); - - PAGFont(std::string fontFamily, std::string fontStyle) - : fontFamily(std::move(fontFamily)), fontStyle(std::move(fontStyle)) { - } - - /** - * A string with the name of the font family. - **/ - const std::string fontFamily; - /** - * A string with the style information — e.g., “bold”, “italic”. - **/ - const std::string fontStyle; -}; - -class File; - -class Layer; - -class LayerCache; - -class Content; - -class Transform; - -class PAGFile; - -class ContentVersion; - -class PAG_API PAGLayer : public Content { - public: - PAGLayer(std::shared_ptr file, Layer* layer); - - ~PAGLayer() override; - - /** - * Returns a globally unique id for this object. - */ - ID uniqueID() const; - - /** - * Returns the type of layer. - */ - LayerType layerType() const; - - /** - * Returns the name of the layer. - */ - std::string layerName() const; - - /** - * A matrix object containing values that alter the scaling, rotation, and translation of the - * layer. Altering it does not change the animation matrix, and it will be concatenated to current - * animation matrix for displaying. - */ - Matrix matrix() const; - - void setMatrix(const Matrix& value); - - /** - * Resets the matrix to its default value. - */ - void resetMatrix(); - - /** - * Returns the layer's display matrix by combining its matrix) property with the current animation - * matrix from the AE timeline. This does not include the parent layer's matrix. - * To calculate the final bounds relative to the PAGSurface, use the PAGPlayer::getBounds(PAGLayer layer) - * method directly. - */ - Matrix getTotalMatrix(); - - /** - * Returns the current alpha of the layer if previously set. - */ - float alpha() const; - - /** - * Set the alpha of the layer, which will be concatenated to the current animation opacity for - * displaying. - */ - void setAlpha(float value); - - /** - * Whether or not the layer is visible. - */ - bool visible() const; - - /** - * Set the visible of the layer. - */ - void setVisible(bool value); - - /** - * Ranges from 0 to PAGFile.numTexts - 1 if the layer type is text, or from 0 to PAGFile.numImages - * -1 if the layer type is image, otherwise returns -1. - */ - int editableIndex() const; - - /** - * Returns the parent PAGComposition of current PAGLayer. - */ - - std::shared_ptr parent() const; - - /** - * Returns the markers of this layer. - */ - std::vector markers() const; - - /** - * Converts the time from the PAGLayer's (local) timeline to the PAGSurface (global) timeline. The - * time is in microseconds. - */ - int64_t localTimeToGlobal(int64_t localTime) const; - - /** - * Converts the time from the PAGSurface (global) to the PAGLayer's (local) timeline timeline. The - * time is in microseconds. - */ - int64_t globalToLocalTime(int64_t globalTime) const; - - /** - * The duration of the layer in microseconds, indicates the length of the visible range. - */ - int64_t duration() const; - - /** - * Returns the frame rate of this layer. - */ - float frameRate() const; - - /** - * The start time of the layer in microseconds, indicates the start position of the visible range - * in parent composition. It could be negative value. - */ - int64_t startTime() const; - - /** - * Set the start time of the layer, in microseconds. - */ - void setStartTime(int64_t time); - - /** - * The current time of the layer in microseconds, the layer is invisible if currentTime is not in - * the visible range (startTime <= currentTime < startTime + duration). - */ - int64_t currentTime() const; - - /** - * Set the current time of the layer, in microseconds. - */ - void setCurrentTime(int64_t time); - - /** - * Returns the current progress of play position, the value ranges from 0.0 to 1.0. - */ - double getProgress(); - - /** - * Set the progress of play position, the value ranges from 0.0 to 1.0. A value of 0.0 represents - * the frame at startTime. A value of 1.0 represents the frame at the end of duration. - */ - void setProgress(double percent); - - /** - * Set the progress of play position to the previous frame. - */ - void preFrame(); - - /** - * Set the progress of play position to the next frame. - */ - void nextFrame(); - - /** - * Returns a rectangle in pixels that defines the original area of the layer, which is not - * transformed by the matrix. - */ - Rect getBounds(); - - /** - * Returns trackMatte layer of this layer. - */ - std::shared_ptr trackMatteLayer() const; - - /** - * Indicate whether this layer is excluded from parent's timeline. If set to true, this layer's - * current time will not change when parent's current time changes. - */ - bool excludedFromTimeline() const; - - /** - * Set the excludedFromTimeline flag of this layer. - */ - void setExcludedFromTimeline(bool value); - - /** - * Returns true if this layer is a PAGFile. - */ - virtual bool isPAGFile() const; - - // internal use only. - void* externalHandle = nullptr; - std::shared_ptr getFile() const; - void notifyAudioModified(); - - protected: - std::shared_ptr rootLocker = nullptr; - Layer* layer = nullptr; - LayerCache* layerCache = nullptr; - PAGStage* stage = nullptr; - PAGComposition* _parent = nullptr; - Frame startFrame = 0; - Frame contentFrame = 0; - // It could be nullptr when the layer is created by PAGComposition(width, height), - // check before using it! - std::shared_ptr file = nullptr; - PAGFile* rootFile = nullptr; - std::weak_ptr weakThis; - Matrix layerMatrix = {}; - float layerAlpha = 1.0f; - PAGLayer* trackMatteOwner = nullptr; - - const Layer* getLayer() const; - const PAGStage* getStage() const; - Frame localFrameToGlobal(Frame localFrame) const; - Frame globalToLocalFrame(Frame globalFrame) const; - Point globalToLocalPoint(float stageX, float stageY); - void draw(Recorder* recorder) override; - void measureBounds(tgfx::Rect* bounds) override; - Matrix getTotalMatrixInternal(); - virtual void setMatrixInternal(const Matrix& matrix); - virtual float frameRateInternal() const; - double getProgressInternal(); - void setProgressInternal(double percent); - void preFrameInternal(); - void nextFrameInternal(); - virtual bool gotoTime(int64_t layerTime); - virtual Frame childFrameToLocal(Frame childFrame, float childFrameRate) const; - virtual Frame localFrameToChild(Frame localFrame, float childFrameRate) const; - - /** - * Marks the content of parent (and parent's parent...) changed. It also marks this layer's - * content changed if you pass true in the contentChanged parameter. - */ - void notifyModified(bool contentChanged = false); - virtual bool contentModified() const; - virtual bool cacheFilters() const; - virtual Frame frameDuration() const; - virtual Frame stretchedFrameDuration() const; - virtual Frame stretchedContentFrame() const; - virtual int64_t durationInternal() const; - virtual int64_t startTimeInternal() const; - virtual Content* getContent(); - virtual void invalidateCacheScale(); - virtual void onAddToStage(PAGStage* pagStage); - virtual void onRemoveFromStage(); - virtual void onAddToRootFile(PAGFile* pagFile); - virtual void onRemoveFromRootFile(); - virtual void onTimelineChanged(); - virtual void updateRootLocker(std::shared_ptr locker); - - private: - ID _uniqueID = 0; - bool layerVisible = true; - bool _excludedFromTimeline = false; - std::shared_ptr _trackMatteLayer = nullptr; - int _editableIndex = -1; - uint32_t contentVersion = 0; - std::atomic audioVersion = {0}; - - void setVisibleInternal(bool value); - void setStartTimeInternal(int64_t time); - int64_t currentTimeInternal() const; - Frame currentFrameInternal() const; - bool setCurrentTimeInternal(int64_t time); - bool frameVisible() const; - void removeFromParentOrOwner(); - void attachToTree(std::shared_ptr newLocker, PAGStage* newStage); - void detachFromTree(); - PAGLayer* getTimelineOwner() const; - PAGLayer* getParentOrOwner() const; - bool getTransform(Transform* transform); - bool gotoTimeAndNotifyChanged(int64_t targetTime); - - friend class PAGComposition; - - friend class PAGFile; - - friend class TrackMatteRenderer; - - friend class FilterModifier; - - friend class RenderCache; - - friend class PAGStage; - - friend class PAGPlayer; - - friend class FileReporter; - - friend class PAGImageLayer; - - friend class SequenceImageQueue; - - friend class PAGAudioReader; - - friend class AudioClip; - - friend class ContentVersion; - - friend class PAGDecoder; -}; - -class SolidLayer; - -class PAG_API PAGSolidLayer : public PAGLayer { - public: - static std::shared_ptr Make(int64_t duration, int32_t width, int32_t height, - Color solidColor, Opacity opacity = 255); - - PAGSolidLayer(std::shared_ptr file, SolidLayer* layer); - - ~PAGSolidLayer() override; - - /** - * Returns the layer's solid color. - */ - Color solidColor(); - - /** - * Set the layer's solid color. - */ - void setSolidColor(const Color& value); - - protected: - Content* getContent() override; - bool contentModified() const override; - - private: - SolidLayer* emptySolidLayer = nullptr; - Content* replacement = nullptr; - Color _solidColor = White; -}; - -class TextLayer; - -class TextReplacement; - -class PAG_API PAGTextLayer : public PAGLayer { - public: - static std::shared_ptr Make(int64_t duration, std::string text, float fontSize = 24, - std::string fontFamily = "", - std::string fontStyle = ""); - - static std::shared_ptr Make(int64_t duration, - std::shared_ptr textDocumentHandle); - - PAGTextLayer(std::shared_ptr file, TextLayer* layer); - ~PAGTextLayer() override; - - /** - * Returns the text layer’s fill color. - */ - Color fillColor() const; - - /** - * Set the text layer’s fill color. - */ - void setFillColor(const Color& value); - - /** - * Returns the text layer's font. - */ - PAGFont font() const; - - /** - * Set the text layer's font. - */ - void setFont(const PAGFont& font); - - /** - * Returns the text layer's font size. - */ - float fontSize() const; - - /** - * Set the text layer's font size. - */ - void setFontSize(float size); - - /** - * Returns the text layer's stroke color. - */ - Color strokeColor() const; - - /** - * Set the text layer's stroke color. - */ - void setStrokeColor(const Color& color); - - /** - * Returns the text layer's text. - */ - std::string text() const; - - /** - * Set the text layer's text. - */ - void setText(const std::string& text); - - /** - * Reset the text layer to its default text data. - */ - void reset(); - - protected: - void replaceTextInternal(std::shared_ptr textData); - void setMatrixInternal(const Matrix& matrix) override; - Content* getContent() override; - bool contentModified() const override; - - private: - TextLayer* emptyTextLayer = nullptr; - - TextReplacement* replacement = nullptr; - - const TextDocument* textDocumentForRead() const; - - TextDocument* textDocumentForWrite(); - - friend class PAGFile; - - friend class TextReplacement; -}; - -class ShapeLayer; - -class PAG_API PAGShapeLayer : public PAGLayer { - public: - PAGShapeLayer(std::shared_ptr file, ShapeLayer* layer); -}; - -/** - * Represents a time range from the content of PAGImageLayer. - */ -class PAG_API PAGVideoRange { - public: - PAGVideoRange(int64_t startTime, int64_t endTime, int64_t playDuration) - : _startTime(startTime), _endTime(endTime), _playDuration(playDuration) { - } - - /** - * The start time of the source video, in microseconds. - */ - int64_t startTime() const { - return _startTime < _endTime ? _startTime : _endTime; - } - - /** - * The end time of the source video (not included), in microseconds. - */ - int64_t endTime() const { - return _startTime < _endTime ? _endTime : _startTime; - } - - /** - * The duration for playing after applying speed. - */ - int64_t playDuration() const { - return _playDuration; - } - - /** - * Indicates whether the video should play backward. - */ - bool reversed() const { - return _startTime > _endTime; - } - - private: - int64_t _startTime; - int64_t _endTime; - int64_t _playDuration; -}; - -class ImageLayer; - -class ImageReplacement; - -template -class Property; - -template -class AnimatableProperty; - -class PAG_API PAGImageLayer : public PAGLayer { - public: - /** - * Make a PAGImageLayer with width, height and duration(in microseconds). - */ - static std::shared_ptr Make(int width, int height, int64_t duration); - - PAGImageLayer(std::shared_ptr file, ImageLayer* layer); - - ~PAGImageLayer() override; - - /** - * Returns the content duration in microseconds, which indicates the minimal length required for - * replacement. - */ - int64_t contentDuration(); - - /** - * Returns the time ranges of the source video for replacement. - */ - std::vector getVideoRanges() const; - - /** - * [Deprecated] - * Replace the original image content with the specified PAGImage object. - * Passing in null for the image parameter resets the layer to its default image content. - * The replaceImage() method modifies all associated PAGImageLayers that have the same - * editableIndex to this layer. - * - * @param image The PAGImage object to replace with. - */ - void replaceImage(std::shared_ptr image); - - /** - * Replace the original image content with the specified PAGImage object. - * Passing in null for the image parameter resets the layer to its default image content. - * The setImage() method only modifies the content of the calling PAGImageLayer. - * - * @param image The PAGImage object to replace with. - */ - void setImage(std::shared_ptr image); - - /** - * Converts the time from the PAGImageLayer's timeline to the replacement content's timeline. The - * time is in microseconds. - */ - int64_t layerTimeToContent(int64_t layerTime); - - /** - * Converts the time from the replacement content's timeline to the PAGLayer's timeline. The time - * is in microseconds. - */ - int64_t contentTimeToLayer(int64_t contentTime); - - /** - * The default image data of this layer, which is webp format. - */ - ByteData* imageBytes() const; - - protected: - bool gotoTime(int64_t layerTime) override; - void setImageInternal(std::shared_ptr image); - int64_t getCurrentContentTime(int64_t layerTime); - Property* getContentTimeRemap(); - bool contentVisible(); - Content* getContent() override; - bool contentModified() const override; - bool cacheFilters() const override; - void onRemoveFromRootFile() override; - void onTimelineChanged() override; - int64_t localFrameToFileFrame(int64_t localFrame) const; - int64_t fileFrameToLocalFrame(int64_t fileFrame) const; - - private: - ImageLayer* emptyImageLayer = nullptr; - ImageReplacement* replacement = nullptr; - std::unique_ptr> contentTimeRemap; - - PAGImageLayer(int width, int height, int64_t duration); - bool hasPAGImage() const; - std::shared_ptr getPAGImage() const; - std::unique_ptr> copyContentTimeRemap(); - TimeRange getVisibleRangeInFile(); - static void BuildContentTimeRemap(AnimatableProperty* property, PAGFile* fileOwner, - const TimeRange& visibleRange, double frameScale); - static void ExpandPropertyByRepeat(AnimatableProperty* property, PAGFile* fileOwner, - Frame contentDuration); - static Frame ScaleTimeRemap(AnimatableProperty* property, const TimeRange& visibleRange, - double frameScale, Frame fileEndFrame); - Frame getFrameFromTimeRemap(Frame value); - void measureBounds(tgfx::Rect* bounds) override; - int64_t contentDurationInternal(); - PAGScaleMode getDefaultScaleMode(); - - friend class RenderCache; - - friend class PAGStage; - - friend class PAGFile; - - friend class AudioClip; -}; - -class PreComposeLayer; - -class VectorComposition; - -class PAG_API PAGComposition : public PAGLayer { - public: - /** - * Make an empty PAGComposition with specified size. - */ - static std::shared_ptr Make(int width, int height); - - PAGComposition(std::shared_ptr file, PreComposeLayer* layer); - - ~PAGComposition() override; - - /** - * Returns the width of the Composition. - */ - int width() const; - - /** - * Returns the height of the Composition. - */ - int height() const; - - /** - * Set the width and height of the Composition. - */ - void setContentSize(int width, int height); - - /** - * Returns the number of child layers of this composition. - */ - int numChildren() const; - - /** - * Returns the child layer that exists at the specified index. - * @param index The index position of the child layer. - * @returns The child layer at the specified index position. - */ - std::shared_ptr getLayerAt(int index) const; - - /** - * Returns the index position of a child layer. - * @param pagLayer The layer instance to identify. - * @returns The index position of the child layer to identify. - */ - int getLayerIndex(std::shared_ptr pagLayer) const; - - /** - * Changes the position of an existing child layer in the composition. This affects the layering - * of child layers. - * @param pagLayer The child layer for which you want to change the index number. - * @param index The resulting index number for the child layer. - */ - void setLayerIndex(std::shared_ptr pagLayer, int index); - - /** - * Add a PAGLayer to the current PAGComposition at the top. If you add a layer that already has a - * different PAGComposition object as a parent, the layer is removed from the other PAGComposition - * object. - */ - bool addLayer(std::shared_ptr pagLayer); - - /** - * Add a PAGLayer to the current PAGComposition at the specified index. If you add a layer that - * already has a different PAGComposition object as a parent, the layer is removed from the other - * PAGComposition object. - */ - bool addLayerAt(std::shared_ptr pagLayer, int index); - - /** - * Check whether the current PAGComposition contains the specified pagLayer. - */ - bool contains(std::shared_ptr pagLayer) const; - - /** - * Remove the specified PAGLayer from the current PAGComposition. - */ - std::shared_ptr removeLayer(std::shared_ptr pagLayer); - - /** - * Remove the PAGLayer at specified index from current PAGComposition. - */ - std::shared_ptr removeLayerAt(int index); - - /** - * Remove all PAGLayers from current PAGComposition. - */ - void removeAllLayers(); - - /** - * Swap the layers. - */ - void swapLayer(std::shared_ptr pagLayer1, std::shared_ptr pagLayer2); - - /** - * Swap the layers at the specified index. - */ - void swapLayerAt(int index1, int index2); - - /** - * The audio data of this composition, which is an AAC audio in an MPEG-4 container. - */ - ByteData* audioBytes() const; - - /** - * Returns the audio markers of this composition. - */ - std::vector audioMarkers() const; - - /** - * Indicates when the first frame of the audio plays in the composition's timeline. - */ - int64_t audioStartTime() const; - - /** - * Returns an array of layers that match the specified layer name. - */ - std::vector> getLayersByName(const std::string& layerName); - - /** - * Returns an array of layers that lie under the specified point. The point is in pixels and from - * this PAGComposition's local coordinates. - */ - std::vector> getLayersUnderPoint(float localX, float localY); - - protected: - int _width = 0; - int _height = 0; - int64_t _frameDuration = 1; - float _frameRate = 60; - std::vector> layers; - - PAGComposition(int width, int height); - std::vector> getLayersBy( - std::function filterFunc); - float frameRateInternal() const override; - bool gotoTime(int64_t layerTime) override; - Frame childFrameToLocal(Frame childFrame, float childFrameRate) const override; - Frame localFrameToChild(Frame localFrame, float childFrameRate) const override; - int widthInternal() const; - int heightInternal() const; - void setContentSizeInternal(int width, int height); - void draw(Recorder* recorder) override; - void measureBounds(tgfx::Rect* bounds) override; - bool hasClip() const; - Frame frameDuration() const override; - bool cacheFilters() const override; - void invalidateCacheScale() override; - void onAddToStage(PAGStage* pagStage) override; - void onRemoveFromStage() override; - void onAddToRootFile(PAGFile* pagFile) override; - void onRemoveFromRootFile() override; - void onTimelineChanged() override; - void updateRootLocker(std::shared_ptr locker) override; - virtual bool doAddLayer(std::shared_ptr pagLayer, int index); - virtual std::shared_ptr doRemoveLayer(int index); - - private: - VectorComposition* emptyComposition = nullptr; - - static void FindLayers(std::function filterFunc, - std::vector>* result, - std::shared_ptr pagLayer); - static void MeasureChildLayer(tgfx::Rect* bounds, PAGLayer* childLayer); - static void DrawChildLayer(Recorder* recorder, PAGLayer* childLayer); - static bool GetTrackMatteLayerAtPoint(PAGLayer* childLayer, float x, float y, - std::vector>* results); - static bool GetChildLayerAtPoint(PAGLayer* childLayer, float x, float y, - std::vector>* results); - - bool getLayersUnderPointInternal(float x, float y, - std::vector>* results); - int getLayerIndexInternal(std::shared_ptr child) const; - void doSwapLayerAt(int index1, int index2); - void doSetLayerIndex(std::shared_ptr pagLayer, int index); - bool doContains(PAGLayer* layer) const; - void updateDurationAndFrameRate(); - - friend class PAGLayer; - - friend class PAGFile; - - friend class RenderCache; - - friend class PAGStage; - - friend class PAGPlayer; - - friend class PAGImageLayer; - - friend class FileReporter; - - friend class AudioClip; - - friend class PAGDecoder; -}; - -class PAG_API PAGFile : public PAGComposition { - public: - /** - * The maximum tag level current SDK supports. - */ - static uint16_t MaxSupportedTagLevel(); - /** - * Load a pag file from byte data, return null if the bytes is empty or it's not a valid pag - * file. - */ - static std::shared_ptr Load(const void* bytes, size_t length, - const std::string& filePath = "", - const std::string& password = ""); - /** - * Load a pag file from path, return null if the file does not exist or the data is not a pag - * file. - */ - static std::shared_ptr Load(const std::string& filePath, - const std::string& password = ""); - - PAGFile(std::shared_ptr file, PreComposeLayer* layer); - - /** - * The tag level this pag file requires. - */ - uint16_t tagLevel(); - - /** - * The number of replaceable texts. - */ - int numTexts(); - - /** - * The number of replaceable images. - */ - int numImages(); - - /** - * The number of video compositions. - */ - int numVideos(); - - /** - * The path string of this file, returns empty string if the file is loaded from byte stream. - */ - std::string path() const; - - /** - * Get a text data of the specified index. The index ranges from 0 to numTexts - 1. - * Note: It always returns the default text data. - */ - std::shared_ptr getTextData(int editableTextIndex); - - /** - * Replace the text data of the specified index. The index ranges from 0 to PAGFile.numTexts - 1. - * Passing in null for the textData parameter will reset it to default text data. - */ - void replaceText(int editableTextIndex, std::shared_ptr textData); - - /** - * Replace file's image content of the specified index with a PAGImage object. The index ranges from - * 0 to PAGFile.numImages - 1. Passing in null for the image parameter will reset it to default - * image content. - */ - void replaceImage(int editableImageIndex, std::shared_ptr image); - - /** - * Replace file's image content of the specified layer name with a PAGImage object. - * Passing in null for the image parameter will reset it to default image content. - */ - void replaceImageByName(const std::string& layerName, std::shared_ptr image); - - /** - * Return an array of layers by specified editable index and layer type. - */ - std::vector> getLayersByEditableIndex(int editableIndex, - LayerType layerType); - - /** - * Returns the indices of the editable layers in this PAGFile. - * If the editableIndex of a PAGLayer is not present in the returned indices, the PAGLayer should - * not be treated as editable. - */ - std::vector getEditableIndices(LayerType layerType); - - /** - * Indicate how to stretch the original duration to fit target duration when file's duration is - * changed. The default value is PAGTimeStretchMode::Repeat. - */ - PAGTimeStretchMode timeStretchMode() const; - - /** - * Set the timeStretchMode of this file. - */ - void setTimeStretchMode(PAGTimeStretchMode value); - - /** - * Set the duration of this PAGFile. Passing a value less than or equal to 0 resets the duration - * to its default value. - */ - void setDuration(int64_t duration); - - /** - * Make a copy of the original file, any modification to current file has no effect on the result - * file. - */ - std::shared_ptr copyOriginal(); - - bool isPAGFile() const override; - - protected: - bool gotoTime(int64_t layerTime) override; - Frame childFrameToLocal(Frame childFrame, float childFrameRate) const override; - Frame localFrameToChild(Frame localFrame, float childFrameRate) const override; - std::vector> getLayersByEditableIndexInternal(int editableIndex, - LayerType layerType); - Frame stretchedFrameDuration() const override; - Frame stretchedContentFrame() const override; - - private: - static std::shared_ptr MakeFrom(std::shared_ptr file); - static std::shared_ptr BuildPAGLayer(std::shared_ptr file, pag::Layer* layer); - - void setDurationInternal(int64_t duration); - Frame stretchedFrameToFileFrame(Frame stretchedFrame) const; - int64_t stretchedTimeToFileTime(int64_t stretchedTime) const; - Frame scaledFrameToFileFrame(Frame scaledFrame, const TimeRange& scaledTimeRange) const; - Frame fileFrameToStretchedFrame(Frame fileFrame) const; - Frame fileFrameToScaledFrame(Frame fileFrame, const TimeRange& scaledTimeRange) const; - void replaceTextInternal(const std::vector>& textLayers, - std::shared_ptr textData); - void replaceImageInternal(const std::vector>& imageLayers, - std::shared_ptr image); - PAGTimeStretchMode timeStretchModeInternal() const; - - Frame _stretchedContentFrame = 0; - Frame _stretchedFrameDuration = 1; - PAGTimeStretchMode _timeStretchMode = PAGTimeStretchMode::Repeat; - - friend class PAGImageLayer; - - friend class LayerRenderer; - - friend class AudioClip; - - friend class HardwareDecoder; -}; - -class Composition; - -class PAGPlayer; - -class GLRestorer; - -class PAG_API PAGSurface { - public: - /** - * Creates a new PAGSurface from specified Drawable, Returns nullptr if drawable is nullptr. - */ - static std::shared_ptr MakeFrom(std::shared_ptr drawable); - - /** - * Creates a new PAGSurface from specified backend render target and origin. The PAGSurface uses - * the GPU context on the calling thread directly. Returns null if the render target is invalid. - */ - static std::shared_ptr MakeFrom(const BackendRenderTarget& renderTarget, - ImageOrigin origin); - - /** - * Creates a new PAGSurface from specified backend texture and origin. Note, the texture must not - * be bound to any frame buffer. Passes true in the forAsyncThread parameter if the returned - * PAGSurface needs to be used for asynchronous rendering. If passing true, the PAGSurface - * internally creates an independent GPU context, and the caller can use semaphore objects to - * synchronize content (see flushAndSignalSemaphore() and wait()), otherwise, it uses the GPU - * context on the calling thread directly. Returns null if the texture is invalid. - */ - static std::shared_ptr MakeFrom(const BackendTexture& texture, ImageOrigin origin, - bool forAsyncThread = false); - - /** - * Creates a new PAGSurface for off-screen rendering. Allocates memory for pixels, based on the - * width and height, which can be accessed by readPixels(). Returns null if the specified size - * is not valid. - */ - static std::shared_ptr MakeOffscreen(int width, int height); - - /** - * Creates a new PAGSurface from specified hardware buffer. Returns null if the hardware buffer - * is invalid. - */ - static std::shared_ptr MakeFrom(HardwareBufferRef hardwareBuffer); - - virtual ~PAGSurface() = default; - - /** - * Returns the width in pixels of the surface. - */ - int width(); - - /** - * Returns the height in pixels of the surface. - */ - int height(); - - /** - * Update the size of the surface, and reset the internal surface. - */ - void updateSize(); - - /** - * Erases all pixels of the surface with transparent color. Returns true if the content has - * changed. - */ - bool clearAll(); - - /** - * Free the cache created by the surface immediately. Can be called to reduce memory pressure. - */ - void freeCache(); - - /** - * Retrieves the backing hardware buffer. This method does not acquire any additional reference to - * the returned hardware buffer. Returns nullptr if the PAGSurface is not created from a hardware - * buffer. - */ - HardwareBufferRef getHardwareBuffer(); - - /** - * Copies pixels from current PAGSurface to dstPixels with specified color type, alpha type and - * row bytes. Returns true if pixels are copied to dstPixels. - */ - bool readPixels(ColorType colorType, AlphaType alphaType, void* dstPixels, size_t dstRowBytes); - - protected: - explicit PAGSurface(std::shared_ptr drawable, bool externalContext = false); - - virtual void onDraw(std::shared_ptr graphic, std::shared_ptr surface, - RenderCache* cache); - virtual void onFreeCache(); - - private: - uint32_t contentVersion = 0; - PAGPlayer* pagPlayer = nullptr; - std::shared_ptr rootLocker = nullptr; - std::shared_ptr drawable = nullptr; - bool externalContext = false; - GLRestorer* glRestorer = nullptr; - - bool draw(RenderCache* cache, std::shared_ptr graphic, BackendSemaphore* signalSemaphore, - bool autoClear = true); - bool prepare(RenderCache* cache, std::shared_ptr graphic); - bool hitTest(RenderCache* cache, std::shared_ptr graphic, float x, float y); - tgfx::Context* lockContext(); - void unlockContext(); - bool wait(const BackendSemaphore& waitSemaphore); - - BackendTexture getFrontTexture(); - BackendTexture getBackTexture(); - HardwareBufferRef getFrontHardwareBuffer(); - HardwareBufferRef getBackHardwareBuffer(); - - friend class PAGPlayer; - - friend class FileReporter; - - friend class PAGSurfaceExt; -}; - -class FileReporter; - -class PAG_API PAGPlayer { - public: - PAGPlayer(); - - virtual ~PAGPlayer(); - - /** - * Returns the current PAGComposition for PAGPlayer to render as content. - */ - std::shared_ptr getComposition(); - - /** - * Sets a new PAGComposition for PAGPlayer to render as content. - * Note: If the composition is already added to another PAGPlayer, it will be removed from the - * previous PAGPlayer. - */ - void setComposition(std::shared_ptr newComposition); - - /** - * Returns the PAGSurface object for PAGPlayer to render onto. - */ - std::shared_ptr getSurface(); - - /** - * Set the PAGSurface object for PAGPlayer to render onto. - */ - void setSurface(std::shared_ptr newSurface); - - /** - * If set to false, PAGPlayer skips rendering for video composition. - */ - bool videoEnabled(); - - /** - * Set the value of videoEnabled property. - */ - void setVideoEnabled(bool value); - - /** - * If set to true, PAGPlayer caches an internal bitmap representation of the static content for - * each layer. This caching can increase performance for layers that contain complex vector - * content. The execution speed can be significantly faster depending on the complexity of the - * content, but it requires extra graphics memory. The default value is true. - */ - bool cacheEnabled(); - - /** - * Set the value of cacheEnabled property. - */ - void setCacheEnabled(bool value); - - /** - * If set to true, PAG will cache the associated rendering data into a disk file, such as the - * decoded image frames of video compositions. This can help reduce memory usage and improve - * rendering performance. - */ - bool useDiskCache(); - - /** - * Set the value of useDiskCache property. - */ - void setUseDiskCache(bool value); - - /** - * This value defines the scale factor for internal graphics caches, ranges from 0.0 to 1.0. The - * scale factors less than 1.0 may result in blurred output, but it can reduce the usage of - * graphics memory which leads to better performance. The default value is 1.0. - */ - float cacheScale(); - - /** - * Set the value of cacheScale property. - */ - void setCacheScale(float value); - - /** - * The maximum frame rate for rendering, ranges from 1 to 60. If set to a value less than the - * actual frame rate from composition, it drops frames but increases performance. Otherwise, it - * has no effect. The default value is 60. - */ - float maxFrameRate(); - - /** - * Sets the maximum frame rate for rendering. - */ - void setMaxFrameRate(float value); - - /** - * Returns the current scale mode. - */ - PAGScaleMode scaleMode(); - - /** - * Specifies the rule of how to scale the pag content to fit the surface size. The matrix - * changes when this method is called. - */ - void setScaleMode(PAGScaleMode mode); - - /** - * Returns a copy of the current matrix. - */ - Matrix matrix(); - - /** - * Sets the transformation which will be applied to the composition. The scaleMode property - * will be set to PAGScaleMode::None when this method is called. - */ - void setMatrix(const Matrix& matrix); - - /** - * The duration of composition in microseconds. - */ - int64_t duration(); - - /** - * Set the progress of play position to next frame. It is applied only when the composition is not - * null. - */ - void nextFrame(); - - /** - * Set the progress of play position to previous frame. It is applied only when the composition is - * not null. - */ - void preFrame(); - - /** - * Returns the current progress of play position, the value is from 0.0 to 1.0. - */ - double getProgress(); - - /** - * Sets the progress of play position, the value ranges from 0.0 to 1.0. It is applied only when - * the composition is not null. - */ - void setProgress(double percent); - - /** - * Returns the current frame. - */ - Frame currentFrame() const; - - /** - * If true, PAGPlayer clears the whole content of PAGSurface before drawing anything new to it. - * The default value is true. - */ - bool autoClear(); - - /** - * Sets the autoClear property. - */ - void setAutoClear(bool value); - - /** - * Prepares the player for the next flush() call. It collects all CPU tasks from the current - * progress of the composition and runs them asynchronously in parallel. It is usually used for - * speeding up the first frame rendering. - */ - void prepare(); - - /** - * Inserts a GPU semaphore that the current GPU-backed API must wait on before executing any more - * commands on the GPU for this player. It is usually called before PAGPlayer.flush(). PAG will - * take ownership of the underlying semaphore and delete it once it has been signaled and waited - * on. If this call returns false, then the GPU back-end will not wait on the passed semaphore, - * and the client will still own the semaphore. Returns true if GPU is waiting on the semaphore. - * It is used when we need to draw a PAGImage which is made from a BackendTexture. - * - * @param waitSemaphore semaphore container - * @returns true if GPU is waiting on semaphore - */ - bool wait(const BackendSemaphore& waitSemaphore); - - /** - * Apply all pending changes to the target surface immediately. Returns true if the content has - * changed. - */ - bool flush(); - - /** - * Apply all pending changes to the target surface immediately. Returns true if the content has - * changed. After issuing all commands, the signalSemaphore will be signaled by the GPU. - * - * If the signalSemaphore is not null and uninitialized, a new semaphore is created and - * initializes BackendSemaphore. - * - * The caller must delete the semaphore returned in signalSemaphore. - * BackendSemaphore can be deleted as soon as this function returns. - * - * If the back-end API is OpenGL only uninitialized backend semaphores are supported. - * - * If signalSemaphore is uninitialized, the GPU back-end did not create or add a semaphore to - * signal on the GPU; the caller should not instruct the GPU to wait on the semaphore. - * - * It is used when the PAGSurface is made from a BackendRenderTarget or BackendTexture. - * - * @param signalSemaphore semaphore container - */ - bool flushAndSignalSemaphore(BackendSemaphore* signalSemaphore); - - /** - * Returns a rectangle in pixels that defines the displaying area of the specified layer, which - * is in the coordinate of the PAGSurface. - */ - Rect getBounds(std::shared_ptr pagLayer); - - /** - * Returns an array of layers that lie under the specified point. The point is in the coordinate - * space of the PAGSurface. - */ - std::vector> getLayersUnderPoint(float surfaceX, float surfaceY); - - /** - * Evaluates the PAGLayer to see if it overlaps or intersects with the specified point. The point - * is in the coordinate space of the PAGSurface, not the PAGComposition that contains the - * PAGLayer. It always returns false if the PAGLayer or its parent (or parent's parent...) has not - * been added to this PAGPlayer. The pixelHitTest parameter indicates whether or not to check - * against the actual pixels of the object (true) or the bounding box (false). Returns true if the - * PAGLayer overlaps or intersects with the specified point. - */ - bool hitTestPoint(std::shared_ptr pagLayer, float surfaceX, float surfaceY, - bool pixelHitTest = false); - - /** - * The time cost by rendering in microseconds. - */ - int64_t renderingTime(); - - /** - * The time cost by image decoding in microseconds. - */ - int64_t imageDecodingTime(); - - /** - * The time cost by presenting in microseconds. - */ - int64_t presentingTime(); - - /** - * The memory cost by graphics in bytes. - */ - int64_t graphicsMemory(); - - protected: - std::shared_ptr rootLocker = nullptr; - std::shared_ptr stage = nullptr; - RenderCache* renderCache = nullptr; - std::shared_ptr pagSurface = nullptr; - uint32_t contentVersion = 0; - std::shared_ptr lastGraphic = nullptr; - - virtual void updateScaleModeIfNeed(); - virtual bool flushInternal(BackendSemaphore* signalSemaphore); - - private: - FileReporter* reporter = nullptr; - float _maxFrameRate = 60; - PAGScaleMode _scaleMode = PAGScaleMode::LetterBox; - bool _autoClear = true; - - bool updateStageSize(); - void setSurfaceInternal(std::shared_ptr newSurface); - int64_t getTimeStampInternal(); - void prepareInternal(); - int64_t durationInternal(); - - friend class PAGSurface; -}; - -class SequenceFile; -class CompositionReader; -class BitmapBuffer; - -/** - * PAGDecoder provides a utility to read image frames directly from a PAGComposition, and caches the - * image frames as a sequence file on the disk, which may significantly speed up the reading process - * depending on the complexity of the PAG files. You can use the PAGDiskCache::SetMaxDiskSize() - * method to manage the cache limit of the disk usage. - */ -class PAG_API PAGDecoder { - public: - /** - * Creates a PAGDecoder with a PAGComposition, a frame rate limit, and a scale factor for the - * decoded image size. Please only keep an external reference to the PAGComposition if you need to - * modify it in the feature. Otherwise, the internal composition will not be released - * automatically after the associated disk cache is complete, which may cost more memory than - * necessary. Returns nullptr if the composition is nullptr. Note that the returned PAGDecoder may - * become invalid if the associated PAGComposition is added to a PAGPlayer or another PAGDecoder. - */ - static std::shared_ptr MakeFrom(std::shared_ptr composition, - float maxFrameRate = 30.0f, float scale = 1.0f); - - ~PAGDecoder(); - - /** - * Returns the width of decoded image frames. - */ - int width() const { - return _width; - } - - /** - * Returns the height of decoded image frames. - */ - int height() const { - return _height; - } - - /** - * Returns the number of frames in the PAGDecoder. Note that the value may change if the - * associated PAGComposition was modified. - */ - int numFrames(); - - /** - * Returns the frame rate of decoded image frames. The value may change if the associated - * PAGComposition was modified. - */ - float frameRate(); - - /** - * Returns true if the frame at the given index has changed since the last readFrame() call. The - * caller should skip the corresponding reading call if the frame has not changed. - */ - bool checkFrameChanged(int index); - - /** - * Reads pixels of the image frame at the given index into the specified memory address. Returns - * false if failed. Note that caller must ensure that colorType, alphaType, and dstRowBytes stay - * the same throughout every reading call. Otherwise, it may return false. - */ - bool readFrame(int index, void* pixels, size_t rowBytes, - ColorType colorType = ColorType::RGBA_8888, - AlphaType alphaType = AlphaType::Premultiplied); - - /** - * Reads pixels of the image frame at the given index into the specified HardwareBuffer. Returns - * false if failed. Reading image frames into HardwareBuffer usually has better performance than - * reading into memory. - */ - bool readFrame(int index, HardwareBufferRef hardwareBuffer); - - private: - std::mutex locker = {}; - int _width = 0; - int _height = 0; - int _numFrames = 0; - float _frameRate = 30.0f; - float maxFrameRate = 30.0f; - int lastReadIndex = -1; - tgfx::ImageInfo* lastImageInfo = nullptr; - uint32_t lastContentVersion = 0; - std::shared_ptr container = nullptr; - std::shared_ptr sequenceFile = nullptr; - std::shared_ptr reader = nullptr; - std::vector staticTimeRanges = {}; - std::function)> cacheKeyGeneratorFun = - nullptr; - - static Composition* GetSingleComposition(std::shared_ptr pagComposition); - static std::pair GetFrameCountAndRate(std::shared_ptr pagComposition, - float maxFrameRate); - static std::vector GetStaticTimeRange(std::shared_ptr composition, - int numFrames); - - PAGDecoder(std::shared_ptr composition, int width, int height, int numFrames, - float frameRate, float maxFrameRate); - - bool readFrameInternal(int index, std::shared_ptr bitmap); - bool renderFrame(std::shared_ptr composition, int index, - std::shared_ptr bitmap); - bool checkSequenceFile(std::shared_ptr composition, const tgfx::ImageInfo& info); - void checkCompositionChange(std::shared_ptr composition); - std::string generateCacheKey(std::shared_ptr composition); - std::shared_ptr getComposition(); - void setCacheKeyGeneratorFun( - std::function)> fun); - friend class DiskSequenceReader; -}; - -/** - * Defines methods to manage the disk cache capabilities. - */ -class PAG_API PAGDiskCache { - public: - /** - * Returns the size limit of the disk cache in bytes. The default value is 1 GB. - */ - static size_t MaxDiskSize(); - - /** - * Sets the size limit of the disk cache in bytes, which will triggers the cache cleanup if the - * disk usage exceeds the limit. The opened files are not removed immediately, even if their disk - * usage exceeds the limit, and they will be rechecked after they are closed. - */ - static void SetMaxDiskSize(size_t size); - - /** - * Removes all cached files from the disk. All the opened files will be also removed after they - * are closed. - */ - static void RemoveAll(); -}; - -/** - * Defines methods to control video decoding capabilities of PAG. - */ -class PAG_API PAGVideoDecoder { - public: - /** - * Set the maximum number of hardware video decoders that PAG can create. - */ - static void SetMaxHardwareDecoderCount(int count); - - /** - * Register a software decoder factory to PAG, which can be used to create video decoders for - * decoding video sequences from a pag file, if hardware decoders are not available. - */ - static void RegisterSoftwareDecoderFactory(SoftwareDecoderFactory* decoderFactory); -}; - -class PAG_API PAG { - public: - /** - * Get SDK version information. - */ - static std::string SDKVersion(); -}; - -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/types.h b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/types.h deleted file mode 100644 index 9a6ed8d..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Headers/pag/types.h +++ /dev/null @@ -1,1730 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////////////////////// -// -// Tencent is pleased to support the open source community by making libpag available. -// -// Copyright (C) 2021 Tencent. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file -// except in compliance with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// unless required by applicable law or agreed to in writing, software distributed under the -// license is distributed on an "as is" basis, without warranties or conditions of any kind, -// either express or implied. see the license for the specific language governing permissions -// and limitations under the license. -// -///////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "pag/defines.h" - -namespace pag { - -typedef uint32_t ID; -typedef float Percent; // in the range [0 - 1] -typedef uint8_t Opacity; // in the range [0 - 255] -typedef int64_t Frame; - -static constexpr ID ZeroID = 0; -static constexpr Frame ZeroFrame = 0; -static constexpr Opacity Opaque = 255; -static constexpr Opacity Transparent = 0; - -/** - * Concatenates two opacity values. - */ -inline Opacity PAG_API OpacityConcat(Opacity a, Opacity b) { - return static_cast(a * b / 255); -} - -struct RTTR_AUTO_REGISTER_CLASS Color { - uint8_t red, green, blue; // in the range [0 - 255] -}; - -inline bool operator==(const Color& left, const Color& right) { - return left.red == right.red && left.green == right.green && left.blue == right.blue; -} - -inline bool operator!=(const Color& left, const Color& right) { - return !(left == right); -} - -static constexpr Color Black = {0, 0, 0}; -static constexpr Color White = {255, 255, 255}; -static constexpr Color Red = {255, 0, 0}; -static constexpr Color Green = {0, 255, 0}; -static constexpr Color Blue = {0, 0, 255}; - -/** - * TimeRange represents a range of frames. - */ -struct RTTR_AUTO_REGISTER_CLASS TimeRange { - /** - * The start frame of the time range, which is included. - */ - Frame start; - /** - * The end frame of the time range, which is also included. - */ - Frame end; - - Frame duration() const { - return end - start + 1; - } - - bool isValid() const { - return 0 <= start && start <= end; - } - - bool contains(Frame frame) const { - return start <= frame && frame <= end; - } -}; - -/** - * Point holds two 32-bit floating point coordinates. - */ -struct PAG_API Point { - /** - * x-axis value. - */ - float x; - /** - * y-axis value. - */ - float y; - - /** - * Creates a Point set to (0, 0). - */ - static const Point& Zero() { - static const Point zero = Point::Make(0, 0); - return zero; - } - - /** - * Creates a Point with specified x and y value. - */ - static constexpr Point Make(float x, float y) { - return {x, y}; - } - - /** - * Creates a Point with specified x and y value. - */ - static constexpr Point Make(int x, int y) { - return {static_cast(x), static_cast(y)}; - } - - /** - * Returns true if x and y are both zero. - */ - bool isZero() const { - return (0 == x) & (0 == y); - } - - /** - * Sets xValue to x and yValue to y. - */ - void set(float xValue, float yValue) { - x = xValue; - y = yValue; - } - - /** - * Adds offset (dx, dy) to Point. - */ - void offset(float dx, float dy) { - x += dx; - y += dy; - } - - /** - * Returns the Euclidean distance from origin. - */ - float length() const { - return Point::Length(x, y); - } - - /** - * Returns true if a is equivalent to b. - */ - friend bool operator==(const Point& a, const Point& b) { - return a.x == b.x && a.y == b.y; - } - - /** - * Returns true if a is not equivalent to b. - */ - friend bool operator!=(const Point& a, const Point& b) { - return a.x != b.x || a.y != b.y; - } - - /** - * Returns a Point from b to a; computed as (a.fX - b.fX, a.fY - b.fY). - */ - friend Point operator-(const Point& a, const Point& b) { - return {a.x - b.x, a.y - b.y}; - } - - /** - * Returns Point resulting from Point a offset by Point b, computed as: - * (a.fX + b.fX, a.fY + b.fY). - */ - friend Point operator+(const Point& a, const Point& b) { - return {a.x + b.x, a.y + b.y}; - } - - /** - * Returns the Euclidean distance from origin. - */ - static float Length(float x, float y) { - return sqrt(x * x + y * y); - } - - /** - * Returns the Euclidean distance between a and b. - */ - static float Distance(const Point& a, const Point& b) { - return Length(a.x - b.x, a.y - b.y); - } -}; - -/** - * Point holds three 32-bit floating point coordinates. - */ -struct PAG_API Point3D { - /** - * x-axis value. - */ - float x; - /** - * y-axis value. - */ - float y; - /** - * z-axis value. - */ - float z; - - /** - * Creates a Point set to (0, 0, 0). - */ - static const Point3D& Zero() { - static const Point3D zero = Point3D::Make(0, 0, 0); - return zero; - } - - /** - * Creates a Point with specified x y z value. - */ - static constexpr Point3D Make(float x, float y, float z) { - return {x, y, z}; - } - - /** - * Returns true if x y z are all zero. - */ - bool isZero() const { - return (0 == x) & (0 == y) & (0 == z); - } - - /** - * Sets xValue to x, yValue to y and zValue to z. - */ - void set(float xValue, float yValue, float zValue) { - x = xValue; - y = yValue; - z = zValue; - } - - /** - * Adds offset (dx, dy, dz) to Point. - */ - void offset(float dx, float dy, float dz) { - x += dx; - y += dy; - z += dz; - } - - /** - * Returns the Euclidean distance from origin. - */ - float length() const { - return Point3D::Length(x, y, z); - } - - /** - * Returns true if a is equivalent to b. - */ - friend bool operator==(const Point3D& a, const Point3D& b) { - return a.x == b.x && a.y == b.y && a.z == b.z; - } - - /** - * Returns true if a is not equivalent to b. - */ - friend bool operator!=(const Point3D& a, const Point3D& b) { - return a.x != b.x || a.y != b.y || a.z != b.z; - } - - /** - * Returns a Point from b to a; computed as (a.fX - b.fX, a.fY - b.fY, a.fZ - b.fZ). - */ - friend Point3D operator-(const Point3D& a, const Point3D& b) { - return {a.x - b.x, a.y - b.y, a.z - b.z}; - } - - /** - * Returns Point resulting from Point a offset by Point b, computed as: - * (a.x + b.x, a.y + b.y, a.z + b.z). - */ - friend Point3D operator+(const Point3D& a, const Point3D& b) { - return {a.x + b.x, a.y + b.y, a.z + b.z}; - } - - /** - * Returns the Euclidean distance from origin. - */ - static float Length(float x, float y, float z) { - return sqrt(x * x + y * y + z * z); - } - - /** - * Returns the Euclidean distance between a and b. - */ - static float Distance(const Point3D& a, const Point3D& b) { - return Length(a.x - b.x, a.y - b.y, a.z - b.z); - } -}; - -/** - * Rect holds four float coordinates describing the upper and lower bounds of a rectangle. Rect may - * be created from outer bounds or from position, width, and height. Rect describes an area; if its - * right is less than or equal to its left, or if its bottom is less than or equal to its top, it is - * considered empty. - */ -struct PAG_API Rect { - /** - * smaller x-axis bounds. - */ - float left; - /** - * smaller y-axis bounds. - */ - float top; - /** - * larger x-axis bounds. - */ - float right; - /** - * larger y-axis bounds. - */ - float bottom; - - /** - * Returns constructed Rect set to (0, 0, 0, 0). - */ - static constexpr Rect MakeEmpty() { - return {0, 0, 0, 0}; - } - - /** - * Returns constructed Rect set to float values (0, 0, w, h). Does not validate input; w or h may - * be negative. - */ - static constexpr Rect MakeWH(float w, float h) { - return {0, 0, w, h}; - } - - /** - * Returns constructed Rect set to float values (0, 0, w, h). Does not validate input; w or h may - * be negative. - */ - static constexpr Rect MakeWH(int w, int h) { - return {0, 0, static_cast(w), static_cast(h)}; - } - - /** - * Returns constructed Rect set to (l, t, r, b). Does not sort input; Rect may result in left - * greater than right, or top greater than bottom. - */ - static constexpr Rect MakeLTRB(float l, float t, float r, float b) { - return {l, t, r, b}; - } - - /** - * Returns constructed Rect set to (x, y, x + w, y + h). Does not validate input; w or h may be - * negative. - */ - static constexpr Rect MakeXYWH(float x, float y, float w, float h) { - return {x, y, x + w, y + h}; - } - - /** - * Returns true if left is equal to or greater than right, or if top is equal to or greater - * than bottom. Call sort() to reverse rectangles with negative width() or height(). - */ - bool isEmpty() const { - // We write it as the NOT of a non-empty rect, so we will return true if any values - // are NaN. - return !(left < right && top < bottom); - } - - /** - * Returns true if left is equal to or less than right, or if top is equal to or less than - * bottom. Call sort() to reverse rectangles with negative width() or height(). - */ - bool isSorted() const { - return left <= right && top <= bottom; - } - - /** - * Returns left edge of Rect, if sorted. Call isSorted() to see if Rect is valid. Call sort() to - * reverse left and right if needed. - */ - float x() const { - return left; - } - - /** - * Returns top edge of Rect, if sorted. Call isEmpty() to see if Rect may be invalid, and sort() - * to reverse top and bottom if needed. - */ - float y() const { - return top; - } - - /** - * Returns span on the x-axis. This does not check if Rect is sorted, or if result fits in 32-bit - * float; result may be negative or infinity. - */ - float width() const { - return right - left; - } - - /** - * Returns span on the y-axis. This does not check if Rect is sorted, or if result fits in 32-bit - * float; result may be negative or infinity. - */ - float height() const { - return bottom - top; - } - - /** - * Returns average of left edge and right edge. Result does not change if Rect is sorted. - */ - float centerX() const { - // don't use (left + bottom) * 0.5f as that might overflow before the 0.5f - return left * 0.5f + right * 0.5f; - } - - /** - * Returns average of top edge and bottom edge. Result does not change if Rect is sorted. - */ - float centerY() const { - // don't use (top + bottom) * 0.5f as that might overflow before the 0.5f - return top * 0.5f + bottom * 0.5f; - } - - /** - * Returns true if all members in a: left, top, right, and bottom; are equal to the - * corresponding members in b. - * a and b are not equal if either contain NaN. a and b are equal if members contain zeroes with - * different signs. - */ - friend bool operator==(const Rect& a, const Rect& b) { - return a.left == b.left && a.right == b.right && a.top == b.top && a.bottom == b.bottom; - } - - /** - * Returns true if any in a: left, top, right, and bottom; does not equal the corresponding - * members in b. - * a and b are not equal if either contain NaN. a and b are equal if members contain zeroes with - * different signs. - */ - friend bool operator!=(const Rect& a, const Rect& b) { - return a.left != b.left || a.right != b.right || a.top != b.top || a.bottom != b.bottom; - } - - /** - * Sets Rect to (0, 0, 0, 0). - */ - void setEmpty() { - *this = MakeEmpty(); - } - - /** - * Sets Rect to (left, top, right, bottom). left and right are not sorted; left is not necessarily - * less than right. top and bottom are not sorted; top is not necessarily less than bottom. - */ - void setLTRB(float l, float t, float r, float b) { - left = l; - top = t; - right = r; - bottom = b; - } - - /** - * Sets to bounds of Point array with count entries. Returns false if count is zero or smaller, or - * if Point array contains an infinity or NaN; in these cases sets Rect to (0, 0, 0, 0). - * Result is either empty or sorted: left is less than or equal to right, and top is less than - * or equal to bottom. - */ - bool setBounds(const Point pts[], int count); - - /** - * Sets Rect to (x, y, x + width, y + height). Does not validate input; width or height may be - * negative. - */ - void setXYWH(float x, float y, float width, float height) { - left = x; - top = y; - right = x + width; - bottom = y + height; - } - - /** - * Sets Rect to (0, 0, width, height). Does not validate input, width or height may be negative. - */ - void setWH(float width, float height) { - left = 0; - top = 0; - right = width; - bottom = height; - } - - /** - * Returns Rect offset by (dx, dy). - * If dx is negative, Rect returned is moved to the left. - * If dx is positive, Rect returned is moved to the right. - * If dy is negative, Rect returned is moved upward. - * If dy is positive, Rect returned is moved downward. - */ - Rect makeOffset(float dx, float dy) const { - return MakeLTRB(left + dx, top + dy, right + dx, bottom + dy); - } - - /** - * Returns Rect, inset by (dx, dy). - * If dx is negative, Rect returned is wider. - * If dx is positive, Rect returned is narrower. - * If dy is negative, Rect returned is taller. - * If dy is positive, Rect returned is shorter. - */ - Rect makeInset(float dx, float dy) const { - return MakeLTRB(left + dx, top + dy, right - dx, bottom - dy); - } - - /** - * Returns Rect, outset by (dx, dy). - * If dx is negative, Rect returned is narrower. - * If dx is positive, Rect returned is wider. - * If dy is negative, Rect returned is shorter. - * If dy is positive, Rect returned is taller. - */ - Rect makeOutset(float dx, float dy) const { - return MakeLTRB(left - dx, top - dy, right + dx, bottom + dy); - } - - /** - * Offsets Rect by adding dx to left, right; and by adding dy to top, bottom. - * If dx is negative, moves Rect to the left. - * If dx is positive, moves Rect to the right. - * If dy is negative, moves Rect upward. - * If dy is positive, moves Rect downward. - */ - void offset(float dx, float dy) { - left += dx; - top += dy; - right += dx; - bottom += dy; - } - - /** - * Offsets Rect by adding delta.fX to left, right; and by adding delta.y to top, bottom. - * If delta.x is negative, moves Rect to the left. - * If delta.x is positive, moves Rect to the right. - * If delta.y is negative, moves Rect upward. - * If delta.y is positive, moves Rect downward. - */ - void offset(const Point& delta) { - this->offset(delta.x, delta.y); - } - - /** - * Offsets Rect so that left equals newX, and top equals newY. width and height are unchanged. - */ - void offsetTo(float newX, float newY) { - right += newX - left; - bottom += newY - top; - left = newX; - top = newY; - } - - /** - * Insets Rect by (dx, dy). - * If dx is positive, makes Rect narrower. - * If dx is negative, makes Rect wider. - * If dy is positive, makes Rect shorter. - * If dy is negative, makes Rect taller. - */ - void inset(float dx, float dy) { - left += dx; - top += dy; - right -= dx; - bottom -= dy; - } - - /** - * Outsets Rect by (dx, dy). - * If dx is positive, makes Rect wider. - * If dx is negative, makes Rect narrower. - * If dy is positive, makes Rect taller. - * If dy is negative, makes Rect shorter. - */ - void outset(float dx, float dy) { - this->inset(-dx, -dy); - } - - /** - * Scale the rectangle by scaleX and scaleY. - */ - void scale(float scaleX, float scaleY); - - /** - * Returns true if Rect intersects r, and sets Rect to intersection. Returns false if Rect does - * not intersect r, and leaves Rect unchanged. Returns false if either r or Rect is empty, leaving - * Rect unchanged. - */ - bool intersect(const Rect& r) { - return this->intersect(r.left, r.top, r.right, r.bottom); - } - - /** - * Constructs Rect to intersect from (left, top, right, bottom). Does not sort construction. - * Returns true if Rect intersects construction, and sets Rect to intersection. - * Returns false if Rect does not intersect construction, and leaves Rect unchanged. - * Returns false if either construction or Rect is empty, leaving Rect unchanged. - */ - bool intersect(float l, float t, float r, float b); - - /** - * Returns true if a intersects b, and sets Rect to intersection. - * Returns false if a does not intersect b, and leaves Rect unchanged. - * Returns false if either a or b is empty, leaving Rect unchanged. - */ - bool intersect(const Rect& a, const Rect& b); - - /** - * Constructs Rect to intersect from (left, top, right, bottom). Does not sort construction. - * Returns true if Rect intersects construction. - * Returns false if either construction or Rect is empty, or do not intersect. - */ - bool intersects(float l, float t, float r, float b) const; - - /** - * Returns true if Rect intersects r. Returns false if either r or Rect is empty, or do not - * intersect. - */ - bool intersects(const Rect& r) const; - - /** - * Returns true if a intersects b. Returns false if either a or b is empty, or do not intersect. - */ - static bool Intersects(const Rect& a, const Rect& b); - - /** - * Constructs Rect to intersect from (left, top, right, bottom). Does not sort construction. - * Sets Rect to the union of itself and the construction. Has no effect if construction is empty. - * Otherwise, if Rect is empty, sets Rect to construction. - */ - void join(float l, float t, float r, float b); - - /** - * Sets Rect to the union of itself and r. Has no effect if r is empty. Otherwise, if Rect is - * empty, sets Rect to r. - */ - void join(const Rect& r) { - this->join(r.left, r.top, r.right, r.bottom); - } - - /** - * Returns true if: left <= x < right && top <= y < bottom. Returns false if Rect is empty. - */ - bool contains(float x, float y) const { - return x >= left && x < right && y >= top && y < bottom; - } - - /** - * Returns true if Rect contains r. Returns false if Rect is empty or r is empty. Rect contains r - * when Rect area completely includes r area. - */ - bool contains(const Rect& r) const { - return left <= r.left && top <= r.top && right >= r.right && bottom >= r.bottom; - } - - /** - * Sets Rect by discarding the fractional portion of left and top; and rounding up right and - * bottom. - */ - void roundOut(); - - /** - * Sets Rect by rounding of left, top, right and bottom. - */ - void round(); - - /** - * Swaps left and right if left is greater than right; and swaps top and bottom if top is - * greater than bottom. Result may be empty; and width() and height() will be zero or positive. - */ - void sort(); - - /** - * Returns Rect with left and right swapped if left is greater than right, and with top and - * bottom swapped if top is greater than bottom. Result may be empty, and width() and height() - * will be zero or positive. - */ - Rect makeSorted() const; -}; - -/*** - * Matrix holds a 3x3 matrix for transforming coordinates. This allows mapping Point and vectors - * with translation, scaling, skewing, rotation, and perspective. - * Matrix elements are in row major order. Matrix does not have a constructor, so it must be - * explicitly initialized. setIdentity() initializes Matrix so it has no effect. - * setTranslate(), setScale(), setSkew(), setRotate(), set9 and setAll() initializes all Matrix - * elements with the corresponding mapping. - */ -class PAG_API Matrix { - public: - /** - * Sets Matrix to scale by (sx, sy). Returned matrix is: - * - * | sx 0 0 | - * | 0 sy 0 | - * | 0 0 1 | - * - * @param sx horizontal scale factor - * @param sy vertical scale factor - * @return Matrix with the scale factors. - */ - static Matrix MakeScale(float sx, float sy) { - Matrix m = {}; - m.setScale(sx, sy); - return m; - } - - /** - * Sets Matrix to scale by (scale, scale). Returned matrix is: - * - * | scale 0 0 | - * | 0 scale 0 | - * | 0 0 1 | - * - * @param scale horizontal and vertical scale factor - * @return Matrix with the scale factors. - */ - static Matrix MakeScale(float scale) { - Matrix m = {}; - m.setScale(scale, scale); - return m; - } - - /** - * Sets Matrix to translate by (dx, dy). Returned matrix is: - * - * | 1 0 dx | - * | 0 1 dy | - * | 0 0 1 | - * - * @param dx horizontal translation - * @param dy vertical translation - * @return Matrix with translation - */ - static Matrix MakeTrans(float dx, float dy) { - Matrix m = {}; - m.setTranslate(dx, dy); - return m; - } - - /** - * Sets Matrix to: - * - * | scaleX skewX transX | - * | skewY scaleY transY | - * | pers0 pers1 pers2 | - * - * @param scaleX horizontal scale factor - * @param skewX horizontal skew factor - * @param transX horizontal translation - * @param skewY vertical skew factor - * @param scaleY vertical scale factor - * @param transY vertical translation - * @param pers0 input x-axis perspective factor - * @param pers1 input y-axis perspective factor - * @param pers2 perspective scale factor - * @return Matrix constructed from parameters - */ - static Matrix MakeAll(float scaleX, float skewX, float transX, float skewY, float scaleY, - float transY, float pers0, float pers1, float pers2) { - Matrix m = {}; - m.setAll(scaleX, skewX, transX, skewY, scaleY, transY, pers0, pers1, pers2); - return m; - } - - /** - * Returns true if Matrix is identity. The identity matrix is: - * - * | 1 0 0 | - * | 0 1 0 | - * | 0 0 1 | - * - * @return Returns true if the Matrix has no effect - */ - bool isIdentity() const; - - /** - * Returns one matrix value. - */ - float operator[](int index) const; - - /** - * Returns one matrix value. - */ - float get(int index) const; - - /** - * Returns the scale factor multiplied by x-axis input, contributing to x-axis output. With - * mapPoints(), scales Point along the x-axis. - * @return horizontal scale factor - */ - float getScaleX() const { - return values[SCALE_X]; - } - - /** - * Returns the scale factor multiplied by y-axis input, contributing to y-axis output. With - * mapPoints(), scales Point along the y-axis. - * @return vertical scale factor - */ - float getScaleY() const { - return values[SCALE_Y]; - } - - /** - * Returns the scale factor multiplied by x-axis input, contributing to y-axis output. With - * mapPoints(), skews Point along the y-axis. Skewing both axes can rotate Point. - * @return vertical skew factor - */ - float getSkewY() const { - return values[SKEW_Y]; - } - - /** - * Returns the scale factor multiplied by y-axis input, contributing to x-axis output. With - * mapPoints(), skews Point along the x-axis. Skewing both axes can rotate Point. - * @return horizontal scale factor - */ - float getSkewX() const { - return values[SKEW_X]; - } - - /** - * Returns translation contributing to x-axis output. With mapPoints(), moves Point along the - * x-axis. - * @return horizontal translation factor - */ - float getTranslateX() const { - return values[TRANS_X]; - } - - /** - * Returns translation contributing to y-axis output. With mapPoints(), moves Point along the - * y-axis. - * @return vertical translation factor - */ - float getTranslateY() const { - return values[TRANS_Y]; - } - - /** - * Returns writable Matrix value. - */ - float& operator[](int index); - - /** - * Sets Matrix value. - */ - void set(int index, float value); - - /** - * Sets horizontal scale factor. - * @param v horizontal scale factor to store - */ - void setScaleX(float v); - - /** - * Sets the vertical scale factor. - * @param v vertical scale factor to store - */ - void setScaleY(float v); - - /** - * Sets vertical skew factor. - * @param v vertical skew factor to store - */ - void setSkewY(float v); - - /** - * Sets the horizontal skew factor. - * @param v horizontal skew factor to store - */ - void setSkewX(float v); - - /** - * Sets horizontal translation. - * @param v horizontal translation to store - */ - void setTranslateX(float v); - - /** - * Sets vertical translation. - * @param v vertical translation to store - */ - void setTranslateY(float v); - - /** - * Sets all values from parameters. Sets matrix to: - * - * | scaleX skewX transX | - * | skewY scaleY transY | - * | persp0 persp1 persp2 | - * - * @param scaleX horizontal scale factor to store - * @param skewX horizontal skew factor to store - * @param transX horizontal translation to store - * @param skewY vertical skew factor to store - * @param scaleY vertical scale factor to store - * @param transY vertical translation to store - * @param persp0 input x-axis values perspective factor to store - * @param persp1 input y-axis values perspective factor to store - * @param persp2 perspective scale factor to store - */ - void setAll(float scaleX, float skewX, float transX, float skewY, float scaleY, float transY, - float persp0, float persp1, float persp2); - - /** - * Sets the Matrix to affine values, passed in column major order: - * - * | a c tx | - * | b d ty | - * | 0 1 | - * - * @param a horizontal scale factor - * @param b vertical skew factor - * @param c horizontal skew factor - * @param d vertical scale factor - * @param tx horizontal translation - * @param ty vertical translation - */ - void setAffine(float a, float b, float c, float d, float tx, float ty); - - /** - * Copies nine scalar values contained by Matrix into buffer, in member value ascending order: - * ScaleX, SkewX, TransX, SkewY, ScaleY, TransY, Persp0, Persp1, Persp2. - * @param buffer storage for nine scalar values - */ - void get9(float buffer[9]) const; - - /** - * Sets Matrix to nine scalar values in buffer, in member value ascending order: ScaleX, - * SkewX, TransX, SkewY, ScaleY, TransY, Persp0, Persp1, Persp2. - * - * Sets matrix to: - * - * | buffer[0] buffer[1] buffer[2] | - * | buffer[3] buffer[4] buffer[5] | - * | buffer[6] buffer[7] buffer[8] | - * - * @param buffer nine scalar values - */ - void set9(const float buffer[9]); - - /** - * Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to: - * - * | 1 0 0 | - * | 0 1 0 | - * | 0 0 1 | - * - * Also called setIdentity(); use the one that provides better inline documentation. - */ - void reset(); - - /** - * Sets Matrix to identity; which has no effect on mapped Point. Sets Matrix to: - * - * | 1 0 0 | - * | 0 1 0 | - * | 0 0 1 | - * - * Also called reset(); use the one that provides better inline documentation. - */ - void setIdentity() { - this->reset(); - } - - /** - * Sets Matrix to translate by (dx, dy). - * @param dx horizontal translation - * @param dy vertical translation - */ - void setTranslate(float dx, float dy); - - /** - * Sets Matrix to scale by sx and sy, about a pivot point at (px, py). The pivot point is - * unchanged when mapped with Matrix. - * @param sx horizontal scale factor - * @param sy vertical scale factor - * @param px pivot on x-axis - * @param py pivot on y-axis - */ - void setScale(float sx, float sy, float px, float py); - - /** - * Sets Matrix to scale by sx and sy about at pivot point at (0, 0). - * @param sx horizontal scale factor - * @param sy vertical scale factor - */ - void setScale(float sx, float sy); - - /** - * Sets Matrix to rotate by degrees about a pivot point at (px, py). The pivot point is - * unchanged when mapped with Matrix. Positive degrees rotates clockwise. - * @param degrees angle of axes relative to upright axes - * @param px pivot on x-axis - * @param py pivot on y-axis - */ - void setRotate(float degrees, float px, float py); - - /** - * Sets Matrix to rotate by degrees about a pivot point at (0, 0). Positive degrees rotates - * clockwise. - * @param degrees angle of axes relative to upright axes - */ - void setRotate(float degrees); - - /** - * Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (px, py). - * The pivot point is unchanged when mapped with Matrix. - * Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). - * Vector length specifies the scale factor. - */ - void setSinCos(float sinV, float cosV, float px, float py); - - /** - * Sets Matrix to rotate by sinValue and cosValue, about a pivot point at (0, 0). - * Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). - * Vector length specifies the scale factor. - */ - void setSinCos(float sinV, float cosV); - - /** - * Sets Matrix to skew by kx and ky, about a pivot point at (px, py). The pivot point is - * unchanged when mapped with Matrix. - * @param kx horizontal skew factor - * @param ky vertical skew factor - * @param px pivot on x-axis - * @param py pivot on y-axis - */ - void setSkew(float kx, float ky, float px, float py); - - /** - * Sets Matrix to skew by kx and ky, about a pivot point at (0, 0). - * @param kx horizontal skew factor - * @param ky vertical skew factor - */ - void setSkew(float kx, float ky); - - /** - * Sets Matrix to Matrix a multiplied by Matrix b. Either a or b may be this. - * - * Given: - * - * | A B C | | J K L | - * a = | D E F |, b = | M N O | - * | G H I | | P Q R | - * - * sets Matrix to: - * - * | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | - * a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | - * | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | - * - * @param a Matrix on the left side of multiply expression - * @param b Matrix on the right side of multiply expression - */ - void setConcat(const Matrix& a, const Matrix& b); - - /** - * Preconcats the matrix with the specified scale. M' = M * S(sx, sy) - */ - void preTranslate(float dx, float dy); - - /** - * Postconcats the matrix with the specified scale. M' = S(sx, sy, px, py) * M - */ - void preScale(float sx, float sy, float px, float py); - - /** - * Preconcats the matrix with the specified scale. M' = M * S(sx, sy) - */ - void preScale(float sx, float sy); - - /** - * Preconcats the matrix with the specified rotation. M' = M * R(degrees, px, py) - */ - void preRotate(float degrees, float px, float py); - - /** - * Preconcats the matrix with the specified rotation. M' = M * R(degrees) - */ - void preRotate(float degrees); - - /** - * Preconcats the matrix with the specified skew. M' = M * K(kx, ky, px, py) - */ - void preSkew(float kx, float ky, float px, float py); - - /** - * Preconcats the matrix with the specified skew. M' = M * K(kx, ky) - */ - void preSkew(float kx, float ky); - - /** - * Preconcats the matrix with the specified matrix. M' = M * other - */ - void preConcat(const Matrix& other); - - /** - * Postconcats the matrix with the specified translation. M' = T(dx, dy) * M - */ - void postTranslate(float dx, float dy); - - /** - * Postconcats the matrix with the specified scale. M' = S(sx, sy, px, py) * M - */ - void postScale(float sx, float sy, float px, float py); - - /** - * Postconcats the matrix with the specified scale. M' = S(sx, sy) * M - */ - void postScale(float sx, float sy); - - /** - * Postconcats the matrix with the specified rotation. M' = R(degrees, px, py) * M - */ - void postRotate(float degrees, float px, float py); - - /** - * Postconcats the matrix with the specified rotation. M' = R(degrees) * M - */ - void postRotate(float degrees); - - /** - * Postconcats the matrix with the specified skew. M' = K(kx, ky, px, py) * M - */ - void postSkew(float kx, float ky, float px, float py); - - /** - * Postconcats the matrix with the specified skew. M' = K(kx, ky) * M - */ - void postSkew(float kx, float ky); - - /** - * Postconcats the matrix with the specified matrix. M' = other * M - */ - void postConcat(const Matrix& other); - - /** - * If this matrix can be inverted, return true and if the inverse is not null, set inverse to be - * the inverse of this matrix. If this matrix cannot be inverted, ignore the inverse and return false. - */ - bool invert(Matrix* inverse) const; - - /** - * Returns true if the Matrix is invertible. - * @return - */ - bool invertible() const; - - /** - * Maps src Point array of length count to dst Point array of equal or greater length. Points are - * mapped by multiplying each Point by Matrix. Given: - * - * | A B C | | x | - * Matrix = | D E F |, pt = | y | - * | G H I | | 1 | - * - * where - * - * for (i = 0; i < count; ++i) { - * x = src[i].fX - * y = src[i].fY - * } - * - * each dst Point is computed as: - * - * |A B C| |x| Ax+By+C Dx+Ey+F - * Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - * |G H I| |1| Gx+Hy+I Gx+Hy+I - * - * src and dst may point to the same storage. - * - * @param dst storage for mapped Point - * @param src Point to transform - * @param count number of Points to transform - */ - void mapPoints(Point dst[], const Point src[], int count) const; - - /** - * Maps pts Point array of length count in place. Point are mapped by multiplying each Point by - * Matrix. Given: - * - * | A B C | | x | - * Matrix = | D E F |, pt = | y | - * | G H I | | 1 | - * - * where - * - * for (i = 0; i < count; ++i) { - * x = pts[i].fX - * y = pts[i].fY - * } - * - * each resulting pts Point is computed as: - * - * |A B C| |x| Ax+By+C Dx+Ey+F - * Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - * |G H I| |1| Gx+Hy+I Gx+Hy+I - * - * @param pts storage for mapped Point - * @param count number of Points to transform - */ - void mapPoints(Point pts[], int count) const { - this->mapPoints(pts, pts, count); - } - - /** - * Maps Point (x, y) to result. Point is mapped by multiplying by Matrix. Given: - * - * | A B C | | x | - * Matrix = | D E F |, pt = | y | - * | G H I | | 1 | - * - * the result is computed as: - * - * |A B C| |x| Ax+By+C Dx+Ey+F - * Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - * |G H I| |1| Gx+Hy+I Gx+Hy+I - * - * @param x x-axis value of Point to map - * @param y y-axis value of Point to map - * @param result storage for mapped Point - */ - void mapXY(float x, float y, Point* result) const; - - /** - * Returns Point (x, y) multiplied by Matrix. Given: - * - * | A B C | | x | - * Matrix = | D E F |, pt = | y | - * | G H I | | 1 | - * - * the result is computed as: - * - * |A B C| |x| Ax+By+C Dx+Ey+F - * Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - * |G H I| |1| Gx+Hy+I Gx+Hy+I - * - * @param x x-axis value of Point to map - * @param y y-axis value of Point to map - * @return mapped Point - */ - Point mapXY(float x, float y) const { - Point result = {}; - this->mapXY(x, y, &result); - return result; - } - - /** - * Sets dst to bounds of src corners mapped by Matrix. - */ - void mapRect(Rect* dst, const Rect& src) const; - - /** - * Sets rect to bounds of rect corners mapped by Matrix. Returns true if mapped corners are - * computed rect corners. - */ - void mapRect(Rect* rect) const { - mapRect(rect, *rect); - } - - /** - * Returns bounds of src corners mapped by Matrix. - */ - Rect mapRect(const Rect& src) const { - Rect dst = {}; - mapRect(&dst, src); - return dst; - } - - /** Compares a and b; returns true if a and b are numerically equal. Returns true even if sign - * of zero values are different. Returns false if either Matrix contains NaN, even if the other - * Matrix also contains NaN. - */ - friend PAG_API bool operator==(const Matrix& a, const Matrix& b); - - /** - * Compares a and b; returns true if a and b are not numerically equal. Returns false even if - * sign of zero values are different. Returns true if either Matrix contains NaN, even if the - * other Matrix also contains NaN. - */ - friend bool operator!=(const Matrix& a, const Matrix& b) { - return !(a == b); - } - - /** - * Returns the minimum scaling factor of the Matrix by decomposing the scaling and skewing - * elements. Returns -1 if scale factor overflows. - */ - float getMinScale() const; - - /** - * Returns the maximum scaling factor of the Matrix by decomposing the scaling and skewing - * elements. Returns -1 if scale factor overflows. - */ - float getMaxScale() const; - - /** - * Returns true if all elements of the matrix are finite. Returns false if any element is - * infinity, or NaN. - */ - bool isFinite() const; - - /** - * Returns reference to const identity Matrix. Returned Matrix is set to: - * - * | 1 0 0 | - * | 0 1 0 | - * | 0 0 1 | - * - * @return const identity Matrix - */ - static const Matrix& I(); - - /** - * Returns reference to a const Matrix with invalid values. Returned Matrix is set to: - * - * | FLT_MAX FLT_MAX FLT_MAX | - * | FLT_MAX FLT_MAX FLT_MAX | - * | 0 0 1 | - * - * @return const invalid Matrix - */ - static const Matrix& Invalid(); - - private: -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-private-field" - float values[6]; - mutable int32_t typeMask; - /** - * Matrix organizes its values in row order. These members correspond to each value in Matrix. - */ - static constexpr int SCALE_X = 0; //!< horizontal scale factor - static constexpr int SKEW_X = 1; //!< horizontal skew factor - static constexpr int TRANS_X = 2; //!< horizontal translation - static constexpr int SKEW_Y = 3; //!< vertical skew factor - static constexpr int SCALE_Y = 4; //!< vertical scale factor - static constexpr int TRANS_Y = 5; //!< vertical translation -#pragma clang diagnostic pop -}; - -/** - * Layers are always one of the following types. - */ -enum class RTTR_AUTO_REGISTER_CLASS LayerType { - Unknown, - Null, - Solid, - Text, - Shape, - Image, - PreCompose, - Camera, -}; - -/** - * Defines the rules on how to scale the content to fit the specified area. - */ -enum class PAG_API PAGScaleMode : uint8_t { - /** - * The content is not scaled. - */ - None = 0, - /** - * The content is stretched to fit. - */ - Stretch = 1, - /** - * The content is scaled with respect to the original unscaled image's aspect ratio. - * This is the default value. - */ - LetterBox = 2, - /** - * The content is scaled to fit with respect to the original unscaled image's aspect ratio. - * This results in cropping on one axis. - */ - Zoom = 3 -}; - -/** - * Defines the rules on how to stretch the timeline of content to fit the specified duration. - */ -enum class PAG_API PAGTimeStretchMode : uint8_t { - /** - * Keep the original playing speed, and display the last frame if the content's duration is less - * than target duration. - */ - None = 0, - /* - * Change the playing speed of the content to fit target duration. - */ - Scale = 1, - /** - * Keep the original playing speed, but repeat the content if the content's duration is less than - * target duration. This is the default mode. - */ - Repeat = 2, - /** - * Keep the original playing speed, but repeat the content in reversed if the content's duration - * is less than target duration. - */ - RepeatInverted = 3 -}; - -enum class PAG_API ParagraphJustification : uint8_t { - LeftJustify = 0, - CenterJustify = 1, - RightJustify = 2, - FullJustifyLastLineLeft = 3, - FullJustifyLastLineRight = 4, - FullJustifyLastLineCenter = 5, - FullJustifyLastLineFull = 6 -}; - -enum class PAG_API TextDirection : uint8_t { - Default = 0, - Horizontal = 1, - Vertical = 2 -}; - -/** - * The Text object stores a value for a TextLayer's Source Text property. - */ -class PAG_API TextDocument { - public: - /** - * When true, the text layer shows a fill. - */ - bool applyFill = true; - - /** - * When true, the text layer shows a stroke. - */ - bool applyStroke = false; - - /** - * Readonly, external modifications are not valid. - */ - float baselineShift = 0; - - /** - * When true, the text layer is paragraph (bounded) text. - * Readonly, external modifications are not valid. - */ - bool boxText = false; - - /** - * Readonly, external modifications are not valid. - */ - Point boxTextPos = Point::Zero(); - - /** - * For box text, the pixel dimensions for the text bounds. - * Readonly, external modifications are not valid. - */ - Point boxTextSize = Point::Zero(); - - /** - * Readonly, external modifications are not valid. - */ - float firstBaseLine = 0; - - bool fauxBold = false; - - bool fauxItalic = false; - /** - * The text layer’s fill color. - */ - Color fillColor = Black; - - /** - * A string with the name of the font family. - **/ - std::string fontFamily = ""; - - /** - * A string with the style information — e.g., “bold”, “italic”. - **/ - std::string fontStyle = ""; - - /** - * The text layer’s font size in pixels. - */ - float fontSize = 24; - - /** - * The text layer’s stroke color. - */ - Color strokeColor = Black; - - /** - * Indicates the rendering order for the fill and stroke of a text layer. - * Readonly, external modifications are not valid. - */ - bool strokeOverFill = true; - - /** - * The text layer’s stroke thickness. - */ - float strokeWidth = 1; - - /** - * The text layer’s Source Text value. - */ - std::string text = ""; - - /** - * The paragraph justification for the text layer. - */ - ParagraphJustification justification = ParagraphJustification::LeftJustify; - - /** - * The space between lines, 0 indicates 'auto', which is fontSize * 1.2 - */ - float leading = 0; - - /** - * The text layer’s spacing between characters. - */ - float tracking = 0; - - /** - * The text layer’s background color - */ - Color backgroundColor = White; - /** - * The text layer’s background alpha. 0 = 100% transparent, 255 = 100% opaque. - */ - uint8_t backgroundAlpha = 0; - - TextDirection direction = TextDirection::Default; -}; - -typedef std::shared_ptr TextDocumentHandle; - -/** - * Marker stores comments and other metadata and mark important times in a composition or layer. - */ -struct RTTR_AUTO_REGISTER_CLASS Marker { - Frame startTime = 0; - Frame duration = 0; - std::string comment; -}; - -/** - * A container for data of bytes. - */ -class PAG_API ByteData { - public: - /** - * Creates a ByteData object from the specified file path. - */ - static std::unique_ptr FromPath(const std::string& filePath); - /** - * Creates a ByteData object and copy the specified data into it. - */ - static std::unique_ptr MakeCopy(const void* data, size_t length); - /** - * Call this when the data parameter is already const and will outlive the lifetime of the - * ByteData. Suitable for with const globals. - */ - static std::unique_ptr MakeWithoutCopy(void* data, size_t length); - /** - * Creates a ByteData object and take ownership of the specified data. The specified data will be - * deleted when the returned ByteData is released. - * Set releaseCallback to release outer data, and default protocol is to call 'delete[] data', - * if data is created by 'malloc', you need send a function to call 'free(data)'. - */ - static std::unique_ptr MakeAdopted( - uint8_t* data, size_t length, std::function releaseCallback = DeleteCallback); - /** - * Creates a ByteData object with specified length. - */ - static std::unique_ptr Make(size_t length); - - ~ByteData() { - if (_releaseCallback) { - _releaseCallback(_data); - } - } - - /** - * Returns the memory address of byte data. - */ - uint8_t* data() const { - return _data; - } - - /** - * Returns the byte size. - */ - size_t length() const { - return _length; - } - - private: - static void DeleteCallback(uint8_t* data) { - if (data) delete[] data; - } - - ByteData(uint8_t* data, size_t length, - std::function releaseCallback = DeleteCallback) - : _data(data), _length(length), _releaseCallback(std::move(releaseCallback)) { - } - - uint8_t* _data; - size_t _length; - const std::function _releaseCallback; -}; - -/** - * Describes how to interpret the alpha component of a pixel. - */ -enum class AlphaType { - /** - * uninitialized. - */ - Unknown, - /** - * pixel is opaque. - */ - Opaque, - /** - * pixel components are premultiplied by alpha. - */ - Premultiplied, - /** - * pixel components are independent of alpha. - */ - Unpremultiplied, -}; - -/** - * Describes how pixel bits encode color. These values match up with the enum in Bitmap.Config on - * Android platform. - */ -enum class ColorType { - /** - * uninitialized. - */ - Unknown, - /** - * Each pixel is stored as a single translucency (alpha) channel. This is very useful for - * storing masks efficiently, for instance. No color information is stored. With this - * configuration, each pixel requires 1 byte of memory. - */ - ALPHA_8, - /** - * Each pixel is stored on 4 bytes. Each channel (RGB and alpha for translucency) is stored with 8 - * bits of precision (256 possible values). The channel order is: red, green, blue, alpha. - */ - RGBA_8888, - /** - * Each pixel is stored on 4 bytes. Each channel (RGB and alpha for translucency) is stored with 8 - * bits of precision (256 possible values). The channel order is: blue, green, red, alpha. - */ - BGRA_8888, - /** - * Each pixel is stored on 2 bytes, and only the RGB channels are encoded: red is stored with 5 - * bits of precision (32 possible values), green is stored with 6 bits of precision (64 possible - * values), and blue is stored with 5 bits of precision. - */ - RGB_565, - /** - * Each pixel is stored as a single grayscale level. No color information is stored. With this - * configuration, each pixel requires 1 byte of memory. - */ - Gray_8, - /** - * Each pixel is stored on 8 bytes. Each channel (RGB and alpha for translucency) is stored as a - * half-precision floating point value. This configuration is particularly suited for wide-gamut - * and HDR content. - */ - RGBA_F16, - /** - * Each pixel is stored on 4 bytes. Each RGB channel is stored with 10 bits of precision (1024 - * possible values). There is an additional alpha channel that is stored with 2 bits of precision - * (4 possible values). This configuration is suited for wide-gamut and HDR content which does not - * require alpha blending, such that the memory cost is the same as RGBA_8888 while enabling - * higher color precision. - */ - RGBA_1010102 -}; - -enum class PAG_API BlendMode : uint8_t { - Normal = 0, - Multiply = 1, - Screen = 2, - Overlay = 3, - Darken = 4, - Lighten = 5, - ColorDodge = 6, - ColorBurn = 7, - HardLight = 8, - SoftLight = 9, - Difference = 10, - Exclusion = 11, - Hue = 12, - Saturation = 13, - Color = 14, - Luminosity = 15, - Add = 16 -}; - -} // namespace pag diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Resources/Info.plist b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Resources/Info.plist deleted file mode 100644 index d6fa5fa..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/Resources/Info.plist +++ /dev/null @@ -1,48 +0,0 @@ - - - - - BuildMachineOSBuild - 24F74 - CFBundleDevelopmentRegion - English - CFBundleExecutable - libpag - CFBundleIdentifier - com.tencent.libpag - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - FMWK - CFBundleShortVersionString - 4.5.2 - CFBundleSignature - ???? - CFBundleSupportedPlatforms - - MacOSX - - CFBundleVersion - 4.5.2 - CSResourcesFileMapped - - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 24C94 - DTPlatformName - macosx - DTPlatformVersion - 15.2 - DTSDKBuild - 24C94 - DTSDKName - macosx15.2 - DTXcode - 1620 - DTXcodeBuild - 16C5032a - LSMinimumSystemVersion - 11.0 - - diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/_CodeSignature/CodeResources b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/_CodeSignature/CodeResources deleted file mode 100644 index 5b618d5..0000000 --- a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/_CodeSignature/CodeResources +++ /dev/null @@ -1,464 +0,0 @@ - - - - - files - - Resources/Info.plist - - UNaibRh/Eidvu+TWzEBnH3o7uwM= - - - files2 - - Headers/CocoaUtils.h - - hash2 - - ZxaQ3M+/jSnCuZljo3coIWDfW+qtkkZgDTIpBnAqxaA= - - - Headers/PAG.h - - hash2 - - mREbuNRE8MtaBDS6OHqLmGk1ML01bFrTmajdOdqTbQY= - - - Headers/PAGComposition.h - - hash2 - - VUrUTpQOlzpG5d97zIGdadD3OuwL/uubskbS9ekl65o= - - - Headers/PAGDiskCache.h - - hash2 - - 0Jfz8vAgk+BYh2WzotBulyyfobUSO3CYr8jqPiZ4lvM= - - - Headers/PAGFile.h - - hash2 - - Rl7Sp5BDpCEnGA7GL8mGJn/A3ArA5YDtj3aa9kL2xhw= - - - Headers/PAGFont.h - - hash2 - - Z6mRn0l/mwzlsySfj4uLQjdhR+RHGpqCOO13Y5ntp38= - - - Headers/PAGImage.h - - hash2 - - eUGv5ygK0CSBJfmMKGWqyi1VmnF3MY/8eC4tACXRUK8= - - - Headers/PAGImageLayer.h - - hash2 - - fer6sCxPMGolXaZk0yNuwg2i/9h9P9H5Eis7sfhkVII= - - - Headers/PAGLayer.h - - hash2 - - 8iEbY5PT+aCnL5Ettbvvtq16Jm8hy/BO43FZwywfDKM= - - - Headers/PAGMarker.h - - hash2 - - f6rGzRibEfBLvwvVSacSiFI7iUvUAFMjfr3Z3P6PSFQ= - - - Headers/PAGPlayer.h - - hash2 - - KrhwHgrWUgfq13966j3egfPAWRglXi4Y2CqRaBoj0G0= - - - Headers/PAGScaleMode.h - - hash2 - - /5/k313//7G5J2xuu/GSioE99enfkpbV6aOMMBMdj90= - - - Headers/PAGShapeLayer.h - - hash2 - - EmtlbiCcBBADk9qmT8ADL8YmxplMgFSesZpYGXuGj8s= - - - Headers/PAGSolidLayer.h - - hash2 - - w4WjykaZEkkXw0xnoSh86nWdJWf6XdhP+7nfUaXYR/w= - - - Headers/PAGSurface.h - - hash2 - - lLe3GZ/6FCZnC5Us+9LdqU5nxl756b3guXI6A5mKGgc= - - - Headers/PAGText.h - - hash2 - - QEVLp+EejRPuE4ZY0wnvxObG+HAPleylTcF0n+oWa+M= - - - Headers/PAGTextLayer.h - - hash2 - - dctcHBaYwTsOSFxWN5yeGTUnOT3TqDCQKoC2yWEJWTE= - - - Headers/PAGTimeStretchMode.h - - hash2 - - WCWFbHQEx0653NdqTaCY7uKNTn8ARRXke4wxYfKwuuo= - - - Headers/PAGVideoDecoder.h - - hash2 - - z8Zm8iTZooZ2aO1D0xZlSVl+pofCMt1XQv5bysAvG1g= - - - Headers/PAGVideoRange.h - - hash2 - - eFs9m3mZiOTG/lsMkMjRow4Hk3kQGeAaPQ+iTHu9D/4= - - - Headers/PAGView.h - - hash2 - - 5epNLZ2UpCDbz54ICIpeoAvwsC9ns9OcRR03erYzloY= - - - Headers/libpag.h - - hash2 - - m6msh2BJbfkviFD5t3c/tlyKlsuryWFb1IePp8L8HlE= - - - Headers/pag/c/ext/egl/pag_egl_globals.h - - hash2 - - RfoGWlbxNIep45TdJRS9KFdDBljg1zo+dYopp/8L/yE= - - - Headers/pag/c/ext/pag_surface_ext.h - - hash2 - - biwVj12Led2KUzKg+6xi/dioWTaUsO7LKhy+s4Ib6SE= - - - Headers/pag/c/pag.h - - hash2 - - 70bE+v0+Gv3UqjMv9zTmVT/UoV17zh93L4rQh0KI7Zc= - - - Headers/pag/c/pag_animator.h - - hash2 - - lHkLe39PIpSWBU7X5EoLRwItR0Y/tHm7KYlEprkeDTA= - - - Headers/pag/c/pag_backend_semaphore.h - - hash2 - - ukZypohjm0vIu0zX/z3vphZ+2yBYB4+DYCRRYDRROCo= - - - Headers/pag/c/pag_backend_texture.h - - hash2 - - N1eWyrcnRsAU6600fi/QT1DvQShFOQScf8yXlwr6UDo= - - - Headers/pag/c/pag_byte_data.h - - hash2 - - oDey43WS/pqSsk25y4ojvY6YnpkIeD6ZPLR00ry/Gu4= - - - Headers/pag/c/pag_composition.h - - hash2 - - v+OsHsJcPzCdkcMQWKHjkW5hJMTXdSOuZr6km0cKeBU= - - - Headers/pag/c/pag_decoder.h - - hash2 - - Zo61cgGdYHu5UdkEHs/fCV52r7+fyFLWytAftyyg5VE= - - - Headers/pag/c/pag_disk_cache.h - - hash2 - - 54BIZAaawgLOsk5Vd0rp1jmUTgzBl88O7MYCN1Pd5SI= - - - Headers/pag/c/pag_file.h - - hash2 - - g9mRz+rkOklF29aWwtYtsr+/lD9q5A6u+biRe5yBl54= - - - Headers/pag/c/pag_font.h - - hash2 - - ej1yadv15XJkirUiz8rZ6LkRHZgYQygY/yVQ/ym9zQ8= - - - Headers/pag/c/pag_image.h - - hash2 - - Y4/2wHSWJX6fV/1zzWeQdCpq6UbtWojuG/T+7XFkXNw= - - - Headers/pag/c/pag_image_layer.h - - hash2 - - ca0wHLFtOYipZV2PY+XpdQvLSKszbUUenODdO+UA0fU= - - - Headers/pag/c/pag_layer.h - - hash2 - - PNrhQYZotqELfuaQ8qSOPQhWAPJiC4vmKgQkY/AgjPs= - - - Headers/pag/c/pag_player.h - - hash2 - - ZHl6zzr5e6/OBWYidF0OW9XMOih/JJ/YHYlLXZKnJX8= - - - Headers/pag/c/pag_solid_layer.h - - hash2 - - gX/SGexbnSJZ8FXwyVlPIx1m46jr4qp/mmSQjpfJmus= - - - Headers/pag/c/pag_surface.h - - hash2 - - AEZ6wLt59zINuo18TVAgzxeevaRKfl9yYgn1knhW9fI= - - - Headers/pag/c/pag_text_document.h - - hash2 - - bs8PHv/MQ1+q5K6N0PTSsqlG7F3UhJQdAlOUVoiKaHE= - - - Headers/pag/c/pag_types.h - - hash2 - - QcZdXQ9i7fQSDTcc+CICNSEOjulUDu6GMXylKObA62M= - - - Headers/pag/decoder.h - - hash2 - - 9czbSPFyqQop87PLvq/ruCocgRONRRdnDWQdC9xSqmU= - - - Headers/pag/defines.h - - hash2 - - t3Y4L+QKnJ/47wOhpmhDENXhjyNen0Pg/fUinUTbN+o= - - - Headers/pag/file.h - - hash2 - - +dMd9ESwKCrOjzhMKWQehw2vw0NCc7zvmempHwqAXOA= - - - Headers/pag/gpu.h - - hash2 - - Xpg5Ut83MAxjHAyh2pydDQeJTOw7FO2ms6NUPjVLTe4= - - - Headers/pag/pag.h - - hash2 - - kLSR7aZCI2OrgwgDCxQIfNQyEsxhTm0lsNBguB8EQUQ= - - - Headers/pag/types.h - - hash2 - - 2KnRnVwb0lWhslBpybu5FO1Gq8kgnhBGFyxrrDGz6ig= - - - Resources/Info.plist - - hash2 - - PBTT0YhBJMGfm1RWW0sFuM0ve/AFIOiyqTV3ys4wVWo= - - - - rules - - ^Resources/ - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^Resources/Base\.lproj/ - - weight - 1010 - - ^version.plist$ - - - rules2 - - .*\.dSYM($|/) - - weight - 11 - - ^(.*/)?\.DS_Store$ - - omit - - weight - 2000 - - ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ - - nested - - weight - 10 - - ^.* - - ^Info\.plist$ - - omit - - weight - 20 - - ^PkgInfo$ - - omit - - weight - 20 - - ^Resources/ - - weight - 20 - - ^Resources/.*\.lproj/ - - optional - - weight - 1000 - - ^Resources/.*\.lproj/locversion.plist$ - - omit - - weight - 1100 - - ^Resources/Base\.lproj/ - - weight - 1010 - - ^[^/]+$ - - nested - - weight - 10 - - ^embedded\.provisionprofile$ - - weight - 20 - - ^version\.plist$ - - weight - 20 - - - - diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/libpag b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/libpag deleted file mode 100755 index 8a04001..0000000 Binary files a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/Versions/Current/libpag and /dev/null differ diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/libpag b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/libpag deleted file mode 100755 index 7a94cc3..0000000 Binary files a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/libpag and /dev/null differ diff --git a/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/libpag b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/libpag new file mode 120000 index 0000000..ba7759f --- /dev/null +++ b/framework/libpag.xcframework/macos-arm64_x86_64/libpag.framework/libpag @@ -0,0 +1 @@ +Versions/Current/libpag \ No newline at end of file diff --git a/libpag-macOS.podspec b/libpag-macOS.podspec index 0961a6f..8b528a2 100644 --- a/libpag-macOS.podspec +++ b/libpag-macOS.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.source = {:git => 'https://github.com/libpag/pag-mac.git', :tag => s.version.to_s } s.license = { :type => 'Apache License Version 2.0', :file => 'LICENSE' } s.author = {'libpag' => 'libpag@tencent.com'} - s.osx.frameworks = ['ApplicationServices', 'AGL', 'OpenGL', 'QuartzCore', 'Cocoa', 'Foundation', 'VideoToolbox', 'CoreMedia'] + s.osx.frameworks = ['ApplicationServices', 'OpenGL', 'QuartzCore', 'Cocoa', 'Foundation', 'VideoToolbox', 'CoreMedia'] s.osx.libraries = ["iconv", "c++", "compression"] s.vendored_frameworks = 'framework/libpag.xcframework' s.xcconfig = {