From 2283a9e345f63b9298f3f5af3d912837294f6074 Mon Sep 17 00:00:00 2001 From: 1024x2 Date: Tue, 16 Jul 2024 02:03:54 +0100 Subject: Initial kermit --- vexnc.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 vexnc.c (limited to 'vexnc.c') diff --git a/vexnc.c b/vexnc.c new file mode 100644 index 0000000..51cd483 --- /dev/null +++ b/vexnc.c @@ -0,0 +1,33 @@ +// gcc -O2 -march=native -o vexnc vexnc.c -lvncserver -lm + +#include + +#define STB_IMAGE_IMPLEMENTATION +#include "stb_image.h" + +int main(int argc, char const *argv[]) { + if (argc < 3) { + printf("usage: %s IMAGEFILE TITLE\n", argv[0]); + return 0; + } + + int imx, imy, imc; + unsigned char *im = stbi_load(argv[1], &imx, &imy, &imc, 4); + if (im == NULL) { + printf("bad image: %s\n", stbi_failure_reason()); + return 1; + } + + rfbScreenInfoPtr rfbScreen = rfbGetScreen(NULL, NULL, imx, imy, 8, 3, 4); + rfbScreen->desktopName = argv[2] ? argv[2] : ""; + rfbScreen->frameBuffer = (char*)im; + rfbScreen->alwaysShared = TRUE; + + rfbInitServer(rfbScreen); + rfbRunEventLoop(rfbScreen, -1, FALSE); + + stbi_image_free(im); + rfbScreenCleanup(rfbScreen); + + return 0; +} -- cgit v1.2.3