using the following example from the docs
Code: Select all
Procedure FilterCallback(x, y, SourceColor, TargetColor)
; Take only the Red component from the Source, do not modify the others
ProcedureReturn RGBA(Red(SourceColor), Green(TargetColor), Blue(TargetColor), Alpha(TargetColor))
EndProcedure
UseJPEGImageDecoder()
If OpenWindow(0, 0, 0, 400, 200, "2DDrawing Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
LoadImage(1, #PB_Compiler_Home + "examples/3d/Data/Textures/clouds.jpg")
If CreateImage(0, 400, 200) And StartDrawing(ImageOutput(0))
DrawImage(ImageID(1), 0, 0, 400, 200)
DrawingMode(#PB_2DDrawing_CustomFilter)
CustomFilterCallback(@FilterCallback())
Circle(100, 100, 100, $0000FF)
Circle(300, 100, 100, $000000)
StopDrawing()
ImageGadget(0, 0, 0, 400, 200, ImageID(0))
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
Code: Select all
CustomFilterCallback(): The Procedure specified in '@Callback()' does not have the required argument or returntype.
Because in the docs it is written:
But normally for PB it is told, that if NO type is given, the .i integer type will be used, that on 64-bit systems will be 64-bit and not the 32-bit for colors from the help.The SourceColor ... and the TargetColor .... Both colors are always 32-bit with alpha channel independent of the color depth of the output. The callback has to calculate the color that the target pixel should have after the drawing and return that.
Thanks, hoerbie