English Amiga Board


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

 
 
Thread Tools
Old 26 August 2018, 22:48   #1
Havie
Registered User
 
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,893
Help With Palettes

I want to be able to invert the palette ie. white goes to black etc.

Use Palette keeps giving me an 'Object not in use' error even though I haev previously loaded and displayed a palette.

Any ideas what I am doing wrong?
Havie is offline  
Old 26 August 2018, 22:53   #2
Havie
Registered User
 
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,893
Here is the code:

Code:
LoadPalette 0,"graphics/bl1bw"

BLITZ

Colour 0,1

;set up bitmap...
;
BitMap 0,400,200,2

;InitCopList 0,2
InitCopList 0,44,200,2,8,4,0
DisplayPalette 0,0
CreateDisplay 0
Use Palette 0
Havie is offline  
Old 27 August 2018, 15:10   #3
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
I don't think you can use palette objects in that way with the Display Library. Commands that modify a palette object take the palette ID number as an argument, so PalRGB 0, 24, 255, 255, 255 will set pen 24 to white within palette object 0. The currently displayed palette isn't considered a palette object. On an OS screen you can set colours directly (and I think under Slices as well), but for the Display library you have to modify the palette object and then copy it to the display using DisplayPalette each time.
Daedalus is offline  
Old 27 August 2018, 22:38   #4
Havie
Registered User
 
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,893
Ok - thought I didn't understand. Your answer seems clear so I'll have a play. Hopefully I can get it working and send my game out into the wild...

Last edited by Havie; 27 August 2018 at 22:55.
Havie is offline  
Old 28 August 2018, 00:09   #5
Havie
Registered User
 
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,893
It works - thank you for your help. game nearly ready...
Havie is offline  
Old 03 July 2021, 13:28   #6
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
Sorry for hijack this old thread but it´s for a good reason

Every time I import a ppaint palette (#?.col) from an iff image with 2 bitplanes for create Sprites with GetaShape & GetaSprite functions, the colors displayed by the sprites created become misplaced.
How can import the palette and stay with the right colors at the final sprites?
What conditionates the colors imported? Importing palettes from other graphics programs turns in the same bug?
AlfaRomeo is offline  
Old 03 July 2021, 23:05   #7
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
The sprites are only 2 bitplanes deep, but they take their colours from different parts of the palette depending on various things. Assuming an OCS/ECS palette setup with plain non-attached sprites, the sprites all take their colours from palette entries 16-31. Sprite channels 0 and 1 use 16-19, 2 and 3 use 20-23, 4 and 5 use 24-27, 6 and 7 use 28-31. The first colour of each of those sets (16, 20, 24 and 28) are transparent, leaving 3 colours for each pair of sprite channels.

So the palette position you need to use depends on the channels the sprite will be displayed on. Blitz allows you to load a palette at an offset position, you can use the LoadPalette function to load the palette at any offset, e.g. 16 for the first two sprites:

Code:
LoadPalette 0, "myfile.iff", 16
Daedalus is offline  
Old 03 July 2021, 23:50   #8
Havie
Registered User
 
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,893
Beat me to it.

Also, it is important to make sure that you have 32 colours in the Initcoplist statement, even if you game is running in less colours as this allocates space for all the palette entries from 16-31 which then allows you to load them as above.

I find that if you are using 4 colour sprites then it is easier to load each palatte for each set of sprites individually rather than one 16 colour palette but that is a personal preference!

I have spent many hours understanding how sprite palettes work and still get it wrong at times so you just have to keep at it! Who says the Amiga is hard to program - wait, that's a completely different thread.
Havie is offline  
Old 04 July 2021, 00:08   #9
AlfaRomeo
A1200 040 SAM440EP 667
 
AlfaRomeo's Avatar
 
Join Date: Jan 2008
Location: Lisbon / Portugal
Posts: 873
Thanks for the help guys
Already tried a palette with 5 bitplanes but I didn't know how to point at colors 16 to 19 in Blitz.
Will try again with your tips
AlfaRomeo 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
NES color palettes for emulators Leandro Jardim Retrogaming General Discussion 0 11 May 2015 13:29
A guide to analyze your color palettes with Grafx2 nobody Amiga scene 10 11 January 2015 21:08
Problems on an A3000 (Drag-and-Drop & palettes broken) BuddhaPhi project.ClassicWB 1 01 March 2012 00:46
Themes and Palettes discussion fitzsteve project.ClassicWB 16 11 March 2011 13:47
ClassicWB Palettes and Themes Bloodwych project.ClassicWB 1 06 March 2011 00:49

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 01:19.

Top

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