-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added methods to copy a pixel by changing one component.
- Loading branch information
Showing
7 changed files
with
96 additions
and
18 deletions.
There are no files selected for viewing
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
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
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
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
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
24 changes: 24 additions & 0 deletions
24
scrimage-tests/src/test/kotlin/com/sksamuel/scrimage/core/Issue239Test.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,24 @@ | ||
package com.sksamuel.scrimage.core | ||
|
||
import com.sksamuel.scrimage.ImmutableImage | ||
import com.sksamuel.scrimage.MutableImage | ||
import io.kotest.core.spec.style.FunSpec | ||
import java.awt.image.BufferedImage | ||
|
||
class Issue239Test : FunSpec({ | ||
|
||
// https://github.com/sksamuel/scrimage/issues/239 | ||
test("Pixels with alpha 0 turns black #239") { | ||
val image = ImmutableImage.loader().fromResource("/issue239.jpg") | ||
val mutImage = MutableImage(image.copy(BufferedImage.TYPE_INT_ARGB).awt()) | ||
for (pixel in mutImage.pixels()) { | ||
if (pixel.red() > 240 && pixel.green() > 240 && pixel.blue() > 240) { | ||
val newPixel = pixel.fullalpha().red(125).blue(0).green(0) | ||
mutImage.setPixel(newPixel) | ||
} | ||
} | ||
|
||
// issue was that the source image did not have alpha enabled | ||
} | ||
|
||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.