Untitled.png
When an image receives an image mask it decreases in size by 2 pixels. Appears to be antialiasing the image resulting in the appearance of a smaller meter, rather than actually changing the image's dimensions.
It is currently April 20th, 2024, 3:33 am
[Bug] Antialiasing difference when applying an image mask
-
- Posts: 268
- Joined: May 12th, 2019, 8:55 am
[Bug] Antialiasing difference when applying an image mask
When an image receives an image mask it decreases in size by 2 pixels. Appears to be antialiasing the image resulting in the appearance of a smaller meter, rather than actually changing the image's dimensions.
You do not have the required permissions to view the files attached to this post.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [Bug] Antialiasing difference when applying an image mask
I would be tempted to use Container rather than MaskImage. I really think Container will do all you want, and it shouldn't have any weirdness with how it renders images. MaskImage is in effect deprecated, and I don't recommend it.Cariboudjan wrote: ↑August 20th, 2021, 6:59 pm Untitled.png
When an image receives an image mask it decreases in size by 2 pixels. Appears to be antialiasing the image resulting in the appearance of a smaller meter, rather than actually changing the image's dimensions.
-
- Posts: 268
- Joined: May 12th, 2019, 8:55 am
Re: [Bug] Antialiasing difference when applying an image mask
Would love to but containers actually do not work in this specific application, since the meter itself is also inside its own container, and containers cant exist inside another container.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [Bug] Antialiasing difference when applying an image mask
Well, the bad news is that we are just done with MaskImage, and I don't foresee any changes being made to it. You might want to re-think the approach are using if MaskImage isn't working well for you.
-
- Developer
- Posts: 2679
- Joined: November 24th, 2011, 1:42 am
- Location: Utah
Re: [Bug] Antialiasing difference when applying an image mask
I wish we could fix this, but this is a limitation of D2D. The masking requires "aliasing".
https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillopacitymask(id2d1bitmap_id2d1brush_d2d1_opacity_mask_content_constd2d1_rect_f__constd2d1_rect_f_)#remarks
And here is where we deal with it:
https://github.com/rainmeter/rainmeter/blob/master/Common/Gfx/Canvas.cpp#L624-L647
-Brian
https://docs.microsoft.com/en-us/windows/win32/api/d2d1/nf-d2d1-id2d1rendertarget-fillopacitymask(id2d1bitmap_id2d1brush_d2d1_opacity_mask_content_constd2d1_rect_f__constd2d1_rect_f_)#remarks
And here is where we deal with it:
https://github.com/rainmeter/rainmeter/blob/master/Common/Gfx/Canvas.cpp#L624-L647
-Brian
-
- Rainmeter Sage
- Posts: 7128
- Joined: February 27th, 2015, 2:38 pm
- Location: Terra Yincognita
Re: [Bug] Antialiasing difference when applying an image mask
Just speculating here, but maybe you could apply a TransformationMatrix to the image to make sure it stays the same size visually, then use a partially opaque padding approach of some kind (if possible) for the underlying meter to make sure the clickable area stays the same too...
-
- Posts: 268
- Joined: May 12th, 2019, 8:55 am
Re: [Bug] Antialiasing difference when applying an image mask
It's not a big deal. I just thought I'd share. It's not breaking anything.