source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function WriteBufferToPixels() { const color: ArrayBuffer = new ArrayBuffer(96); // 96 is the size of the pixel buffer to create. The value is calculated as follows: height * width *4. let bufferArr: Uint8Array = new Uint8Array(color); for (let i = 0; ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function WriteBufferToPixels() { const color: ArrayBuffer = new ArrayBuffer(96); // 96 is the size of the pixel buffer to create. The value is calculated as follows: height * width *4. let bufferArr: Uint8Array = new Uint8Array(color); for (let i = 0; ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function WriteBufferToPixelsSync() { const color : ArrayBuffer = new ArrayBuffer(96); // 96 is the size of the pixel buffer to create. The value is calculated as follows: height * width *4. let bufferArr : Uint8Array = new Uint8Array(color); for (let ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function GetImageInfo() { if (pixelMap != undefined) { pixelMap.getImageInfo().then((imageInfo: image.ImageInfo) => { if (imageInfo != undefined) { console.info("Succeeded in obtaining the image pixel map information."+ imageInfo.size.hei...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function GetImageInfo() { if (pixelMap != undefined) { pixelMap.getImageInfo((error: BusinessError, imageInfo: image.ImageInfo) => { if (error) { console.error(`Failed to obtain the image pixel map information. code is ${error.code}, mess...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function GetImageInfoSync() { if (pixelMap != undefined) { let imageInfo : image.ImageInfo = pixelMap.getImageInfoSync(); return imageInfo; } return undefined; }
application-dev\reference\apis-image-kit\js-apis-image.md
let rowCount: number = pixelMap.getBytesNumberPerRow();
application-dev\reference\apis-image-kit\js-apis-image.md
let pixelBytesNumber: number = pixelMap.getPixelBytesNumber();
application-dev\reference\apis-image-kit\js-apis-image.md
let getDensity: number = pixelMap.getDensity();
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Opacity() { let rate: number = 0.5; if (pixelMap != undefined) { pixelMap.opacity(rate, (err: BusinessError) => { if (err) { console.error(`Failed to set opacity. code is ${err.code}, message is ${err.message}`); return...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Opacity() { let rate: number = 0.5; if (pixelMap != undefined) { pixelMap.opacity(rate).then(() => { console.info('Succeeded in setting opacity.'); }).catch((err: BusinessError) => { console.error(`Failed to set opacity. code...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function OpacitySync() { let rate : number = 0.5; if (pixelMap != undefined) { pixelMap.opacitySync(rate); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function CreateAlphaPixelmap() { if (pixelMap != undefined) { pixelMap.createAlphaPixelmap().then((alphaPixelMap: image.PixelMap) => { console.info('Succeeded in creating alpha pixelmap.'); }).catch((error: BusinessError) => { console.e...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function CreateAlphaPixelmap() { if (pixelMap != undefined) { pixelMap.createAlphaPixelmap((err: BusinessError, alphaPixelMap: image.PixelMap) => { if (alphaPixelMap == undefined) { console.error(`Failed to obtain new pixel map. code is $...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function CreateAlphaPixelmapSync() { if (pixelMap != undefined) { let pixelmap : image.PixelMap = pixelMap.createAlphaPixelmapSync(); return pixelmap; } return undefined; }
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Scale() { let scaleX: number = 2.0; let scaleY: number = 1.0; if (pixelMap != undefined) { pixelMap.scale(scaleX, scaleY, (err: BusinessError) => { if (err) { console.error(`Failed to scale pixelmap. code is ${err.code}, mess...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Scale() { let scaleX: number = 2.0; let scaleY: number = 1.0; if (pixelMap != undefined) { pixelMap.scale(scaleX, scaleY).then(() => { console.info('Succeeded in scaling pixelmap.'); }).catch((err: BusinessError) => { conso...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function ScaleSync() { let scaleX: number = 2.0; let scaleY: number = 1.0; if (pixelMap != undefined) { pixelMap.scaleSync(scaleX, scaleY); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Scale() { let scaleX: number = 2.0; let scaleY: number = 1.0; if (pixelMap != undefined) { pixelMap.scale(scaleX, scaleY, image.AntiAliasingLevel.LOW).then(() => { console.info('Succeeded in scaling pixelmap.'); }).catch((err: Bu...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function ScaleSync() { let scaleX: number = 2.0; let scaleY: number = 1.0; if (pixelMap != undefined) { pixelMap.scaleSync(scaleX, scaleY, image.AntiAliasingLevel.LOW); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function CreateScaledPixelMap() { let scaleX: number = 2.0; let scaleY: number = 1.0; if (pixelMap != undefined) { pixelMap.createScaledPixelMap(scaleX, scaleY, image.AntiAliasingLevel.LOW).then((scaledPixelMap: image.PixelMap) => { console...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function CreateScaledPixelMapSync() { let scaleX: number = 2.0; let scaleY: number = 1.0; if (pixelMap != undefined) { let scaledPixelMap = pixelMap.createScaledPixelMapSync(scaleX, scaleY, image.AntiAliasingLevel.LOW); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Demo() { if (pixelMap != undefined) { pixelMap.clone().then((clonePixelMap: image.PixelMap) => { console.info('Succeeded clone pixelmap.'); }).catch((error: BusinessError) => { console.error(`Failed to clone pixelmap. code is $...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Demo(pixelMap: image.PixelMap) { if (pixelMap != undefined) { try { let clonedPixelMap = pixelMap.cloneSync(); } catch(e) { let error = e as BusinessError; console.error(`clone pixelmap error. code is ${error.code}, messa...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Translate() { let translateX: number = 50.0; let translateY: number = 10.0; if (pixelMap != undefined) { pixelMap.translate(translateX, translateY, (err: BusinessError) => { if (err) { console.error(`Failed to translate pixel...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Translate() { let translateX: number = 50.0; let translateY: number = 10.0; if (pixelMap != undefined) { pixelMap.translate(translateX, translateY).then(() => { console.info('Succeeded in translating pixelmap.'); }).catch((err: B...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function TranslateSync() { let translateX : number = 50.0; let translateY : number = 10.0; if (pixelMap != undefined) { pixelMap.translateSync(translateX, translateY); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Rotate() { let angle: number = 90.0; if (pixelMap != undefined) { pixelMap.rotate(angle, (err: BusinessError) => { if (err) { console.error(`Failed to rotate pixelmap. code is ${err.code}, message is ${err.message}`); r...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Rotate() { let angle: number = 90.0; if (pixelMap != undefined) { pixelMap.rotate(angle).then(() => { console.info('Succeeded in rotating pixelmap.'); }).catch((err: BusinessError) => { console.error(`Failed to rotate pixelma...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function RotateSync() { let angle : number = 90.0; if (pixelMap != undefined) { pixelMap.rotateSync(angle); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Flip() { let horizontal: boolean = true; let vertical: boolean = false; if (pixelMap != undefined) { pixelMap.flip(horizontal, vertical, (err: BusinessError) => { if (err) { console.error(`Failed to flip pixelmap. code is ${e...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Flip() { let horizontal: boolean = true; let vertical: boolean = false; if (pixelMap != undefined) { pixelMap.flip(horizontal, vertical).then(() => { console.info('Succeeded in flipping pixelmap.'); }).catch((err: BusinessError) ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function FlipSync() { let horizontal : boolean = true; let vertical : boolean = false; if (pixelMap != undefined) { pixelMap.flipSync(horizontal, vertical); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Crop() { let region: image.Region = { x: 0, y: 0, size: { height: 100, width: 100 } }; if (pixelMap != undefined) { pixelMap.crop(region, (err: BusinessError) => { if (err) { console.error(`Failed to crop pixelmap. code is ${er...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Crop() { let region: image.Region = { x: 0, y: 0, size: { height: 100, width: 100 } }; if (pixelMap != undefined) { pixelMap.crop(region).then(() => { console.info('Succeeded in cropping pixelmap.'); }).catch((err: BusinessError) =...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function CropSync() { let region : image.Region = { x: 0, y: 0, size: { height: 100, width: 100 } }; if (pixelMap != undefined) { pixelMap.cropSync(region); } }
application-dev\reference\apis-image-kit\js-apis-image.md
async function GetColorSpace() { if (pixelMap != undefined) { let csm = pixelMap.getColorSpace(); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { colorSpaceManager } from '@kit.ArkGraphics2D'; async function SetColorSpace() { let colorSpaceName = colorSpaceManager.ColorSpace.SRGB; let csm: colorSpaceManager.ColorSpaceManager = colorSpaceManager.create(colorSpaceName); if (pixelMap != undefined) { pixelMap.setColorSpace(csm); } }
application-dev\reference\apis-image-kit\js-apis-image.md
import { colorSpaceManager } from '@kit.ArkGraphics2D'; import { BusinessError } from '@kit.BasicServicesKit'; async function ApplyColorSpace() { let colorSpaceName = colorSpaceManager.ColorSpace.SRGB; let targetColorSpace: colorSpaceManager.ColorSpaceManager = colorSpaceManager.create(colorSpaceName); if (pixel...
application-dev\reference\apis-image-kit\js-apis-image.md
import { colorSpaceManager } from '@kit.ArkGraphics2D'; import { BusinessError } from '@kit.BasicServicesKit'; async function ApplyColorSpace() { let colorSpaceName = colorSpaceManager.ColorSpace.SRGB; let targetColorSpace: colorSpaceManager.ColorSpaceManager = colorSpaceManager.create(colorSpaceName); if (pixel...
application-dev\reference\apis-image-kit\js-apis-image.md
import image from '@ohos.multimedia.image'; import resourceManager from '@ohos.resourceManager'; import { BusinessError } from '@kit.BasicServicesKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext(...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; import image from '@ohos.multimedia.image'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // Rep...
application-dev\reference\apis-image-kit\js-apis-image.md
import image from '@ohos.multimedia.image'; import { BusinessError } from '@kit.BasicServicesKit'; let staticMetadata: image.HdrStaticMetadata = { displayPrimariesX: [1.1, 1.1, 1.1], displayPrimariesY: [1.2, 1.2, 1.2], whitePointX: 1.1, whitePointY: 1.2, maxLuminance: 2.1, minLuminance: 1.0, maxContentLi...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; import image from '@ohos.multimedia.image'; import taskpool from '@ohos.taskpool'; @Concurrent // Child thread method. async function loadPixelMap(rawFileDescriptor: number): Promise<PixelMap> { // Create an ImageSource instance. const imageSource = image.crea...
application-dev\reference\apis-image-kit\js-apis-image.md
import { image } from '@kit.ImageKit'; import { rpc } from '@kit.IPCKit'; class MySequence implements rpc.Parcelable { pixel_map: image.PixelMap; constructor(conPixelMap : image.PixelMap) { this.pixel_map = conPixelMap; } marshalling(messageSequence : rpc.MessageSequence) { this.pixel_map.marshalling(m...
application-dev\reference\apis-image-kit\js-apis-image.md
import { image } from '@kit.ImageKit'; import { rpc } from '@kit.IPCKit'; class MySequence implements rpc.Parcelable { pixel_map: image.PixelMap; constructor(conPixelMap: image.PixelMap) { this.pixel_map = conPixelMap; } marshalling(messageSequence: rpc.MessageSequence) { this.pixel_map.marshalling(mes...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Release() { if (pixelMap != undefined) { pixelMap.release().then(() => { console.info('Succeeded in releasing pixelmap object.'); }).catch((error: BusinessError) => { console.error(`Failed to release pixelmap object. code is ${...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; async function Release() { if (pixelMap != undefined) { pixelMap.release((err: BusinessError) => { if (err) { console.error(`Failed to release pixelmap object. code is ${err.code}, message is ${err.message}`); return; } else { ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; if (pixelMap != undefined) { // Set the target pixel format to NV12. let targetPixelFormat = image.PixelMapFormat.NV12; pixelMap.convertPixelFormat(targetPixelFormat).then(() => { // The pixelMap is converted to the NV12 format. console.info('PixelMa...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@ohos.base'; async function SetMemoryNameSync() { if (pixelMap != undefined) { try { pixelMap.setMemoryNameSync("PixelMapName Test"); } catch(e) { let error = e as BusinessError; console.error(`setMemoryNameSync error. code is ${error.code}, message is ${error...
application-dev\reference\apis-image-kit\js-apis-image.md
// Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with the actual one in use. Otherwise, the imageSource instan...
application-dev\reference\apis-image-kit\js-apis-image.md
let sourceOptions: image.SourceOptions = { sourceDensity: 120 }; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.png' is only an example. Replace...
application-dev\reference\apis-image-kit\js-apis-image.md
import { fileIo as fs } from '@kit.CoreFileKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with the ac...
application-dev\reference\apis-image-kit\js-apis-image.md
import { fileIo as fs } from '@kit.CoreFileKit'; let sourceOptions: image.SourceOptions = { sourceDensity: 120 }; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbility...
application-dev\reference\apis-image-kit\js-apis-image.md
const buf: ArrayBuffer = new ArrayBuffer(96); // 96 is the size of the pixel buffer to create. The value is calculated as follows: height * width *4. const imageSourceApi: image.ImageSource = image.createImageSource(buf);
application-dev\reference\apis-image-kit\js-apis-image.md
const data: ArrayBuffer = new ArrayBuffer(112); let sourceOptions: image.SourceOptions = { sourceDensity: 120 }; const imageSourceApi: image.ImageSource = image.createImageSource(data, sourceOptions);
application-dev\reference\apis-image-kit\js-apis-image.md
import { resourceManager } from '@kit.LocalizationKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // Obtain a resource manager. const resourceMgr: ...
application-dev\reference\apis-image-kit\js-apis-image.md
// Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let imageArray = context.resourceManager.getMediaContentSync($r('app.media.startIcon')); // Obtain the ima...
application-dev\reference\apis-image-kit\js-apis-image.md
// Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; let imageArray = context.resourceManager.getMediaContentSync($r('app.media.startIcon')) // Obtain the imag...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getImageInfo(0, (error: BusinessError, imageInfo: image.ImageInfo) => { if (error) { console.error(`Failed to obtain the image information.code is ${error.code}, message is ${error.message}`); } else { console.info('Succeeded in obtainin...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getImageInfo((err: BusinessError, imageInfo: image.ImageInfo) => { if (err) { console.error(`Failed to obtain the image information.code is ${err.code}, message is ${err.message}`); } else { console.info('Succeeded in obtaining the image...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getImageInfo(0) .then((imageInfo: image.ImageInfo) => { console.info('Succeeded in obtaining the image information.'); }).catch((error: BusinessError) => { console.error(`Failed to obtain the image information.code is ${error.code}, mess...
application-dev\reference\apis-image-kit\js-apis-image.md
import { image } from '@kit.ImageKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with the actual one i...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; let options: image.ImagePropertyOptions = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty(image.PropertyKey.BITS_PER_SAMPLE, options) .then((data: string) => { console.info('Succeeded in getting the value of the specified attribute key of the ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getImageProperty("BitsPerSample") .then((data: string) => { console.info('Succeeded in getting the value of the specified attribute key of the image.'); }).catch((error: BusinessError) => { console.error('Failed to get the value of the s...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getImageProperty("BitsPerSample", (error: BusinessError, data: string) => { if (error) { console.error('Failed to get the value of the specified attribute key of the image.'); } else { console.info('Succeeded in getting the value of the ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; let property: image.GetImagePropertyOptions = { index: 0, defaultValue: '9999' } imageSourceApi.getImageProperty("BitsPerSample", property, (error: BusinessError, data: string) => { if (error) { console.error('Failed to get the value of the specified attribu...
application-dev\reference\apis-image-kit\js-apis-image.md
import { image } from '@kit.ImageKit'; import { BusinessError } from '@kit.BasicServicesKit'; let key = [image.PropertyKey.IMAGE_WIDTH, image.PropertyKey.IMAGE_LENGTH]; imageSourceApi.getImageProperties(key).then((data) => { console.info(JSON.stringify(data)); }).catch((err: BusinessError) => { console.error(JSON....
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.modifyImageProperty(image.PropertyKey.IMAGE_WIDTH, "120").then(() => { imageSourceApi.getImageProperty(image.PropertyKey.IMAGE_WIDTH).then((width: string) => { console.info(`ImageWidth is :${width}`); }).catch((error: BusinessError) => { ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.modifyImageProperty("ImageWidth", "120").then(() => { imageSourceApi.getImageProperty("ImageWidth").then((width: string) => { console.info(`ImageWidth is :${width}`); }).catch((error: BusinessError) => { console.error('Failed to get the ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.modifyImageProperty("ImageWidth", "120", (err: BusinessError) => { if (err) { console.error(`Failed to modify the Image Width.code is ${err.code}, message is ${err.message}`); } else { console.info('Succeeded in modifying the Image Width...
application-dev\reference\apis-image-kit\js-apis-image.md
import { image } from '@kit.ImageKit'; import { BusinessError } from '@kit.BasicServicesKit'; let keyValues: Record<PropertyKey, string|null> = { [image.PropertyKey.IMAGE_WIDTH] : "1024", [image.PropertyKey.IMAGE_LENGTH] : "1024" }; let checkKey = [image.PropertyKey.IMAGE_WIDTH, image.PropertyKey.IMAGE_LENGTH]...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; const array: ArrayBuffer = new ArrayBuffer(100); imageSourceApi.updateData(array, false, 0, 10).then(() => { console.info('Succeeded in updating data.'); }).catch((err: BusinessError) => { console.error(`Failed to update data.code is ${err.code},message is ${e...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; const array: ArrayBuffer = new ArrayBuffer(100); imageSourceApi.updateData(array, false, 0, 10, (err: BusinessError) => { if (err) { console.error(`Failed to update data.code is ${err.code},message is ${err.message}`); } else { console.info('Succeeded ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { image } from '@kit.ImageKit'; async function CreatePicture() { let options: image.DecodingOptionsForPicture = { desiredAuxiliaryPictures: [image.AuxiliaryPictureType.GAINMAP] // GAINMAP indicates the type of the auxiliary picture to be decoded. }; let pictureObj: image.Picture = await imageSourceApi...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.createPixelMap().then((pixelMap: image.PixelMap) => { console.info('Succeeded in creating pixelMap object through image decoding parameters.'); }).catch((error: BusinessError) => { console.error('Failed to create pixelMap object through image de...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.createPixelMap((err: BusinessError, pixelMap: image.PixelMap) => { if (err) { console.error(`Failed to create pixelMap.code is ${err.code},message is ${err.message}`); } else { console.info('Succeeded in creating pixelMap object.'); } ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; let decodingOptions: image.DecodingOptions = { sampleSize: 1, editable: true, desiredSize: { width: 1, height: 2 }, rotate: 10, desiredPixelFormat: image.PixelMapFormat.RGBA_8888, desiredRegion: { size: { width: 1, height: 2 }, x: 0, y: 0 }, cropAndS...
application-dev\reference\apis-image-kit\js-apis-image.md
import { image } from '@kit.ImageKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with the actual one i...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; let decodeOpts: image.DecodingOptions = { sampleSize: 1, editable: true, desiredSize: { width: 198, height: 202 }, rotate: 0, desiredPixelFormat: image.PixelMapFormat.RGBA_8888, index: 0, }; imageSourceApi.createPixelMapList(decodeOpts).then((pixelMapL...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.createPixelMapList((err: BusinessError, pixelMapList: Array<image.PixelMap>) => { if (err) { console.error(`Failed to create pixelMapList object, error code is ${err}`); } else { console.info('Succeeded in creating pixelMapList object.')...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; let decodeOpts: image.DecodingOptions = { sampleSize: 1, editable: true, desiredSize: { width: 198, height: 202 }, rotate: 0, desiredPixelFormat: image.PixelMapFormat.RGBA_8888, index: 0, }; imageSourceApi.createPixelMapList(decodeOpts, (err: BusinessE...
application-dev\reference\apis-image-kit\js-apis-image.md
import image from '@ohos.multimedia.image'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with the actual ...
application-dev\reference\apis-image-kit\js-apis-image.md
import image from '@ohos.multimedia.image'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with the actual ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getDelayTimeList((err: BusinessError, delayTimes: Array<number>) => { if (err) { console.error(`Failed to get delayTimes object.code is ${err.code},message is ${err.message}`); } else { console.info('Succeeded in getting delayTimes objec...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getDelayTimeList().then((delayTimes: Array<number>) => { console.info('Succeeded in getting delayTimes object.'); }).catch((err: BusinessError) => { console.error(`Failed to get delayTimes object.code is ${err.code},message is ${err.message}`); ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getFrameCount((err: BusinessError, frameCount: number) => { if (err) { console.error(`Failed to get frame count.code is ${err.code},message is ${err.message}`); } else { console.info('Succeeded in getting frame count.'); } })
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getFrameCount().then((frameCount: number) => { console.info('Succeeded in getting frame count.'); }).catch((err: BusinessError) => { console.error(`Failed to get frame count.code is ${err.code},message is ${err.message}`); })
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.getDisposalTypeList().then((disposalTypes: Array<number>) => { console.info('Succeeded in getting disposalTypes object.'); }).catch((err: BusinessError) => { console.error(`Failed to get disposalTypes object.code ${err.code},message is ${err.mess...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.release((err: BusinessError) => { if (err) { console.error(`Failed to release the image source instance.code ${err.code},message is ${err.message}`); } else { console.info('Succeeded in releasing the image source instance.'); } })
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; imageSourceApi.release().then(() => { console.info('Succeeded in releasing the image source instance.'); }).catch((error: BusinessError) => { console.error(`Failed to release the image source instance.code ${error.code},message is ${error.message}`); })
application-dev\reference\apis-image-kit\js-apis-image.md
const imagePackerApi: image.ImagePacker = image.createImagePacker();
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; const color: ArrayBuffer = new ArrayBuffer(96); // 96 is the size of the pixel buffer to create. The value is calculated as follows: height * width *4. let opts: image.InitializationOptions = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image....
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; import { image } from '@kit.ImageKit'; async function Packing(context: Context) { const resourceMgr = context.resourceManager; const rawFile = await resourceMgr.getRawFileContent("test.jpg"); let ops: image.SourceOptions = { sourceDensity: 98, } let ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@ohos.base'; import image from "@ohos.multimedia.image"; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; const resourceMgr...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; // Obtain the context from the component and ensure that the return value of this.getUIContext().getHostContext() is UIAbilityContext. let context = this.getUIContext().getHostContext() as common.UIAbilityContext; // 'test.jpg' is only an example. Replace it with ...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; const color: ArrayBuffer = new ArrayBuffer(96); // 96 is the size of the pixel buffer to create. The value is calculated as follows: height * width *4. let opts: image.InitializationOptions = { editable: true, pixelFormat: image.PixelMapFormat.RGBA_8888, size: { h...
application-dev\reference\apis-image-kit\js-apis-image.md
import { BusinessError } from '@kit.BasicServicesKit'; const color: ArrayBuffer = new ArrayBuffer(96); // 96 is the size of the pixel buffer to create. The value is calculated as follows: height * width *4. let opts: image.InitializationOptions = { editable: true, pixelFormat: image.PixelMapFormat.RGBA_8888, size: { h...