Yet another enhancement for CustomFilterCallback
Posted: Fri Aug 21, 2009 10:40 am
As it is, this drawing mode works very slowly because the callback procedure is called for every pixel.
A way round this would be some flags to specify when to call the callback procedure.
I think this would drastically reduce the calls to the callback, making many drawing operations much faster.
A simpler way would be just to have another mode: #PB_2DDrawing_QuickCustomFilter. This would do away with the x and y parameters (the callback procedure would be Procedure.i MyPaint(top.i,bottom.i)). But the system described above would be more flexible.
A way round this would be some flags to specify when to call the callback procedure.
Code: Select all
#CFC_AlwaysCall ; as it is just now
#CFC_ForNewTopColours ; if the top colour has been drawn already, use the value the proc returned for it. Otherwise it's a new top colour, so call procedure.
#CFC_ForNewBottomColours ; if the bottom colour has been drawn already, use the value the proc returned for it. Otherwise it's a new bottom colour, so call procedure.
#CFC_ForUniqueCombinations ; if the combination of the top colour and the bottom has been drawn already, use the value the proc returned for it. Otherwise it's a new combination of top colour and bottom colour, so call procedure.
A simpler way would be just to have another mode: #PB_2DDrawing_QuickCustomFilter. This would do away with the x and y parameters (the callback procedure would be Procedure.i MyPaint(top.i,bottom.i)). But the system described above would be more flexible.