move grid functions to trait

This commit is contained in:
Vinzenz Schroeter 2024-05-18 10:50:35 +02:00
parent 314bec36f3
commit bcf040911d
11 changed files with 96 additions and 88 deletions

View file

@ -63,15 +63,13 @@ int main(void) {
sp2_PixelGrid *pixels = sp2_pixel_grid_new(sp2_PIXEL_WIDTH, sp2_PIXEL_HEIGHT);
sp2_pixel_grid_fill(pixels, true);
command = sp2_command_bitmap_linear_win(0, 0, pixels); // pixels get consumed here
if (command == NULL)
return 4;
if (!sp2_connection_send(connection, command)) // command gets consumed here
return 5;
// connection does not get consumed and has to be freed manually
sp2_connection_dealloc(connection);
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;
sp2_connection_dealloc(connection);
return 0;
}
```