Sha256: 52871b00603d26738150f92617086ab84cc86b35da6692dfa8d743fc3510cbb9

Contents?: true

Size: 584 Bytes

Versions: 31

Compression:

Stored size: 584 Bytes

Contents

# frozen_string_literal: true

begin
  require 'prawn/gmagick'
rescue LoadError # rubocop:disable Lint/SuppressedException
end unless defined? GMagick::Image

Gmagick.prepend (Module.new do
  def initialize image_blob
    super
    # apply patch for https://github.com/packetmonkey/prawn-gmagick/issues/19
    if bits != 8 && (GMagick::Image.format image_blob) == 'PNG'
      (io = StringIO.new image_blob).read 8
      chunk_size = io.read 4
      self.bits = ((io.read chunk_size.unpack1 'N').unpack 'NNC')[-1] if (io.read 4) == 'IHDR'
    end
  end
end) if defined? GMagick::Image

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
asciidoctor-pdf-2.3.19 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.18 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.17 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.16 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.15 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.14 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.13 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.12 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.11 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.10 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.9 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.8 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.7 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.6 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.5 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.4 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.3 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.2 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.1 lib/asciidoctor/pdf/ext/prawn-gmagick.rb
asciidoctor-pdf-2.3.0 lib/asciidoctor/pdf/ext/prawn-gmagick.rb