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

575 B
Raw Permalink Blame History

id title
png-pre-warm PNG 缓存预热(推荐)

🔥 PNG 缓存预热(推荐)

在挂载 Canvas 前预热 PNG 解码缓存,可节省 100250ms 的初始化时间。

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 可获得最佳性能。