Skip to content

Commit

Permalink
fixed alpha parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
fabi321 committed Jun 15, 2023
1 parent d3da855 commit e99b81e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,17 @@ pub async fn parse_pixelflut_commands(

let rgba = simd_unhex(&buffer[i - 9..i - 1]);

let alpha = rgba & 0xff;
let alpha = (rgba >> 24) & 0xff;

if alpha == 0 || x >= fb.get_width() || y >= fb.get_height() {
continue;
}

let alpha_comp = 0xff - alpha;
let current = fb.get_unchecked(x, y);
let r = (rgba >> 24) & 0xff;
let g = (rgba >> 16) & 0xff;
let b = (rgba >> 8) & 0xff;
let r = (rgba >> 16) & 0xff;
let g = (rgba >> 8) & 0xff;
let b = rgba & 0xff;

let r: u32 =
(((current >> 24) & 0xff) * alpha_comp + r * alpha) / 0xff;
Expand Down

0 comments on commit e99b81e

Please sign in to comment.