Module: Blurhash

Defined in:
lib/blurhash.rb,
lib/blurhash/version.rb

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.encode(width, height, pixels, x_comp: 4, y_comp: 3) ⇒ Object



7
8
9
10
11
12
# File 'lib/blurhash.rb', line 7

def self.encode(width, height, pixels, x_comp: 4, y_comp: 3)
  FFI::MemoryPointer.new(:u_int8_t, pixels.size) do |p|
    p.write_array_of_uint8(pixels)
    return Unstable.blurHashForPixels(x_comp, y_comp, width, height, p, width * 3)
  end
end