Sha256: faa86eefa23f1e70069c7bc980738a3cde80fe27319fbf06844721bec8408245
Contents?: true
Size: 462 Bytes
Versions: 4
Compression:
Stored size: 462 Bytes
Contents
# frozen-string-literal: true module ChunkyPNG class Canvas # Methods to export a canvas to a PNG data URL. module DataUrlExporting # Exports the canvas as a data url (e.g. data:image/png;base64,<data>) that can # easily be used inline in CSS or HTML. # @return [String] The canvas formatted as a data URL string. def to_data_url ["data:image/png;base64,", to_blob].pack("A*m").delete("\n") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems