Quantcast Why does a mask object automatically flip an art horizontally? - WoWInterface
Thread Tools Display Modes
10-17-17, 05:51 AM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 356
Why does a mask object automatically flip an art horizontally?

Hi all,

Just for testing, I have made a parallelogram texture and applied this on a plain texture object as well as on a texture object with a mask object.

The first one draws an art as it is while the second one automatically flips an art horizontally...



Here's an exact code snippet:

Lua Code:
  1. local mask = UIParent:CreateMaskTexture();
  2. mask:SetTexture(parallel);
  3. mask:SetSize(256, 32);
  4. mask:SetPoint("RIGHT", UIParent, "CENTER", -50, 0);
  5.  
  6. local texture1 = UIParent:CreateTexture(nil, "ARTWORK");
  7. texture1:SetColorTexture(1, 1, 1);
  8. texture1:SetAllPoints(mask);
  9. texture1:AddMaskTexture(mask);
  10.  
  11. local texture2 = UIParent:CreateTexture(nil, "ARTWORK");
  12. texture2:SetTexture(parallel);
  13. texture2:SetSize(256, 32);
  14. texture2:SetPoint("LEFT", UIParent, "CENTER", 50, 0);

Is this an intended behavior of a mask object?

Thank you!
  Reply With Quote
12-06-17, 11:10 AM   #2
vis781
A Fallenroot Satyr
Join Date: Dec 2017
Posts: 27
Hi, in my experience with masking in wow it doesn't..... some code I just tested using a mask created in gimp that turns any texture in to a circle works fine.

Code:
local tex = Frame:CreateTexture(nil, "ARTWORK", nil, 0);
	tex:SetTexture(some texture);
	tex:SetAllPoints(Frame);
	tex:SetMask(Some Path to CircularMask.tga")
  Reply With Quote
12-06-17, 06:57 PM   #3
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 400
Originally Posted by vis781 View Post
Hi, in my experience with masking in wow it doesn't..... some code I just tested using a mask created in gimp that turns any texture in to a circle works fine.
A circle looks the same when horizontally flipped, no?
I can confirm this problem exists, because I created all these mask textures:


When rendered in game, most of them are wrong, so I had to map the opposing mask to the texture it was meant for.
__________________
  Reply With Quote
12-07-17, 04:49 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,272
Didn't they fixed this? Maybe it's just not live yet.
  Reply With Quote
12-08-17, 01:04 AM   #5
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 400
Originally Posted by Resike View Post
Didn't they fixed this? Maybe it's just not live yet.
They fixed the issue with unrelated masks linking together in the back-end, but it seems the calculations are still reversed. My code kinda reveals the issue.
Notice how I swapped M1 left/right with the corresponding masks for M2.
Lua Code:
  1. ['M1'] = {
  2.     up = TEX_PATH:format([[Masks\M1_down]]),
  3.     down = TEX_PATH:format([[Masks\M1_up]]),
  4.     left = TEX_PATH:format([[Masks\M2_left]]),
  5.     right = TEX_PATH:format([[Masks\M2_right]]),
  6. },
  7. ['M2'] = {
  8.     up = TEX_PATH:format([[Masks\M2_down]]),
  9.     down = TEX_PATH:format([[Masks\M2_up]]),
  10.     left = TEX_PATH:format([[Masks\M1_left]]),
  11.     right = TEX_PATH:format([[Masks\M1_right]]),
  12. },
This is still happening on the PTR, but if it never gets fixed it's as easy as horizontally flipping your mask texture to work around it.
From a programming perspective, I would imagine whoever implemented this only used symmetrical textures (as most masks are) during testing.
__________________

Last edited by MunkDev : 12-08-17 at 01:11 AM.
  Reply With Quote
12-08-17, 09:14 AM   #6
vis781
A Fallenroot Satyr
Join Date: Dec 2017
Posts: 27
Originally Posted by MunkDev View Post
A circle looks the same when horizontally flipped, no?
I can confirm this problem exists, because I created all these mask textures:


When rendered in game, most of them are wrong, so I had to map the opposing mask to the texture it was meant for.
Erm, yes, but only if the texture was a mirror of itself on the considered axis, we're not talking about the mask used, we're talking about the texture. Try the code snippet I posted. SetMask does not flip the texture, I am and have used it multiple time in my addon.
  Reply With Quote
12-08-17, 09:16 AM   #7
vis781
A Fallenroot Satyr
Join Date: Dec 2017
Posts: 27
and what do you mean "Rendered in game" You don't render a mask, in fact is the complete opposite of that.
  Reply With Quote
12-08-17, 09:19 AM   #8
vis781
A Fallenroot Satyr
Join Date: Dec 2017
Posts: 27
and secondly, why all the different colors? The engine uses Mask Alpha only
  Reply With Quote
12-08-17, 02:10 PM   #9
lightspark
A Frostmaul Preserver
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 286
Originally Posted by vis781 View Post
Erm, yes, but only if the texture was a mirror of itself on the considered axis, we're not talking about the mask used, we're talking about the texture. Try the code snippet I posted. SetMask does not flip the texture, I am and have used it multiple time in my addon.
People in this thread are talking about relatively new mask textures (created via CreateMaskTexture) and not old masks (set via SetMask). They work differently.

Mask textures are still a bit buggy.
__________________

Last edited by lightspark : 12-08-17 at 02:14 PM.
  Reply With Quote
12-08-17, 02:58 PM   #10
vis781
A Fallenroot Satyr
Join Date: Dec 2017
Posts: 27
I've has look further in to this and th reason I can't replicate the problem is becuase all masks i use are symmetrical, but that is how masks are in C. So for me the behaviour of the function is expected. The problem you are seeing may well be result of the raster operations performed to make the mask "work" for the want if a better word. It will likely combine bitwise and/or to crop out the mask and then apply srcalpha at the end. This is and has been the standard way of masking for a long time, and it is the fastest to my knowledge. However the result of the raster operation are a flipped image. Which may well be why you don't see asymmetrical masks in the bliz art.
  Reply With Quote
12-08-17, 03:50 PM   #11
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 400
Originally Posted by vis781 View Post
Erm, yes, but only if the texture was a mirror of itself on the considered axis, we're not talking about the mask used, we're talking about the texture. Try the code snippet I posted. SetMask does not flip the texture, I am and have used it multiple time in my addon.
You're talking about an old function native to textures, this thread is discussing MaskTexture widgets. MaskTexture is a relatively new widget, designed to replace the old texture function and to be a lot more versatile.

Originally Posted by vis781 View Post
and what do you mean "Rendered in game" You don't render a mask, in fact is the complete opposite of that.
When the TEXTURE is rendered in game [...]. Happy now?

Originally Posted by vis781 View Post
and secondly, why all the different colors? The engine uses Mask Alpha only
It's a compilation. The mask is the black part. Colors are there to distinguish the boundaries of each mask.

You must be new here.
__________________
  Reply With Quote
12-08-17, 04:15 PM   #12
vis781
A Fallenroot Satyr
Join Date: Dec 2017
Posts: 27
New yes, but I'm finding my feet and I believe I have something to offer as well as learn a thing or two myself.
  Reply With Quote
12-09-17, 08:43 AM   #13
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,272
I poked a dev, it's gonna be looked into.
  Reply With Quote
01-28-18, 09:01 PM   #14
lightspark
A Frostmaul Preserver
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 286
This issue was fixed in 7.3.5.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Why does a mask object automatically flip an art horizontally?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off