← Back to team overview

kicad-developers team mailing list archive

Re: How to make single-plane .cpp from .png?


Hi guys,

I just needed to add a current-probe cursor for spice (which meant re-authoring the voltage-probe to match).  I ended up authoring them in Gimp (because anything converted from SVG to a 1-bit-per-pixel bitmap looks awful).

Since Gimp can save as XBM I didn’t bother to use the PNG2cpp script — it’s easy enough to just copy/paste the text from the XBM file.


> On 6 Aug 2019, at 11:39, Seth Hillbrand <seth@xxxxxxxxxxxxx> wrote:
> On 2019-08-05 15:22, Jeff Young wrote:
>> Our PNG2cpp.cmake script makes a 3 or 4 plane (ie: colour) char array.
>> wxWidgets’ wxBitmap() constructor needs a single plane char array.
>> John Beard created a couple for the SPICE cursors, but I’m not sure
>> how he did it.
> I'm pretty sure that John just moved the cursors that Orson built.  The PNG2cpp puts raw PNG data into cpp arrays.
> Are you looking to build a new cursor library?
> If you want to generate binary (white or black) cursors, you can save the icon as an XBM file from gimp.  Then 0=white and 1=black.  You can use the same PNG2cpp script to convert the file from XBM to a cpp array.
> -Seth