feat: getTexturePtr
This commit is contained in:
parent
1a164ee5a0
commit
0f59fef831
5 changed files with 32 additions and 4 deletions
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
|
|
@ -32,9 +34,20 @@ class MethodChannelTextureRgbaRenderer extends TextureRgbaRendererPlatform {
|
|||
|
||||
@override
|
||||
Future<bool> onRgba(int key, Uint8List data, int height, int width) async {
|
||||
assert(data.length == height * width * 4);
|
||||
return await methodChannel.invokeMethod<bool>('onRgba',
|
||||
{"data": data, "height": height, "width": width, "key": key}) ??
|
||||
false;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<int> getTexturePtr(int key) async {
|
||||
// TODO: currently only supports Windows.
|
||||
if (!Platform.isWindows) {
|
||||
return -1;
|
||||
}
|
||||
final ptr =
|
||||
await methodChannel.invokeMethod('getTexturePtr', {"key": key}) ??
|
||||
false;
|
||||
return ptr;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue