Home All Groups Group Topic Archive Search About

Looking for an easy way to achive this problem.

Author
1 Mar 2007 11:41 PM
Kardon Coupé
Dear All,

I'm looking for some tips and/or suggestions to this little task I've set
myself.

I've dug out a load of my old 8 bit stuff (old source code and graphics
files, etc) and I've got a load of graphics that I need to view, so
basically I'm wanting to write a vb app that can load a binary file, and
read byte by byte, and display the bytes in a graphics box, so the graphics
will show a 8 by 8 grid, with pixels on and off, based on the bytes that are
being read in (I really hope this makes sense)...

I can appreacite that a 8 by 8 char would be very small, so I was thinking
of making the pixels about the size of a normal 8 size font on windows...

If I have the principal building blocks, I'll be able to move foward and
maybe do a 16 by 16 box, or 8 by 16, etc....

I'm just asking what is the best way to go about this, as I've never worked
with pictures directly using VB, I can load a .bmp into a form, etc and use
it that way, but not be able to manipulate it?

Is it easy, or will it be a challenge?

Regards
Paul.

Author
2 Mar 2007 7:40 AM
BeastFish
I ~think~ I kinda understand.  If I do understand correctly, each data byte
read in is just an indicator if the corresponding pixel is on or off.  If
so, you can accomplish this using a PictureBox and the PSet method.

To simplify this example, I just used a 64 character string with each
character being either a "1" (on) or "0" (off).  And I hardcoded the string
to indicate a little 8 x 8 box...

    Dim PixelMap As String

    ' Hardcode it as an 8x8 box
    PixelMap = "11111111"
    PixelMap = PixelMap & "10000001"
    PixelMap = PixelMap & "10000001"
    PixelMap = PixelMap & "10000001"
    PixelMap = PixelMap & "10000001"
    PixelMap = PixelMap & "10000001"
    PixelMap = PixelMap & "10000001"
    PixelMap = PixelMap & "11111111"
    Debug.Print PixelMap

    Picture1.ScaleMode = vbPixels
    Picture1.AutoRedraw = True

    Dim XX As Single, YY As Single, PP As Integer

    For YY = 0 To 7
        For XX = 0 To 7
            PP = PP + 1
            If Mid$(PixelMap, PP, 1) = "1" Then Picture1.PSet (XX, YY),
&HFF&  ' red pixel
        Next XX
    Next YY




Show quoteHide quote
"Kardon Coupé" <prefer.to@readon.newsgroups> wrote in message
news:eGJGdsFXHHA.1636@TK2MSFTNGP02.phx.gbl...
> Dear All,
>
> I'm looking for some tips and/or suggestions to this little task I've set
> myself.
>
> I've dug out a load of my old 8 bit stuff (old source code and graphics
> files, etc) and I've got a load of graphics that I need to view, so
> basically I'm wanting to write a vb app that can load a binary file, and
> read byte by byte, and display the bytes in a graphics box, so the
graphics
> will show a 8 by 8 grid, with pixels on and off, based on the bytes that
are
> being read in (I really hope this makes sense)...
>
> I can appreacite that a 8 by 8 char would be very small, so I was thinking
> of making the pixels about the size of a normal 8 size font on windows...
>
> If I have the principal building blocks, I'll be able to move foward and
> maybe do a 16 by 16 box, or 8 by 16, etc....
>
> I'm just asking what is the best way to go about this, as I've never
worked
> with pictures directly using VB, I can load a .bmp into a form, etc and
use
> it that way, but not be able to manipulate it?
>
> Is it easy, or will it be a challenge?
>
> Regards
> Paul.
>
>
Author
2 Mar 2007 7:48 AM
J French
On Thu, 1 Mar 2007 23:41:17 -0000, "Kardon Coupé"
<prefer.to@readon.newsgroups> wrote:

Show quoteHide quote
>Dear All,
>
>I'm looking for some tips and/or suggestions to this little task I've set
>myself.
>
>I've dug out a load of my old 8 bit stuff (old source code and graphics
>files, etc) and I've got a load of graphics that I need to view, so
>basically I'm wanting to write a vb app that can load a binary file, and
>read byte by byte, and display the bytes in a graphics box, so the graphics
>will show a 8 by 8 grid, with pixels on and off, based on the bytes that are
>being read in (I really hope this makes sense)...
>
>I can appreacite that a 8 by 8 char would be very small, so I was thinking
>of making the pixels about the size of a normal 8 size font on windows...

Been there !

Always set your ScaleMode to vbPixels

Have a look at the Line method - specifically Box Fill

Also: PSet

Ultimately you'll land up using the APIs
SetPixel, FillRect etc
Author
2 Mar 2007 9:56 AM
Larry Serflaten
"J French" <erew***@nowhere.uk> wrote

> >I'm looking for some tips and/or suggestions to this little task I've set
> >myself.
<...>
> >I can appreacite that a 8 by 8 char would be very small, so I was thinking
> >of making the pixels about the size of a normal 8 size font on windows...

>
> Ultimately you'll land up using the APIs
> SetPixel, FillRect etc

He could use a lookup table that has images for the 256 different bit configurations.
Here is an example that is oriented horizontally (instead of vertically like they
would be in an 8-bit character map).  Not quite the same, but enough to get an idea....
http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/853cb2c6db9d178a

LFS
Author
2 Mar 2007 12:10 PM
J French
On Fri, 2 Mar 2007 03:56:17 -0600, "Larry Serflaten"
<serfla***@usinternet.com> wrote:

Show quoteHide quote
>
>"J French" <erew***@nowhere.uk> wrote
>
>> >I'm looking for some tips and/or suggestions to this little task I've set
>> >myself.
><...>
>> >I can appreacite that a 8 by 8 char would be very small, so I was thinking
>> >of making the pixels about the size of a normal 8 size font on windows...
>
>>
>> Ultimately you'll land up using the APIs
>> SetPixel, FillRect etc
>
>He could use a lookup table that has images for the 256 different bit configurations.
>Here is an example that is oriented horizontally (instead of vertically like they
>would be in an 8-bit character map).  Not quite the same, but enough to get an idea....
>http://groups.google.co.uk/group/microsoft.public.vb.general.discussion/msg/853cb2c6db9d178a

Very true - it reminds me of printing to two colour CGA screens