feat: add screenshot app

This commit is contained in:
2026-03-22 13:28:49 +01:00
parent 9030485fcb
commit a805b06406
10 changed files with 2097 additions and 4 deletions
+66
View File
@@ -0,0 +1,66 @@
# Makefile for libjpegwrite (JPEG encoding via stb_image_write) on MontaukOS
# Copyright (c) 2026 Daniel Hammer
MAKEFLAGS += -rR
.SUFFIXES:
# ---- Toolchain ----
TOOLCHAIN_PREFIX := $(shell cd ../../.. && pwd)/toolchain/local/bin/x86_64-elf-
ifneq ($(wildcard $(TOOLCHAIN_PREFIX)gcc),)
CC := $(TOOLCHAIN_PREFIX)gcc
AR := $(TOOLCHAIN_PREFIX)ar
else
CC := gcc
AR := ar
endif
# ---- Paths ----
LIBC_INC := ../../include/libc
PROG_INC := ../../include
OBJDIR := obj
# ---- Compiler flags ----
CFLAGS := \
-std=gnu11 \
-g -O2 -pipe \
-Wall \
-Wno-unused-parameter \
-Wno-unused-function \
-nostdinc \
-ffreestanding \
-fno-stack-protector \
-fno-stack-check \
-fno-PIC \
-ffunction-sections \
-fdata-sections \
-fno-tree-loop-distribute-patterns \
-m64 \
-march=x86-64 \
-msse \
-msse2 \
-mno-red-zone \
-mcmodel=small \
-I $(PROG_INC) \
-isystem $(LIBC_INC) \
-isystem $(shell $(CC) -print-file-name=include)
# ---- Target ----
TARGET := libjpegwrite.a
.PHONY: all clean
all: $(TARGET)
$(TARGET): $(OBJDIR)/stb_image_write_impl.o
$(AR) rcs $@ $^
$(OBJDIR)/stb_image_write_impl.o: stb_image_write_impl.c Makefile
@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
clean:
rm -rf $(OBJDIR) $(TARGET)
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,23 @@
/*
* stb_image_write_impl.c
* Single compilation unit for stb_image_write JPEG encoder on MontaukOS
* Copyright (c) 2026 Daniel Hammer
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* Only enable JPEG writing. */
#define STBI_WRITE_NO_STDIO
/* Route allocations through libc (which uses MontaukOS heap). */
#define STBIW_MALLOC(sz) malloc(sz)
#define STBIW_FREE(p) free(p)
#define STBIW_REALLOC(p, newsz) realloc(p, newsz)
#define STBIW_MEMMOVE(d, s, n) memmove(d, s, n)
#define STBIW_ASSERT(x) ((void)(x))
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include <gui/stb_image_write.h>