home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2007 November
/
CPNL0711.ISO
/
beeld
/
screen
/
hcf.exe
/
Basic
/
Basic_!LineExtend.bas
< prev
next >
Wrap
BASIC Source File
|
2004-01-31
|
2KB
|
82 lines
w0 = Image(0).Width
h0 = Image(0).Height
w = 0
h = 0
if __LastPointStartX > w0 Then ' is the mouse pointer outside of the image?
w = __LastPointStartX ' then use the new size
endif
if __LastPointEndX > w0 Then
w = __LastPointEndX
endif
if __LastPointStartY > h0 Then
h = __LastPointStartY
endif
if __LastPointEndY > h0 Then
h = __LastPointEndY
endif
if w > 0 or h > 0 then
if h = 0 then
h = h0
endif
if w = 0 then
w = w0
endif
v = CreateImage( w, h ) ' create a temp image with the new size
Image(v).Color = _ColorWhite ' the "outside" color
Image(v).DrawImage( 0,0, w0,h0, 0 ) ' copy the old image to the temp image
Image(0).Resample( w,h ) ' resample the old image
Image(0).DrawImage( 0,0, w ,h , v ) ' copy the temp image to the old image
Image(v).Delete() ' delete the temp image
endif
w0 = Image(0).Width
h0 = Image(0).Height
w = 0
h = 0
lx = 0
ly = 0
if __LastPointEndX < 0 Then
lx = __LastPointEndX * -1
w = lx + w0
endif
if __LastPointEndY < 0 Then
ly = __LastPointEndY * -1
h = ly + h0
endif
if w > 0 or h > 0 then
if h = 0 then
h = h0
endif
if w = 0 then
w = w0
endif
v = CreateImage( w, h ) ' create a temp image with the new size
Image(v).Color = _ColorWhite ' the "outside" color
Image(v).DrawImage( lx,ly, w0,h0, 0 )' copy the old image to the temp image
Image(0).Resample( w,h ) ' resample the old image
Image(0).DrawImage( 0,0, w ,h , v ) ' copy the temp image to the old image
Image(v).Delete() ' delete the temp image
endif
Pen.GradientMode = _GradientModeForwardDiagonal
Pen.Width = __PenWidth
Pen.StartCap = _LineCapArrowAnchor
if __LastMouseButton = _LeftMouseButton Then
Pen.StartColor = __ForegroundColor
Pen.EndColor = __ForegroundColor
else
if __LastMouseButton = _RightMouseButton Then
Pen.StartColor = __BackgroundColor
Pen.EndColor = __BackgroundColor
else
Pen.StartColor = __ForegroundColor
Pen.EndColor = __ForegroundColor
Pen.StartTolerance = 128
Pen.EndTolerance = 128
endif
endif
Image(0).Line( __LastPointStartX,__LastPointStartY, __LastPointEndX+lx,__LastPointEndY+ly )