English Amiga Board (http://eab.abime.net/index.php)
-   Coders. Asm / Hardware (http://eab.abime.net/forumdisplay.php?f=112)
-   -   Blitter Line reverse drawing question (http://eab.abime.net/showthread.php?t=105881)

 sandruzzo 18 February 2021 12:54

Blitter Line reverse drawing question

Currently I'm drawing line from top to bottom, I would like to reverse order. Is there any fast trick way to do that?

 DanScott 18 February 2021 12:56

just swap the coordinates

 sandruzzo 18 February 2021 13:42

Doesn't work like that. Order is still top to bottom

 Thomas Richter 18 February 2021 14:26

Quote:
 Originally Posted by sandruzzo (Post 1463292) Doesn't work like that. Order is still top to bottom
Err, if you setup the blitter control blits, it can draw lines in all of the 8 possible octants. Or use graphics/Draw(), which does all the computation for you.

 Toni Wilen 18 February 2021 14:32

Most optimized blitter line routines swap coordinates if direction is "wrong" because it makes rest of calculation (octanct etc) simpler and faster.

 sandruzzo 18 February 2021 15:07

I and using an optimized one, that allways draw top to bottom

 Photon 19 February 2021 00:54

Then I think the routine is made to do that. That is, you swap the coordinates and then call the routine, and the routine does what it's made to do, takes lines pointing upward or downward, and swap the coordinates to draw all lines downward.

To fix it, look in the routine. There should be a subtract to create delta values for X and Y. Then, look for a test for the sign of delta Y. Reverse the test.

But if it's optimized, it's not made for that (only has 4/8 octants, the downward pointing ones). This means a rewrite of the routine.

 sandruzzo 19 February 2021 04:50

@Photon

Yes, it's optimized and use octant' symmetry, that's way swapping coordinate don't work. I

 LaBodilsen 19 February 2021 14:50

Quote:
 Originally Posted by sandruzzo (Post 1463479) @Photon Yes, it's optimized and use octant' symmetry, that's way swapping coordinate don't work. I
just put you screen pointer to the bottom of your bitmap, and set module to -80 :D

(just kidding of course)

 sandruzzo 20 February 2021 05:52

@LaBodilsen

Partial working: x is flipped too! I'm using line drawing to simulate rope swing, so, all it's up-side down!

 All times are GMT +2. The time now is 04:29.