Results 1 to 12 of 12

Thread: Z-order when drawing graphics??

Hybrid View

  1. #1
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Z-order when drawing graphics??

    OK.

    I made it as simple as possible just to demonstrate the ZOrder principle and a bit of inheritance that lets you treat diamonds and circles in the same way.

    Any questions just PM me.
    Attached Files Attached Files
    I don't live here any more.

  2. #2
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Z-order when drawing graphics??

    A screeny for those too lazy to download it
    Attached Images Attached Images  
    I don't live here any more.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830

    Re: Z-order when drawing graphics??

    Thanks! If nothing else..it is very pretty!

    I will have to look at closely, but what I need (to clarify further) is to draw an image at startup. While my program is running...another image will be drawn to the screen. This image must be (behind) the image that was drawn first. Will you example do that? To make it worse...I will have another image that will be moving around the screen as the program runs. This image must pass over (and under) other drawn images. That is why having a z-order to change on the fly would be nice.

  4. #4
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Z-order when drawing graphics??

    Quote Originally Posted by birthjay
    This image must pass over (and under) other drawn images
    I wish you had said that earlier.

    You'd be better off thinking about transparent colours and alphablending instead of zorder. You cannot draw something 'behind' something else but you can draw one thing and then something else on top. You have to draw from the back to the front in that order.

    My demo will not change the z order for you but it is ready to have that feature added simply by shuffling the contents of an arraylist in whatever sequence you like. Just look at the Button's code and you see what I mean.

    I didn't code the shuffling because i wasn't sure how you wanted to change the zOrder I've left it open ended for you.

    Feel free to give me a rating if you want
    I don't live here any more.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830

    Re: Z-order when drawing graphics??

    Thanks! I thought when I said "z-order" that would be a clue to "over and under"...but anyway....

    I really appreciate your efforts and will give a great rating!

    Thanks again..

  6. #6
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: Z-order when drawing graphics??

    Quote Originally Posted by birthjay
    Thanks! I thought when I said "z-order" that would be a clue to "over and under"...but anyway....

    I really appreciate your efforts and will give a great rating!

    Thanks again..
    I knew you meant "over and under" that is the very definition of the Z axis Its just the way you mentioned animation that makes alphablending more suitable. You can easily use BOTH z ordering AND alphablending to great effect though, give it a shot
    I don't live here any more.

  7. #7
    Addicted Member
    Join Date
    Sep 2004
    Location
    UK
    Posts
    129

    Re: Z-order when drawing graphics??

    Hi, you should be able to animate with Z order, as long as you redraw all the primitives every frame. This is well within the capabilities of GDI+, well up to approx 2000 – 3000 thousand primitives anyway!

    See the attached project for a demo. I have little experience with animation but you will need to address the animation speed issue, at the moment I just change the number of frames, I'm sure there is a more refined way of doing this.
    I’ve not commented but should be clear enough, let me know if you have any questions!
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width