WoWInterface - View Single Post - Achieving pixel perfection
View Single Post
12-15-18, 02:51 AM   #2
A Chromatic Dragonspawn
d87's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 157
WoW screen is using these sort of floating point virtual pixels, they go up to 768 in height and proportionally for aspect ratio in width, and they map onto your real resolution. And then there's possibly global UI scale in the mix. In the end the line that you wanted to be 2 virtual pixels wide ends up snapping to either 2 or 3 real pixels depending on where it is
So you need to reverse this process and find out what amount of virtual pixels is corresponding to real pixels

Here's what i use to find it:
local res = GetCVar("gxWindowedResolution")
if res then
    local w,h = string.match(res, "(%d+)x(%d+)")
    pmult = (768/h) / UIParent:GetScale()
Not sure if consistently using whole number of real pixels guarantees perfection, but in my experience it makes it better at least. Also ideally you don't want to use UI scale
  Reply With Quote