content: // Generated by dart-wayland-scanner
  // https://github.com/your-repo/dart-wayland-scanner
  // XML file : https://gitlab.freedesktop.org/wayland/wayland-protocols/-/raw/main/staging/single-pixel-buffer/single-pixel-buffer-v1.xml
  //
  // single_pixel_buffer_v1 Protocol Copyright: 
  /// 
  /// Copyright © 2022 Simon Ser
  /// 
  /// Permission is hereby granted, free of charge, to any person obtaining a
  /// copy of this software and associated documentation files (the "Software"),
  /// to deal in the Software without restriction, including without limitation
  /// the rights to use, copy, modify, merge, publish, distribute, sublicense,
  /// and/or sell copies of the Software, and to permit persons to whom the
  /// Software is furnished to do so, subject to the following conditions:
  /// 
  /// The above copyright notice and this permission notice (including the next
  /// paragraph) shall be included in all copies or substantial portions of the
  /// Software.
  /// 
  /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  /// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  /// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  /// DEALINGS IN THE SOFTWARE.
  /// 
  
  library client;
  
  import 'package:wayland/wayland.dart';
  import 'package:wayland/protocols/wayland.dart';
  import 'dart:async';
  import 'dart:convert';
  import 'dart:typed_data';
  import 'package:result_dart/result_dart.dart';
  
  
  /// global factory for single-pixel buffers
  /// 
  /// The wp_single_pixel_buffer_manager_v1 interface is a factory for
  /// single-pixel buffers.
  /// 
  class WpSinglePixelBufferManagerV1 extends Proxy{
    final Context innerContext;
    final version = 1;
  
    WpSinglePixelBufferManagerV1(this.innerContext) : super(innerContext.allocateClientId()){
      innerContext.register(this);
    }
  
  
  @override
  toString(){
  return "WpSinglePixelBufferManagerV1 {name: 'wp_single_pixel_buffer_manager_v1', id: '$objectId', version: '1',}";
  }
  
  /// destroy the manager
  /// 
  /// Destroy the wp_single_pixel_buffer_manager_v1 object.
  /// 
  /// The child objects created via this interface are unaffected.
  /// 
    Result<void,Object> destroy() {
  innerContext.unRegister(this);
      logLn("WpSinglePixelBufferManagerV1::destroy ");
  var arguments = [];var argTypes = <WaylandType>[];
  var calclulatedSize  = calculateSize(argTypes, arguments);
  final bytesBuilder = BytesBuilder();
  bytesBuilder.add(Uint32List.fromList([objectId, (calclulatedSize << 16) | 0]).buffer.asUint8List());
      try{
      innerContext.sendMessage(bytesBuilder.toBytes(), );
      }catch (e) {
        logLn("Exception in WpSinglePixelBufferManagerV1::destroy: $e");
     return Failure(e);
      }
      return Success(Object());
    }
  
  /// create a 1×1 buffer from 32-bit RGBA values
  /// 
  /// Create a single-pixel buffer from four 32-bit RGBA values.
  /// 
  /// Unless specified in another protocol extension, the RGBA values use
  /// pre-multiplied alpha.
  /// 
  /// The width and height of the buffer are 1.
  /// 
  /// [id]:
  /// [r]: value of the buffer's red channel
  /// [g]: value of the buffer's green channel
  /// [b]: value of the buffer's blue channel
  /// [a]: value of the buffer's alpha channel
    Result<Buffer,Object> createU32RgbaBuffer(int r, int g, int b, int a) {
    var id =  Buffer(innerContext);
      logLn("WpSinglePixelBufferManagerV1::createU32RgbaBuffer  id: $id r: $r g: $g b: $b a: $a");
  var arguments = [id, r, g, b, a];var argTypes = <WaylandType>[WaylandType.newId, WaylandType.uint, WaylandType.uint, WaylandType.uint, WaylandType.uint];
  var calclulatedSize  = calculateSize(argTypes, arguments);
  final bytesBuilder = BytesBuilder();
  bytesBuilder.add(Uint32List.fromList([objectId, (calclulatedSize << 16) | 1]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([id.objectId]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([r]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([g]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([b]).buffer.asUint8List());
      bytesBuilder.add(Uint32List.fromList([a]).buffer.asUint8List());
      try{
      innerContext.sendMessage(bytesBuilder.toBytes(), );
      }catch (e) {
        logLn("Exception in WpSinglePixelBufferManagerV1::createU32RgbaBuffer: $e");
     return Failure(e);
      }
      return Success(id);
    }
  
  }
  
  