1 /* 2 * Copyright (c) 2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CJ_EFFECT_KIT_FFI_H 17 #define CJ_EFFECT_KIT_FFI_H 18 19 #include <vector> 20 21 #include "cj_common_ffi.h" 22 23 extern "C" { 24 struct CArrFloat { 25 float* head; 26 int64_t size; 27 }; 28 29 struct CJColor { 30 int r; 31 int g; 32 int b; 33 int a; 34 }; 35 36 struct CArrCJColor { 37 CJColor* head; 38 int64_t size; 39 }; 40 41 struct CArrDouble { 42 double* head; 43 int64_t size; 44 }; 45 46 FFI_EXPORT int64_t FfiEffectKitCreateEffect(int64_t sourceId, uint32_t* errorCode); 47 FFI_EXPORT void FfiEffectKitBlur(int64_t id, float radius); 48 FFI_EXPORT void FfiEffectKitInvert(int64_t id); 49 FFI_EXPORT void FfiEffectKitBrightness(int64_t id, float bright); 50 FFI_EXPORT void FfiEffectKitGrayscale(int64_t id); 51 FFI_EXPORT void FfiEffectKitSetColorMatrix(int64_t id, CArrFloat cjColorMatrix, uint32_t* errorCode); 52 FFI_EXPORT int64_t FfiEffectKitGetEffectPixelMap(); 53 FFI_EXPORT int64_t FfiEffectKitCreateColorPicker(int64_t sourceId, uint32_t* errorCode); 54 FFI_EXPORT int64_t FfiEffectKitCreateColorPickerRegion(int64_t sourceId, CArrDouble region, uint32_t* errorCode); 55 FFI_EXPORT CJColor FfiEffectKitGetMainColor(uint32_t* errorCode); 56 FFI_EXPORT CJColor FfiEffectKitGetLargestProportionColor(uint32_t* errorCode); 57 FFI_EXPORT CJColor FfiEffectKitGetHighestSaturationColor(uint32_t* errorCode); 58 FFI_EXPORT CJColor FfiEffectKitGetAverageColor(uint32_t* errorCode); 59 FFI_EXPORT bool FfiEffectKitIsBlackOrWhiteOrGrayColor(uint32_t color, uint32_t* errorCode); 60 FFI_EXPORT CArrCJColor FfiEffectKitGetTopProportionColors(double colorCount, uint32_t* errorCode); 61 } 62 63 #endif