I make a CreateImage() in procedure: MaakPolygonTexturesInAlleKleuren(), in StartVectorDrawing() i try to use that image in VectorSourceImage()
but nothing is there. if i load a image (see comments in code) then it works perfectly.
What do i miss here?
code:
Code: Select all
Enumeration
#Mainwindow
#canvas
#image1
#IMAGE_Polygon_Fill_SchuineStreep_Groen
EndEnumeration
Procedure MaakPolygonTexturesInAlleKleuren()
If CreateImage(#IMAGE_Polygon_Fill_SchuineStreep_Groen, 30, 30, 32, #PB_Image_Transparent) And StartDrawing(ImageOutput(#IMAGE_Polygon_Fill_SchuineStreep_Groen))
Box(0, 0, 20, 20, RGBA(100,100,100,255))
StopDrawing()
EndIf
EndProcedure
If OpenWindow(#Mainwindow, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
LoadImage(#image1, #PB_Compiler_Home + "examples/Sources/Data/PureBasicLogo.bmp")
MaakPolygonTexturesInAlleKleuren()
CanvasGadget(#canvas, 0, 0, 400, 200)
If StartVectorDrawing(CanvasVectorOutput(#canvas))
x = 10
y = 10
MovePathCursor(x, y) ; start
AddPathLine(x + 150, y, #PB_Path_Default)
AddPathLine(x + 150, y + 100, #PB_Path_Default)
AddPathLine(x + 100, y + 100, #PB_Path_Default)
AddPathLine(x + 100, y + 150, #PB_Path_Default)
AddPathLine(x, y + 150, #PB_Path_Default)
AddPathLine(x, y, #PB_Path_Default)
VectorSourceColor(RGBA(255, 0, 0, 255))
StrokePath(5, #PB_Path_RoundEnd | #PB_Path_Preserve)
; doesnt work
VectorSourceImage(ImageID(#IMAGE_Polygon_Fill_SchuineStreep_Groen), 255, 30, 30, #PB_VectorImage_Repeat)
; works
;VectorSourceImage(ImageID(#image1), 255, ImageWidth(#image1), ImageHeight(#image1), #PB_VectorImage_Repeat)
FillPath()
StrokePath(2)
StopVectorDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf