// Modified by the Kitedesk fork (2026, B212, B252): closeTexture takes // `recycle`. import 'dart:typed_data'; export './texture_rgba_ffi.dart' show Native; import 'texture_rgba_renderer_platform_interface.dart'; class TextureRgbaRenderer { /// Create a texture with unique [key]. /// /// @return a texture id which can be used with /// ```dart /// Texture(textureId: textureId) /// ``` Future createTexture(int key) { return TextureRgbaRendererPlatform.instance.createTexture(key); } /// Close a texture with unique identifier [key]. /// /// Pass [recycle] = true only when nothing calls `onRgba` with the pointer /// from [getTexturePtr] any more: Linux then keeps the texture for the next /// [createTexture] of the same window, and Windows and macOS release it. /// Without it the texture stays a valid object that drops the frames still /// pushed to that pointer (Kitedesk fork, B212, B252). /// /// @return a boolean to indicate whether the operation is sucessfully executed. Future closeTexture(int key, {bool recycle = false}) { return TextureRgbaRendererPlatform.instance .closeTexture(key, recycle: recycle); } /// Provide the rgba data to the texture. Future onRgba( int key, Uint8List data, int height, int width, int strideAlign) { return TextureRgbaRendererPlatform.instance .onRgba(key, data, height, width, strideAlign); } Future getTexturePtr(int key) { return TextureRgbaRendererPlatform.instance.getTexturePtr(key); } }