|
-
December 21st, 2007, 05:27 AM
#1
Rotate Image (without control)
I need to write a function inside a module that doesn't use a PictureBox to rotate an image. I've found some API stuff that almost does this, but they all use a PictureBox to save the bitmap.
Can someone please help me out with this? I'm a bit lost when it comes to funky API stuff
-
December 21st, 2007, 10:52 AM
#2
Re: Rotate Image (without control)
You want code that "doesn't use a PictureBox to rotate an image."
Is that like code that 'doesn't even do anything?" Not hard to write I guess.
Where is your image? If it's somewhere, it can be rotated.
-
December 21st, 2007, 12:19 PM
#3
Re: Rotate Image (without control)
You could create a bitmap in memory, or use an StdPicture object.
Please remember to rate the posts and threads that you find useful.
How can something be both new and improved at the same time?
-
December 21st, 2007, 12:27 PM
#4
Re: Rotate Image (without control)
 Originally Posted by Ryuichi
I need to write a function inside a module that doesn't use a PictureBox to rotate an image. I've found some API stuff that almost does this, but they all use a PictureBox to save the bitmap.
Dump the bitmap into a 2 dimensional array. Then just transpose the rows and columns. This should give you the basic gist, to rotate clockwise you need to change the write order:
Code:
Private Function RotateArrayCCW(bSource() As Byte) As Byte()
Dim lOuter As Long, lInner As Long, bOut() As Byte
On Error Resume Next
ReDim bOut(UBound(bSource, 2), UBound(bSource))
If Err.Number <> 0 Then
'Invalid source array.
Err.Clear
Exit Function
Else
For lOuter = LBound(bSource) To UBound(bSource) 'Loop rows.
For lInner = LBound(bSource, 2) To UBound(bSource, 2) 'Loop columns.
bOut(lInner, lOuter) = bSource(lOuter, lInner) 'Write the new values.
Next lInner
Next lOuter
RotateArrayCCW = bOut
End If
End Function
 Originally Posted by dglienna
Is that like code that 'doesn't even do anything?" Not hard to write I guess.
I like that idea. Maybe I'll write a Rube Goldberg program.
Last edited by Comintern; December 21st, 2007 at 02:37 PM.
Reason: Change Quote tag
-
December 21st, 2007, 02:28 PM
#5
Re: Rotate Image (without control)
I'm not the OP. The quote on top is.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|