Skip to content

Commit 409a6d3

Browse files
committed
improve scRGB alpha handling
since it's now 0-1
1 parent b88cc5c commit 409a6d3

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## master
22

33
- fix ctrl/shift detect on windows
4+
- add menu pin button
45

56
## 9.0.6 2025/04/16
67

TODO

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
- toolkit menu: return to home by default, have a temp "pin in place" toggle
2-
at the top right to stop it
3-
4-
- pin in place disables if you click "back"
5-
6-
- ctrl-drag / ctrl-click to make region / mark does not work on windows
7-
8-
- fix scRGB with alpha
9-
101
- "reset" in display bar resets the position of scale/offset widgets, but does
112
not reset the menu items (eg. tick on falsecolour)
123

@@ -33,6 +24,8 @@
3324

3425
we've implemented #separator
3526

27+
- the nip4 menus need reworking to use max_alpha 255 for scrgb
28+
3629
- add something to find unresolved symbols
3730

3831
- get rid of im_copy_set etc.
@@ -44,15 +37,6 @@
4437

4538
- rename Image_type as Image_interpretation
4639

47-
- add
48-
49-
minpair
50-
maxpair
51-
clamp
52-
sdf
53-
54-
to stdenv
55-
5640
- try:
5741

5842
Matrix_build_item.Matrix_laplacian_item.action

src/tilesource.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,18 @@ tilesource_rgb_image(Tilesource *tilesource, VipsImage *in)
654654

655655
// reattach alpha
656656
if (alpha) {
657-
if (vips_cast(alpha, &x, image->BandFmt, "shift", TRUE, NULL))
657+
double max_alpha_before = vips_interpretation_max_alpha(alpha->Type);
658+
double max_alpha_after = vips_interpretation_max_alpha(image->Type);
659+
660+
if (max_alpha_before != max_alpha_after) {
661+
if (vips_linear1(alpha, &x,
662+
max_alpha_after / max_alpha_before, 0.0, NULL))
663+
return NULL;
664+
VIPS_UNREF(alpha);
665+
alpha = x;
666+
}
667+
668+
if (vips_cast(alpha, &x, image->BandFmt, NULL))
658669
return NULL;
659670
VIPS_UNREF(alpha);
660671
alpha = x;

src/workspaceview.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,9 +1259,9 @@ workspaceview_key_pressed(GtkEventControllerKey *self,
12591259
gboolean handled;
12601260

12611261
#ifdef DEBUG_VERBOSE
1262-
#endif /*DEBUG_VERBOSE*/
12631262
printf("workspaceview_key_pressed: keyval = %d, state = %d\n",
12641263
keyval, state);
1264+
#endif /*DEBUG_VERBOSE*/
12651265

12661266
handled = FALSE;
12671267

0 commit comments

Comments
 (0)