* Load external image * 加载外部图像
(url: string)
| 424 | * 加载外部图像 |
| 425 | */ |
| 426 | protected async loadExternalImage(url: string): Promise<void> { |
| 427 | try { |
| 428 | const response = await fetch(url); |
| 429 | const blob = await response.blob(); |
| 430 | const bitmap = await createImageBitmap(blob); |
| 431 | |
| 432 | // Create texture ID from URL |
| 433 | this.onExternalLoadSuccess(url, bitmap.width, bitmap.height); |
| 434 | } catch (error) { |
| 435 | console.error(`Failed to load external image: ${url}`, error); |
| 436 | this.onExternalLoadFailed(); |
| 437 | } |
| 438 | } |
| 439 | |
| 440 | /** |
| 441 | * Free external resource |
no test coverage detected