Code: Select all
Procedure.i Icon_ReSize (img.i, size.i, color.i)
; in : img : number of the image which is to be created, or #PB_Any
; size : number of pixels (width and height)
; color: foreground color of the image (background is transparent)
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
Protected ret.i, hw.d
hw = size / 16.0
ret = CreateImage(img, size, size, 32, #PB_Image_Transparent)
If img = #PB_Any
img = ret
EndIf
If ret And StartVectorDrawing(ImageVectorOutput(img))
VectorSourceColor(color)
AddPathBox(hw,hw,size - 2 * hw, size - 2 * hw)
DashPath(1,3)
AddPathBox(hw,size - 7 * hw, 6 * hw,6 * hw)
MovePathCursor(size - 7 * hw, 4 * hw)
AddPathLine(size - hw,hw)
AddPathLine(size - 4 * hw,6.5 * hw)
FillPath()
MovePathCursor(3 * hw,size - 3 * hw)
AddPathLine(size - 3 * hw,3 * hw)
StrokePath(hw/2)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure