mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-26 02:28:24 +00:00
Color Wheel: a test for the gray over out-of-gamut cells
- A new test paints a two-by-two grid and checks that the gray covers the marked cells only and that each edge is drawn dark, then light. - The "Show Out-of-Gamut Colors" catalog row moves to right after "Box View", next to the panel's other menu items, in every catalog. - The gamut_grid doc comment says that a pick's color is tested before any conversion to CMYK or Lab, which happens only for some targets. - The test profile's guard is created after the profile registers.
This commit is contained in:
@@ -559,10 +559,10 @@ font-technology Variable Променливи
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Изглед „Колело“
|
||||
Box View Изглед „Квадрат“
|
||||
Show Out-of-Gamut Colors Показване на цветовете извън цветовата гама
|
||||
Box Channel Канал на квадрата
|
||||
Color box Цветови квадрат
|
||||
Color Wheel Options Опции на цветното колело
|
||||
Show Out-of-Gamut Colors Показване на цветовете извън цветовата гама
|
||||
Color Type: Цветен тип:
|
||||
Color: Цвят:
|
||||
Colorize Оцветяване
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -737,10 +737,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Prikaz kotača
|
||||
Box View Prikaz kvadrata
|
||||
Show Out-of-Gamut Colors Prikaži boje izvan gamuta
|
||||
Box Channel Kanal kvadrata
|
||||
Color box Kvadrat boje
|
||||
Color Wheel Options Opcije kotača boja
|
||||
Show Out-of-Gamut Colors Prikaži boje izvan gamuta
|
||||
CSS Properties CSS svojstva
|
||||
Document Info Informacije o dokumentu
|
||||
Flattener Preview Pregled spljoštavanja
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -821,10 +821,10 @@ antiAlias Sharp Nítid
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Visualització de roda
|
||||
Box View Visualització de quadre
|
||||
Show Out-of-Gamut Colors Mostra els colors fora de gama
|
||||
Box Channel Canal del quadre
|
||||
Color box Quadre de color
|
||||
Color Wheel Options Opcions de la roda de colors
|
||||
Show Out-of-Gamut Colors Mostra els colors fora de gama
|
||||
Color Type: Tipus de color:
|
||||
Color wheel Roda de color
|
||||
Color: Color:
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -750,10 +750,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Zobrazení kola
|
||||
Box View Zobrazení čtverce
|
||||
Show Out-of-Gamut Colors Zobrazit barvy mimo gamut
|
||||
Box Channel Kanál čtverce
|
||||
Color box Barevný čtverec
|
||||
Color Wheel Options Možnosti barevného kola
|
||||
Show Out-of-Gamut Colors Zobrazit barvy mimo gamut
|
||||
CSS Properties Vlastnosti CSS
|
||||
Document Info Informace o dokumentu
|
||||
Flattener Preview Náhled sloučení
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -695,10 +695,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Hjulvisning
|
||||
Box View Kvadratvisning
|
||||
Show Out-of-Gamut Colors Vis farver uden for gamut
|
||||
Box Channel Kvadratets kanal
|
||||
Color box Farvekvadrat
|
||||
Color Wheel Options Indstillinger for farvehjul
|
||||
Show Out-of-Gamut Colors Vis farver uden for gamut
|
||||
CSS Properties CSS-egenskaber
|
||||
Document Info Dokumentoplysninger
|
||||
Flattener Preview Udjævningsforhåndsvisning
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -552,10 +552,10 @@ font-technology Variable Variabel
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Kreisansicht
|
||||
Box View Quadratansicht
|
||||
Show Out-of-Gamut Colors Farben außerhalb des Farbumfangs einblenden
|
||||
Box Channel Kanal des Quadrats
|
||||
Color box Farbquadrat
|
||||
Color Wheel Options Optionen für den Farbkreis
|
||||
Show Out-of-Gamut Colors Farben außerhalb des Farbumfangs einblenden
|
||||
Color Type: Farbart:
|
||||
Color: Farbe:
|
||||
Colorize Einfärben
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -534,10 +534,10 @@ font-technology Variable Μεταβλητές
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Προβολή τροχού
|
||||
Box View Προβολή τετραγώνου
|
||||
Show Out-of-Gamut Colors Εμφάνιση χρωμάτων εκτός χρωματικής γκάμας
|
||||
Box Channel Κανάλι τετραγώνου
|
||||
Color box Τετράγωνο χρώματος
|
||||
Color Wheel Options Επιλογές χρωματικού τροχού
|
||||
Show Out-of-Gamut Colors Εμφάνιση χρωμάτων εκτός χρωματικής γκάμας
|
||||
Color Type: Τύπος χρώματος:
|
||||
Color: Χρώμα:
|
||||
Colorize Χρωματισμός
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -574,10 +574,10 @@ font-technology Variable Variables
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Vista de rueda
|
||||
Box View Vista de cuadro
|
||||
Show Out-of-Gamut Colors Mostrar colores fuera de gama
|
||||
Box Channel Canal del cuadro
|
||||
Color box Cuadro de color
|
||||
Color Wheel Options Opciones de la rueda de color
|
||||
Show Out-of-Gamut Colors Mostrar colores fuera de gama
|
||||
Color Type: Tipo de color:
|
||||
Color: Color:
|
||||
Colorize Colorear
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -741,10 +741,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Ympyränäkymä
|
||||
Box View Ruutunäkymä
|
||||
Show Out-of-Gamut Colors Näytä väriavaruuden ulkopuoliset värit
|
||||
Box Channel Ruudun kanava
|
||||
Color box Väriruutu
|
||||
Color Wheel Options Väriympyrän asetukset
|
||||
Show Out-of-Gamut Colors Näytä väriavaruuden ulkopuoliset värit
|
||||
CSS Properties CSS-ominaisuudet
|
||||
Document Info Asiakirjan tiedot
|
||||
Flattener Preview Litistyksen esikatselu
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -575,10 +575,10 @@ font-technology Variable Variables
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Affichage roue
|
||||
Box View Affichage carré
|
||||
Show Out-of-Gamut Colors Afficher les couleurs hors gamme
|
||||
Box Channel Couche du carré
|
||||
Color box Carré de couleur
|
||||
Color Wheel Options Options de la roue chromatique
|
||||
Show Out-of-Gamut Colors Afficher les couleurs hors gamme
|
||||
Color Type: Type de couleur :
|
||||
Color: Couleur :
|
||||
Colorize Coloriser
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -4226,10 +4226,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View વ્હીલ વ્યૂ
|
||||
Box View બૉક્સ વ્યૂ
|
||||
Show Out-of-Gamut Colors ગેમટ બહારના રંગો બતાવો
|
||||
Box Channel બૉક્સ ચેનલ
|
||||
Color box રંગ બૉક્સ
|
||||
Color Wheel Options રંગ વ્હીલ વિકલ્પો
|
||||
Show Out-of-Gamut Colors ગેમટ બહારના રંગો બતાવો
|
||||
{name} (spot) {name} (સ્પૉટ)
|
||||
{pages} in all, {count} per copy કુલ {pages}, પ્રતિ નકલ {count}
|
||||
{page} of {count} {count} માંથી {page}
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 72 and column 5.
|
@@ -945,10 +945,10 @@ antiAlias Sharp शार्प
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View व्हील व्यू
|
||||
Box View बॉक्स व्यू
|
||||
Show Out-of-Gamut Colors गैमट से बाहर के रंग दिखाएँ
|
||||
Box Channel बॉक्स चैनल
|
||||
Color box कलर बॉक्स
|
||||
Color Wheel Options कलर व्हील ऑप्शन्स
|
||||
Show Out-of-Gamut Colors गैमट से बाहर के रंग दिखाएँ
|
||||
Color Type: रंग का प्रकार:
|
||||
Color wheel कलर व्हील
|
||||
Color: रंग:
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -750,10 +750,10 @@ font-technology Variable Változó
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Körnézet
|
||||
Box View Négyzetnézet
|
||||
Show Out-of-Gamut Colors Színtartományon kívüli színek megjelenítése
|
||||
Box Channel Négyzet csatornája
|
||||
Color box Színnégyzet
|
||||
Color Wheel Options Színkör beállításai
|
||||
Show Out-of-Gamut Colors Színtartományon kívüli színek megjelenítése
|
||||
Color Type: Színtípus:
|
||||
Color: Szín:
|
||||
Colorization Színezés
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -695,10 +695,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Tampilan roda
|
||||
Box View Tampilan kotak
|
||||
Show Out-of-Gamut Colors Tampilkan warna di luar gamut
|
||||
Box Channel Saluran kotak
|
||||
Color box Kotak warna
|
||||
Color Wheel Options Opsi roda warna
|
||||
Show Out-of-Gamut Colors Tampilkan warna di luar gamut
|
||||
CSS Properties Properti CSS
|
||||
Document Info Info dokumen
|
||||
Flattener Preview Pratinjau perata
|
||||
|
||||
|
@@ -574,10 +574,10 @@ font-technology Variable Variabili
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Vista ruota
|
||||
Box View Vista riquadro
|
||||
Show Out-of-Gamut Colors Mostra colori fuori gamma
|
||||
Box Channel Canale del riquadro
|
||||
Color box Riquadro colore
|
||||
Color Wheel Options Opzioni ruota dei colori
|
||||
Show Out-of-Gamut Colors Mostra colori fuori gamma
|
||||
Color Type: Tipo di colore:
|
||||
Color: Colore:
|
||||
Colorize Colora
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -765,10 +765,10 @@ digits Malayalam マラヤーラム数字
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}、{name2} {value2}
|
||||
Wheel View ホイール表示
|
||||
Box View ボックス表示
|
||||
Show Out-of-Gamut Colors 色域外のカラーを表示
|
||||
Box Channel ボックスのチャンネル
|
||||
Color box カラーボックス
|
||||
Color Wheel Options カラーホイールオプション
|
||||
Show Out-of-Gamut Colors 色域外のカラーを表示
|
||||
CSS Properties CSS プロパティ
|
||||
Document Info ドキュメント情報
|
||||
Flattener Preview 分割・統合プレビュー
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -661,10 +661,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View წრის ხედი
|
||||
Box View კვადრატის ხედი
|
||||
Show Out-of-Gamut Colors ფერთა გამის გარეთ მყოფი ფერების ჩვენება
|
||||
Box Channel კვადრატის არხი
|
||||
Color box ფერის კვადრატი
|
||||
Color Wheel Options ფერთა წრის პარამეტრები
|
||||
Show Out-of-Gamut Colors ფერთა გამის გარეთ მყოფი ფერების ჩვენება
|
||||
CSS Properties CSS თვისებები
|
||||
Document Info დოკუმენტის ინფორმაცია
|
||||
Flattener Preview გაბრტყელების წინასწარი ნახვა
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -758,10 +758,10 @@ digits Malayalam 말라얄람어
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View 휠 보기
|
||||
Box View 상자 보기
|
||||
Show Out-of-Gamut Colors 색상 범위를 벗어난 색상 표시
|
||||
Box Channel 상자 채널
|
||||
Color box 색상 상자
|
||||
Color Wheel Options 색상환 옵션
|
||||
Show Out-of-Gamut Colors 색상 범위를 벗어난 색상 표시
|
||||
CSS Properties CSS 속성
|
||||
Document Info 문서 정보
|
||||
Flattener Preview 병합 미리 보기
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -1213,10 +1213,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Wielweergave
|
||||
Box View Vakweergave
|
||||
Show Out-of-Gamut Colors Kleuren buiten gamut tonen
|
||||
Box Channel Kanaal van het vak
|
||||
Color box Kleurvak
|
||||
Color Wheel Options Opties voor kleurenwiel
|
||||
Show Out-of-Gamut Colors Kleuren buiten gamut tonen
|
||||
CSS Properties CSS-eigenschappen
|
||||
Document Info Documentinfo
|
||||
Flattener Preview Afvlakvoorbeeld
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -699,10 +699,10 @@
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Widok koła
|
||||
Box View Widok kwadratu
|
||||
Show Out-of-Gamut Colors Pokaż kolory poza gamutem
|
||||
Box Channel Kanał kwadratu
|
||||
Color box Kwadrat koloru
|
||||
Color Wheel Options Opcje koła kolorów
|
||||
Show Out-of-Gamut Colors Pokaż kolory poza gamutem
|
||||
CSS Properties Właściwości CSS
|
||||
Document Info Informacje o dokumencie
|
||||
Flattener Preview Podgląd spłaszczania
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -519,10 +519,10 @@ antiAlias Sharp Nítido
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Exibição em Roda
|
||||
Box View Exibição em Caixa
|
||||
Show Out-of-Gamut Colors Mostrar Cores Fora do Gamut
|
||||
Box Channel Canal da Caixa
|
||||
Color box Caixa de cor
|
||||
Color Wheel Options Opções da Roda de Cores
|
||||
Show Out-of-Gamut Colors Mostrar Cores Fora do Gamut
|
||||
Color Type: Tipo de Cor:
|
||||
Color blindness – Deuteranopia-type Daltonismo – tipo deuteranopia
|
||||
Color blindness – Protanopia-type Daltonismo – tipo protanopia
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -572,10 +572,10 @@ font-technology Variable Вариативные
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Вид «Круг»
|
||||
Box View Вид «Квадрат»
|
||||
Show Out-of-Gamut Colors Показать цвета вне цветового охвата
|
||||
Box Channel Канал квадрата
|
||||
Color box Цветовой квадрат
|
||||
Color Wheel Options Параметры цветового круга
|
||||
Show Out-of-Gamut Colors Показать цвета вне цветового охвата
|
||||
Color Type: Тип цвета:
|
||||
Color: Цвет:
|
||||
Colorize Тонировать
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -561,10 +561,10 @@ font-technology Variable Variabla
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Hjulvy
|
||||
Box View Rutvy
|
||||
Show Out-of-Gamut Colors Visa färger utanför färgomfånget
|
||||
Box Channel Rutans kanal
|
||||
Color box Färgruta
|
||||
Color Wheel Options Alternativ för färghjulet
|
||||
Show Out-of-Gamut Colors Visa färger utanför färgomfånget
|
||||
Color Type: Färgtyp:
|
||||
Color: Färg:
|
||||
Colorize Färglägg
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -555,10 +555,10 @@ font-technology Variable Değişken
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Tekerlek Görünümü
|
||||
Box View Kutu Görünümü
|
||||
Show Out-of-Gamut Colors Gamut Dışı Renkleri Göster
|
||||
Box Channel Kutu Kanalı
|
||||
Color box Renk kutusu
|
||||
Color Wheel Options Renk Tekerleği Seçenekleri
|
||||
Show Out-of-Gamut Colors Gamut Dışı Renkleri Göster
|
||||
Color Type: Renk Türü:
|
||||
Color: Renk:
|
||||
Colorize Renklendir
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 25.
|
@@ -568,10 +568,10 @@ font-technology Variable Варіативні
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Вигляд «Коло»
|
||||
Box View Вигляд «Квадрат»
|
||||
Show Out-of-Gamut Colors Показати кольори поза колірним охопленням
|
||||
Box Channel Канал квадрата
|
||||
Color box Колірний квадрат
|
||||
Color Wheel Options Параметри колірного кола
|
||||
Show Out-of-Gamut Colors Показати кольори поза колірним охопленням
|
||||
Color Type: Тип кольору:
|
||||
Color: Колір:
|
||||
Colorize Тонувати
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -661,10 +661,10 @@ font-technology Variable Biến thiên
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1}, {name2} {value2}
|
||||
Wheel View Hiển thị bánh xe
|
||||
Box View Hiển thị hộp
|
||||
Show Out-of-Gamut Colors Hiện màu ngoài dải màu
|
||||
Box Channel Kênh của hộp
|
||||
Color box Hộp màu
|
||||
Color Wheel Options Tùy chọn bánh xe màu
|
||||
Show Out-of-Gamut Colors Hiện màu ngoài dải màu
|
||||
Color Type: Loại màu:
|
||||
Color: Màu:
|
||||
Colorization Tô màu
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 204 and column 5.
|
@@ -520,10 +520,10 @@ antiAlias Sharp 锐利
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1},{name2} {value2}
|
||||
Wheel View 色轮视图
|
||||
Box View 方块视图
|
||||
Show Out-of-Gamut Colors 显示超出色域的颜色
|
||||
Box Channel 方块色版
|
||||
Color box 颜色方块
|
||||
Color Wheel Options 色轮选项
|
||||
Show Out-of-Gamut Colors 显示超出色域的颜色
|
||||
Color Type: 颜色类型:
|
||||
Color: 颜色:
|
||||
Colorize 上色
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -537,10 +537,10 @@ font-technology Variable 可變
|
||||
{name1} {value1}, {name2} {value2} {name1} {value1},{name2} {value2}
|
||||
Wheel View 色輪檢視
|
||||
Box View 方塊檢視
|
||||
Show Out-of-Gamut Colors 顯示超出色域的顏色
|
||||
Box Channel 方塊色版
|
||||
Color box 顏色方塊
|
||||
Color Wheel Options 色輪選項
|
||||
Show Out-of-Gamut Colors 顯示超出色域的顏色
|
||||
Color Type: 顏色類型:
|
||||
Color: 顏色:
|
||||
Colorize 上色
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -169,9 +169,9 @@ pub(crate) const GAMUT_CELLS: usize = 16;
|
||||
pub(crate) type GamutGrid = [u16; GAMUT_CELLS];
|
||||
|
||||
/// The out-of-gamut cells of the box of channel `ch` at strip value `z` through `cms`, each tested
|
||||
/// at its center by the out-of-gamut warning's test ([`Cms::out_of_gamut`]) on the working-RGB color
|
||||
/// of a pick there, before [`stored`] converts it to CMYK or Lab. The wheel's square is the box of
|
||||
/// [`Channel::Hue`] at the ring's hue.
|
||||
/// at its center by the out-of-gamut warning's test ([`Cms::out_of_gamut`]) on the working-RGB
|
||||
/// color of a pick there, before any conversion to CMYK or Lab in [`stored`]. The wheel's square is
|
||||
/// the box of [`Channel::Hue`] at the ring's hue.
|
||||
pub(crate) fn gamut_grid(cms: &Cms, ch: Channel, z: f32) -> GamutGrid {
|
||||
let n = GAMUT_CELLS as f32;
|
||||
let mut grid = [0; GAMUT_CELLS];
|
||||
|
||||
@@ -116,8 +116,8 @@ fn the_grid_is_computed_again_after_a_profile_is_loaded() {
|
||||
}
|
||||
let name = "Color Wheel Gamut Reload CMYK";
|
||||
let bytes = cms::icc_bytes(cms::GENERIC_CMYK).unwrap();
|
||||
let _unregister = Unregister(name);
|
||||
cms::register_icc(&bytes, Some(name.into())).unwrap();
|
||||
let _unregister = Unregister(name);
|
||||
h.run_steps(2);
|
||||
let Some((after, _)) = drawn(&h) else { panic!("the box drew no grid") };
|
||||
assert_eq!((after.0, after.1, &after.2), (before.0, before.1, &before.2));
|
||||
@@ -221,3 +221,34 @@ fn the_edge_runs_between_marked_and_unmarked_cells() {
|
||||
assert_eq!(crate::widgets::shade_edges(&[0b100]), Vec::<[(usize, usize); 2]>::new(), "bit 2 is past a 1 × 1 grid");
|
||||
assert_eq!(crate::widgets::shade_edges(&[]), Vec::<[(usize, usize); 2]>::new());
|
||||
}
|
||||
|
||||
/// The gray covers each marked cell and no other, and each edge is drawn dark, then light on top.
|
||||
#[test]
|
||||
fn the_gray_covers_the_marked_cells_only() {
|
||||
use egui::{Pos2, Rect, Shape};
|
||||
let ctx = egui::Context::default();
|
||||
let rect = Rect::from_min_size(Pos2::new(10.0, 20.0), vec2(16.0, 16.0));
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| crate::widgets::shade_cells(ui.painter(), rect, &[0b01, 0b10]));
|
||||
out.textures_delta.clear();
|
||||
let grays: Vec<Rect> = out
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|c| match &c.shape {
|
||||
Shape::Rect(r) if r.fill == crate::widgets::SHADE => Some(r.rect),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
let cell = |col: f32, row: f32| Rect::from_min_size(Pos2::new(10.0 + col * 8.0, 20.0 + row * 8.0), vec2(8.0, 8.0));
|
||||
assert_eq!(grays, vec![cell(0.0, 0.0), cell(1.0, 1.0)]);
|
||||
let lines: Vec<(f32, egui::Color32)> = out
|
||||
.shapes
|
||||
.iter()
|
||||
.filter_map(|c| match &c.shape {
|
||||
Shape::LineSegment { stroke, .. } => Some((stroke.width, stroke.color)),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
let dark = vec![(2.0, egui::Color32::BLACK); 4];
|
||||
let light = vec![(1.0, egui::Color32::WHITE); 4];
|
||||
assert_eq!(lines, [dark, light].concat(), "four edges, dark under light");
|
||||
}
|
||||
|
||||
@@ -34,14 +34,14 @@ pub(crate) use buttons::{button_width, icon_button_info, primary_button_width, s
|
||||
#[cfg(test)]
|
||||
use chips::gradient_chip_colors;
|
||||
pub use chips::{ProxyClicks, chip_button, chip_button_named, fill_stroke_proxy, gradient_chip, paint_chip, proxy_chip, swatch_tile};
|
||||
#[cfg(test)]
|
||||
pub(crate) use color::shade_edges;
|
||||
pub use color::{
|
||||
FieldAxis, Live, RingResponse, SliderValue, WheelResponse, channel_slider, channel_slider_named, channel_slider_stepped, channel_slider_valued,
|
||||
color_field, color_field_shaded, color_mesh, color_slider, color_slider_named, color_slider_stepped, color_slider_valued, harmony_wheel,
|
||||
hex_field, hex_field_named, hsb32, hue_ring, region_texture, ring_square, segment_color, segmented_wheel, stepped_area,
|
||||
};
|
||||
pub(crate) use color::{HEX_FIELD_CHARS, hex_text, pointer_phase};
|
||||
#[cfg(test)]
|
||||
pub(crate) use color::{SHADE, shade_cells, shade_edges};
|
||||
pub use drag::{
|
||||
PanelDrag, RowClick, SwatchRows, apply_row_click, art_drop, doc_preview, drag_ghost, drag_source, drop_target_outline, ghost_row, row_click,
|
||||
};
|
||||
|
||||
@@ -463,7 +463,7 @@ pub fn color_field_shaded(
|
||||
}
|
||||
|
||||
/// The gray over a shaded cell of a [`color_field_shaded`].
|
||||
const SHADE: Color32 = Color32::from_rgba_premultiplied(96, 96, 96, 192);
|
||||
pub(crate) const SHADE: Color32 = Color32::from_rgba_premultiplied(96, 96, 96, 192);
|
||||
|
||||
/// Whether cell `col` of row `row` of `shade` is marked; a cell outside the grid is not.
|
||||
fn shaded(shade: &[u16], col: usize, row: usize) -> bool {
|
||||
@@ -491,7 +491,7 @@ pub(crate) fn shade_edges(shade: &[u16]) -> Vec<[(usize, usize); 2]> {
|
||||
|
||||
/// Gray out the cells `shade` marks over `rect`, and draw the lines between them and the others
|
||||
/// dark under light.
|
||||
fn shade_cells(painter: &egui::Painter, rect: Rect, shade: &[u16]) {
|
||||
pub(crate) fn shade_cells(painter: &egui::Painter, rect: Rect, shade: &[u16]) {
|
||||
let n = shade.len().min(16);
|
||||
if n == 0 {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user