freitag
8th May 2010, 08:08
Hio, i just started with QT and I want to port some of my stuff from win to mac.
But currently I'm a bit stuck at this point:
I use lockbits in vb.net to get the most speed to manipulate images (as far as I know this should be the fastest way in vb.net). This is a small example how to invert an image
Public Shared Function Invert_Image(ByVal doImage As Bitmap) As Bitmap
Dim imageData As BitmapData = doImage.LockBits(New Rectangle(0, 0, doImage.Width, doImage.Height), _
System.Drawing.Imaging.ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb)
Dim pointer0 As IntPtr = imageData.Scan0
Dim stride As Integer = imageData.Stride
Dim pixels(doImage.Width * doImage.Height - 1) As Integer
Copy(pointer0, pixels, 0, pixels.Length)
For i As Integer = 0 To pixels.Length - 1
pixels(i) = (Not pixels(i) And &HFFFFFF) Or (pixels(i) And &HFF000000)
Next i
Copy(pixels, 0, pointer0, pixels.Length)
doImage.UnlockBits(imageData)
Return doImage
End Function
And this is the point where my questions starts...is there a similar way to manipulate images in QT?
I've read the documentation for QImage but I still don't understand wether QImage got something like this lockbits or wether QT got maybe some even faster methode.
Would some one clarify this to me maybe with some small example?
Thx in advance
freitag
But currently I'm a bit stuck at this point:
I use lockbits in vb.net to get the most speed to manipulate images (as far as I know this should be the fastest way in vb.net). This is a small example how to invert an image
Public Shared Function Invert_Image(ByVal doImage As Bitmap) As Bitmap
Dim imageData As BitmapData = doImage.LockBits(New Rectangle(0, 0, doImage.Width, doImage.Height), _
System.Drawing.Imaging.ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb)
Dim pointer0 As IntPtr = imageData.Scan0
Dim stride As Integer = imageData.Stride
Dim pixels(doImage.Width * doImage.Height - 1) As Integer
Copy(pointer0, pixels, 0, pixels.Length)
For i As Integer = 0 To pixels.Length - 1
pixels(i) = (Not pixels(i) And &HFFFFFF) Or (pixels(i) And &HFF000000)
Next i
Copy(pixels, 0, pointer0, pixels.Length)
doImage.UnlockBits(imageData)
Return doImage
End Function
And this is the point where my questions starts...is there a similar way to manipulate images in QT?
I've read the documentation for QImage but I still don't understand wether QImage got something like this lockbits or wether QT got maybe some even faster methode.
Would some one clarify this to me maybe with some small example?
Thx in advance
freitag