Skip to content

Commit

Permalink
Merge pull request #98 from kosenda/hot-fix/rgb-to-cmyk-mistate-value
Browse files Browse the repository at this point in the history
バグ: rgbToCmykの計算が間違っていてCMYKの計算結果がおかしくなる
  • Loading branch information
kosenda authored Apr 30, 2023
2 parents 5a8f15c + a66e25f commit 3d61a65
Show file tree
Hide file tree
Showing 16 changed files with 47 additions and 45 deletions.
12 changes: 6 additions & 6 deletions app/src/main/java/kosenda/makecolor/navigation/Navigation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ import kosenda.makecolor.feature.display.screen.SplitColorScreen
import kosenda.makecolor.feature.display.screen.SplitScreen
import kosenda.makecolor.feature.edit.RegisterScreen
import kosenda.makecolor.feature.info.InfoDialog
import kosenda.makecolor.feature.makecolor.screen.InputTextScreen
import kosenda.makecolor.feature.makecolor.screen.MergeScreen
import kosenda.makecolor.feature.makecolor.screen.PickerScreen
import kosenda.makecolor.feature.makecolor.screen.PictureScreen
import kosenda.makecolor.feature.makecolor.screen.RandomScreen
import kosenda.makecolor.feature.makecolor.screen.SeekbarScreen
import kosenda.makecolor.feature.screen.InputTextScreen
import kosenda.makecolor.feature.screen.MergeScreen
import kosenda.makecolor.feature.screen.PickerScreen
import kosenda.makecolor.feature.screen.PictureScreen
import kosenda.makecolor.feature.screen.RandomScreen
import kosenda.makecolor.feature.screen.SeekbarScreen
import kosenda.makecolor.feature.settings.SettingScreen
import kosenda.makecolor.ui.GoogleAd
import kotlinx.serialization.decodeFromString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class AndroidApplicationPlugin: Plugin<Project> {
applicationId = "kosenda.makecolor"
minSdk = 24
targetSdk = 33
versionCode = 37
versionName = "4.2"
versionCode = 38
versionName = "4.3"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ class UpdateOtherColorUseCase @Inject constructor() {
)
}
ColorType.CMYK -> {
val rgb = cmykToRgb(colorData.cmyk)
colorData.copy(
rgb = cmykToRgb(colorData.cmyk),
hsv = rgbToHsv(colorData.rgb),
hex = rgbToHex(colorData.rgb),
rgb = rgb,
hsv = rgbToHsv(rgb),
hex = rgbToHex(rgb),
)
}
ColorType.HSV -> {
val rgb = hsvToRGB(colorData.hsv)
colorData.copy(
rgb = hsvToRGB(colorData.hsv),
cmyk = rgbToCmyk(colorData.rgb),
hex = rgbToHex(colorData.rgb),
rgb = rgb,
cmyk = rgbToCmyk(rgb),
hex = rgbToHex(rgb),
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun rgbToCmyk(rgb: RGB): CMYK {
val blue: Float = (rgb.blue / 255f).coerceAtMost(1f)
val black: Float = when {
red == 1f || green == 1f || blue == 1f -> 0f
else -> ((1f - (max(red, max(green, blue)))) * 100f).coerceAtMost(100f)
else -> (1f - (max(red, max(green, blue)))).coerceAtMost(1f)
}
val cyan: Float = when {
black != 1f -> ((1f - red - black) / (1f - black) * 100f).coerceAtMost(100f)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.screen
package kosenda.makecolor.feature.screen

import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -33,9 +33,9 @@ import kosenda.makecolor.core.ui.feature.common.card.SpinnerCard
import kosenda.makecolor.core.ui.feature.common.topbar.TopBar
import kosenda.makecolor.core.ui.feature.theme.MakeColorTheme
import kosenda.makecolor.core.resource.R
import kosenda.makecolor.feature.makecolor.viewmodel.InputTextViewModel
import kosenda.makecolor.feature.makecolor.viewmodel.InputTextViewModelImpl
import kosenda.makecolor.feature.makecolor.viewmodel.PreviewInputTextViewModel
import kosenda.makecolor.feature.viewmodel.InputTextViewModel
import kosenda.makecolor.feature.viewmodel.InputTextViewModelImpl
import kosenda.makecolor.feature.viewmodel.PreviewInputTextViewModel
import kosenda.makecolor.feature.preview.PreviewSurface

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.screen
package kosenda.makecolor.feature.screen

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -41,9 +41,9 @@ import kosenda.makecolor.core.ui.feature.common.topbar.TopBar
import kosenda.makecolor.core.ui.feature.theme.MakeColorTheme
import kosenda.makecolor.core.util.getNameIfNoAlias
import kosenda.makecolor.core.resource.R
import kosenda.makecolor.feature.makecolor.viewmodel.MergeViewModel
import kosenda.makecolor.feature.makecolor.viewmodel.MergeViewModelImpl
import kosenda.makecolor.feature.makecolor.viewmodel.PreviewMergeViewModel
import kosenda.makecolor.feature.viewmodel.MergeViewModel
import kosenda.makecolor.feature.viewmodel.MergeViewModelImpl
import kosenda.makecolor.feature.viewmodel.PreviewMergeViewModel
import kosenda.makecolor.feature.preview.PreviewSurface
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.screen
package kosenda.makecolor.feature.screen

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
Expand Down Expand Up @@ -35,9 +35,9 @@ import kosenda.makecolor.core.ui.feature.common.card.HarmonyColorPickerCard
import kosenda.makecolor.core.ui.feature.common.card.SpinnerCard
import kosenda.makecolor.core.ui.feature.common.topbar.TopBar
import kosenda.makecolor.core.ui.feature.theme.MakeColorTheme
import kosenda.makecolor.feature.makecolor.viewmodel.PickerViewModel
import kosenda.makecolor.feature.makecolor.viewmodel.PickerViewModelImpl
import kosenda.makecolor.feature.makecolor.viewmodel.PreviewPickerViewModel
import kosenda.makecolor.feature.viewmodel.PickerViewModel
import kosenda.makecolor.feature.viewmodel.PickerViewModelImpl
import kosenda.makecolor.feature.viewmodel.PreviewPickerViewModel
import kosenda.makecolor.feature.preview.PreviewSurface

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.screen
package kosenda.makecolor.feature.screen

import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
Expand Down Expand Up @@ -36,9 +36,9 @@ import kosenda.makecolor.core.ui.feature.common.card.SelectImageCard
import kosenda.makecolor.core.ui.feature.common.topbar.TopBar
import kosenda.makecolor.core.ui.feature.theme.MakeColorTheme
import kosenda.makecolor.core.resource.R
import kosenda.makecolor.feature.makecolor.viewmodel.PictureViewModel
import kosenda.makecolor.feature.makecolor.viewmodel.PictureViewModelImpl
import kosenda.makecolor.feature.makecolor.viewmodel.PreviewPictureViewModel
import kosenda.makecolor.feature.viewmodel.PictureViewModel
import kosenda.makecolor.feature.viewmodel.PictureViewModelImpl
import kosenda.makecolor.feature.viewmodel.PreviewPictureViewModel
import kosenda.makecolor.feature.preview.PreviewSurface

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.screen
package kosenda.makecolor.feature.screen

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -31,9 +31,9 @@ import kosenda.makecolor.core.ui.feature.common.card.RandomColorsCard
import kosenda.makecolor.core.ui.feature.common.card.SpinnerCard
import kosenda.makecolor.core.ui.feature.common.topbar.TopBar
import kosenda.makecolor.core.ui.feature.theme.MakeColorTheme
import kosenda.makecolor.feature.makecolor.viewmodel.PreviewRandomViewModel
import kosenda.makecolor.feature.makecolor.viewmodel.RandomViewModel
import kosenda.makecolor.feature.makecolor.viewmodel.RandomViewModelImpl
import kosenda.makecolor.feature.viewmodel.PreviewRandomViewModel
import kosenda.makecolor.feature.viewmodel.RandomViewModel
import kosenda.makecolor.feature.viewmodel.RandomViewModelImpl
import kosenda.makecolor.feature.preview.PreviewSurface

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.screen
package kosenda.makecolor.feature.screen

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
Expand Down Expand Up @@ -31,9 +31,9 @@ import kosenda.makecolor.core.ui.feature.common.card.SpinnerCard
import kosenda.makecolor.core.ui.feature.common.topbar.TopBar
import kosenda.makecolor.core.ui.feature.theme.MakeColorTheme
import kosenda.makecolor.core.resource.R
import kosenda.makecolor.feature.makecolor.viewmodel.PreviewSeekbarViewModel
import kosenda.makecolor.feature.makecolor.viewmodel.SeekbarViewModel
import kosenda.makecolor.feature.makecolor.viewmodel.SeekbarViewModelImpl
import kosenda.makecolor.feature.viewmodel.PreviewSeekbarViewModel
import kosenda.makecolor.feature.viewmodel.SeekbarViewModel
import kosenda.makecolor.feature.viewmodel.SeekbarViewModelImpl
import kosenda.makecolor.feature.preview.PreviewSurface

@Composable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.viewmodel
package kosenda.makecolor.feature.viewmodel

import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.viewmodel
package kosenda.makecolor.feature.viewmodel

import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Brush
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.viewmodel
package kosenda.makecolor.feature.viewmodel

import androidx.lifecycle.ViewModel
import com.godaddy.android.colorpicker.HsvColor
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.viewmodel
package kosenda.makecolor.feature.viewmodel

import android.content.Context
import android.graphics.Bitmap
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.viewmodel
package kosenda.makecolor.feature.viewmodel

import androidx.compose.ui.graphics.Color
import androidx.lifecycle.ViewModel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package kosenda.makecolor.feature.makecolor.viewmodel
package kosenda.makecolor.feature.viewmodel

import androidx.lifecycle.ViewModel
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down

0 comments on commit 3d61a65

Please sign in to comment.