Skip to content

Commit

Permalink
Release 0.5.1 version.
Browse files Browse the repository at this point in the history
Fix color Int creation, by setting 0xff for alpha channel.
Transparency is not supported in BITMAPINFOHEADER.
  • Loading branch information
alexdupre committed May 7, 2021
1 parent a3ba24a commit e9e8dfd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import scala.scalanative.build._
name := "bmp4s"

ThisBuild / organization := "com.alexdupre"
ThisBuild / version := "0.5"
ThisBuild / version := "0.5.1"
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / scalaVersion := "2.13.5"
ThisBuild / scalacOptions := List("-feature", "-unchecked", "-deprecation", "-explaintypes", "-encoding", "UTF8", "-language:postfixOps")
Expand Down
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.1.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.7.0")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.8.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.0")
2 changes: 1 addition & 1 deletion src/main/scala/com/alexdupre/bmp/BMPImageInfo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ object BMPImageInfo {
private def readPalette(in: ReaderInterface, size: Int): Array[Int] = {
val buf = readBuf(in, size * 4)
buf.rewind()
Array.fill(size)(buf.getInt() & 0x00ffffff)
Array.fill(size)(0xff000000 | buf.getInt())
}

def read(in: ReaderInterface): BMPImageInfo = {
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/alexdupre/bmp/BMPImageLine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class BMPImageLine(info: BMPImageInfo) {
require(line.length - offset >= info.width, "Output buffer is too small")
in.read(rawLine)
val dataLine = wrappedRawLine()
for (i <- 0 until line.length) line(i + offset) = info.colorDepth match {
case 32 => dataLine.getInt() & 0xffffff
for (i <- 0 until line.length) line(i + offset) = 0xff000000 | info.colorDepth match {
case 32 => dataLine.getInt()
case 24 =>
val b = dataLine.get() & 0xff
val g = dataLine.get() & 0xff
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/com/alexdupre/bmp/BMPImageSeekableLine.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class BMPImageSeekableLine(info: BMPImageInfo) {
val rawLen = length * info.colorDepth / 8
in.read(rawLine, 0, rawLen)
val dataLine = wrappedRawLine()
for (i <- 0 until line.length) line(i + offset) = info.colorDepth match {
case 32 => dataLine.getInt() & 0xffffff
for (i <- 0 until line.length) line(i + offset) = 0xff000000 | info.colorDepth match {
case 32 => dataLine.getInt()
case 24 =>
val b = dataLine.get() & 0xff
val g = dataLine.get() & 0xff
Expand Down

0 comments on commit e9e8dfd

Please sign in to comment.