A question about logic.

J

JoeC

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top