English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 20 June 2018, 19:02   #141
E-Penguin
Banana

 
Join Date: Jul 2016
Location: Darmstadt
Posts: 587
Quote:
Originally Posted by E-Penguin View Post
Code:
PaletteRange Palette#,StartCol,EndCol,r0,g0,b0,r1,g1,b1 

PaletteRange creates a spread of colors within a palette. Similar to DPaint's spread
function PaletteRange takes a start and end colour and creates the color tweens
between them.
Does this work for anyone? I just get black in all the colour registers. I've gone as far as writing my own RGB interpolation function (which, sadly, I just lost because I didn't press save) but surely there must be a way of getting this to work.
As promised, here's my fixed version, for interpolating through the RGB colourspace. I'm still working on an HSV version. Example interpolation attached.
Code:
; By Daniel Lakey, 2018
; Distributed under attribution (CC-BY) licence. 
; Use as you will, a credit would be nice :)
; 
Function.w round{v.q}
	If Frac(v) >= 0.5
		Function Return (Int(v) + 1)
	Else
		Function Return int(v)
	EndIf
End Function

NewType .ntRGB
	r.b
	g.b
	b.b
End NewType

Statement PaletteRangeFixed_RGB{palette_num.w, color_start_num.b, color_end_num.b, *start_rgb.ntRGB, *end_rgb.ntRGB}
	steps.b = (color_end_num - color_start_num)
	t.f = 1/steps
	
	For i=0 to steps
		r_step.b = round{*start_rgb\r + (*end_rgb\r - *start_rgb\r)*(t*i)}
		g_step.b = round{*start_rgb\g + (*end_rgb\g - *start_rgb\g)*(t*i)}
		b_step.b = round{*start_rgb\b + (*end_rgb\b - *start_rgb\b)*(t*i)}
		
		PalRGB palette_num, color_start_num + i, r_step, g_step, b_step
	Next i
End Statement

; .....


  ; Use Palette Range to set the rest of the colours
  a.ntRGB\r=$F,0,0
  b.ntRGB\r=0,$F,0
  PaletteRangeFixed_RGB{#P_1, 2, 6, a, b}
  
  a.ntRGB\r=0,$F,0
  b.ntRGB\r=0,0,$F
  PaletteRangeFixed_RGB{#P_1, 6, 10, a, b}
  
  a.ntRGB\r=0,0,$F
  b.ntRGB\r=$F,0,0
  PaletteRangeFixed_RGB{#P_1, 10, 15, a, b}
Attached Thumbnails
Click image for larger version

Name:	Untitled.png
Views:	27
Size:	7.4 KB
ID:	58606  
E-Penguin is offline  
AdSense AdSense  
Old 23 June 2018, 10:20   #142
Master484
Registered User
Master484's Avatar
 
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 328
I tested the PaletteRange command and it seems to work on classic Blitz 2.1 at least, but the color values given have to be between 0-255, even if it's an OCS screen with OCS palette.

Also you have to give the "Use Palette" or "DisplayPalette" command after PaletteRange, or else the changes won't take effect. So it works in the same way as PalRGB and other palette commands; the changes can't be seen until an Use Palette/DisplayPalette is executed.
Master484 is offline  
Old 28 June 2018, 12:39   #143
Cobe
Registered User

 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 35
Posts: 564
Is there a way to check disk activity?
Cobe is offline  
Old 28 June 2018, 22:41   #144
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 2,923
Not really, no. It might be possible to do it for floppies by checking the motor bit on the CIAs, but no equivalent exists for hard drives, and anyway, there's no guarantee that some other task doesn't start disk access between you checking and doing something else...
Daedalus is offline  
Old 28 June 2018, 23:43   #145
Cobe
Registered User

 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 35
Posts: 564
Thanks.. I feared its like that...
Cobe is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Blitz basic 2 Help Havie Coders. Blitz Basic 30 08 September 2013 09:15
blitz basic petza request.Apps 11 08 April 2007 01:49
Blitz Basic 2 anyone? jobro request.Apps 12 28 November 2005 18:15
Blitz Basic StopCD32 Tony Landais Coders. General 2 08 May 2003 22:51
Blitz Basic 2 LaundroMat Retrogaming General Discussion 5 24 July 2001 08:10

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 20:53.


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