update language bindings and examples
This commit is contained in:
		
							parent
							
								
									862804de3b
								
							
						
					
					
						commit
						95928ee85c
					
				
					 4 changed files with 8 additions and 6 deletions
				
			
		|  | @ -9,7 +9,7 @@ int main(void) { | |||
|     sp2_PixelGrid *pixels = sp2_pixel_grid_new(sp2_PIXEL_WIDTH, sp2_PIXEL_HEIGHT); | ||||
|     sp2_pixel_grid_fill(pixels, true); | ||||
| 
 | ||||
|     sp2_Command *command = sp2_command_bitmap_linear_win(0, 0, pixels); | ||||
|     sp2_Command *command = sp2_command_bitmap_linear_win(0, 0, pixels, Uncompressed); | ||||
|     sp2_Packet *packet = sp2_packet_from_command(command); | ||||
|     if (!sp2_connection_send(connection, packet)) | ||||
|         return 1; | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| using ServicePoint2; | ||||
| using CompressionCode = ServicePoint2.BindGen.CompressionCode; | ||||
| 
 | ||||
| using var connection = Connection.Open("127.0.0.1:2342"); | ||||
| 
 | ||||
|  | @ -14,6 +15,6 @@ for (var offset = 0; offset < int.MaxValue; offset++) | |||
|     for (var y = 0; y < pixels.Height; y++) | ||||
|         pixels[(y + offset) % Constants.PixelWidth, y] = true; | ||||
| 
 | ||||
|     connection.Send(Command.BitmapLinearWin(0, 0, pixels.Clone()).IntoPacket()); | ||||
|     connection.Send(Command.BitmapLinearWin(0, 0, pixels.Clone(), CompressionCode.Lzma).IntoPacket()); | ||||
|     Thread.Sleep(14); | ||||
| } | ||||
|  |  | |||
|  | @ -105,11 +105,11 @@ public sealed class Command : Sp2NativeInstance<BindGen.Command> | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public static Command BitmapLinearWin(int x, int y, PixelGrid pixelGrid) | ||||
|     public static Command BitmapLinearWin(int x, int y, PixelGrid pixelGrid, CompressionCode compression) | ||||
|     { | ||||
|         unsafe | ||||
|         { | ||||
|             return new Command(NativeMethods.sp2_command_bitmap_linear_win((ushort)x, (ushort)y, pixelGrid.Into())); | ||||
|             return new Command(NativeMethods.sp2_command_bitmap_linear_win((ushort)x, (ushort)y, pixelGrid.Into(), compression)); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -38,7 +38,8 @@ impl Connection { | |||
|     /// # Examples
 | ||||
|     ///
 | ||||
|     /// ```rust
 | ||||
|     ///  let connection = servicepoint2::Connection::open("172.23.42.29:2342")
 | ||||
|     ///  use servicepoint2::CompressionCode;
 | ||||
|     /// let connection = servicepoint2::Connection::open("172.23.42.29:2342")
 | ||||
|     ///     .expect("connection failed");
 | ||||
|     ///
 | ||||
|     ///  // turn off all pixels
 | ||||
|  | @ -50,7 +51,7 @@ impl Connection { | |||
|     ///  pixels.fill(true);
 | ||||
|     ///
 | ||||
|     ///  // send pixels to display
 | ||||
|     ///  connection.send(servicepoint2::Command::BitmapLinearWin(servicepoint2::Origin::top_left(), pixels).into())
 | ||||
|     ///  connection.send(servicepoint2::Command::BitmapLinearWin(servicepoint2::Origin::top_left(), pixels, CompressionCode::Lzma).into())
 | ||||
|     ///     .expect("send failed");
 | ||||
|     /// ```
 | ||||
|     pub fn send( | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Vinzenz Schroeter
						Vinzenz Schroeter