← Back to team overview

kicad-developers team mailing list archive

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

 

If you open the PNG in Gimp and then export as XBM it works.  (Note that while wxBitmap’s constructor purports to support sizes, if you pass anything under 32x32 you’ll get garbage.)

However, the cursors aren’t greyscale (they’re true black-and-white), so the whole SVG source idea produces some pretty ugly cursors.  I think we’ll have to specify them as bitmaps.

> On 5 Aug 2019, at 15:25, Jeff Young <jeff@xxxxxxxxx> wrote:
> 
> I also tried online converters for PNG -> XBM and directly from the source (SVG -> XBM), but they all give me black images….
> 
> 
>> On 5 Aug 2019, at 15:15, Jeff Young <jeff@xxxxxxxxx> wrote:
>> 
>> I found doc on the colour modes; 0 is monochrome without alpha, 2 is RGB, 4 is monochrome with alpha and 6 is RGBA.
>> 
>> So -c 0 should be correct.  
>> 
>> But it appears wxBitmap is expecting XBM data rather than PNG data.  Hm…..
>> 
>> 
>>> On 5 Aug 2019, at 14:46, Jeff Young <jeff@xxxxxxxxx> wrote:
>>> 
>>> pngcrush -c 0 makes a single-plane char array, but it appears to be in a different order or something (the array is the right size, but produces a garbage cursor).
>>> 
>>> Anyone know what the other colour modes are?  (0, 2, 4, 6)
>>> 
>>>> On 5 Aug 2019, at 13:22, Jeff Young <jeff@xxxxxxxxx> 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.
>>>> 
>>>> Thanks,
>>>> Jeff.
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~kicad-developers
>>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>>> More help   : https://help.launchpad.net/ListHelp
>>> 
>>> 
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>> 
>> 
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References