Skip to content

Commit

Permalink
[apg_pixfont] outlines dark grey instead of black
Browse files Browse the repository at this point in the history
  • Loading branch information
capnramses committed Oct 18, 2024
1 parent 093b6d9 commit fdcdf93
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apg_pixfont/apg_pixfont.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* apg_pixfont - C Pixel Font Utility v0.4.3
/* apg_pixfont - C Pixel Font Utility v0.4.4
C99 Implementation
See header file for licence and instructions.
Anton Gerdelan 2019
Expand Down Expand Up @@ -250,11 +250,12 @@ static bool _is_img_idx_coloured( const unsigned char* image, int idx, int n_cha
return false;
}

// NOTE(Anton) could also user-specify an outline colour rather than all zero
// Outline is dark rather than black so it can match text colour e.g. in a shader multiplication.
// And so that in e.g. a 1-channel image it can be differentiated from the background.
static void _apply_outline( unsigned char* image, int idx, int n_channels ) {
for ( int c = 0; c < n_channels; c++ ) { image[idx * n_channels + c] = 0x00; }
if ( 2 == n_channels ) { image[idx * n_channels + 1] = 0xFF; } // don't set alpha to 0
if ( 4 == n_channels ) { image[idx * n_channels + 3] = 0xFF; } // don't set alpha to 0
for ( int c = 0; c < n_channels; c++ ) { image[idx * n_channels + c] = 0x33; }
if ( 2 == n_channels ) { image[idx * n_channels + 1] = 0xFF; } // Don't set alpha to 0.
if ( 4 == n_channels ) { image[idx * n_channels + 3] = 0xFF; } // Don't set alpha to 0.
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
1 change: 1 addition & 0 deletions apg_pixfont/apg_pixfont.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Technical Details:
History:
==============================================================
0.4.4 - 2024 Oct 18 - Outline is now a darker shade of text colour, not black.
0.4.0 - 2024 Jun 15 - Most of Latin-1 character set included.
0.3.0 - 2023 Mar 09 - Bold/italic/underline/strikethrough style. '\n's at the end of strings trimmed. Atlas generation tools. Basic Unicode UTF-8 support.
0.2.1 - 2022 Sep 26 - Readme correction.
Expand Down

0 comments on commit fdcdf93

Please sign in to comment.