• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_PIXEL_MAP_NAPI_KITS_H_
17 #define FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_PIXEL_MAP_NAPI_KITS_H_
18 
19 #include "common_utils.h"
20 #include "pixel_map.h"
21 #include "pixel_map_napi.h"
22 #include "image_pixel_map_mdk.h"
23 
24 namespace OHOS {
25 namespace Media {
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 struct PixelMapNapiArgs {
30     OhosPixelMapCreateOps createOptions;
31     void* inBuffer;
32     size_t bufferLen;
33     napi_value inValue;
34     int32_t inNum0;
35     int32_t inNum1;
36     int32_t inNum2;
37     int32_t inNum3;
38     float inFloat0;
39     float inFloat1;
40     napi_value* outValue;
41     int32_t* outNum;
42     OhosPixelMapInfos *outInfo;
43     void** outAddr;
44 };
45 
46 using PixelMapNapiArgs = struct PixelMapNapiArgs;
47 enum {
48     ENV_FUNC_CREATE,
49     ENV_FUNC_CREATE_ALPHA,
50     CTX_FUNC_GET_ROW_BYTES,
51     CTX_FUNC_IS_EDITABLE,
52     CTX_FUNC_IS_SUPPORT_ALPHA,
53     CTX_FUNC_GET_DENSITY,
54     CTX_FUNC_SET_ALPHAABLE,
55     CTX_FUNC_SET_DENSITY,
56     CTX_FUNC_SET_OPACITY,
57     CTX_FUNC_SCALE,
58     CTX_FUNC_TRANSLATE,
59     CTX_FUNC_ROTATE,
60     CTX_FUNC_FLIP,
61     CTX_FUNC_CROP,
62     CTX_FUNC_GET_IMAGE_INFO,
63     CTX_FUNC_ACCESS_PIXELS,
64     CTX_FUNC_UNACCESS_PIXELS,
65 };
66 
67 PixelMapNapi* PixelMapNapi_Unwrap(napi_env env, napi_value value);
68 int32_t PixelMapNapiNativeEnvCall(int32_t mode, napi_env env, PixelMapNapiArgs* args);
69 int32_t PixelMapNapiNativeCtxCall(int32_t mode, PixelMapNapi* native, PixelMapNapiArgs* args);
70 #ifdef __cplusplus
71 };
72 #endif
73 } // namespace Media
74 } // namespace OHOS
75 
76 #endif // FRAMEWORKS_KITS_JS_COMMON_INCLUDE_IMAGE_PIXEL_MAP_NAPI_KITS_H_
77