-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from alexzhirkevich/highlighting
Added highlighting for anchor elements
- Loading branch information
Showing
11 changed files
with
494 additions
and
153 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
..._qr_generator/src/main/java/com/github/alexzhirkevich/customqrgenerator/QrHighlighting.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.github.alexzhirkevich.customqrgenerator | ||
|
||
import androidx.annotation.FloatRange | ||
import com.github.alexzhirkevich.customqrgenerator.vector.style.QrVectorColor | ||
import com.github.alexzhirkevich.customqrgenerator.vector.style.QrVectorShapeModifier | ||
|
||
|
||
interface IAnchorsHighlighting { | ||
val cornerEyes : HighlightingType | ||
val versionEyes : HighlightingType | ||
val timingLines : HighlightingType | ||
val alpha : Float | ||
} | ||
|
||
|
||
|
||
/** | ||
* Highlighting of the anchor QR code elements. | ||
* Has the most impact when using a background image or color | ||
* | ||
* @param cornerEyes background highlighting of the corner eyes | ||
* @param versionEyes background and draw mode of version eyes | ||
* @param timingLines vertical and horizontal lines of interleaved pixels | ||
* */ | ||
data class QrHighlighting( | ||
override val cornerEyes : HighlightingType = HighlightingType.None, | ||
override val versionEyes : HighlightingType = HighlightingType.None, | ||
override val timingLines : HighlightingType = HighlightingType.None, | ||
@FloatRange(from = 0.0, to = 1.0) override val alpha: Float = .75f | ||
) : IAnchorsHighlighting | ||
|
||
|
||
|
||
sealed interface HighlightingType { | ||
|
||
object None : HighlightingType | ||
|
||
object Default : HighlightingType | ||
|
||
class Styled( | ||
val shape : QrVectorShapeModifier? = null, | ||
val color : QrVectorColor? = null | ||
) : HighlightingType | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.