A question about logic.

Discussion in 'C++' started by JoeC, Apr 14, 2010.

  1. JoeC

    JoeC Guest

    I am trying to create a series of graphics on a single bitmap. So I
    can edit any of a series of graphics.

    ac, dw are the across and down locations.

    I have to invert the bitmap because windows draws graphics up side
    down.

    acc is the pitch or total width of the whole bitmap.

    Each graphic will be 16x16 part of the bitmap.

    So I am using a flat array to hold the graphics data.

    The logic is that for my down coord I go accross the whole bit map
    until I get to the down location.

    I go accross current which is the current graphic being edited
    skipping the others that are not.

    Finally I go across ac to the location being edited which I change the
    color of that square.

    It works fine for one graphic but when I start adding graphics, the
    wrong blocks get changed and when I fill a 16x16 graphic a fraction
    1/3 or 1/2 of the previous graphic gets filled not the edited
    graphic. Is there some flaw in my logic or much I post more code for
    explain better what I am trying to do and the results I am getting.

    void bitmap::changeBit(int ac, int dn, BYTE col){

    BYTE up = 16-dn;

    BYTE num = (up*acc)+(current*16)+ac;

    if((num < acc*dwn) || (num > 0)){
    bits[num] = col;
    }
    }

    Thank you for your time.
     
    JoeC, Apr 14, 2010
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mca
    Replies:
    3
    Views:
    389
    ccallen
    May 6, 2004
  2. Igor
    Replies:
    2
    Views:
    2,822
  3. Sue

    simple logic question

    Sue, Apr 6, 2005, in forum: Java
    Replies:
    5
    Views:
    2,432
  4. javadude
    Replies:
    2
    Views:
    5,929
    Wendy Smoak
    Jun 30, 2005
  5. spike
    Replies:
    8
    Views:
    1,497
    Steve Holden
    Feb 9, 2010
Loading...

Share This Page