It is currently April 19th, 2024, 11:16 am

Question about Mask Image

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Question about Mask Image

Post by balala »

I have a simple skin, with two image meters:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Image1]
Meter=Image
ImageName=#@#First.jpg
X=0
Y=0
W=120
H=90
PreserveAspectRatio=1

[Image2]
Meter=Image
ImageName=#@#Second.jpg
X=0
Y=0
W=120
H=90
PreserveAspectRatio=1
(see the attached two images).
I'd like to add a mask to the [Image2] meter. To do that, I added this meter to the skin:

Code: Select all

[Add]
Meter=STRING
X=0r
Y=100
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Add
LeftMouseUpAction=[!SetOption Image2 MaskImageName "#@#Mask.png"][!UpdateMeter Image2][!Redraw]
(also attached the Mask.png image).
I'd also like to remove the mask. I thought it'll be simple, so I added this meter:

Code: Select all

[Remove]
Meter=STRING
X=0r
Y=2R
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Remove
LeftMouseUpAction=[!SetOption Image2 MaskImageName ""][!UpdateMeter Image2][!Redraw]
And now the surprise: this is the initial status of the skin:
Image
When I click to the Add string, I'm getting this:
Image
(that's ok so far).
But when I click to the Remove string, nothings happening, the images remain as they was.
I tried more possibilities to remove the mask (on the [Remove] meter), eg:
LeftMouseUpAction=[!SetOption Image2 MaskImageName ""][!Update][!Redraw]
but had no success at all.
So, my question is if there's any possibility to remove the once applied mask?
Thanks in advance.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question about Mask Image

Post by jsmorley »

Just for fun, instead of "removing" the mask image option, try "changing" it to be the same image as the main image on the meter, the one you were "masking" before. That will have the same size and shape as the main image, so it should be the same as "removing" the mask in a sense.

This is a bit of a bug I suspect. The image is masked initially, so now the actual image displayed is a "masked version" of the image. When you remove the mask option entirely, nothing about that is telling the meter to re-evaluate the main image, which as far as it is concerned, has not changed.

We will take a look a this.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about Mask Image

Post by balala »

Thanks jsmorley, but it seems that's not a good idea. I think you can't use the same image file as displayed image and mask into the same image meter. This simple meter:

Code: Select all

[Image2]
Meter=Image
ImageName=#@#Second.jpg
X=0
Y=0
W=120
H=90
PreserveAspectRatio=1
MaskImageName=#@#Second.jpg
shows nothing, the skin remains blank. Without the MaskImageName option I can see the image.
I think I'll wait while you (or the team) will take a look at the bug possibility and (I hope) will fix it and I'll return then to this work (this is part of a greater project).
Thank you.
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question about Mask Image

Post by jsmorley »

Yeah, it is clearly some kind of bug, as it just always fails for me as well if I "remove" an ImageMask with !SetOption.

I did find that at least for your skin, this will have the desired result:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Image1]
Meter=Image
ImageName=#@#First.jpg
X=0
Y=0
W=120
H=90
PreserveAspectRatio=1

[Image2]
Meter=Image
ImageName=#@#Second.jpg
X=0
Y=0
W=120
H=90
PreserveAspectRatio=1

[Add]
Meter=STRING
X=0r
Y=100
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Add
LeftMouseUpAction=[!SetOption Image2 MaskImageName "#@#Mask.png"][!UpdateMeter Image2][!Redraw]

[Remove]
Meter=STRING
X=0r
Y=2R
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=12
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=Remove
LeftMouseUpAction=[!SetOption Image2 MaskImageName "#@#First.png"][!UpdateMeter Image2][!Redraw]
But that is only because Image1 and Image2 are the same W and H.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about Mask Image

Post by balala »

I'm not very sure why applying First.png (the image of the first image meter) as mask of the second (Image2) meter, removes the previously applied mask, but it definitely work.
Thanks a lot, once again, jsmorley, you're great, with great ideas!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question about Mask Image

Post by jsmorley »

balala wrote:I'm not very sure why applying First.png (the image of the first image meter) as mask of the second (Image2) meter, removes the previously applied mask, but it definitely work.
Thanks a lot, once again, jsmorley, you're great, with great ideas!
It doesn't "remove" it as such, but just replaces the mask image of the circle you had with a mask image that is the same size as the actual image, so while it is still "masked", it is just masked into an image that causes no visible difference. It's just a hideous workaround while we figure this out.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about Mask Image

Post by balala »

Understood.
Am I right that can't be used the same file as image and as mask?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Question about Mask Image

Post by jsmorley »

balala wrote:Understood.
Am I right that can't be used the same file as image and as mask?
That is right. I tried that, and it fails as you noted. The main image and mask image have to be different images.
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Question about Mask Image

Post by balala »

Ok, thanks a lot, jsmorley.
User avatar
Brian
Developer
Posts: 2679
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Question about Mask Image

Post by Brian »

@balala: Thanks for reporting this bug, it has been fixed for the next beta.

-Brian