The message below is being cross-posted from the LogoForum. Please
reply here at comp.lang.logo and it will be cross-posted back to the
LogoForum. The original author of this message is
bgorman@[EMAIL PROTECTED]
do a bit of image manipulation, so I checked by running my program in
both MSWLogo and FMSLogo, and it works identically in both.
I do not use FD to move about, but FOR loops that control movement using
setxy.
Here's a sample, works with any .bmp file:
First load the pix and set variable "pixsize:
to getpix :filename
;Get the picture
;cs home
bitload :filename
; Get it's size
make "pixsize bitloadsize :filename
end
This is the main routine that loops through the image:
to pix :Type
; get size from :Pixsize
ht pu
make "xsiz first :pixsize
make "ysiz second :pixsize
make "newpxl []
for [x 0 :xsiz-1 1]~
[for [y :ysiz-1 0 -1]~
[DoPixel]]
end
to DoPixel
; inherit x & y
setxy :x :y
make "pxl pixel
; Transform
make "red first :pxl
make "grn second :pxl
make "blu third :pxl
;
; Transform the image
change :Type
make "newpxl (list :red :grn :blu)
setpixel :newpxl
end
Here's a sample Transformation - Reverse, which done twice restores the
original.
to change :type
if :type = "reverse [~
make "red 255 - :red
make "grn 255 - :grn
make "blu 255 - :blu
stop]
end
Utilities
to second :list
;output 2nd element
output first butfirst :list
end
to third :thing
output first butfirst butfirst :thing
end
Enjoy,
Bob
--
A ship in a harbor is safe. But that is not what ships were built for...
J.A. Shedd
http://www.KnCell.org
http://blog.KnCell.org
__._,_.___
LogoForum messages are archived at:
http://groups.yahoo.com/group/LogoForum
> The message below is being cross-posted from the LogoForum. Please
> reply here at comp.lang.logo and it will be cross-posted back to the
> LogoForum. The original author of this message is
> dale-reed@[EMAIL PROTECTED]
>
>
> This discussion reminds me of the old saw that when you acquire a brand
> new hammer everything looks like a nail.
>
> Do any of you have any evidence that programming with Logo will improve
> your thinking about any thing else?
>
> Dale
>
> PS Back to "standards"
> Try this code in MSWLogo and FMSLogo and tell me if you get the same
> answers. On my computer, but apparently not others, MSWLogo determines
> the color of the pixels *under* the pen but FMSLogo determines the color
> *of* the pen.
>
> to aa
> cs pu
> fd 100
> rt 90 fd 100
> setpc [255 0 0]
> setpensize[3 3]
> pd bk 200
> pu home
> setpc [0 0 0]
> setpensize[1 1]
> pd fd 95
> repeat 10[show pixel fd 1]
> end
>
> ---
> $ dale-reed@[EMAIL PROTECTED]
Seattle, Washington $
>
> __._,_.___
> LogoForum messages are archived at:
> http://groups.yahoo.com/group/LogoForum


|