1# Graphics Subsystem Changelog
2
3## cl.graphic.1 **getPixelMap** Replaced by **getEffectPixelMap**
4
5**Access Level**
6
7Public
8
9**Reason for Change**
10
11**getPixelMap** is a synchronous API. Its running takes a long time and may block the main thread. Therefore, it is deprecated and replaced by an asynchronous API.
12
13**Change Impact**
14
15The change is not compatible with earlier versions. Use the new API in your code.
16
17**API Level**
189
19
20**Deprecated Since**
21
22OpenHarmony SDK 4.1.5.5
23
24**Deprecated APIs**
25
26| API                                                    | Description                                                    | Substitute API                                                    |
27| ------------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
28| getPixelMap():image.PixelMap; | This API takes a long time and is replaced by an asynchronous API.  | getEffectPixelMap():Promise<image.PixelMap>; |
29
30**Adaptation Guide**
31
32In the sample code below:
33
34```ts
35import image from "@ohos.multimedia.image";
36import effectKit from "@ohos.effectKit";
37
38const color = new ArrayBuffer(96);
39let opts : image.InitializationOptions = {
40  editable: true,
41  pixelFormat: 3,
42  size: {
43    height: 4,
44    width: 6
45  }
46};
47image.createPixelMap(color, opts).then((pixelMap) => {
48  let pixel = effectKit.createEffect(pixelMap).grayscale().getPixelMap();
49  console.log('getPixelBytesNumber = ', pixel.getPixelBytesNumber());
50})
51```
52Before change:
53```ts
54let pixel = effectKit.createEffect(pixelMap).grayscale().getPixelMap();
55```
56After change:
57```ts
58effectKit.createEffect(pixelMap).grayscale().getEffectPixelMap().then(data => {
59    let pixel = data;
60}).catch(ex => console.log("getEffectPixelMap error: " + ex.toString()));
61```
62In summary, replace **getPixelMap** with **getEffectPixelMap**, and use a promise to receive the **pixelMap** object.
63
64