October 12, 2024, 05:04:08 pm
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
1 Hour
1 Day
Forever
Login with username, password and session length
News
: Want to see a specific Tutorial? ASK!
Home
Help
Search
Arcade
Links
Staff List
Login
Register
Making monochrome images
Weekly Qbasic and Qb64 Lesson Topics
>
Forum
>
DEMOS
>
Working QB64 Demos
>
Making monochrome images
Pages: [
1
]
« previous
next »
Print
Author
Topic: Making monochrome images (Read 511 times)
Unseen Machine
Post Demos
Posts: 46
Making monochrome images
«
on:
April 27, 2011, 08:49:53 am »
Converted from the GDK function GDK_ApplyMonoFilter, this version can be used on any image.
Code:
SCREEN _NEWIMAGE(800, 600, 32)
image& = _LOADIMAGE("qblogo.png")
ConvertImage_Mono image&, _RGB(0, 0, 0)
_PUTIMAGE (0, 0), image&
SUB ConvertImage_Mono (Image AS LONG, Alpha&)
OldSource& = _SOURCE
_SOURCE Image
_DEST Image
w% = _WIDTH(Image)
h% = _HEIGHT(Image)
FOR i% = 0 TO w%
FOR j% = 0 TO h%
m& = POINT(i%, j%)
IF m& <> Alpha& THEN
clrsum% = (INT((_BLUE(m&) / 100) * 11) + INT((_RED(m&) / 100) * 39) + INT((_GREEN(m&) / 100) * 50))
IF clrsum% > 0 AND clrsum% < 255 THEN
PSET (i%, j%), _RGB(clrsum%, clrsum%, clrsum%)
END IF
END IF
NEXT
NEXT
_SOURCE OldSource&
_DEST 0
END SUB
Report Spam
Logged
OlDosLover
Guest
Re: Making monochrome images
«
Reply #1
on:
April 27, 2011, 08:58:31 am »
Hi all,
Welcome to the forum unseen. This looks a good program , thanks for sharing. Would like to point out that this site has Private Messageing and Image posting , and would like to invite you to use either as needed.
OlDosLover.
Report Spam
Logged
OlDosLover
Guest
Re: Making monochrome images
«
Reply #2
on:
April 27, 2011, 09:27:23 am »
Hi all,
Inspired by unseen's post a little effect that tricks my eyes.
Code:
REM
SCREEN _NEWIMAGE(800, 600, 32)
image& = _LOADIMAGE("qblogo.png")
effect& = _LOADIMAGE("qblogo.png")
ConvertImage_Mono image&, _RGB(0, 0, 0)
x% = 0: y% = 0: z% = 50
DO
_LIMIT 30
_PUTIMAGE (0, 0), image&
_PUTIMAGE (x%, y%)-(x% + z%, y% + z%), effect&, 0, (x%, y%)-(x% + z%, y% + z%)
_DISPLAY
x% = x% + 1: IF x% >= 158 - z% THEN x% = 0
y% = y% + 1: IF y% >= 127 - z% THEN y% = 0
LOOP UNTIL _KEYDOWN(27)
SLEEP
SYSTEM
SUB ConvertImage_Mono (Image AS LONG, Alpha&)
OldSource& = _SOURCE
_SOURCE Image
_DEST Image
w% = _WIDTH(Image)
h% = _HEIGHT(Image)
FOR i% = 0 TO w%
FOR j% = 0 TO h%
m& = POINT(i%, j%)
IF m& <> Alpha& THEN
clrsum% = (INT((_BLUE(m&) / 100) * 11) + INT((_RED(m&) / 100) * 39) + INT((_GREEN(m&) / 100) * 50))
IF clrsum% > 0 AND clrsum% < 255 THEN
PSET (i%, j%), _RGB(clrsum%, clrsum%, clrsum%)
END IF
END IF
NEXT
NEXT
_SOURCE OldSource&
_DEST 0
END SUB
Thanks unseen.
OlDosLover.
«
Last Edit: April 27, 2011, 10:20:31 pm by OlDosLover
»
Report Spam
Logged
Unseen Machine
Post Demos
Posts: 46
Re: Making monochrome images
«
Reply #3
on:
April 27, 2011, 10:05:53 am »
Nice, i never even thought of that!
Report Spam
Logged
GarrisonRicketson
Admin
Administrator
Hero Member
Posts: 583
Re: Making monochrome images
«
Reply #4
on:
April 27, 2011, 07:53:39 pm »
Hi, Unseen, thanks for all the stuff you posted, I didnt reply to each one,
But do appreciate them all,..
All though everyone here probably has the qblogo image, partly just to demo this, anyone that wants to run the above code, needs the attached image, or they can change the image file name in the code, for any image,..( I think, or dose the size matter, if so it ,the image,would need edited to the corect size, or the code),... any way here is the image attcahed.
Report Spam
Logged
From Garry
http://www.garryricketsonartworks.com/SMF
http://www.garryricketsonartworks.com/phpbbforum
http://www.garryricketsonartworks.org
http://www.garryspages.webs.com
http://wittywittywhatisthat.freesmfhosting.com/index.php
http://www.garryricketsonartworks.com/FluxBB
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> Useful Information ,Rules,FAQs,LINKS,etc.
===> INTRODUCE Yourself
=> General QB64 Forum
=> MS DOS, FREE DOS, ANY DOS
-----------------------------
QB64 lessons and tutorials,Games
-----------------------------
=> Lesson Disussion
=> Weekly Lesson
=> Games
-----------------------------
TUTORIALS
-----------------------------
=> QB64 Tutorials
=> Text Adventure
=> QBasic Tutorials
=> Other Tutorials
-----------------------------
UNSEENS GDK+SFML Librarys
-----------------------------
=> Discussions on GDK+SFML
=> GDK+SFML Demos, and projects
-----------------------------
DEMOS
-----------------------------
=> Working QB64 Demos
=> QB64 Games
=> QB64 Programs You Are Proud Of.
=> Function + SUB Club
-----------------------------
OFF TOPIC,and Off The wall
-----------------------------
=> OffTopic and Off the Wall
Powered by
EzPortal
Loading...