BlurhashFfiBindings class
Bindings for src/blurhash_ffi.h
.
Regenerate bindings with flutter pub run ffigen --config ffigen.yaml
.
Constructors
- BlurhashFfiBindings(DynamicLibrary dynamicLibrary)
-
The symbols are looked up in
dynamicLibrary
. -
BlurhashFfiBindings.fromLookup(Pointer<
T> lookup<T extends NativeType>(String symbolName) ) -
The symbols are looked up with
lookup
.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
blurHashForPixels(
int xComponents, int yComponents, int width, int height, Pointer< Uint8> rgb, int bytesPerRow) → Pointer<Char> -
encode : Returns the blurhash string for the given image
This function returns a string containing the BlurHash. This memory is managed by the function, and you should not free it.
It will be overwritten on the next call into the function, so be careful!
Parameters :
xComponents
- The number of components in the X direction. Must be between 1 and 9. 3 to 5 is usually a good range for this.yComponents
- The number of components in the Y direction. Must be between 1 and 9. 3 to 5 is usually a good range for this.width
- The width in pixels of the supplied image.height
- The height in pixels of the supplied image.rgb
- A pointer to the pixel data. This is supplied in RGBA format, with 4 bytes per pixels.bytesPerRow
- The number of bytes per row of the RGB pixel data. -
decode(
Pointer< Char> blurhash, int width, int height, int punch, int nChannels) → Pointer<Uint8> - decode : Returns the pixel array of the result image given the blurhash string, Parameters : blurhash : A string representing the blurhash to be decoded. width : Width of the resulting image height : Height of the resulting image punch : The factor to improve the contrast, default = 1 nChannels : Number of channels in the resulting image array, 3 = RGB, 4 = RGBA Returns : A pointer to memory region where pixels are stored in (H, W, C) format
-
decodeToArray(
Pointer< Char> blurhash, int width, int height, int punch, int nChannels, Pointer<Uint8> pixelArray) → int - decodeToArray : Decodes the blurhash and copies the pixels to pixelArray, This method is suggested if you use an external memory allocator for pixelArray. pixelArray should be of size : width * height * nChannels Parameters : blurhash : A string representing the blurhash to be decoded. width : Width of the resulting image height : Height of the resulting image punch : The factor to improve the contrast, default = 1 nChannels : Number of channels in the resulting image array, 3 = RGB, 4 = RGBA pixelArray : Pointer to memory region where pixels needs to be copied. Returns : int, -1 if error 0 if successful
-
freePixelArray(
Pointer< Uint8> pixelArray) → void - freePixelArray : Frees the pixel array Parameters : pixelArray : Pixel array pointer which will be freed. Returns : void (None)
-
isValidBlurhash(
Pointer< Char> blurhash) → bool - isValidBlurhash : Checks if the Blurhash is valid or not. Parameters : blurhash : A string representing the blurhash Returns : bool (true if it is a valid blurhash, else false)
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited