Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
xform question/issue?
#4
(02-19-2025, 01:34 PM)1micha.elok Wrote: sorry, I deleted a reply... I still make an error  Big Grin

(02-19-2025, 10:40 AM)kevin Wrote: Hi, 
I have a question about the xform function please. In the attached example, I have a png image of 100 * 100 pixels (created in GIMP), that I am displaying on screen using the xform function with a scaling of 7. However, rather than displaying an image of 700 * 700 pixels, the image dimensions would appear to be 693 * 693 pixels? I have tried this with image files created in different applications, with the same results.
...

Hi Kevin
Perhaps this one resolve this issue ?

Code:
set window "xform test",700,700
set redraw off

img = loadimage("hundred by hundred pixels.png")

set color 255,255,255;cls

factor = screenw()/screenh()           
draw image xform img,0,0,7*factor,7*factor,0,0,0
save image primary, "700.png"

temp = rln()

It's all my bad, there's an error in the calculations in the 'draw image xform' implementation (C code). Simply put, the implementation subtracts 1 from the width and height of the image before applying the transformations, so when scaling by 7, 7 pixels goes missing. Sorry, I don't know how that bug got there, I must have left some test in the code by mistake.

Thanks for noticing this bug, Kevin! Smile
Reply


Messages In This Thread
xform question/issue? - by kevin - 02-19-2025, 10:40 AM
RE: xform question/issue? - by Marcus - 02-19-2025, 01:32 PM
RE: xform question/issue? - by 1micha.elok - 02-19-2025, 01:34 PM
RE: xform question/issue? - by Marcus - 02-19-2025, 02:47 PM
RE: xform question/issue? - by kevin - 02-19-2025, 03:12 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)