react-native-mask-segment-c.../docs/i18n/zh-CN/docusaurus-plugin-content-docs/current/examples/png-pre-warm.md
a1518 bea6de3767 Add Docusaurus documentation site with i18n support
- Docusaurus 3.7.0 with both English and Chinese (zh-CN) locales
- Full API reference split into structured pages
- Homepage with hero, feature cards, and quick start section
- GitHub Actions workflow for auto-deployment to GitHub Pages

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-02 23:25:56 -07:00

20 lines
575 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: png-pre-warm
title: PNG 缓存预热(推荐)
---
# 🔥 PNG 缓存预热(推荐)
在挂载 Canvas 前预热 PNG 解码缓存,可节省 **100250ms** 的初始化时间。
```tsx
import { prewarmPngBgrCacheAsync } from 'react-native-mask-segment-canvas';
async function openPaintScreen(originUrl: string, maskUrl: string) {
await prewarmPngBgrCacheAsync([originUrl, maskUrl]);
navigation.navigate('Paint', { originUrl, maskUrl });
}
```
在下载/提取图片后、导航到上色界面前调用 `prewarmPngBgrCacheAsync` 可获得最佳性能。