18 February 2021, 12:54 | #1 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
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?
Thanks in Advance |
18 February 2021, 12:56 | #2 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,213
|
just swap the coordinates
|
18 February 2021, 13:42 | #3 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
Doesn't work like that. Order is still top to bottom
|
18 February 2021, 14:26 | #4 |
Registered User
Join Date: Jan 2019
Location: Germany
Posts: 3,316
|
|
18 February 2021, 14:32 | #5 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,573
|
Most optimized blitter line routines swap coordinates if direction is "wrong" because it makes rest of calculation (octanct etc) simpler and faster.
|
18 February 2021, 15:07 | #6 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
I and using an optimized one, that allways draw top to bottom
|
19 February 2021, 00:54 | #7 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,658
|
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. Last edited by Photon; 19 February 2021 at 12:25. |
19 February 2021, 04:50 | #8 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
@Photon
Yes, it's optimized and use octant' symmetry, that's way swapping coordinate don't work. I |
19 February 2021, 14:50 | #9 |
Registered User
Join Date: Dec 2017
Location: Denmark
Posts: 179
|
|
20 February 2021, 05:52 | #10 |
Registered User
Join Date: Feb 2011
Location: Italy/Rome
Posts: 2,344
|
@LaBodilsen
Partial working: x is flipped too! I'm using line drawing to simulate rope swing, so, all it's up-side down! |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Puzzling: Blitter line drawing faster on second execution | Yragael | Coders. Asm / Hardware | 10 | 02 June 2019 22:52 |
Blitter line-drawing mode? | E-Penguin | Coders. Blitz Basic | 2 | 13 April 2019 21:37 |
Blitter: clean-up line drawing and fill mode idle cycles. | ross | Coders. Asm / Hardware | 9 | 12 May 2018 22:32 |
Blitter line drawing: nothing happens | Crank | Coders. General | 21 | 25 April 2018 21:43 |
Drawing a line... | Lonewolf10 | Coders. Tutorials | 24 | 06 September 2011 00:46 |
|
|