Reformat with scalafmt 3.5.1

This commit is contained in:
Scala Steward 2022-04-16 20:42:16 +02:00
parent 37d840b365
commit b402d34be8
No known key found for this signature in database
GPG Key ID: 96BDF10FFAB8B6A6
3 changed files with 7 additions and 7 deletions

View File

@ -46,7 +46,7 @@ class BackgroundTask(config: Config, captchaManager: CaptchaManager) {
(captcha.allowedLevels).flatMap { level =>
(captcha.allowedMedia).flatMap { media =>
(captcha.allowedInputType).flatMap { inputType =>
(captcha.allowedSizes).map {size =>
(captcha.allowedSizes).map { size =>
Parameters(level, media, inputType, size)
}
}

View File

@ -43,16 +43,16 @@ class FilterChallenge extends ChallengeProvider {
val height = size2D(1)
val canvas = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB)
val g = canvas.createGraphics()
val fontHeight = (height*0.6).toInt
val fontHeight = (height * 0.6).toInt
g.setColor(Color.WHITE)
g.fillRect(0, 0, canvas.getWidth, canvas.getHeight)
g.setColor(Color.BLACK)
val font = new Font("Serif", Font.BOLD, fontHeight)
g.setFont(font)
val stringWidth = g.getFontMetrics().stringWidth(secret)
val scaleX = if (stringWidth > width) width/(stringWidth.toDouble) else 1d
val scaleX = if (stringWidth > width) width / (stringWidth.toDouble) else 1d
val margin = if (stringWidth > width) 0 else (width - stringWidth)
val xOffset = (margin*r.nextDouble).toInt
val xOffset = (margin * r.nextDouble).toInt
g.scale(scaleX, 1d)
g.drawString(secret, xOffset, fontHeight)
g.dispose()

View File

@ -128,13 +128,13 @@ class RainDropsCP extends ChallengeProvider {
val textX = if (textWidth > width) 0 else ((width - textWidth) / 2)
// this will be overlapped by the following text to show the top outline because of the offset
val yOffset = (fontHeight*0.01).ceil.toInt
val yOffset = (fontHeight * 0.01).ceil.toInt
g.setColor(textHighlightColor)
g.drawString(secret, textX, (fontHeight*1.1).toInt - yOffset)
g.drawString(secret, textX, (fontHeight * 1.1).toInt - yOffset)
// paint the text
g.setColor(textColor)
g.drawString(secret, textX, (fontHeight*1.1).toInt)
g.drawString(secret, textX, (fontHeight * 1.1).toInt)
g.dispose()
writer.writeToSequence(canvas)