github alexzhirkevich/custom-qr-generator 1.4.0

latest releases: 2.0.0-alpha01, 1.6.2, 1.6.1...
2 years ago

What's new:

  • New gradient colour - RhombusGradient. Looks like SquareGradient, but rotated by 45 degree;
  • New QrOptions parameter - QrOffset. Now QR code pattern can have x and y offset;
  • Added serialization ability. Now QrOptions, QrData or any class from style package can be serialized using kotlinx-serialization.
    All options and QrData classes marked as @Serializable. Every class with interface preperties (or interfaces itself) now have companion object with defaultSerializersModule property. It provides kotlinx-serialization SerializersModule that should be used to serialize it instances.
    There is global value QrSerializersModule, that can be used to serialize any serializable class instance.
    [!] If you implemented custom shape, color or other option, it must be added to module.
    Serialization can be useful for remote config QR code style changing or to store generated codes with their options for later modification (for ex, in QR code generator apps)

Changes:

  • Reworked DSL. Parameter instantiationing replaced with corresponding builder functions with own scopes.
    Canvas shape and colour builders moved from top-level QrOptionBuilderScope to corresponding 2nd-level scopes.
  • drawShapeModifier renamed to 'drawShape`
  • QrCanvasShapeModifier renamed to QrCanvasShape;
  • QrBackgroundImage renamed to QrBackground;
  • QrBackgroundColor moved from QrColors to QrBackground;
  • QrLogo and QrBackground drawable parameter changed from Drawable to wrapper - DrawableSource;
    It can be Empty, Resource, File. Custom DrawableSource can be implemented (for example web source). It made due to serialization needs and to simplify drawable picking from file system. It automatically disables mutability flag from picked image (mutable bitmaps cause exception);
  • QrCodeGenerator instance must now be created using QrCodeGenerator function (same name). Now it requires Context. Old QrGenerator class is now internal and renamed to QrCodeGeneratorImpl;
  • Reworked options size parameter. size -> width & height. Now width can be unequal to height (does not affect QR code pattern, it is still square). With new QrOffset parameter, it can be useful for non-square backgrounds (for example, frame with "SCAN ME" label below)

Fixed bugs:

  • Fixed image blending bugs. Visual glitches could occur if your background or logo image had partially transparent pixels.
  • Fixed RadialGradient. Now it is true radial. Radius can be > 1

Don't miss a new custom-qr-generator release

NewReleases is sending notifications on new releases.