|
|
|
06-29-2015, 08:33 AM
|
#1
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
gfxblit broken in newer versions?
I have some code that works in V4.6 , and does not work in V5 pres or in 4.78...
I suspect that gfx_blit(source, scale, rotation[, srcx, srcy, srcw, srch, destx, desty, destw, desth, rotxoffs, rotyoffs]) no longer works when using -1 as the as the first parameter to reference the main frame buffer.
(seems to work when specifying only 3 parameters. It does not work if you specify source and destination)
*gfxblitext() is broken as well.
Did something change? I've not been active here, so might have missed something.
Or maybe it's just broken?
Last edited by James HE; 06-29-2015 at 08:52 AM.
|
|
|
06-29-2015, 10:17 AM
|
#2
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
Quick and dirty test code
Code:
desc:rotation test
slider1:0<0,7,.01>variable
@gfx
gfx_r=gfx_g=gfx_b=.5;
gfx_circle(40,40,20,1);
gfx_r=gfx_g=gfx_b=0;
gfx_circle(54,40,3,1);
gfx_blit(-1, 1, slider1, 20,20, 40, 40, 20, 20, 40, 40);
this works in 4.75 and below.
in 4.76 and above, the rotation is centered from the wrong spot!
|
|
|
06-29-2015, 10:24 AM
|
#3
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
ahh!
the rotation offset (last two possible variables) are wrong in newer versions if not specified
quick and dirty fix...
Code:
desc:rotation test
slider1:0<0,7,.01>variable
@gfx
gfx_r=gfx_g=gfx_b=.5;
gfx_circle(40,40,20,1);
gfx_r=gfx_g=gfx_b=0;
gfx_circle(54,40,3,1);
gfx_blit(-1, 1, slider1, 20,20, 40, 40, 20, 20, 40, 40, -20, -20);
you have to set the offset to half the width / height to compensate? or something, can't figure the formula exactly. This example works, however I can't get the compensation right in some more complex code.
So... is this a bug? or a bug fix!??
Last edited by James HE; 06-29-2015 at 04:32 PM.
|
|
|
06-30-2015, 08:48 AM
|
#4
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
so... found the hack to fix it...
Code:
//to rotate a circle ay x,y
function rotation_alt(x,y,radius,var)
( gfx_blit(-1,1,var,x-radius,y-radius,radius*2,radius*2,x-radius,y-radius,radius*2,radius*2,-x+radius,-y+radius); );
in the new versions, the default x offset is off by the value of x minus the radius(or width, rather), similar for y.
Last edited by James HE; 06-30-2015 at 10:27 AM.
|
|
|
07-04-2015, 03:52 PM
|
#5
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
Can anyone confirm please?
|
|
|
07-19-2015, 12:42 AM
|
#6
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
This is how it works on my computer (Win8.1 64bit, R5 rc4/x64):
|
|
|
01-02-2016, 03:38 PM
|
#8
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,745
|
Quote:
Originally Posted by James HE
|
Thanks for figuring this out!
We could easily switch the behavior back, but at this point it has been this way for long enough (over a year), I'm slightly more worried about breaking newer scripts rather than old ones... any thoughts?
Last edited by Justin; 01-02-2016 at 03:43 PM.
|
|
|
01-02-2016, 04:21 PM
|
#9
|
Human being with feelings
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
|
gfx.blit2 maybe?
|
|
|
01-02-2016, 04:29 PM
|
#10
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,745
|
Switching it back for 5.12pre2, the old behavior was correct, and a year isn't that long!
If you want to write a script to support both versions, blit into a temporary buffer at (0,0) and use 0,0 as the source coordinates, and it should work...
|
|
|
01-02-2016, 09:09 PM
|
#11
|
Human being with feelings
Join Date: Mar 2007
Location: Surrey, BC
Posts: 745
|
FYI, gfx_blitext was also broken back in version 4.76.
I haven't upgraded to version 5 as I just don't need all the new functionality. Any chance of getting an updated jsfx.dll that works with version 4? Or should I just grab jsfx.dll from a previous version? - edit: actually, I tried that and it doesn't work. Oh well, it's not a big deal anyway.
Thanks,
argee
Last edited by argee; 01-02-2016 at 09:32 PM.
|
|
|
01-03-2016, 02:31 AM
|
#12
|
Human being with feelings
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
|
Quote:
Originally Posted by Justin
Switching it back for 5.12pre2, the old behavior was correct, and a year isn't that long!
If you want to write a script to support both versions, blit into a temporary buffer at (0,0) and use 0,0 as the source coordinates, and it should work...
|
Great!
I did end up doing everything into temporary buffers, eventually.
For a while there i was writing a "switch" into my functions such that I could go back to the old behavior if needed.
...what took you so long anyways? ha ha ha.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 04:11 PM.
|