flutter_texture_rgba_renderer/lib/texture_rgba_renderer.dart
fufesou 873919902e
Feat/row align bytes (#7)
* better bytes alignment

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* debug macos

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* debug linux

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* windows switch_rgba

Signed-off-by: fufesou <shuanglongchen@yeah.net>

* better switch_rgba

Signed-off-by: fufesou <shuanglongchen@yeah.net>

---------

Signed-off-by: fufesou <shuanglongchen@yeah.net>
2023-03-03 09:30:05 +08:00

35 lines
1 KiB
Dart

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<int> createTexture(int key) {
return TextureRgbaRendererPlatform.instance.createTexture(key);
}
/// Close a texture with unique identifier [key].
///
/// @return a boolean to indicate whether the operation is sucessfully executed.
Future<bool> closeTexture(int key) {
return TextureRgbaRendererPlatform.instance.closeTexture(key);
}
/// Provide the rgba data to the texture.
Future<bool> onRgba(
int key, Uint8List data, int height, int width, int row_align_bytes) {
return TextureRgbaRendererPlatform.instance
.onRgba(key, data, height, width, row_align_bytes);
}
Future<int> getTexturePtr(int key) {
return TextureRgbaRendererPlatform.instance.getTexturePtr(key);
}
}