View Full Version : Bug in ColorKeyMask interface (2.57)
Gavino
1st April 2008, 17:18
Not sure if this is the right place to report bugs, but here goes anyway...
In Avisynth 2.57, ColorKeyMask does not allow the color and threshold parameters to be defaulted, although the documentation states that they are optional (defaults black and 10 respectively).
Examining the 2.57 source code (layer.cpp), I see that the signature is set to "cii", ie all parameters mandatory, even though ColorKeyMask::Create has code to faithfully supply the default values.
Wilbert
1st April 2008, 19:18
Looking at the code, i think it is fixed in v2.58a2.
Gavino
7th November 2008, 11:34
To resurrect this thread from a while back...
It appears the problem still exists in 2.58 RC4. This script
ColorBars(pixel_type="RGB32")
ResetMask()
ColorKeyMask()
gives "Invalid arguments to function ColorKeyMask".
ColorKeyMask(color_black) is accepted, but ColorKeyMask(color=color_black) is not.
ColorKeyMask(tolR=10) gives "ColorKeyMask does not have a named argument tolR"
IanB
7th November 2008, 12:14
Yes oops a bit. The code is :-{ "ColorKeyMask", "ci[]i[]i[]i", ColorKeyMask::Create }
The current inbuilt doc matches this (note no quotes, so args are unnamed) :-ColorKeyMask (clip, int color[, int tolB, int tolG, int tolR])
But text still has it wrong :-... comparing the color (default black). ...
Gavino
7th November 2008, 20:43
Are you saying it works as intended, and it's the docs that are wrong?
Note that in the quick reference, the names are in quotes.
Any compelling reason why the code can't be changed to make them all named arguments (including color)?
Among other things, this would save people from having to remember the correct order (B,G,R) for the tolerances.
Wilbert
8th November 2008, 00:06
Sorry i don't see it. What's wrong with the docs (apart from the quotes in the quick reference)? color is zero by default.
Fizick
8th November 2008, 00:27
so, there is no default now (with this code). you must provide the color parameter.
Gavino
8th November 2008, 01:37
Wilbert, there is currently an inconsistency between the code and the docs. The docs say color defaults to black but the code requires a value to be provided for color.
I would prefer the code to be changed rather than the docs.
Or preferibly, the docs too to make them all named parameters.
(Incidentally, where can I find the 2.58 source code?)
IanB
8th November 2008, 03:00
The previous code was{ "ColorKeyMask", "cii", ColorKeyMask::Create }So there never have been any default values. The docs have always been mistaken.
Source code is in CVS on sourceforge
Gavino
8th November 2008, 09:46
So there never have been any default values. The docs have always been mistaken.
Or (this part of) the code has always been wrong. ;)
ColorKeyMask::Create uses args[1].AsInt(0), suggesting that the intention was to support a default color value.
And the previous code was wrong in not marking the tolerance as optional.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.