DIRECTFB-CSOURCE(1)
β¨ directfb-csource β¨
okay bestie, welcome to the DirectFB Manual Pages β this is the directfb-csource(1) page and it's literally about turning your pretty little pictures into C code π
π NAME π
directfb-csource β a C code generation utility for DirectFB surfaces. she takes your art and makes it into code, no cap β¨
π¦ SYNOPSIS π¦
directfb-csource [options] <imagefiles>
πΈ DESCRIPTION πΈ
so basically, directfb-csource is this tiny lil utility that reads PNG (Portable Network Graphics) image files and generates C code that you can use to compile an image straight into a DirectFB application. iconic behavior fr fr π
below is a simple example to show you how it goes, because a vibe check needs visuals:
if you pass multiple PNG image files to directfb-csource, they get combined into a single surface π³β¨ the different images can then be blitted from this surface using the array of rectangles that is also dumped. this is lowkey perfect for stuff like icons or sprites, like it's giving game dev main character energy π
π OPTIONS π
--name=identifierβ specifies the identifier name (prefix) for the generated variables. if you don't use this option, the identifier gets generated from the filename. you HAVE to specify an identifier name when processing multiple images β not optional, bestie, that's the rule π--format=pixelformatβ specifies the pixel-format of the generated inline surface. possible values areARGB,RGB32,RGB24,RGB16,RGB15,RGB332,A8andLUT8. by default the format isARGBif the PNG image has an alpha channel, orRGB32otherwise π¨--dither-rgb16β if specified, images rendered toRGB16surfaces are dithered. this reduces banding caused by the limited colorspace. heads up tho: this option has no effect for any pixel-format other thanRGB16π--transparent=AARRGGBBβ if specified, completely transparent pixels are set to this color value. this may be useful for color keying and for working around bugs in graphics drivers π--versionβ output version information β¨--helpβ print brief help and exit π«Ά
π EXAMPLE π
generate a header file from a PNG image file:
directfb-csource --name=foo foo.png > foo.h
include the generated header in your application and create a surface using the surface description from the header file:
#include <directfb.h>
#include "foo.h"
IDirectFB *dfb;
IDirectFBSurface *surface;
...
dfb->CreateSurface( dfb, &foo_desc, &surface );
and that's it, you're literally slaying β
π OTHER INFO π
directfb-csource was inspired by and uses code from gdk-pixbuf-csource, a similar program written by Tim Janik. giving credit where credit is due, we love to see it π«Ά
the canonical place to find informations about DirectFB is at http://www.directfb.org/ π
okay that's the whole page, you ate it, no crumbs π β¨
and that's a wrap on version 1.7.7, dated 14 May 2009 β yes she's an older icon but she still serves, periodt ππ
π¦ where this page comes from
- alpine 3.24: directfb-doc 1.7.7-r8 Β· LGPL-2.0-or-later
- debian bookworm: libdirectfb-bin 1.7.7-11 Β· LGPL-2.0-or-later
- nixos 26.05: directfb 1.7.7
- ubuntu jammy: libdirectfb-bin 1.7.7-9build1 Β· LGPL-2.0-or-later
- ubuntu noble: libdirectfb-bin 1.7.7-11.1ubuntu2 Β· LGPL-2.0-or-later
- Copyright (C) 2002-2003 Sven Neumann <neo@directfb.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms