256 Color Palette 
Author Message
 256 Color Palette

Hi,

  Has anyone figured out some numerical progression in the layout of the 256
color palette? In other words.. If I start with the standard VGA palette and
take #32 (true blue) is there some factor I could add to get a lighter blue
and/or a darker blue?

  I'm attempting to create a 3D effect for box frames, etc. and require AT
LEAST 3 hues of the same color to do so. 4 or 5 would be better but I'll
settle for 3..

TIA,

        Don Schullian

 www.basicguru.com/schullian



Tue, 10 Oct 2000 03:00:00 GMT  
 256 Color Palette

Don Schullian heeft geschreven in bericht

Quote:
>Hi,
Hi,

>  Has anyone figured out some numerical progression in the layout of the
256
>color palette?

256 colors ??? in powerbasic ????
are you using VESA modes or are you using a self-made SCREEN 13 ???

Quote:
>In other words.. If I start with the standard VGA palette and
>take #32 (true blue) is there some factor I could add to get a lighter blue
>and/or a darker blue?

if you are using VESA you could use interrupt 10 to change the palette to
whatever you like.
64 shades of blue for instance ;)
fill an array with the colors you like just like this :
first color (color 0)
red              byte
green            byte
blue             byte
empty one        byte
second color (color 1)
red              byte
green            byte

etc.

sub SetPalette (tabel() as byte) public
  reg %ax,&h4f09             'vesa paletfunctions
  reg %bx,&0000              'subfunction set palette
  reg %cx,128                'number (the first 128, bacause you can't enter
                             '256 in a byte to do them all at once. )
  reg %dx,0                  'first palletindex
  reg %es,varseg(tabel(0))   let them kow where the colors are
  reg %di,varptr(tabel(0))
  call interrupt &h10        'do the job

  reg %ax,&h4f09             'vesa paletfunctions
  reg %bx,&0000              'subfunction set palette
  reg %cx,128                'number
  reg %dx,128                  'first palletindex

  reg %es,varseg(tabel(512))
  reg %di,varptr(tabel(512))
  call interrupt &h10
end sub

Quote:

>  I'm attempting to create a 3D effect for box frames, etc. and require AT

AAAAAAAAHHHHHHHHHHH !!!!!! (good luck :)
Quote:
>LEAST 3 hues of the same color to do so. 4 or 5 would be better but I'll
>settle for 3..

>TIA,

>        Don Schullian

> www.basicguru.com/schullian



Wed, 11 Oct 2000 03:00:00 GMT  
 256 Color Palette

This is an assembly newsgroup. most pb discussion is at
http://www.powerbasic.com/support/bbs

To the original poster: Why don't you 'make' the hues?

mov dx, 0x3C8
mov al, <color you want to modify>
OUT DX, AL
inc dx
mov al, <amount of red, 0=none, 63=max>
out dx, al
mov al, <amount of green. 0-63>
out dx, al
mov al, <amount of blue. 0-63>
out dx, al
dec dx ;now you are back at 0x3C8, the index port.

to set up your hues just divide the numbers by 3 and then multiply by 2
or 1 depending on how much hue you want. You might wanna divide by 4 and
multiply by 1, 2, 3, or 4.. and use all shifts for some speed (and a
shift up plus add for tbe *3) to give four hues.

NB: Instead up OUTing the colors you can IN them and you'll recieve the
intensities, from 0-63, of red, then green, then blue.

Quote:

> Don Schullian heeft geschreven in bericht

> >Hi,
> Hi,

> >  Has anyone figured out some numerical progression in the layout of the
> 256
> >color palette?
> 256 colors ??? in POWERbasic ????
> are you using VESA modes or are you using a self-made SCREEN 13 ???

> >In other words.. If I start with the standard VGA palette and
> >take #32 (true blue) is there some factor I could add to get a lighter blue
> >and/or a darker blue?
> if you are using VESA you could use interrupt 10 to change the palette to
> whatever you like.
> 64 shades of blue for instance ;)
> fill an array with the colors you like just like this :
> first color (color 0)
> red              byte
> green            byte
> blue             byte
> empty one        byte
> second color (color 1)
> red              byte
> green            byte

> etc.

> sub SetPalette (tabel() as byte) public
>   reg %ax,&h4f09             'vesa paletfunctions
>   reg %bx,&0000              'subfunction set palette
>   reg %cx,128                'number (the first 128, bacause you can't enter
>                              '256 in a byte to do them all at once. )
>   reg %dx,0                  'first palletindex
>   reg %es,varseg(tabel(0))   let them kow where the colors are
>   reg %di,varptr(tabel(0))
>   call interrupt &h10        'do the job

>   reg %ax,&h4f09             'vesa paletfunctions
>   reg %bx,&0000              'subfunction set palette
>   reg %cx,128                'number
>   reg %dx,128                  'first palletindex

>   reg %es,varseg(tabel(512))
>   reg %di,varptr(tabel(512))
>   call interrupt &h10
> end sub

> >  I'm attempting to create a 3D effect for box frames, etc. and require AT
> AAAAAAAAHHHHHHHHHHH !!!!!! (good luck :)

> >LEAST 3 hues of the same color to do so. 4 or 5 would be better but I'll
> >settle for 3..

> >TIA,

> >        Don Schullian

> > www.basicguru.com/schullian

--
- Ray Zwitserloot.


 Change the E-mail address to reply!

----------------------------------------------------



Wed, 11 Oct 2000 03:00:00 GMT  
 256 Color Palette

Quote:

> Hi,

>   Has anyone figured out some numerical progression in the layout of the 256
> color palette? In other words.. If I start with the standard VGA palette and
> take #32 (true blue) is there some factor I could add to get a lighter blue
> and/or a darker blue?

<snip>

The simple answer  :

colour = Colour to Adjust
red    = red component of colour   (0..63)
green  = green component of colour (0..63)
blue   = blue component of colour  (0..63)

PALETTE  colour, red + green * &h100 + blue * &h10000

lo and behold, the colour  #colour now has new attributes.
For light blue, use something like
Red = 32
Green = 32
Blue = 63

-Peter



Wed, 11 Oct 2000 03:00:00 GMT  
 256 Color Palette

Quote:

>This is an assembly newsgroup. most pb discussion is at
>http://www.powerbasic.com/support/bbs

Actually, you crossposted your message to:

alt.lang.asm
alt.lang.powerbasic
comp.lang.basic.misc

Only one of which is an assembly newsgroup.



Wed, 11 Oct 2000 03:00:00 GMT  
 256 Color Palette

On Sat, 25 Apr 1998 12:32:10 +0100, Reinier Zwitserloot

Quote:

}This is an assembly newsgroup. most pb discussion is at
}http://www.powerbasic.com/support/bbs

[snip a good answer]

Newsgroups: alt.lang.asm,alt.lang.powerbasic,comp.lang.basic.misc

:)

...



Wed, 11 Oct 2000 03:00:00 GMT  
 256 Color Palette



Quote:

>> Hi,

>>   Has anyone figured out some numerical progression in the layout of the 256
>> color palette? In other words.. If I start with the standard VGA palette and
>> take #32 (true blue) is there some factor I could add to get a lighter blue
>> and/or a darker blue?

><snip>

>The simple answer  :

WRONG!!

I don't want to change the existing colors or their positions within the
palette. I want to be able to use the default palette with BMP's, etc.

  ____    _    ____      ____  _____
 |  _ \  / \  / ___) __ | ___)(_   _)
 | |_)  / _ \ \____\/  \|  _)   | |
 |____//_/ \_\(____/\__/|_|     |_|

     www.basicguru.com/schullian



Wed, 11 Oct 2000 03:00:00 GMT  
 256 Color Palette

I could be wrong in this but I am not aware of any pattern to the colors in
the VGA's pallette. You can however reprogram the VGA's pallette with the
colors you want. In DOS you simply program the VGA using IN and OUT
commands. E-mail me if you want details or look in any VGA techniques book.
In Windows, because many programs are using the screen simeotaneously, this
probably would result in a general protection fault. However, DirectX has a
set of functions for setting the pallette. See the developer's area of
Microsoft's homesite for docs on DirectX or look in any game writing book.



Quote:
>   Has anyone figured out some numerical progression in the layout of the
256
> color palette? In other words.. If I start with the standard VGA palette
and
> take #32 (true blue) is there some factor I could add to get a lighter
blue
> and/or a darker blue?



Thu, 12 Oct 2000 03:00:00 GMT  
 256 Color Palette

Hi Don,

You could locate the nearest color in the palette, by going through all
colors (0 - 255) and
determining the distance (difference in red)^2 + (difference in green)^2
+ (difference in blue)^2.
(The smallest distance of course is the closest color)
This isn't very fast, so you could put these in a lookup table. This
way, you don't have to alter the palette. Hope that helped.

Greetings,
Lennaert

Quote:



> >> Hi,

> >>   Has anyone figured out some numerical progression in the layout of the 256
> >> color palette? In other words.. If I start with the standard VGA palette and
> >> take #32 (true blue) is there some factor I could add to get a lighter blue
> >> and/or a darker blue?

> ><snip>

> >The simple answer  :

> WRONG!!

> I don't want to change the existing colors or their positions within the
> palette. I want to be able to use the default palette with BMP's, etc.

<knip>


Thu, 12 Oct 2000 03:00:00 GMT  
 256 Color Palette

Ahh...

I see.

Well, I know how to do that aswell...
I could prolly even send you some code.

But you'd have to ask nice

-Peter

Quote:



> >> Hi,

> >>   Has anyone figured out some numerical progression in the layout of the 256
> >> color palette? In other words.. If I start with the standard VGA palette and
> >> take #32 (true blue) is there some factor I could add to get a lighter blue
> >> and/or a darker blue?

> ><snip>

> >The simple answer  :

> WRONG!!

> I don't want to change the existing colors or their positions within the
> palette. I want to be able to use the default palette with BMP's, etc.

>   ____    _    ____      ____  _____
>  |  _ \  / \  / ___) __ | ___)(_   _)
>  | |_)  / _ \ \____\/  \|  _)   | |
>  |____//_/ \_\(____/\__/|_|     |_|

>      www.basicguru.com/schullian



Fri, 13 Oct 2000 03:00:00 GMT  
 256 Color Palette

On Sun, 26 Apr 1998 23:19:01 +0200, Lennaert van der Linden

Quote:

>Hi Don,

>You could locate the nearest color in the palette, by going through all
>colors (0 - 255) and
>determining the distance (difference in red)^2 + (difference in green)^2
>+ (difference in blue)^2.
>(The smallest distance of course is the closest color)
>This isn't very fast, so you could put these in a lookup table. This
>way, you don't have to alter the palette. Hope that helped.

Now THAT's a thought! I'll play around with it.

Thanks.

  ____    _    ____      ____  _____
 |  _ \  / \  / ___) __ | ___)(_   _)
 | |_)  / _ \ \____\/  \|  _)   | |
 |____//_/ \_\(____/\__/|_|     |_|

     www.basicguru.com/schullian



Fri, 13 Oct 2000 03:00:00 GMT  
 256 Color Palette

Quote:

>  Has anyone figured out some numerical progression in the layout of the 256
>color palette? In other words.. If I start with the standard VGA palette and
>take #32 (true blue) is there some factor I could add to get a lighter blue
>and/or a darker blue?

>  I'm attempting to create a 3D effect for box frames, etc. and require AT
>LEAST 3 hues of the same color to do so. 4 or 5 would be better but I'll
>settle for 3..

Don, if you run this little QBasic program, you will see several patterns in
the 256 color palette that you can take advantage of.

SCREEN 13
FOR C = 0 TO 255
   LINE (C, 0)-(C, 199), C
NEXT
SCREEN 0
--
Judson McClendon          This is a faithful saying and worthy of all
Sun Valley Systems        acceptance, that Christ Jesus came into the

(please remove numbers from email id to respond)



Fri, 13 Oct 2000 03:00:00 GMT  
 256 Color Palette


Quote:

>> Hi,

>>   Has anyone figured out some numerical progression in the layout of the
256
>> color palette? In other words.. If I start with the standard VGA palette
and
>> take #32 (true blue) is there some factor I could add to get a lighter
blue
>> and/or a darker blue?

><snip>

>The simple answer  :

>colour = Colour to Adjust
>red    = red component of colour   (0..63)
>green  = green component of colour (0..63)
>blue   = blue component of colour  (0..63)

>PALETTE  colour, red + green * &h100 + blue * &h10000

This one is faster (alot more faster):

OUT &H3C8, colour
OUT &H3C9, red
OUT &H3C9, green
OUT &H3C9, blue

- Show quoted text -

Quote:

>lo and behold, the colour  #colour now has new attributes.
>For light blue, use something like
>Red = 32
>Green = 32
>Blue = 63

>-Peter



Fri, 13 Oct 2000 03:00:00 GMT  
 256 Color Palette


Quote:
> I could be wrong in this but I am not aware of any pattern to the colors in
> the VGA's pallette. You can however reprogram the VGA's pallette with the
> colors you want. In DOS you simply program the VGA using IN and OUT
> commands. E-mail me if you want details or look in any VGA techniques book.
> In Windows, because many programs are using the screen simeotaneously, this
> probably would result in a general protection fault. However, DirectX has a
> set of functions for setting the pallette. See the developer's area of
> Microsoft's homesite for docs on DirectX or look in any game writing book.



> >   Has anyone figured out some numerical progression in the layout of the
> 256
> > color palette? In other words.. If I start with the standard VGA palette
> and
> > take #32 (true blue) is there some factor I could add to get a lighter
> blue
> > and/or a darker blue?

I'm not sure of quite how it goes...been away from the dome scene for a
while...but you should be able to use rgb colors in a
x * 65355 + y * 256 + z * 16 or something...think that is the numbers.

I have the source code for this in a nice plasma graphic example somewhere
just trying to get a doc of the net should cover it...

If really interrested in the source code send me a mail

Gottfred



Fri, 09 Mar 2001 03:00:00 GMT  
 256 Color Palette

Quote:
>I'm not sure of quite how it goes...been away from the dome scene for a
>while...but you should be able to use rgb colors in a
>x * 65355 + y * 256 + z * 16 or something...think that is the numbers.

try this:
colour = blue * 655536 + green * 256 + red
P.S.
        I got this from VB's ancestor, MICRO$OFT QuickBasic!


Sat, 10 Mar 2001 03:00:00 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. Using 256 color Palettes in High/True Color

2. choose a color in a 256 color palette ?

3. Coloring a control from a 256-Color palette

4. Coloring a control from a 256-Color palette

5. Custom 256-color palettes - how??

6. 256 color palette with VB controls

7. 256-color palette in VB4 MDI Forms

8. 256 Color Palette not sticking

9. 256 color palettes

10. 256 color palettes with movies

11. Q: using and changing the 256 color palette...

12. grid congtrol not responding to 256 color palette requests

 

 
Powered by phpBB® Forum Software