diff options
Diffstat (limited to 'src/Gameboy/DrawContext.php')
-rw-r--r-- | src/Gameboy/DrawContext.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Gameboy/DrawContext.php b/src/Gameboy/DrawContext.php index 7a4bbba..4081d69 100644 --- a/src/Gameboy/DrawContext.php +++ b/src/Gameboy/DrawContext.php @@ -26,12 +26,13 @@ class DrawContext public function putImageData($canvasBuffer, $left, $top) { for ($i = 0; $i < count($canvasBuffer); $i = $i + 4) { - // IGNORE ALPHA + // Sum of all colors, Ignore alpha $total = $canvasBuffer[$i] + $canvasBuffer[$i + 1] + $canvasBuffer[$i + 2]; $x = ($i / 4) % 160; $y = ceil(($i / 4) / 160); + // 350 is a good threshold for black and white if ($total > 350) { $this->canvas->set($x, $y); } |