English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 18 February 2021, 12:54   #1
sandruzzo
Registered User
 
Join Date: Feb 2011
Location: Italy/Rome
Posts: 1,973
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
sandruzzo is offline  
Old 18 February 2021, 12:56   #2
DanScott
Lemon. / Core Design

DanScott's Avatar
 
Join Date: Mar 2016
Location: Tier 5
Posts: 999
just swap the coordinates
DanScott is offline  
Old 18 February 2021, 13:42   #3
sandruzzo
Registered User
 
Join Date: Feb 2011
Location: Italy/Rome
Posts: 1,973
Doesn't work like that. Order is still top to bottom
sandruzzo is offline  
Old 18 February 2021, 14:26   #4
Thomas Richter
Registered User
 
Join Date: Jan 2019
Location: Germany
Posts: 1,137
Quote:
Originally Posted by sandruzzo View Post
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.
Thomas Richter is offline  
Old 18 February 2021, 14:32   #5
Toni Wilen
WinUAE developer
 
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 46
Posts: 24,783
Most optimized blitter line routines swap coordinates if direction is "wrong" because it makes rest of calculation (octanct etc) simpler and faster.
Toni Wilen is online now  
Old 18 February 2021, 15:07   #6
sandruzzo
Registered User
 
Join Date: Feb 2011
Location: Italy/Rome
Posts: 1,973
I and using an optimized one, that allways draw top to bottom
sandruzzo is offline  
Old 19 February 2021, 00:54   #7
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,954
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.
Photon is offline  
Old 19 February 2021, 04:50   #8
sandruzzo
Registered User
 
Join Date: Feb 2011
Location: Italy/Rome
Posts: 1,973
@Photon

Yes, it's optimized and use octant' symmetry, that's way swapping coordinate don't work. I
sandruzzo is offline  
Old 19 February 2021, 14:50   #9
LaBodilsen
Registered User

 
Join Date: Dec 2017
Location: Gandrup / Denmark
Posts: 134
Quote:
Originally Posted by sandruzzo View Post
@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

(just kidding of course)
LaBodilsen is offline  
Old 20 February 2021, 05:52   #10
sandruzzo
Registered User
 
Join Date: Feb 2011
Location: Italy/Rome
Posts: 1,973
@LaBodilsen

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


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:49.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.08749 seconds with 15 queries