eglCreatePbufferSurface function
Implementation
Pointer<Void> eglCreatePbufferSurface(
Pointer<Void> display,
Pointer<Void> config, {
Map<EglSurfaceAttributes, int>? attributes,
}) {
final attributeCount = attributes == null ? 1 : attributes.length * 2 + 1;
final attributeList = allocate<Int32>(count: attributeCount);
if (attributes != null) {
final attributeEntries = attributes.entries.toList(growable: false);
for (var i = 0; i < attributeEntries.length; ++i) {
attributeList[i * 2] = attributeEntries[i].key.toIntValue();
attributeList[i * 2 + 1] = attributeEntries[i].value;
}
}
// The list must be terminated with EGL_NONE.
attributeList[attributeCount - 1] = EglValue.none.toIntValue();
final nativeCallResult =
_libEGL.eglCreatePbufferSurface(display, config, attributeList);
free(attributeList);
if (nativeCallResult == nullptr) {
throw EglException(
'Failed to create Pbuffer surface for display [$display], config [$config], attributes [$attributeList].');
}
return nativeCallResult;
}