What's new:
- New gradient colour -
RhombusGradient
. Looks likeSquareGradient
, 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 withdefaultSerializersModule
property. It provides kotlinx-serializationSerializersModule
that should be used to serialize it instances.
There is global valueQrSerializersModule
, 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-levelQrOptionBuilderScope
to corresponding 2nd-level scopes. drawShapeModifier
renamed to 'drawShape`QrCanvasShapeModifier
renamed toQrCanvasShape
;QrBackgroundImage
renamed toQrBackground
;QrBackgroundColor
moved fromQrColors
toQrBackground
;QrLogo
andQrBackground
drawable
parameter changed fromDrawable
to wrapper -DrawableSource
;
It can beEmpty
,Resource
,File
. CustomDrawableSource
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 usingQrCodeGenerator
function (same name). Now it requiresContext
. OldQrGenerator
class is now internal and renamed toQrCodeGeneratorImpl
;- 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 newQrOffset
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