Click here to Skip to main content
15,888,461 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: employe information Pin
Henry Minute6-Aug-09 10:22
Henry Minute6-Aug-09 10:22 
Questioncalculate start and stop time Pin
KannanNatesan6-Aug-09 2:32
KannanNatesan6-Aug-09 2:32 
AnswerRe: calculate start and stop time Pin
Johan Hakkesteegt6-Aug-09 3:10
Johan Hakkesteegt6-Aug-09 3:10 
GeneralRe: calculate start and stop time Pin
Dalek Dave6-Aug-09 3:27
professionalDalek Dave6-Aug-09 3:27 
GeneralRe: calculate start and stop time Pin
Luc Pattyn6-Aug-09 4:19
sitebuilderLuc Pattyn6-Aug-09 4:19 
QuestionHow would I deal with 10-bit-integer? Pin
Sonhospa5-Aug-09 22:37
Sonhospa5-Aug-09 22:37 
AnswerRe: How would I deal with 10-bit-integer? Pin
Moreno Airoldi5-Aug-09 23:41
Moreno Airoldi5-Aug-09 23:41 
NewsRe: How would I deal with 10-bit-integer? Pin
Sonhospa6-Aug-09 1:14
Sonhospa6-Aug-09 1:14 
Hi Moreno,

thank you for taking some time. Since I'm a bit clumsy with Hex-stuff I just went and tried your piece of code, replacing the 'buff' value with a UInt32 read from the file (and swapped).

The changed function now considers that the array only consists of 3 Elements (RGB) per pixel instead of 4 (bytes). It now reads like
Private Function MakeRGBArray(ByVal PicFile As FileInfo) As Array
    Dim ft As FileStream = New FileStream(PicFile.FullName, FileMode.Open)
    Dim brh As BinaryReader = New BinaryReader(ft)
    ft.Position = 8192          ' start with first pixel after the header

    ' change array dimensions from 4 bytes per pixel to 3 (RGB)
    Dim RGBArray(CInt(PicFile.Length - ft.Position) / 4 * 3 - 1) As UInt32

    For i = 0 To (RGBArray.Length - 1) Step 3
        Dim buff As UInt32 = SwapDWORD(brh.ReadUInt32)
        RGBArray(i) = (buff And &H3FF)
        RGBArray(i + 1) = (buff And &HFFC00) >> 10
        RGBArray(i + 2) = (buff And &H3FF00000) >> 20
    Next i
    ft.Close()
    brh = Nothing
    ft = Nothing

    Return RGBArray
End Function
To make it short: I can't tell if your idea works, since there's no reasonable result - just a different very bluish pattern. And to be honest: I'm also afraid there's something else wrong with my code, too? As you see in the main function, I also have to use the 'Imaging.PixelFormat.Format32bppRgb' parameter when creating the new bitmap. Changing it results in an ArgumentException Confused | :confused:

BTW: With your code added, the first pixel returns buff=562758160 (&H218B0210) exactly in the order like it's written in the file (==> Red=528, Green=704, Blue=536)

Do you probably have another hint where I'm trapped in my code salad?

Thank you again,
Michael
GeneralRe: How would I deal with 10-bit-integer? [modified] Pin
Moreno Airoldi6-Aug-09 1:47
Moreno Airoldi6-Aug-09 1:47 
GeneralRe: How would I deal with 10-bit-integer? Pin
Sonhospa6-Aug-09 9:39
Sonhospa6-Aug-09 9:39 
GeneralRe: How would I deal with 10-bit-integer? Pin
Moreno Airoldi6-Aug-09 23:34
Moreno Airoldi6-Aug-09 23:34 
GeneralRe: How would I deal with 10-bit-integer? [modified] Pin
Moreno Airoldi7-Aug-09 0:06
Moreno Airoldi7-Aug-09 0:06 
GeneralRe: How would I deal with 10-bit-integer? Pin
Sonhospa7-Aug-09 7:39
Sonhospa7-Aug-09 7:39 
GeneralRe: How would I deal with 10-bit-integer? Pin
Moreno Airoldi7-Aug-09 15:08
Moreno Airoldi7-Aug-09 15:08 
AnswerRe: How would I deal with 10-bit-integer? Pin
DidiKunz12-Aug-09 3:40
DidiKunz12-Aug-09 3:40 
GeneralRe: How would I deal with 10-bit-integer? Pin
Sonhospa13-Aug-09 10:01
Sonhospa13-Aug-09 10:01 
GeneralRe: How would I deal with 10-bit-integer? Pin
DidiKunz13-Aug-09 20:15
DidiKunz13-Aug-09 20:15 
GeneralRe: How would I deal with 10-bit-integer? Pin
Sonhospa13-Aug-09 21:47
Sonhospa13-Aug-09 21:47 
GeneralRe: How would I deal with 10-bit-integer? Pin
DidiKunz13-Aug-09 23:38
DidiKunz13-Aug-09 23:38 
GeneralRe: How would I deal with 10-bit-integer? Pin
Sonhospa14-Aug-09 9:44
Sonhospa14-Aug-09 9:44 
NewsRe: How would I deal with 10-bit-integer? [modified] Pin
Sonhospa15-Aug-09 2:08
Sonhospa15-Aug-09 2:08 
GeneralRe: How would I deal with 10-bit-integer? Pin
DidiKunz16-Aug-09 0:59
DidiKunz16-Aug-09 0:59 
GeneralRe: How would I deal with 10-bit-integer? [modified] Pin
Sonhospa16-Aug-09 2:10
Sonhospa16-Aug-09 2:10 
AnswerResolved: How would I deal with 10-bit-integer? Pin
Sonhospa16-Aug-09 6:53
Sonhospa16-Aug-09 6:53 
QuestionClearing Datagridview when combobox item is changed [modified] Pin
Dambod5-Aug-09 22:31
Dambod5-Aug-09 22:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.