File tree Expand file tree Collapse file tree 2 files changed +0
-25
lines changed Expand file tree Collapse file tree 2 files changed +0
-25
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,6 @@ export const Mock: typeof SkiaExports &
53
53
useTypeface : Noop ,
54
54
useImage : Noop ,
55
55
useSVG : Noop ,
56
- usePicture : Noop ,
57
56
createPicture : Noop ,
58
57
// 3. Point/Rect/Transform utilities
59
58
vec,
Original file line number Diff line number Diff line change 1
- import type { DependencyList } from "react" ;
2
- import { useMemo } from "react" ;
3
-
4
1
import { Skia } from "../Skia" ;
5
2
import type { SkCanvas , SkRect } from "../types" ;
6
3
7
- /**
8
- * Memoizes and returns an SkPicture that can be drawn to another canvas.
9
- * @param rect Picture bounds
10
- * @param cb Callback for drawing to the canvas
11
- * @returns SkPicture
12
- */
13
- export const usePicture = (
14
- rect : SkRect ,
15
- cb : ( canvas : SkCanvas ) => void ,
16
- deps : DependencyList = [ ]
17
- ) => {
18
- console . warn ( "usePicture() is deprecated. Use createPicture() instead." ) ;
19
- return useMemo ( ( ) => {
20
- const recorder = Skia . PictureRecorder ( ) ;
21
- const canvas = recorder . beginRecording ( rect ) ;
22
- cb ( canvas ) ;
23
- return recorder . finishRecordingAsPicture ( ) ;
24
- // eslint-disable-next-line react-hooks/exhaustive-deps
25
- } , deps ) ;
26
- } ;
27
-
28
4
/**
29
5
* Memoizes and returns an SkPicture that can be drawn to another canvas.
30
6
* @param rect Picture bounds
You can’t perform that action at this time.
0 commit comments