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/** 17 * @file 18 * @kit AbilityKit 19 */ 20 21import ExtensionContext from './ExtensionContext'; 22import type { AbilityResult } from '../ability/abilityResult'; 23import image from '../@ohos.multimedia.image'; 24 25/** 26 * The context of Photo Editor extension. It allows access to PhotoEditorExtension-specific resources. 27 * 28 * @extends ExtensionContext 29 * @syscap SystemCapability.Ability.AppExtension.PhotoEditorExtension 30 * @StageModelOnly 31 * @since 12 32 */ 33export default class PhotoEditorExtensionContext extends ExtensionContext { 34 /** 35 * Save image data by uri. 36 * 37 * @param { string } uri Image editing URI. 38 * @returns { Promise<AbilityResult> } Returns the result of save. 39 * @throws { BusinessError } 401 - Params error. Possible causes: 1.Mandatory parameters are left unspecified. 40 * <br>2.Incorrect parameter types. 41 * @throws { BusinessError } 29600001 - Internal error. 42 * @throws { BusinessError } 29600002 - Image input error. 43 * @throws { BusinessError } 29600003 - Image too big. 44 * @syscap SystemCapability.Ability.AppExtension.PhotoEditorExtension 45 * @since 12 46 */ 47 saveEditedContentWithUri(uri: string): Promise<AbilityResult>; 48 49 /** 50 * Save image data by image pixmap. 51 * 52 * @param { image.PixelMap } pixeMap Image pixmap. 53 * @param { image.PackingOption } option Option for image packing. 54 * @returns { Promise<AbilityResult> } Returns the result of save. 55 * @throws { BusinessError } 401 - Params error. Possible causes: 1.Mandatory parameters are left unspecified. 56 * <br>2.Incorrect parameter types. 57 * @throws { BusinessError } 29600001 - Internal error. 58 * @throws { BusinessError } 29600002 - Image input error. 59 * @throws { BusinessError } 29600003 - Image too big. 60 * @syscap SystemCapability.Ability.AppExtension.PhotoEditorExtension 61 * @since 12 62 */ 63 saveEditedContentWithImage(pixeMap: image.PixelMap, option: image.PackingOption): Promise<AbilityResult>; 64}