Site Wide Message: (current site time 9/9/2010 9:26:57 PM EDT)
  • We want your input! One of our sponsors wants to know your opinion about development related issues. Click here to tell us what you think.
  • Are you an emerging/young developer (aged 18-30)? If so, would you like the chance to affect future developer tools and products?
    If so, then click here to give your feedback.
 

Realtime Image Rotation using C dll

Print
Email
winzip icon
Submitted on: 7/22/2010 9:04:24 AM
By: Lefteris Eleftheriades  
Level: Intermediate
User Rating: By 8 Users
Compatibility:VB 5.0, VB 6.0

Users have accessed this code  5829 times.
 
author picture
(About the author)
 
     Rotate a picture at any given angle in realtime. Also scale it, use transparent color, alphablending and hue change. Uses a C dll source included. For the compiled dll: http://www2.cs.ucy.ac.cy/~cs06ee1/rotatedll.zip *UPDATE: 22/7/2010 Fixed memory leak*
 

Windows API/Global Declarations:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
'**************************************
'Windows API/Global Declarations for :Realtime Image Rotation using C dll
'**************************************
Private Declare Function rotatedc Lib "rotate.dll" Alias "rotatedc" (ByVal aHDC As Long, ByVal Angle As Single, ByVal X As Long, ByVal Y As Long, ByVal W As Long, ByVal H As Long, ByVal hBitmap As Long, ByVal pScale As Single, ByVal TraspColor As Long, ByVal Alpha As Single) As Long
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 41 submission(s) by this author

 

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
2/25/2007 9:56:54 PMenmity

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=11830&lngWId=1

http:/ /www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=40386&lngWId=1


(If this comment was disrespectful, please report it.)

 
2/26/2007 2:24:22 AMSoorya

can u pls. add compiled dll (diff ext)?
(If this comment was disrespectful, please report it.)

 
2/26/2007 10:00:56 AMLefteris Eleftheriades

Since the compiled dll got removed from the zip, I gave an external link to the zip file with the dll.

I haven't seen those other submissions mentioned above, but in favour of my submission I have to say, It's clean, fast and standalone just like any windows api
(If this comment was disrespectful, please report it.)

 
2/26/2007 1:20:46 PMMark

Great job Lefteris! Very fast and smooth. *****
(If this comment was disrespectful, please report it.)

 
2/26/2007 1:25:16 PMAkiti Yadav

Good and Clean Code. I did have to go throught the extra step of downlading dev-C++ and compiling the dll.

Thanks.
(If this comment was disrespectful, please report it.)

 
2/26/2007 1:32:36 PMAkiti Yadav

For certain settings, I do get the following error :
Failed to Get Image DIBits"

VB hangs up after this.You will need to make the code more robust.

cheers
(If this comment was disrespectful, please report it.)

 
2/26/2007 3:06:36 PMLaVolpe

Have you considered encoding for 32bpp images using alpha channel? Reading the .c file it appears your code is similar to TransBlt (. I'm suggesting maybe a combination between TransBlt and AlphaBlend. Additionally, if no TranspColor wanted how would that parameter be passed? P.S. I see some optimizations if you are interested
(If this comment was disrespectful, please report it.)

 
2/27/2007 5:46:32 AMpietro ing. cecchi

unable to download from http://www2.cs.ucy.ac.cy/~cs06ee1/rotatedll.zip
please someone who already downloaded it, send me by email:
pietrocecchi@inwind.it

thanks a lot in advance
(If this comment was disrespectful, please report it.)

 
2/27/2007 6:02:52 AMpietro ing. cecchi

well, I retried and succeded in downloading:
http://www2.cs.ucy.ac.cy/~cs06ee1/rotatedll.zip

thanks anyhow

I still have to see the code and how it works...:)
But I vote 5, because I'm sure is the dll we all needed for real time image rotation...

all the best and thanks again dear Lefteris Eleftheriades!...


(If this comment was disrespectful, please report it.)

 
2/27/2007 1:45:48 PMAgustin Rodriguez

I would like that this was a Default function of VB. It Save a lot of work.

(If this comment was disrespectful, please report it.)

 
3/1/2007 6:49:05 AMpietro ing. cecchi

Dear Lefteris,
this is truly a wonderful control...
and it opes new frontieres in VB programming...:)

Very nice is transparency, also...

best compliments and thank you,
Pietro
http://cecchi.infinito.it
(If this comment was disrespectful, please report it.)

 
3/4/2007 8:32:54 AMLefteris Eleftheriades

4-Mar-07
updates:
Fixed a memory leek caused by GetDC()
Fixed Saturation and Luminocity
Optimized code for more speed
Corrected minor bug that caused the image to be rotated 1 pixel off the central rotation axis.
(If this comment was disrespectful, please report it.)

 
7/22/2010 12:49:17 PMWarren Goff

I can only get it to work when compiled and not from the IDE as an insertion point cannot be found.
(If this comment was disrespectful, please report it.)

 
7/23/2010 1:58:54 PMPaul Bahlawan

Works good for me in both ide and exe! I'm thinking of combining this and reexre's "Boxs" program to make something...
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!

Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.