mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:37:35 +00:00
LibGfx/CCITT: Introduce the invert
helper
This function turns Black into White and White into Black.
This commit is contained in:
parent
ce0ac70416
commit
d54dbdae5e
1 changed files with 6 additions and 1 deletions
|
@ -267,6 +267,11 @@ Optional<Code> get_terminal_code(Color color, u16 code_word, u8 code_size)
|
|||
constexpr auto const ccitt_white = Color::NamedColor::White;
|
||||
constexpr auto const ccitt_black = Color::NamedColor::Black;
|
||||
|
||||
Color invert(Color current_color)
|
||||
{
|
||||
return current_color == ccitt_white ? ccitt_black : ccitt_white;
|
||||
}
|
||||
|
||||
ErrorOr<void> decode_single_ccitt3_1d_line(BigEndianInputBitStream& input_bit_stream, BigEndianOutputBitStream& decoded_bits, u32 image_width)
|
||||
{
|
||||
// We always flip the color when entering the loop, so let's initialize the
|
||||
|
@ -284,7 +289,7 @@ ErrorOr<void> decode_single_ccitt3_1d_line(BigEndianInputBitStream& input_bit_st
|
|||
continue;
|
||||
}
|
||||
|
||||
current_color = current_color == ccitt_white ? ccitt_black : ccitt_white;
|
||||
current_color = invert(current_color);
|
||||
|
||||
u8 size {};
|
||||
u16 potential_code {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue