comparison src/name/blackcap/imageprep/RotateDialog.kt @ 8:b5fcabce391f

Use bicubic interpolation, like Gimp.
author David Barts <n5jrn@me.com>
date Fri, 17 Jul 2020 22:56:00 -0700
parents 9129ae110146
children 1f824742e1fa
comparison
equal deleted inserted replaced
7:801cdc780ca8 8:b5fcabce391f
130 } else { 130 } else {
131 val nWidth = (imageIn.width * ratio).toInt() 131 val nWidth = (imageIn.width * ratio).toInt()
132 val nHeight = (imageIn.height * ratio).toInt() 132 val nHeight = (imageIn.height * ratio).toInt()
133 val imageOut = BufferedImage(nWidth, nHeight, BufferedImage.TYPE_INT_RGB) 133 val imageOut = BufferedImage(nWidth, nHeight, BufferedImage.TYPE_INT_RGB)
134 val graphics = imageOut.createGraphics().apply { 134 val graphics = imageOut.createGraphics().apply {
135 setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR) 135 setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC)
136 setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY) 136 setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY)
137 setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON) 137 setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
138 } 138 }
139 graphics.drawImage(imageIn, 0, 0, nWidth, nHeight, null) 139 graphics.drawImage(imageIn, 0, 0, nWidth, nHeight, null)
140 Pair(imageOut, null) 140 Pair(imageOut, null)