Trying to create a poormans wireframe 
Author Message
 Trying to create a poormans wireframe

Hi all,

I stumbled on to this new group by accident...what a great resource!!!!!

I am new to API's.
I am starting a project where I need to take a series of
bitmaps (frames from an avi) and I need to convert all the
pixels that are not white to white and all the pixels that
are white to black.  In effect creating a wire frame that after
I rebuild the wireframe bitmaps, I have a avi of wireframe motion.

I just bought Rod Stephens VB Graphics 2 ed. he touches on this using
bit masking (I still am not clear) but I was wondering if there is a way
to do this using API calls which I presume might be more effic and faster.

I noticed that there are many API functions that handle intricate graphic
problems.
Are there any books on line literature that explain, in newbie detail, the
API graphic
routines, how to use them, etc.

Also on a semi-related topic:  when drawing a line in a picture-box that is
not perfectly
horizontal or vertical, is there any way to generate a straight (diagonal)
line that isn't
obnoxiously jaggie?

Thanks for any light you could shed on this.

Mike Thomas



Wed, 12 Mar 2003 03:00:00 GMT  
 Trying to create a poormans wireframe

Quote:
> I stumbled on to this new group by accident...what a great resource!!!!!

> I am new to API's.
> I am starting a project where I need to take a series of
> bitmaps (frames from an avi) and I need to convert all the
> pixels that are not white to white and all the pixels that
> are white to black.  In effect creating a wire frame that after
> I rebuild the wireframe bitmaps, I have a avi of wireframe motion.

It's tricky to convert a bitmap to a vector, but possible if you don't mind
writing a lot of code..

Quote:
> I just bought Rod Stephens VB Graphics 2 ed. he touches on this using
> bit masking (I still am not clear) but I was wondering if there is a way
> to do this using API calls which I presume might be more effic and faster.

If you have a look at page 189 in the afore mentioned book then you'll see a
section on automating masking, the three demo apps on the CD should be of
use to you there too (CD: -> Src -> Ch6 -> Compose*.vbp).  His code uses the
API, but personally I'd use BitBlt rather than PaintPicture() - It's
marginally faster.
However, if your going to be drawing wireframes then you only need to
process the mask, not actually draw it back to screen.  You can just use the
standard Line() routine of a picture box or the MoveToEx(), LineTo() API
calls to draw your wireframe.

Quote:
> I noticed that there are many API functions that handle intricate graphic
> problems.
> Are there any books on line literature that explain, in newbie detail, the
> API graphic
> routines, how to use them, etc.

Not really, graphics in VB is a kind of grey area since it's really not
designed for it.  However, I and others here will be glad to answer any of
your questions, and we'll try and keep things as simple as possible :)
However, there are a few sites about with demo code on that may help you,
and don't be put off by people who say writing graphics routines in VB is
impossible - There wrong (There just unimaginative)

Quote:
> Also on a semi-related topic:  when drawing a line in a picture-box that
is
> not perfectly
> horizontal or vertical, is there any way to generate a straight (diagonal)
> line that isn't
> obnoxiously jaggie?

The reason you get the jaggie's on an API drawn line is because it uses
integer mathematics so calculate where to draw the pixel.  As your working
on a pixel based display there are only a finite number of physical
locations to draw on the screen, so as you step from one line to the next
you get a very noticeable step, particularly on near-horizontal/vertical
lines.  The technique to draw a smooth like is called antialiasing which
means you plot sub-pixel distances and plot the weight of the pixel over a
range rather than plotting the entire pixel weight on just one pixel.  It
takes longer to process and draw because the computer has a lot more work to
do, and you've got to draw double the number of pixels.
One method of antialiasing is the Wu algorithms, which are fast versions of
'smooth' shape plotting.  You can see examples of these routines over on my
site, and later on today I'll be posting my routine there as a number of
people have expressed interest in it.
Hope this helps,

    Mike

 -- EDais --

WWW: Http://Members.xoom.com/EDais/




Wed, 12 Mar 2003 03:00:00 GMT  
 Trying to create a poormans wireframe
Thanks Mike!!!!



Quote:
> > I stumbled on to this new group by accident...what a great resource!!!!!

> > I am new to API's.
> > I am starting a project where I need to take a series of
> > bitmaps (frames from an avi) and I need to convert all the
> > pixels that are not white to white and all the pixels that
> > are white to black.  In effect creating a wire frame that after
> > I rebuild the wireframe bitmaps, I have a avi of wireframe motion.

> It's tricky to convert a bitmap to a vector, but possible if you don't
mind
> writing a lot of code..

> > I just bought Rod Stephens VB Graphics 2 ed. he touches on this using
> > bit masking (I still am not clear) but I was wondering if there is a way
> > to do this using API calls which I presume might be more effic and
faster.

> If you have a look at page 189 in the afore mentioned book then you'll see
a
> section on automating masking, the three demo apps on the CD should be of
> use to you there too (CD: -> Src -> Ch6 -> Compose*.vbp).  His code uses
the
> API, but personally I'd use BitBlt rather than PaintPicture() - It's
> marginally faster.
> However, if your going to be drawing wireframes then you only need to
> process the mask, not actually draw it back to screen.  You can just use
the
> standard Line() routine of a picture box or the MoveToEx(), LineTo() API
> calls to draw your wireframe.

> > I noticed that there are many API functions that handle intricate
graphic
> > problems.
> > Are there any books on line literature that explain, in newbie detail,
the
> > API graphic
> > routines, how to use them, etc.

> Not really, graphics in VB is a kind of grey area since it's really not
> designed for it.  However, I and others here will be glad to answer any of
> your questions, and we'll try and keep things as simple as possible :)
> However, there are a few sites about with demo code on that may help you,
> and don't be put off by people who say writing graphics routines in VB is
> impossible - There wrong (There just unimaginative)

> > Also on a semi-related topic:  when drawing a line in a picture-box that
> is
> > not perfectly
> > horizontal or vertical, is there any way to generate a straight
(diagonal)
> > line that isn't
> > obnoxiously jaggie?

> The reason you get the jaggie's on an API drawn line is because it uses
> integer mathematics so calculate where to draw the pixel.  As your working
> on a pixel based display there are only a finite number of physical
> locations to draw on the screen, so as you step from one line to the next
> you get a very noticeable step, particularly on near-horizontal/vertical
> lines.  The technique to draw a smooth like is called antialiasing which
> means you plot sub-pixel distances and plot the weight of the pixel over a
> range rather than plotting the entire pixel weight on just one pixel.  It
> takes longer to process and draw because the computer has a lot more work
to
> do, and you've got to draw double the number of pixels.
> One method of antialiasing is the Wu algorithms, which are fast versions
of
> 'smooth' shape plotting.  You can see examples of these routines over on
my
> site, and later on today I'll be posting my routine there as a number of
> people have expressed interest in it.
> Hope this helps,

>     Mike

>  -- EDais --

> WWW: Http://Members.xoom.com/EDais/





Thu, 13 Mar 2003 03:00:00 GMT  
 Trying to create a poormans wireframe

Quote:
> Thanks Mike!!!!

No problem.  Sorry I couldn't post the code until a bit later than I said,
Xoom wouldn't let me on the FTP so some obscure reason, ah well.  It's up
there now, enjoy :)

    Mike

 -- EDais --

WWW: Http://Members.xoom.com/EDais/




Thu, 13 Mar 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. 3D wireframe viewer problem

2. 3d wireframe maze

3. I have tried and tried.... and tried

4. WireFrame on X File

5. Wireframe objects...

6. Problems with the wireframe view

7. Run time error when trying to save a created file

8. Trying to create a drop down file searcher in 97

9. Getting error 429a when trying create database

10. Error 429 trying to create Word objects - help!

11. Trying to create an Internet Email field on Form or Table

12. Trying to create a VBA script that will send out an email everyday

 

 
Powered by phpBB® Forum Software