pixel_surface 1.0.0
pixel_surface: ^1.0.0 copied to clipboard
Flutter GPU texture runtime — TextureRegistry bridge, CVPixelBuffer / SurfaceTexture upload, and GpuTextureView. No editor, filters, or beauty.
1.0.0 #
- Initial pub.dev release of
pixel_surface— Flutter GPU texture bridge for native Rust pipelines and custom renderers. Renamed fromrust_gpu_textureto a proper pub.dev package name. GpuTextureRegistrystatic API:createTexture,updateTexture(RGBA),updateTextureBgra(BGRA — singlememcpyon Apple,Bitmap.copyPixelsFromBufferon Android),presentPixelBuffer(zero-copy blit of VT decode buffer into IOSurface/Metal-compatible texture backing),decodePreviewToSurface(Android MediaCodec → FlutterSurfaceTexture).GpuTextureViewwidget for GPU-resident frame display.- Texture recycling:
PixelBufferPoolon Apple keyed by(width, height, pixelFormat)with 3 warm buffers per bucket (1 s age limit).GpuTextureRegistry.resizeTextureandflushPoolsfor cross-platform memory pressure handling.CVMetalTextureCacheflushed with the pool. - Memory-pressure hooks: Apple
UIApplication.didReceiveMemoryWarningNotification(iOS),ProcessInfo.thermalStateDidChangeNotification+NSApplication.didResignActiveNotification(macOS) callpool.flushAll(). AndroidComponentCallbacks2.onTrimMemory(RUNNING_MODERATE/RUNNING_LOW/RUNNING_CRITICAL/UI_HIDDEN/BACKGROUND/MODERATE/COMPLETE) recycles the backingBitmap. Backing bitmaps re-created on the nextupdateTexture. - New Dart API:
GpuTextureRegistry.resizeTexture,GpuTextureRegistry.flushPools,GpuTextureRegistry.debugStats()→PixelSurfaceStats(handleCount,poolCount,createCount,lastFlushMs,lastMemoryWarningMs,trimEventCount,recycledBitmapCount,lastTrimLevel). PixelLayoutenum (rgba8888/bgra8888) with safeBGRA8Unorm+ 2D assertions in debug builds.BeautyOutputTargettyped wrapper for safely adopting a Flutter-sideCVPixelBuffer+MTLTexturepointer pair into a wgpu pipeline (unsafe fn BeautyOutputTarget::from_adopted, validates non-null + dimension match, takes exactly one+1retain, imports viawrap_metal_texture_as_wgpu_bgra).- RAII
CvMetalTexturewrapper (closes a one-timeCVMetalTextureleak per allocation) andMetalTextureCacheEntrywithDrop(flushes + releases the cache on device change). - iOS uses
vImagePermuteChannels_ARGB8888for the RGBA path;Accelerate.frameworkdeclared in both podspecs. - Android plugin (API 26+, Android 8.0+) uses
Bitmap.copyPixelsFromBufferfor RGBA + BGRA; the API 21-25 fallback keeps the legacy path.kCVPixelBufferMetalCompatibilityKeyset on texture allocation. - Method channel:
pixel_surface/texture. Migrated toTextureRegistry.SurfaceProducer+scheduleFrame()(Flutter 3.27+;markTextureFrameAvailableremoved).
Platform support #
- Android (API 21+,
SurfaceTexture) - iOS (12+,
CVPixelBuffer) - macOS (12+,
CVPixelBuffer) - Linux / Windows / Web: not supported — use an RGBA widget fallback in your app