### Basic NSLayoutConstraints Example Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Demonstrates the verbose way of creating constraints using raw NSLayoutConstraints for a view inset from its superview. ```Objective-C UIView *superview = self.view; UIView *view1 = [[UIView alloc] init]; view1.translatesAutoresizingMaskIntoConstraints = NO; view1.backgroundColor = [UIColor greenColor]; [superview addSubview:view1]; UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10); [superview addConstraints:@[ //view1 constraints [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeTop multiplier:1.0 constant:padding.top], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeLeft multiplier:1.0 constant:padding.left], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-padding.bottom], [NSLayoutConstraint constraintWithItem:view1 attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:superview attribute:NSLayoutAttributeRight multiplier:1 constant:-padding.right], ]] ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Sets the minimum CMake version and project name. Configures the C++ standard to C++14. ```cmake cmake_minimum_required(VERSION 3.10) project(SMBeautyEngine_linux) set(CMAKE_CXX_STANDARD 14) ``` -------------------------------- ### Complete PixelFree SDK Integration Example in C Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/doc/doc_c.md This snippet demonstrates the full lifecycle of using the PixelFree SDK, from creating an instance to processing an image and releasing resources. Ensure correct file paths for the license and filter bundle, and handle potential errors during file operations and SDK calls. ```c #include #include #include "pixelFree_c.hpp" int main() { // 1. 创建实例 PFPixelFree* handle = PF_NewPixelFree(); if (handle == NULL) { printf("Failed to create PixelFree handle\n"); return -1; } // 2. 加载授权文件 FILE* authFile = fopen("pixelfreeAuth.lic", "rb"); if (authFile == NULL) { printf("Failed to open auth file\n"); PF_DeletePixelFree(handle); return -1; } fseek(authFile, 0, SEEK_END); long authSize = ftell(authFile); fseek(authFile, 0, SEEK_SET); char* authBuffer = (char*)malloc(authSize); fread(authBuffer, 1, authSize, authFile); fclose(authFile); PF_createBeautyItemFormBundle(handle, authBuffer, (int)authSize, PFSrcTypeAuthFile); // 3. 加载滤镜资源 FILE* filterFile = fopen("filter_model.bundle", "rb"); if (filterFile == NULL) { printf("Failed to open filter file\n"); free(authBuffer); PF_DeletePixelFree(handle); return -1; } fseek(filterFile, 0, SEEK_END); long filterSize = ftell(filterFile); fseek(filterFile, 0, SEEK_SET); char* filterBuffer = (char*)malloc(filterSize); fread(filterBuffer, 1, filterSize, filterFile); fclose(filterFile); PF_createBeautyItemFormBundle(handle, filterBuffer, (int)filterSize, PFSrcTypeFilter); // 4. 设置美颜参数 float blurValue = 0.7f; PF_pixelFreeSetBeautyFilterParam(handle, PFBeautyFilterTypeFaceBlurStrength, &blurValue); float whitenValue = 0.5f; PF_pixelFreeSetBeautyFilterParam(handle, PFBeautyFilterTypeFaceM_newWhitenStrength, &whitenValue); float whitenTeethValue = 0.5f; PF_pixelFreeSetBeautyFilterParam(handle, PFBeautyFilterWhitenTeeth, &whitenTeethValue); // 5. 设置滤镜 const char* filterName = "heibai1"; PF_pixelFreeSetBeautyFilterParam(handle, PFBeautyFilterName, (void*)filterName); float filterStrength = 0.8f; PF_pixelFreeSetBeautyFilterParam(handle, PFBeautyFilterStrength, &filterStrength); // 6. 处理图像 PFImageInput image; image.textureID = 0; image.wigth = 720; image.height = 1280; image.p_data0 = rgbaData; // 假设已有RGBA数据 image.p_data1 = NULL; image.p_data2 = NULL; image.stride_0 = 720 * 4; image.stride_1 = 0; image.stride_2 = 0; image.format = PFFORMAT_IMAGE_RGBA; image.rotationMode = PFRotationMode90; int result = PF_processWithBuffer(handle, image); printf("Process result: %d\n", result); // 7. 清理资源 free(authBuffer); free(filterBuffer); PF_DeletePixelFree(handle); return 0; } ``` -------------------------------- ### Deploy SMBeauty License API with Docker Compose Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Use Docker Compose to deploy the SMBeauty License API in a production environment. This involves copying the production environment file and starting the services. ```bash # Use production environment configuration cp .env.production .env # Start services docker-compose -f docker-compose.prod.yml up -d ``` -------------------------------- ### Install Certbot for Let's Encrypt SSL Certificates Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Install Certbot, a tool for automatically generating and renewing SSL certificates from Let's Encrypt. This is the recommended method for obtaining certificates. ```bash # Install Certbot # Ubuntu/Debian sudo apt-get update sudo apt-get install certbot # CentOS/RHEL sudo yum install certbot # macOS brew install certbot ``` -------------------------------- ### Install and Configure Fail2ban for System Security Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Install Fail2ban to protect your server against brute-force attacks by monitoring log files and banning suspicious IP addresses. Configure it by creating a local jail configuration file. ```bash # Update system sudo apt-get update && sudo apt-get upgrade # Install security tools sudo apt-get install fail2ban # Configure fail2ban sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local sudo systemctl enable fail2ban sudo systemctl start fail2ban ``` -------------------------------- ### Finding and Verifying GLFW3 Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Finds the GLFW3 package and checks if it was found. Exits with an error if GLFW3 is not installed. ```cmake find_package(glfw3 3.3 REQUIRED) if(NOT glfw3_FOUND) message(FATAL_ERROR "GLFW3 not found. Please install libglfw3-dev") endif() ``` -------------------------------- ### GLM CMakeLists Project Setup Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/glm/CMakeLists.txt Defines the project name and uses file GLOB to find source, inline, header, text, and natvis files within the project structure. This is a common pattern for managing library files in CMake. ```cmake set(NAME glm_dummy) file(GLOB ROOT_SOURCE *.cpp) file(GLOB ROOT_INLINE *.inl) file(GLOB ROOT_HEADER *.hpp) file(GLOB ROOT_TEXT ../*.txt) file(GLOB ROOT_NAT ../util/glm.natvis) file(GLOB_RECURSE CORE_SOURCE ./detail/*.cpp) file(GLOB_RECURSE CORE_INLINE ./detail/*.inl) file(GLOB_RECURSE CORE_HEADER ./detail/*.hpp) file(GLOB_RECURSE GTC_SOURCE ./gtc/*.cpp) file(GLOB_RECURSE GTC_INLINE ./gtc/*.inl) file(GLOB_RECURSE GTC_HEADER ./gtc/*.hpp) file(GLOB_RECURSE GTX_SOURCE ./gtx/*.cpp) file(GLOB_RECURSE GTX_INLINE ./gtx/*.inl) file(GLOB_RECURSE GTX_HEADER ./gtx/*.hpp) ``` -------------------------------- ### Remaking Constraints Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Use `mas_remakeConstraints` to remove all existing constraints for a view and install a new set. This is ideal for situations where the layout logic changes significantly. ```obj-c - (void)changeButtonPosition { [self.button mas_remakeConstraints:^(MASConstraintMaker *make) { make.size.equalTo(self.buttonSize); if (topLeft) { make.top.and.left.offset(10); } else { make.bottom.and.right.offset(-10); } }]; } ``` -------------------------------- ### Compile and Run SMBeauty License API Directly Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Build the Go application for production and run it directly on the server. This method is suitable if Docker is not used. ```bash # Compile application go build -ldflags="-s -w" -o smbeauty-license-api main.go # Copy production environment variables cp .env.production .env # Start service ./smbeauty-license-api ``` -------------------------------- ### Initialize and Use PixelFree SDK in UniApp Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_uniapp/README.md This snippet demonstrates how to import the PixelFree SDK, initialize it with a license file, set beauty filter parameters, and process an image. Ensure the license file is placed in the static directory and the SDK is correctly imported. ```javascript import PixelFree, { PFBeautyFiterType } from '@/js_sdk/pixelfree.js'; // Initialize await PixelFree.createWithLic('/static/pixelfreeAuth.lic'); // Set beauty parameters await PixelFree.pixelFreeSetBeautyFilterParam(PFBeautyFiterType.eyeStrength, 0.5); // Process image const textureID = await PixelFree.processWithImage(imageData, width, height); ``` -------------------------------- ### Defining Source Files Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Lists the source files required to build the project, including main, OpenGL implementation, and Glad source. ```cmake set(SOURCE_FILES src/main.cpp src/opengl.cpp ${GLAD_SOURCE_DIR}/glad.cc ) ``` -------------------------------- ### Build Docker Image for License API Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Create a Docker image for the SMBeautyLicense API using the provided Dockerfile. This image will be used to run the API in a containerized environment. ```bash # Build image docker build -t smbeauty-license-api . ``` -------------------------------- ### Generate Production SSL Certificate with Let's Encrypt Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Use the generate_production_cert.sh script to obtain an SSL certificate for your domain. Ensure you provide the correct domain name and email address. ```bash # Generate certificate ./generate_production_cert.sh --domain api.example.com --email admin@example.com ``` -------------------------------- ### Initialize PixelFree Plugin Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_flutter/pixelfree/README.md Initialize the PixelFree plugin with a license file. This is a required first step before using other functionalities. ```dart import 'package:pixelfree/pixelfree.dart'; final pixelfree = Pixelfree(); // Initialize with license await pixelfree.createWithLic('path/to/license.lic'); ``` -------------------------------- ### Run SMBeauty License API Docker Container Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Deploy the SMBeauty License API as a Docker container. This command configures ports, environment variables for HTTPS, and volume mounts for persistent data. ```bash # Run container docker run -d \ --name smbeauty-api \ --restart unless-stopped \ -p 80:80 \ -p 443:443 \ -e ENABLE_HTTPS=true \ -e SSL_CERT_PATH=/app/certs/cert.pem \ -e SSL_KEY_PATH=/app/certs/key.pem \ -e HTTP_PORT=80 \ -e HTTPS_PORT=443 \ -e DOWNLOAD_BASE_URL=https://api.example.com \ -v $(pwd)/data:/app/data \ -v $(pwd)/licenses:/app/licenses \ -v $(pwd)/certs:/app/certs \ smbeauty-license-api ``` -------------------------------- ### Create Backup Script for Production Data Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Develop a bash script to back up critical data, licenses, and certificates to a timestamped directory, then compress it. Schedule this script using cron for regular backups. ```bash # Create backup script cat > backup.sh << 'EOF' #!/bin/bash BACKUP_DIR="/backup/$(date +%Y%m%d)" mkdir -p $BACKUP_DIR # Backup data cp -r data/ $BACKUP_DIR/ cp -r licenses/ $BACKUP_DIR/ cp -r certs/ $BACKUP_DIR/ # Compress backup tar -czf $BACKUP_DIR.tar.gz $BACKUP_DIR rm -rf $BACKUP_DIR echo "Backup complete: $BACKUP_DIR.tar.gz" EOF chmod +x backup.sh # Add to cron jobs echo "0 2 * * * /path/to/backup.sh" | crontab - ``` -------------------------------- ### Setting Include Directories Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Configures the include paths for the project, including custom headers, third-party libraries, and OpenGL headers. ```cmake include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/pixelfreeLib/Include ${STB_INCLUDE_DIR} ${GLFW3_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} ${GLAD_INCLUDE_DIR} ) ``` -------------------------------- ### Configure Firewall for Production Deployment Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Open necessary ports on your server's firewall to allow HTTP, HTTPS, and SSH traffic. This ensures the API is accessible and manageable. ```bash # Open necessary ports sudo ufw allow 80/tcp # HTTP (for certificate validation) sudo ufw allow 443/tcp # HTTPS sudo ufw allow 22/tcp # SSH sudo ufw enable ``` -------------------------------- ### Configure Commercial SSL Certificates Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md If using a commercial SSL certificate, copy your certificate and private key files to the designated 'certs' directory and set appropriate file permissions. ```bash # Copy certificate files cp your_certificate.crt certs/cert.pem cp your_private_key.key certs/key.pem # Set permissions chmod 644 certs/cert.pem chmod 600 certs/key.pem ``` -------------------------------- ### Setting Output Directories Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Configures the output directories for runtime executables and libraries relative to the binary directory. ```cmake set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) ``` -------------------------------- ### Defining Resource Paths Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Sets variables for the resource directory and an image file path. ```cmake set(RES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Res") set(IMAGE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/IMG_2406.png") ``` -------------------------------- ### Setting Link Libraries for Linux Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Initializes the list of libraries to link and appends Linux-specific libraries including OpenGL, X11, pthread, and dl. ```cmake set(LINK_LIBS "") if(UNIX AND NOT APPLE) list(APPEND LINK_LIBS ${OPENGL_LIBRARIES} X11 pthread dl ) endif() ``` -------------------------------- ### Find libace Library Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Locates the HarmonyOS ACE framework NDK library (ace_ndk.z). This is part of the ArkUI framework for native development. ```cmake find_library( libace-lib ace_ndk.z ) ``` -------------------------------- ### Custom View with Masonry Constraints Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Demonstrates how to integrate Masonry for creating and updating Auto Layout constraints within a custom `UIView` subclass. Requires `requiresConstraintBasedLayout` to be enabled and constraints to be managed in `updateConstraints`. ```objc #import "Masonry.h" @implementation DIYCustomView - (id)init { self = [super init]; if (!self) return nil; // --- Create your views here --- self.button = [[UIButton alloc] init]; return self; } // tell UIKit that you are using AutoLayout + (BOOL)requiresConstraintBasedLayout { return YES; } // this is Apple's recommended place for adding/updating constraints - (void)updateConstraints { // --- remake/update constraints here [self.button remakeConstraints:^(MASConstraintMaker *make) { make.width.equalTo(@(self.buttonSize.width)); make.height.equalTo(@(self.buttonSize.height)); }]; //according to apple super should be called at end of method [super updateConstraints]; } - (void)didTapButton:(UIButton *)button { // --- Do your changes ie change variables that affect your layout etc --- self.buttonSize = CGSize(200, 200); // tell constraints they need updating [self setNeedsUpdateConstraints]; } @end ``` -------------------------------- ### Masonry Constraints with Offsets Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Shows how to create inset constraints using Masonry's DSL, which is more concise than raw NSLayoutConstraints. Masonry automatically adds constraints to the correct view. ```Objective-C UIEdgeInsets padding = UIEdgeInsetsMake(10, 10, 10, 10); [view1 mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(superview.mas_top).with.offset(padding.top); //with is an optional semantic filler make.left.equalTo(superview.mas_left).with.offset(padding.left); make.bottom.equalTo(superview.mas_bottom).with.offset(-padding.bottom); make.right.equalTo(superview.mas_right).with.offset(-padding.right); }]; ``` -------------------------------- ### Creating Executable Target Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Defines the executable target named 'SMBeautyEngine_linux' using the specified source files. ```cmake add_executable(SMBeautyEngine_linux ${SOURCE_FILES}) ``` -------------------------------- ### Defining Third-Party Library Paths Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Sets variables for the include and source directories of third-party libraries like Glad, STB, and GLFW. ```cmake set(THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party") set(GLAD_INCLUDE_DIR "${THIRD_PARTY_DIR}/glad/include") set(GLAD_SOURCE_DIR "${THIRD_PARTY_DIR}/glad/src") set(STB_INCLUDE_DIR "${THIRD_PARTY_DIR}/stb") set(GLFW3_INCLUDE_DIRS "${THIRD_PARTY_DIR}/glfw/include") ``` -------------------------------- ### Primitive and Struct Constraints Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Use primitives and structs for defining constraints with Masonry, supporting autoboxing for convenience. ```objc make.top.mas_equalTo(42); make.height.mas_equalTo(20); make.size.mas_equalTo(CGSizeMake(50, 100)); make.edges.mas_equalTo(UIEdgeInsetsMake(10, 0, 10, 0)); make.left.mas_equalTo(view).mas_offset(UIEdgeInsetsMake(10, 0, 10, 0)); ``` -------------------------------- ### Secure Certificate File Permissions Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Set strict file permissions for SSL certificate and key files to prevent unauthorized access. The private key should have read-only access for the owner. ```bash # Set certificate file permissions chmod 600 certs/key.pem chmod 644 certs/cert.pem # Set data directory permissions chmod 755 data/ chmod 644 data/license_configs.json ``` -------------------------------- ### release Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/doc/api_flutter.md Releases all SDK resources. ```APIDOC ## release ### Description Frees up all resources allocated by the PixelFreeEffects SDK. This method should be called when the SDK is no longer needed to prevent memory leaks. ### Method `Future release()` ### Example ```dart // It is recommended to call this method in the dispose method of your widget or controller. @override void dispose() { pixelfree.release(); super.dispose(); } ``` ``` -------------------------------- ### Import libpixel Shared Library Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Imports an existing shared library 'libpixel' located at a specific path. This is used for linking pre-built native libraries. ```cmake add_library(libpixel SHARED IMPORTED) set_target_properties(libpixel PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/sdk/libs/libpixelfree.so) ``` -------------------------------- ### Find libnapi Library Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Locates the HarmonyOS NAPI (Node API) library (ace_napi.z). This allows interaction between JavaScript and native code. ```cmake find_library( libnapi-lib ace_napi.z ) ``` -------------------------------- ### Checking for Resource Files Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Iterates through the defined resource directory and image file paths, exiting with an error if any are not found. ```cmake foreach(FILE "${RES_DIR}" "${IMAGE_FILE}") if(NOT EXISTS "${FILE}") message(FATAL_ERROR "Required file not found: ${FILE}") endif() endforeach() ``` -------------------------------- ### Verifying Third-Party Directories Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Iterates through defined third-party directory variables and checks if each directory exists. Exits with an error if any are not found. ```cmake foreach(DIR GLAD_INCLUDE_DIR GLAD_SOURCE_DIR STB_INCLUDE_DIR GLFW3_INCLUDE_DIRS) if(NOT EXISTS "${${DIR}}") message(FATAL_ERROR "${DIR} not found at: ${${DIR}}") endif() endforeach() ``` -------------------------------- ### Include Directories Configuration Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Configures the include paths for the C++ compiler. This allows the project to find header files from various directories. ```cmake include_directories( ${NATIVERENDER_ROOT_PATH} ${NATIVERENDER_ROOT_PATH}/include ${NATIVERENDER_ROOT_PATH}/sdk/include ) ``` -------------------------------- ### Tune Kernel Network Parameters for Performance Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Optimize kernel network parameters such as `net.core.somaxconn` and `net.ipv4.tcp_max_syn_backlog` to improve network performance and connection handling under load. ```bash # Optimize kernel parameters echo "net.core.somaxconn = 65535" >> /etc/sysctl.conf echo "net.ipv4.tcp_max_syn_backlog = 65535" >> /etc/sysctl.conf sysctl -p ``` -------------------------------- ### Configure Firewall for Enhanced Security Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Implement a restrictive firewall policy by denying all incoming traffic by default and explicitly allowing only necessary ports like SSH, HTTP, and HTTPS. ```bash # Allow only necessary ports sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw allow ssh sudo ufw allow 80/tcp sudo ufw allow 443/tcp sudo ufw enable ``` -------------------------------- ### MASCompositeConstraints - Size Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Convenience method for setting width and height constraints. Supports size offsets. ```objc // make width and height greater than or equal to titleLabel make.size.greaterThanOrEqualTo(titleLabel) // make width = superview.width + 100, height = superview.height - 50 make.size.equalTo(superview).sizeOffset(CGSizeMake(100, -50)) ``` -------------------------------- ### Apache Configuration for HTTPS Redirect and Proxying Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Set up Apache Virtual Hosts to redirect HTTP requests to HTTPS and forward proxied requests to the API. Configure SSL certificate paths and proxy settings. ```apache ServerName api.example.com Redirect permanent / https://api.example.com/ ServerName api.example.com SSLEngine on SSLCertificateFile /path/to/certs/cert.pem SSLCertificateKeyFile /path/to/certs/key.pem ProxyPreserveHost On ProxyPass / https://localhost:2443/ ProxyPassReverse / https://localhost:2443/ ``` -------------------------------- ### Define Library Directories Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Sets variables for the JNI library path and the library name. These are used later in the configuration. ```cmake set(jnilibs ${CMAKE_SOURCE_DIR}/../jniLibs) set(libname hapiplay) ``` -------------------------------- ### Specify Link Directories Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Lists directories where CMake should search for libraries to link against. This is crucial for finding pre-compiled libraries. ```cmake link_directories( ${jnilibs}/${ANDROID_ABI} ) ``` -------------------------------- ### Custom Function for Resource Copying Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Defines a function 'copy_resources' that uses custom commands to create a 'Res' directory and copy resources and an image file to the build output. ```cmake function(copy_resources) # 创建输出目录 add_custom_command(TARGET SMBeautyEngine_linux POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "$/Res" ) # 复制资源目录 add_custom_command(TARGET SMBeautyEngine_linux POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory "${RES_DIR}" "$/Res" ) # 复制图片文件 add_custom_command(TARGET SMBeautyEngine_linux POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${IMAGE_FILE}" "$" ) endfunction() copy_resources() ``` -------------------------------- ### MASCompositeConstraints - Edges Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Convenience method for setting top, left, bottom, and right constraints simultaneously. Supports insets for offsets. ```objc // make top, left, bottom, right equal view2 make.edges.equalTo(view2); // make top = superview.top + 5, left = superview.left + 10, // bottom = superview.bottom - 15, right = superview.right - 20 make.edges.equalTo(superview).insets(UIEdgeInsetsMake(5, 10, 15, 20)) ``` -------------------------------- ### Linking Libraries to Target Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Links the defined libraries to the 'SMBeautyEngine_linux' executable target. ```cmake target_link_libraries(SMBeautyEngine_linux ${LINK_LIBS}) ``` -------------------------------- ### Link Libraries to 'entry' Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Links various libraries to the 'entry' shared library. This includes graphics libraries, platform libraries, and the imported 'libpixel' library. ```cmake target_link_libraries(entry PUBLIC libpixel) target_link_libraries(entry PUBLIC ${EGL-lib} ${GLES-lib} ${hilog-lib} ${libace-lib} ${libnapi-lib} ${libuv-lib} libbundle_ndk.z.so ${NATIVERENDER_ROOT_PATH}/sdk/libs/libpixelfree.so) ``` -------------------------------- ### Define Third-Party Libraries Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Sets variables to hold lists of third-party libraries required by the project, categorized by their source (e.g., yuv, ffmpeg). ```cmake set(third-party-libs_yuv yuv ) set(third-party-libs_ffmpeg swresample avutil ) ``` -------------------------------- ### Check Domain Name Resolution Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Verify that your domain name is correctly pointing to your server's IP address. This is crucial for API accessibility and SSL certificate validation. ```bash # Check domain resolution nslookup api.example.com dig api.example.com # Should return your server IP ``` -------------------------------- ### Optimize System File Descriptor Limits Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Increase the maximum number of open file descriptors for all users to handle a high volume of connections. This is done by modifying the system's limits configuration. ```bash # Increase file descriptor limits echo "* soft nofile 65536" >> /etc/security/limits.conf echo "* hard nofile 65536" >> /etc/security/limits.conf ``` -------------------------------- ### Appending Project and Third-Party Libraries Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Appends the GLFW library and a custom PixelFree library to the list of libraries to be linked. ```cmake list(APPEND LINK_LIBS glfw) list(APPEND LINK_LIBS "${CMAKE_CURRENT_SOURCE_DIR}/pixelfreeLib/libPixelFree.so") ``` -------------------------------- ### Check SMBeauty API Service Status and Logs Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Monitor the running status of the SMBeauty API service and view its logs. This is essential for diagnosing issues and ensuring the API is operational. ```bash # Check service status docker ps | grep smbeauty-api # Or systemctl status smbeauty-api # View logs docker logs -f smbeauty-api # Or tail -f logs/app.log ``` -------------------------------- ### Find libuv Library Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Locates the libuv library, a multi-platform support library with a focus on asynchronous I/O. Often used for networking and event loops. ```cmake find_library( libuv-lib uv ) ``` -------------------------------- ### Referencing and Uninstalling Constraints Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Hold a reference to a constraint to uninstall it later. This is useful for dynamically managing layout elements. ```obj-c // in public/private interface @property (nonatomic, strong) MASConstraint *topConstraint; ... // when making constraints [view1 mas_makeConstraints:^(MASConstraintMaker *make) { self.topConstraint = make.top.equalTo(superview.mas_top).with.offset(padding.top); make.left.equalTo(superview.mas_left).with.offset(padding.left); }]; ... // then later you can call [self.topConstraint uninstall]; ``` -------------------------------- ### Glob Source Files Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Uses the 'file(GLOB ...)' command to find all C++ source files in the specified directories. This simplifies adding new source files. ```cmake file(GLOB src-files ${CMAKE_SOURCE_DIR}/*.cpp ${CMAKE_SOURCE_DIR}/render/*.cpp ${CMAKE_SOURCE_DIR}/common/*.cpp ${CMAKE_SOURCE_DIR}/util/*.cpp ) ``` -------------------------------- ### Specify Include Directories Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Lists directories that contain header files. CMake will search these directories for header files during compilation. ```cmake include_directories( include glm include/libyuv render common util ) ``` -------------------------------- ### Masonry Constraint Creation Snippet Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md A code snippet for creating new constraints using Masonry. Typically used within `updateConstraints`. ```objc [<#view#> mas_makeConstraints:^(MASConstraintMaker *make) { <#code#> }]; ``` -------------------------------- ### Find hilog Library Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Locates the HarmonyOS logging library (hilog_ndk.z). This is used for system-level logging. ```cmake find_library( hilog-lib hilog_ndk.z ) ``` -------------------------------- ### Restore Data from Backup Archive Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Restore your production data by extracting a previously created backup archive. This process involves decompressing the tarball and copying the contents back to the appropriate locations. ```bash # Restore from backup tar -xzf backup_20241201.tar.gz cp -r backup_20241201/* ./ ``` -------------------------------- ### Masonry Constraints with Insets Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md A more concise way to create inset constraints using Masonry's `edges.insets` property. This simplifies the code further for common inset scenarios. ```Objective-C [view1 mas_makeConstraints:^(MASConstraintMaker *make) { make.edges.equalTo(superview).with.insets(padding); }]; ``` -------------------------------- ### Add Platform Definition Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Adds a preprocessor definition '-DOHOS_PLATFORM' to the build. This is used to conditionally compile code specific to the HarmonyOS platform. ```cmake add_definitions(-DOHOS_PLATFORM) ``` -------------------------------- ### Define Native System Libraries Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Sets a variable containing a list of essential native system libraries provided by the Android NDK and standard C libraries. ```cmake set(native-libs android EGL GLESv3 OpenSLES log m z ) ``` -------------------------------- ### MASCompositeConstraints - Center Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Convenience method for setting centerX and centerY constraints. Supports center offsets. ```objc // make centerX and centerY = button1 make.center.equalTo(button1) // make centerX = superview.centerX - 5, centerY = superview.centerY + 10 make.center.equalTo(superview).centerOffset(CGPointMake(-5, 10)) ``` -------------------------------- ### Set Native Render Root Path Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Defines a variable for the root path of the native render components. This is typically the current source directory. ```cmake set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) ``` -------------------------------- ### Manually Renew Certificate and Restart Service Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Execute the certificate renewal script manually and then restart the SMBeauty API service to apply the renewed certificate. This is useful for immediate updates or troubleshooting. ```bash # Manually renew certificate ./renew_cert.sh # Restart service docker restart smbeauty-api # Or sudo systemctl restart smbeauty-api ``` -------------------------------- ### Add Shared Library 'entry' Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Defines the main shared library 'entry' for the application. It lists all the C++ source files that will be compiled into this library. ```cmake add_library(entry SHARED render/GLProgram.cpp render/GLRenderNV21.cpp render/GLRenderYUYV.cpp render/GLRenderYUV.cpp render/GLRenderRGBA.cpp render/GLOffScreenRender.cpp render/GLBaseModel.cpp render/GLDrawPoints.cpp render/GLCore.cpp render/GLRender.cpp manager/GLManager.cpp sdk/manager/CommonInterface.cpp sdk/manager/PixfreeManager.cpp log/ohos_log.cpp Index.cpp) ``` -------------------------------- ### Finding OpenGL Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_linux/CMakeLists.txt Finds the OpenGL package and checks if it was found. Exits with an error if OpenGL is not found. ```cmake find_package(OpenGL REQUIRED) if(NOT OPENGL_FOUND) message(FATAL_ERROR "OpenGL not found") endif() ``` -------------------------------- ### Link Libraries to Target Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Links the main library target to various other libraries, including system libraries, third-party libraries, and the log library. This ensures all dependencies are resolved. ```cmake target_link_libraries( # Specifies the target library. ${libname} ${native-libs} ${third-party-libs_ffmpeg} ${third-party-libs_yuv} # Links the target library to the log library # included in the NDK. ${log-lib}) ``` -------------------------------- ### Define Project Name Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Sets the name of the project to 'EffectsHarmony'. This is used by CMake for internal referencing. ```cmake project(EffectsHarmony) ``` -------------------------------- ### Schedule Automatic Certificate Renewal with Cron Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Configure a cron job to automatically run a certificate renewal script daily. This ensures your SSL certificate remains valid without manual intervention. ```bash # Edit crontab crontab -e # Add the following line (checks for renewal at 12 PM daily) 0 12 * * * /path/to/project/renew_cert.sh ``` -------------------------------- ### Set Minimum CMake Version Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Specifies the minimum version of CMake required to build the native library. Ensure this version meets the project's requirements. ```cmake cmake_minimum_required(VERSION 3.18.1) ``` -------------------------------- ### processWithBuffer Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/doc/api_flutter.md Processes image data from a buffer. The input data is modified in place with the processed data. ```APIDOC ## processWithBuffer ### Description Processes image data provided in a buffer. This method supports various image formats including RGBA, texture, and YUV. The input data buffer is overwritten with the processed results. ### Method Asynchronous method call (details depend on SDK implementation, likely `await pixelfree.processWithBuffer(imageInput)`). ### Parameters - **imageInput** (PFIamgeInput) - Required - An object containing image data, dimensions, format, and rotation mode. - `width` (int) - Required - Width of the image. - `height` (int) - Required - Height of the image. - `pData0` (Uint8List?) - Optional - Primary image data buffer (e.g., RGBA data, Y data). - `pData1` (Uint8List?) - Optional - Secondary image data buffer (e.g., UV data). - `pData2` (Uint8List?) - Optional - Tertiary image data buffer. - `stride0` (int) - Required - Stride for the first data buffer. - `stride1` (int) - Optional - Stride for the second data buffer. - `stride2` (int) - Optional - Stride for the third data buffer. - `format` (PFDetectFormat) - Required - The format of the image data (e.g., `PFDetectFormat.rgba`, `PFDetectFormat.texture`, `PFDetectFormat.yuvNv21`). - `rotationMode` (PFRotationMode) - Optional - The rotation mode to apply (e.g., `PFRotationMode.rotation90`). - `textureID` (int) - Optional - OpenGL texture ID (used in texture format). ### Return Value This method modifies the `imageInput` object in place. The processed data is available through: - `imageInput.pData0`: Processed primary data. - `imageInput.pData1`: Processed secondary data (if applicable). - `imageInput.textureID`: Processed OpenGL texture ID (if using texture format). ``` -------------------------------- ### Process Image to ByteData Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_flutter/pixelfree/README.md Process raw image data (Uint8List) and convert it into ByteData format. Requires image data, width, and height. ```dart // Process image and get byte data final byteData = await pixelfree.processWithImageToByteData( imageData, // Uint8List width, height, ); ``` -------------------------------- ### Masonry Constraint Remake Snippet Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md A code snippet for removing all existing constraints and creating new ones using Masonry. Use when the layout structure changes significantly. ```objc [<#view#> mas_remakeConstraints:^(MASConstraintMaker *make) { <#code#> }]; ``` -------------------------------- ### Set Beauty Filter Parameters Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_flutter/pixelfree/README.md Configure specific beauty filters like face thinning or eye enlargement. Values typically range from 0.0 to 1.0. ```dart // Set beauty filter parameters await pixelfree.pixelFreeSetBeautyFilterParam( PFBeautyFiterType.faceThinning, // Filter type 0.5, // Value (0.0 to 1.0) ); // Set beauty type parameter await pixelfree.pixelFreeSetBeautyTypeParam( PFBeautyFiterType.typeOneKey, // Beauty type 1, // Value ); ``` -------------------------------- ### Find EGL Library Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Locates the EGL (Embedded-System Graphics Library) native library. This is essential for graphics rendering contexts. ```cmake find_library( EGL-lib EGL ) ``` -------------------------------- ### Priority Constraints Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Set constraint priorities using `.priorityLow`, `.priorityMedium`, `.priorityHigh`, or a specific numeric value. ```objc make.left.greaterThanOrEqualTo(label.mas_left).with.priorityLow(); make.top.equalTo(label.mas_top).with.priority(600); ``` -------------------------------- ### Masonry Constraint Update Snippet Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md A code snippet for updating existing constraints using Masonry. Use when only a subset of constraints need to change. ```objc [<#view#> mas_updateConstraints:^(MASConstraintMaker *make) { <#code#> }]; ``` -------------------------------- ### GLM CMakeLists Source Grouping Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/glm/CMakeLists.txt Organizes the discovered files into logical groups within the CMake build system, such as 'Text Files', 'Core Files', 'GTC Files', and 'GTX Files'. This improves project navigation in IDEs. ```cmake source_group("Text Files" FILES ${ROOT_TEXT}) source_group("Core Files" FILES ${CORE_SOURCE}) source_group("Core Files" FILES ${CORE_INLINE}) source_group("Core Files" FILES ${CORE_HEADER}) source_group("GTC Files" FILES ${GTC_SOURCE}) source_group("GTC Files" FILES ${GTC_INLINE}) source_group("GTC Files" FILES ${GTC_HEADER}) source_group("GTX Files" FILES ${GTX_SOURCE}) source_group("GTX Files" FILES ${GTX_INLINE}) source_group("GTX Files" FILES ${GTX_HEADER}) ``` -------------------------------- ### Set Minimum CMake Version Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Specifies the minimum required version of CMake for this project. This ensures compatibility with the build tools. ```cmake cmake_minimum_required(VERSION 3.4.1) ``` -------------------------------- ### Manage HLS Filters Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_flutter/pixelfree/README.md Add, modify, or delete HLS (Hue, Lightness, Saturation) filters using a unique handle. Requires specifying key color and filter adjustments. ```dart // Add HLS filter final hlsParams = PFHLSFilterParams( keyColor: [1.0, 0.0, 0.0], // RGB values (0-1) hue: 0.0, // Hue adjustment saturation: 1.0, // Saturation (0-1) brightness: 0.0, // Brightness (0-1) similarity: 0.0, // Similarity threshold ); final handle = await pixelfree.pixelFreeAddHLSFilter(hlsParams); // Change HLS filter await pixelfree.pixelFreeChangeHLSFilter(handle, hlsParams); // Delete HLS filter await pixelfree.pixelFreeDeleteHLSFilter(handle); ``` -------------------------------- ### Declare Project Name Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/CMakeLists.txt Declares and names the project. This name is used throughout the CMake build system. ```cmake project("hapiplay") ``` -------------------------------- ### processWithImage Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/doc/api_flutter.md Processes raw image data and returns the ID of the processed OpenGL texture. ```APIDOC ## processWithImage ### Description Processes raw image data (RGBA format) and returns an OpenGL texture ID representing the processed image. This is suitable for direct use in OpenGL rendering pipelines. ### Method `Future processWithImage(Uint8List imageData, int w, int h)` ### Parameters - **imageData** (Uint8List) - Required - The raw image data in RGBA format. - **w** (int) - Required - The width of the image. - **h** (int) - Required - The height of the image. ### Return Value - `Future`: A future that resolves to the OpenGL texture ID of the processed image. ``` -------------------------------- ### processWithImageToByteData Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/doc/api_flutter.md Processes image data and returns the result as ByteData. ```APIDOC ## processWithImageToByteData ### Description Processes raw image data and returns the processed result as `ByteData`. This is useful for saving the image or displaying it in contexts that accept `ByteData`. ### Method `Future processWithImageToByteData(Uint8List imageData, int width, int height)` ### Parameters - **imageData** (Uint8List) - Required - The raw image data. - **width** (int) - Required - The width of the image. - **height** (int) - Required - The height of the image. ### Return Value - `Future`: A future that resolves to the `ByteData` of the processed image, or null if processing fails. ``` -------------------------------- ### Nginx Configuration for HTTPS Redirect and Proxying Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Configure Nginx to redirect HTTP traffic to HTTPS and proxy requests to the API running on a specific port. Ensure SSL certificate paths are correctly set. ```nginx server { listen 80; server_name api.example.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; server_name api.example.com; ssl_certificate /path/to/certs/cert.pem; ssl_certificate_key /path/to/certs/key.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384; ssl_prefer_server_ciphers off; location / { proxy_pass https://localhost:2443; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } ``` -------------------------------- ### Masonry Enhanced Constraint Debugging Output Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Masonry overrides `description` for `NSLayoutConstraint` to provide more meaningful names for views and constraints in console output, aiding in debugging constraint conflicts. ```obj-c Unable to simultaneously satisfy constraints......blah blah blah.... ( "", "= 5000>", "", "" ) Will attempt to recover by breaking constraint = 5000> ``` -------------------------------- ### Chained View Attributes Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_iOS/Pods/Masonry/README.md Chain multiple view attributes for improved readability when defining constraints. ```objc // All edges but the top should equal those of the superview make.left.right.and.bottom.equalTo(superview); make.top.equalTo(otherView); ``` -------------------------------- ### Process Image to ByteData Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/doc/api_flutter.md Processes RGBA image data and returns the result as ByteData. This is useful for saving the processed image or displaying it elsewhere. ```dart Future processWithImageToByteData(Uint8List imageData, int width, int height) ``` -------------------------------- ### GLM CMakeLists Conditional Executable for Testing Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_andriod/pixelfree_android_demo/hapiAVRender/src/main/cpp/glm/CMakeLists.txt Conditionally adds an executable target named 'glm_dummy' if the 'GLM_TEST_ENABLE' variable is set. This executable includes all discovered source, inline, header, text, and natvis files, typically used for running tests. ```cmake if(GLM_TEST_ENABLE) add_executable(${NAME} ${ROOT_TEXT} ${ROOT_NAT} ${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER} ${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER} ${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER} ${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER}) endif(GLM_TEST_ENABLE) ``` -------------------------------- ### Find GLESv3 Library Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_harmonyOS/entry/src/main/cpp/CMakeLists.txt Locates the OpenGL ES 3.0 (GLESv3) native library. This is used for 3D graphics rendering. ```cmake find_library( GLES-lib GLESv3 ) ``` -------------------------------- ### Check API Health and Certificate Validity Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMUpdateService/PRODUCTION_DEPLOYMENT.md Perform health checks on the API endpoint and inspect the details of the SSL certificate. This helps verify the API is responding correctly and the certificate is valid. ```bash # Check API health status curl https://api.example.com/health # Check certificate status openssl x509 -in certs/cert.pem -text -noout | grep -A 2 "Validity" ``` -------------------------------- ### Apply Color Grading Source: https://github.com/uu-code007/pixelfreeeffects/blob/master/SMBeautyEngine_flutter/pixelfree/README.md Adjust image color properties such as brightness, contrast, saturation, and temperature using the PFImageColorGrading parameters. ```dart final params = PFImageColorGrading( isUse: true, // Enable color grading brightness: 0.1, // -1.0 to 1.0 contrast: 1.2, // 0.0 to 4.0 exposure: 0.5, // -10.0 to 10.0 highlights: 0.3, // 0.0 to 1.0 shadows: 0.2, // 0.0 to 1.0 saturation: 1.1, // 0.0 to 2.0 temperature: 5500.0, // Color temperature in Kelvin tint: 0.1, // Tint adjustment hue: 180.0, // 0-360 degrees ); final result = await pixelfree.pixelFreeSetColorGrading(params); ```