To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > VBForums CodeBank > CodeBank - Other

Reply Post New Thread
 
Thread Tools Display Modes
Old Jul 10th, 2004, 12:26 AM   #1
chemicalNova
G&G Moderator
 
chemicalNova's Avatar
 
Join Date: Jun 02
Location: Victoria, Australia
Posts: 4,245
chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)chemicalNova is a jewel in the rough (200+)
[MASM] Solarize Image

This is a filter I've come up with..
Code:
; Solarize

Solarize PROTO :DWORD,:DWORD,:DWORD

Solarize proc uses edi esi hDC:DWORD,imageX:DWORD,imageY:DWORD

LOCAL rect:RECT
LOCAL red:DWORD
LOCAL green:DWORD
LOCAL blue:DWORD
LOCAL red_res:DWORD
LOCAL green_res:DWORD
LOCAL blue_res:DWORD

mov edi,imageX
dec edi
mov esi,imageY
dec esi
.REPEAT
.REPEAT
invoke GetPixel,hDC,edi,esi	

; This gets only the Alpha value back in EAX discarding the rest
;and eax,0FF000000h
;shr eax,24
                              
mov edx,eax
                                                
; RED
and eax,00FF0000h
shr eax,16
mov red,eax
mov red_res,eax
                     
mov eax,edx
                              
; BLUE
and eax,00FF0000h
mov blue,eax
mov blue_res,eax
              
mov eax,edx
                              
; GREEN
and eax,0000FF00h
mov green,eax
mov green_res,eax
                              
                              
.if (red<128) || (red>255)
mov red,255
mov eax,red
sub eax,red_res
mov red,eax
.endif
.if (green<128) || (green>255)
mov green,255
mov eax,green
sub eax,green_res
mov green,eax
.endif
.if (blue<128) || (blue>255)
mov blue,255
mov eax,blue
sub eax,blue_res
mov blue,eax
.endif

mov ecx,red
add ecx,green
add ecx,blue
mov al,cl
shl eax,8
mov al,cl
shl eax,8
mov al,cl

invoke SetPixelV,hDC,edi,esi,eax
dec esi
.UNTIL SIGN?
mov esi,imageY
dec esi
dec edi
.UNTIL SIGN?
ret	
Solarize endp
If you compile it into a DLL (like I have) it can be used in VB :D

Phreak
__________________

Visual Studio 6, Visual Studio.NET 2005, MASM
chemicalNova is offline   Reply With Quote
Reply

Go Back   VBForums > VBForums CodeBank > CodeBank - Other


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:32 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.