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 are ARGB, RGB32, RGB24, RGB16, RGB15, RGB332, A8 and LUT8. by default the format is ARGB if the PNG image has an alpha channel, or RGB32 otherwise 🎨
  • --dither-rgb16 β€” if specified, images rendered to RGB16 surfaces are dithered. this reduces banding caused by the limited colorspace. heads up tho: this option has no effect for any pixel-format other than RGB16 πŸ™ˆ
  • --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