Quantcast WoWInterface - View Single Post - Pixel Perfection for Specific Resolution
View Single Post
01-20-11, 04:09 AM   #73
A Fallenroot Satyr
Alternator's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 20
Just some notes I've found that may be useful

My interest in this topic was to provide pixel perfection without altering how the users ui works (so the user can set "Use UI Scale", "Windowed" mode etc as they wish).

I've found the following:

Use UI Scale: Off

Then UIParent will always match the pixel size of your window client area... I say client area, because this also holds true when you go windowed mode and resize the window.. In this mode things are easy as you are always working in the desired size.

Use UI Scale: On

Not so easy.
While it is possible to get the resolution and then do conversions along the following lines (psuedo code)
xPixel, yPixel = the pixels you're interested in;
xRes, yRes = string.match(({GetScreenResolutions()})[GetCurrentResolution()], "(%d+)x(%d+)");
uiscale = UIParent:GetScale();
Width_Or_XCoord = xPixel * (768.0 / xRes) * GetMonitorAspectRatio() / uiscale;
Height_Or_YCoord = yPixel * (768.0 / yRes) / uiscale;
It won't work for windowed mode unfortunately, as none of those numbers will adjust when the size of the window changes nor am I aware of any attribute that provide the the new scale/dimensions of the window.

This can be a bit tricky, because it does mean if the user does go windowed and UI Scale is on, that you may start to have details drop out (although I chose not to use the technique so far, I would have had single pixel lines that sometimes don't show up)
  Reply With Quote