mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 23:37:35 +00:00
Add a little ReadMe.
This commit is contained in:
parent
f8fc892bac
commit
e78e032c19
4 changed files with 29 additions and 0 deletions
1
Meta/.gitignore
vendored
Normal file
1
Meta/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
convert-raw-to-rgb
|
33
Meta/convert-raw-to-rgb.cpp
Normal file
33
Meta/convert-raw-to-rgb.cpp
Normal file
|
@ -0,0 +1,33 @@
|
|||
#include <stdio.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int main(int argc, char**argv)
|
||||
{
|
||||
int fd = open(argv[1], O_RDONLY);
|
||||
if (fd < 0) {
|
||||
perror("open");
|
||||
return 1;
|
||||
}
|
||||
for (;;) {
|
||||
unsigned buffer;
|
||||
ssize_t nread = read(fd, &buffer, sizeof(buffer));
|
||||
if (nread == 0)
|
||||
break;
|
||||
if (nread < 0) {
|
||||
perror("read");
|
||||
return 1;
|
||||
}
|
||||
unsigned converted = buffer & 0xff00ff00;
|
||||
converted |= (buffer & 0xff0000) >> 16;
|
||||
converted |= (buffer & 0xff) << 16;
|
||||
write(1, &converted, sizeof(unsigned));
|
||||
}
|
||||
int rc = close(fd);
|
||||
if (rc < 0) {
|
||||
perror("close");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
BIN
Meta/screenshot-f8fc892.png
Normal file
BIN
Meta/screenshot-f8fc892.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 334 KiB |
Loading…
Add table
Add a link
Reference in a new issue