Code: Select all
Declare.i Bug (img.i, size.i, color1.i, color2.i)
Declare.i DBug (img.i, size.i, color1.i, color2.i, color3.i)
Declare.i Crop (img.i, size.i, color1.i)
Declare.i ReSize2 (img.i, size.i, color1.i, color2.i)
Procedure.i Bug (img.i, size.i, color1.i, color2.i)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [by davido]
Protected ret.i, p.d
p = size / 32
ret = CreateImage(img, size, size, 32, #Background)
If ret
If img = #PB_Any
img = ret
EndIf
If StartVectorDrawing(ImageVectorOutput(img))
; Body of bug
SaveVectorState()
RotateCoordinates(16*p,16*p,-45)
VectorSourceColor(color1)
AddPathEllipse(9*p, 16*p, 12*p, 8*p)
FillPath()
; Head of bug
RestoreVectorState()
RotateCoordinates(16*p,16*p,-45)
VectorSourceColor(color2)
AddPathEllipse(23*p, 16*p, 4*p, 5*p)
FillPath()
; Antenae
ResetCoordinates()
MovePathCursor(19*p,12*p)
AddPathLine(19*p,1.5*p)
MovePathCursor(19*p,12*p)
AddPathLine(30*p,12*p)
StrokePath(0.3*p)
AddPathCircle(30*p,12*p,p)
AddPathCircle(19*p,2*p,p)
FillPath()
; Spots
AddPathCircle(16*p,19*p,2*p)
AddPathCircle(11*p,16*p,2*p)
AddPathCircle(5*p,20*p,2*p)
AddPathCircle(14*p,25*p,2*p)
AddPathCircle(7*p,28*p,2*p)
FillPath()
; Between wings
MovePathCursor(22.5*p,9*p)
AddPathLine(2.5*p,29.25*p)
StrokePath(0.25 * p)
StopVectorDrawing()
Else
FreeImage(img)
ret = 0
EndIf
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i DBug (img.i, size.i, color1.i, color2.i, color3.i)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2
; color3: foreground color #3
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [by davido]
Protected ret.i, p.d
p = size / 32
ret = CreateImage(img, size, size, 32, #Background)
If ret
If img = #PB_Any
img = ret
EndIf
If StartVectorDrawing(ImageVectorOutput(img))
; Body of bug
SaveVectorState()
RotateCoordinates(16*p,16*p,-45)
VectorSourceColor(color1)
AddPathEllipse(9*p, 16*p, 12*p, 8*p)
FillPath()
; Head of bug
RestoreVectorState()
RotateCoordinates(16*p,16*p,-45)
VectorSourceColor(color2)
AddPathEllipse(23*p, 16*p, 4*p, 5*p)
FillPath()
; Antenae
ResetCoordinates()
MovePathCursor(19*p,12*p)
AddPathLine(19*p,1.5*p)
MovePathCursor(19*p,12*p)
AddPathLine(30*p,12*p)
StrokePath(0.3*p)
AddPathCircle(30*p,12*p,p)
AddPathCircle(19*p,2*p,p)
FillPath()
; Spots
AddPathCircle(16*p,19*p,2*p)
AddPathCircle(11*p,16*p,2*p)
AddPathCircle(5*p,20*p,2*p)
AddPathCircle(11*p,27*p,2*p)
AddPathCircle(3.5*p,25*p,2*p)
FillPath()
; Between wings
MovePathCursor(22.5*p,9*p)
AddPathLine(2.5*p,29.25*p)
StrokePath(0.25 * p)
; Red cross
VectorSourceColor(color3)
RotateCoordinates(16*p,16*p,45)
DrawPlus(16*p,16*p,size * 0.5,3*p)
StopVectorDrawing()
Else
FreeImage(img)
ret = 0
EndIf
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i Crop (img.i, size.i, color1.i)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [by davido]
Protected ret.i, p.d
p = size / 32
ret = CreateImage(img, size, size, 32, #Background)
If ret
If img = #PB_Any
img = ret
EndIf
If StartVectorDrawing(ImageVectorOutput(img))
MovePathCursor(8*p,2*p)
AddPathLine(8*p,24.5*p)
AddPathLine(30.5*p,24.5*p)
MovePathCursor(24.5*p,30.5*p)
AddPathLine(24.5*p,8*p)
AddPathLine(2*p,8*p)
StrokePath(2*p)
StopVectorDrawing()
Else
FreeImage(img)
ret = 0
EndIf
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ReSize2 (img.i, size.i, color1.i, color2.i)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [by davido]
Protected ret.i, p.d, k.i
p = size / 32
ret = CreateImage(img, size, size, 32, #Background)
If ret
If img = #PB_Any
img = ret
EndIf
If StartVectorDrawing(ImageVectorOutput(img))
VectorSourceColor(color1)
MovePathCursor(16*p,26*p)
AddPathLine(2*p,26*p)
AddPathLine(2*p,2*p)
AddPathLine(26*p,2*p)
AddPathLine(26*p,16*p)
AddPathBox(16.5*p,16.5*p,15*p,15*p)
StrokePath(p)
VectorSourceColor(color2)
DrawStar(12*p,12*p,6*p,0,6)
StrokePath(P)
DrawStar(22*p,22*p,3.25*p,0,6)
StrokePath(0.6*P)
StopVectorDrawing()
Else
FreeImage(img)
ret = 0
EndIf
EndIf
ProcedureReturn ret
EndProcedure
#ImgBug
#ImgDbug
#ImgCrop
#ImgReSize2
, "Bug", "Debug", "Crop", "ReSize2"
Bug(#ImgBug, size, #CSS_Orange, #CSS_Black)
DBug(#ImgDBug, size, #CSS_Orange, #CSS_Black, #CSS_Red)
Crop(#ImgCrop, size, #CSS_Navy)
ReSize2(#ImgReSize2, size, #CSS_Navy,#CSS_Blue)
Bug(#ImgBug + #IconCount, size, #CSS_Silver, #CSS_DimGrey)
DBug(#ImgDBug + #IconCount, size, #CSS_Silver, #CSS_DimGrey, #CSS_WhiteSmoke)
Crop(#ImgCrop + #IconCount, size, #CSS_Silver)
ReSize2(#ImgReSize2 + #IconCount, size, #CSS_DimGrey,#CSS_WhiteSmoke)