BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Grayscale"
, by pexe
Turn your graphics to Grayscale Mode.
WARNING: This script is VERY SLOW!
Enjoy.
Code
;Grayscale ;By pexe ;WARNING: This is my first script using readpixel and writepixel, and its VERY SLOW! ;Function grayscale(Buffer, X Starting Point, Y Starting Point, Width, Height) Function grayscale(GS_buffer,GS_vx,GS_vy,GS_w,GS_h) LockBuffer(GS_buffer) For GS_y = GS_vy To GS_vy+GS_h-1 For GS_x = GS_vx To GS_vx+GS_w-1 GS_pix = ReadPixelFast(GS_x,GS_y,GS_buffer) GS_r% = (GS_pix Shr 16) And $ff ;\ GS_g% = (GS_pix Shr 8) And $ff ; Transform values GS_b% = GS_pix And $ff ;/ GS_v% = GS_r+GS_g+GS_b GS_v% = GS_v/3 GS_pix=(GS_v Or (GS_v Shl 8) Or (GS_v Shl 16) Or ($ff000000)) ;Put values back WritePixelFast GS_x,GS_y,GS_pix,GS_buffer Next Next UnlockBuffer(GS_buffer) End Function
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations