public function writeTransparency(PngPalette $palette) 
    {
        if ($palette && $palette->isValid && $palette->hasAlphaChannel) {
            $this->buffer->startChunk("tRNS");
            
            $alpha = '';

            foreach ($palette->colors as $color) {
                $alpha .= pack('C', $color & 0xff);
            }
            
            $this->buffer->writeString($alpha);

            $this->buffer->endChunk();
        }
    }
public function writeTransparency(PngPalette $palette) 
    {
        if ($palette && $palette->isValid && $palette->hasAlphaChannel) {
            $this->buffer->startChunk("tRNS");
            
            $alpha = '';

            foreach ($palette->colors as $color) {
                $alpha .= pack('C', $color & 0xff);
            }
            
            $this->buffer->writeString($alpha);

            $this->buffer->endChunk();
        }
    }
public function writeTransparency ( PngPalette $ palette ) { if ( $ palette && $ palette -> isValid && $ palette -> hasAlphaChannel ) { $ this -> buffer -> startChunk ( "tRNS" ) ; $ alpha = '' ; foreach ( $ palette -> colors as $ color ) { $ alpha .= pack ( 'C' , $ color & 0xff ) ; } $ this -> buffer -> writeString ( $ alpha ) ; $ this -> buffer -> endChunk ( ) ; } }
Writes a tRNS chunk containing the alpha values of indexed colors.

@param \Jdenticon\Canvas\Png\PngPalette $palette Palette containing the
indexed colors.
Writes a tRNS chunk containing the alpha values of indexed colors .