 |
|
|
01-07-2022, 12:43 PM
|
#1
|
Human being with feelings
Join Date: Sep 2008
Location: Sweden
Posts: 7,269
|
gfx.blit requires four parameters...?
The Lua API docs say of gfx.blit(source,scale,rotation) that "If three parameters are specified, copies the entirety of the source bitmap to gfx.x, gfx.y using current opacity and copy mode..." and more. Note the if. To me, this means that not all parameters are required. So I try: gfx.blit(src_img) and to my surprise I get an error saying Function 'blit' requires 4 parameters, 1 passed.
If I do gfx.blit(src_img, 1) I get a message saying almost the same thing: Function 'blit' requires 4 parameters, 2 passed
Only if I pass all three parameters gfx.blit(src_img, 1, 0) do I not get any error message.
So I guess the API docs and the error message should be updated. Right?
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
|
|
|
01-07-2022, 12:50 PM
|
#2
|
Administrator
Join Date: Mar 2007
Location: NY
Posts: 15,349
|
There are two help entries for gfx.blit. The one you are looking at describes the behavior with three parameters, the other one describes the behavior with more than three parameters. The 4th and 5th parameters are "srcx, srcy" so I think you are getting the "4 parameters" message because if you provide one, you have to provide both.
I do notice the documentation spells "entirity" wrong though
|
|
|
01-07-2022, 01:18 PM
|
#3
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,476
|
Maybe it's better to rephrase the error-message to "...requires at least 3 parameters..."
|
|
|
01-07-2022, 03:07 PM
|
#4
|
Human being with feelings
Join Date: Sep 2008
Location: Sweden
Posts: 7,269
|
OK, this is a minor detail really, and maybe my post was a slight overreaction
Quote:
Originally Posted by schwa
There are two help entries for gfx.blit. The one you are looking at describes the behavior with three parameters, the other one describes the behavior with more than three parameters. The 4th and 5th parameters are "srcx, srcy" so I think you are getting the "4 parameters" message because if you provide one, you have to provide both.
|
But, I'm not sure that I follow this... Yes, I read the notes for the simplified 3-parameter blit, and that's the one I use. The problem does not occur if I give srcx but not srcy, it occurs when I give only the src_img, and no scale, no rotation. That should not ask for 4 parameters, should it?
And if I have to give all three parameters, the docs should not say " If three parameters are specified". Or?
Quote:
Originally Posted by schwa
I do notice the documentation spells "entirity" wrong though 
|
Yeah, when quoting the spell-checker complained so I changed it  But when updating that, maybe also the "if" should be removed.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
|
|
|
01-07-2022, 04:19 PM
|
#5
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,586
|
Hmm yeah the two implementations of gfx_blit() can get combined, doing that.
|
|
|
01-07-2022, 04:53 PM
|
#6
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,476
|
Quote:
Originally Posted by Justin
Hmm yeah the two implementations of gfx_blit() can get combined, doing that.
|
Would it be possible to make rotation and scale optional? So
gfx.blit(1)
is equal to
gfx.blit(1, 1, 0)
?
I think that is probably the most used case for people who just want to quickly blit something.
Happens often to me, at least.
|
|
|
01-07-2022, 06:40 PM
|
#7
|
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 15,586
|
Quote:
Originally Posted by Meo-Ada Mespotine
Would it be possible to make rotation and scale optional? So
gfx.blit(1)
is equal to
gfx.blit(1, 1, 0)
?
I think that is probably the most used case for people who just want to quickly blit something.
Happens often to me, at least.
|
Yeah, sure (though it wouldn't work with 6.44 and earlier)
|
|
|
01-07-2022, 06:47 PM
|
#8
|
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,476
|
No problem for my usual usecases.
Maybe a note in the docs "6.44 and lower expect three parameters minimum" for scripts that need to be backwards-compatible should be enough, I think.
|
|
|
01-08-2022, 01:06 PM
|
#9
|
Human being with feelings
Join Date: Sep 2008
Location: Sweden
Posts: 7,269
|
Quote:
Originally Posted by Meo-Ada Mespotine
Would it be possible to make rotation and scale optional? So
gfx.blit(1)
is equal to
gfx.blit(1, 1, 0)
?
I think that is probably the most used case for people who just want to quickly blit something.
Happens often to me, at least.
|
It is exactly the same here. This was what I stumbled on from the beginning, so would be very convenient.
__________________
// MVHMF
I never always did the right thing, but all I did wasn't wrong...
|
|
|
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:29 AM.
|