Revision history for KeyPgPalette


Revision [21679]

Last edited on 2016-11-07 07:42:38 by fxm [Formatting]
Additions:



Revision [21075]

Edited on 2016-03-13 09:04:11 by fxm [Formatting]

No Differences

Revision [20437]

Edited on 2016-02-10 16:06:23 by DkLwikki [Update link format]
Additions:
The ##**Palette**## statement is used to retrieve or customize the current palette for graphics modes with a color depth of up to 8bpp; using ##**Palette**## while in a mode with a higher color depth will have no effect. Calling ##**Palette**## with no argument restores the default palette for current graphics mode, as set by the ##[[KeyPgScreengraphics|Screen (Graphics)]]## statement.
The [[GfxLib]] sets a [[GfxDefPalettes|default palette]] when a ##[[KeyPgScreengraphics|Screen]]## mode is initialized.
##color = red [[KeyPgOpOr|or]] (green [[KeyPgOpShiftLeft|shl]] 8) [[KeyPgOpOr|or]] (blue [[KeyPgOpShiftLeft|shl]] 16)##
Where red, green and blue must range ##0##-##63##. Please note that color values accepted by ##**Palette**## are **not** the in the same form as returned by the ##[[KeyPgRgb|RGB]]## macro (the red and blue fields are inverted, and the range is different); this is for backward compatibility with QB.
- ##[[KeyPgScreengraphics|Screen (Graphics)]]##
- ##[[KeyPgColor|Color]]##
- ##[[KeyPgUsing|Using]]##
- ##[[GfxInternalFormats|Internal Pixel Formats]]##
Deletions:
The ##**Palette**## statement is used to retrieve or customize the current palette for graphics modes with a color depth of up to 8bpp; using ##**Palette**## while in a mode with a higher color depth will have no effect. Calling ##**Palette**## with no argument restores the default palette for current graphics mode, as set by the ##[[KeyPgScreengraphics Screen (Graphics)]]## statement.
The [[GfxLib]] sets a [[GfxDefPalettes default palette]] when a ##[[KeyPgScreengraphics Screen]]## mode is initialized.
##color = red [[KeyPgOpOr or]] (green [[KeyPgOpShiftLeft shl]] 8) [[KeyPgOpOr or]] (blue [[KeyPgOpShiftLeft shl]] 16)##
Where red, green and blue must range ##0##-##63##. Please note that color values accepted by ##**Palette**## are **not** the in the same form as returned by the ##[[KeyPgRgb RGB]]## macro (the red and blue fields are inverted, and the range is different); this is for backward compatibility with QB.
- ##[[KeyPgScreengraphics Screen (Graphics)]]##
- ##[[KeyPgColor Color]]##
- ##[[KeyPgUsing Using]]##
- ##[[GfxInternalFormats Internal Pixel Formats]]##


Revision [15909]

Edited on 2012-02-01 15:55:23 by CountingPine [Formatting]
Additions:
The [[GfxLib]] sets a [[GfxDefPalettes default palette]] when a ##[[KeyPgScreengraphics Screen]]## mode is initialized.
Deletions:
The [[GfxLib]] sets a [[GfxDefPalettes default palette]] when a [[KeyPgScreengraphics Screen]] mode is initialized.


Revision [15741]

Edited on 2012-01-20 11:47:33 by CountingPine [Relocate USING keyword in parameter list]

No Differences

Revision [15740]

Edited on 2012-01-20 11:46:46 by CountingPine [Formatting; QB differences; explicit CamelCase link; example 3]
Additions:
The [[GfxLib]] sets a [[GfxDefPalettes default palette]] when a [[KeyPgScreengraphics Screen]] mode is initialized.
In screen modes ##1##, ##2##, ##7##, ##8## and ##9## you can assign to each color index one of the colors in the available range. In other screen modes, the color must be specified in the form ##&h//BBGGRR//##, where ##//BB//##, ##//GG//## and ##//RR//## are the blue, green and red components ranging ##&h0##-##&h3F## in hexadecimal (##0##-##63## in decimal). If you don't like hexadecimal form, you can use the following formula to compute the integer value to pass to this parameter:
Calling ##**Palette Using**## allows to set a list of color values all at once; you should pass an array holding enough elements as the color indices available for your current graphics mode color depth (2 for 1bpp, 4 for 2bpp, 16 for 4bpp or 256 for 8bpp). The array elements must be integer color values in the form described above. The colors stored into ##//arrayname//## starting with given ##//idx//## index are then assigned to each palette index, starting with index ##0##.
dim pal(0 to 255) as integer
for i as integer = 0 to 15
print using "Color ## = &"; i; hex(pal(i), 6)
- ""QBasic"" did not support PALETTE GET to retrieve a palette.
- ""QBasic"" did not allow passing individual red/green/blue values.
Deletions:
The GfxLib sets a [[GfxDefPalettes default palette]] when a [[KeyPgScreengraphics Screen]] mode is initialized.
In screen modes 1, 2, 7, 8 and 9 you can assign to each color index one of the colors in the available range. In other screen modes, the color must be specified in the form &hBBGGRR, where BB, GG and RR are the blue, green and red components ranging ##&h0##-##&h3F## in hexadecimal (0-63 in decimal). If you don't like hexadecimal form, you can use the following formula to compute the integer value to pass to this parameter:
Calling ##**Palette Using**## allows to set a list of color values all at once; you should pass an array holding enough elements as the color indices available for your current graphics mode color depth (2 for 1bpp, 4 for 2bpp, 16 for 4bpp or 256 for 8bpp). The array elements must be integer color values in the form described above. The colors stored into ##//arrayname//## starting with given ##//idx//## index are then assigned to each palette index, starting with index 0.
dim pal(1 to 256) as integer
dim i as integer
for i = 1 to 16
print "Color"; i; " ="; hex(pal(i))
- QB version did not support palette retrieval.


Revision [14224]

Edited on 2009-08-20 02:10:49 by CountingPine [Formatting; QB differences; explicit CamelCase link; example 3]
Additions:
In screen modes 1, 2, 7, 8 and 9 you can assign to each color index one of the colors in the available range. In other screen modes, the color must be specified in the form &hBBGGRR, where BB, GG and RR are the blue, green and red components ranging ##&h0##-##&h3F## in hexadecimal (0-63 in decimal). If you don't like hexadecimal form, you can use the following formula to compute the integer value to pass to this parameter:
##color = red [[KeyPgOpOr or]] (green [[KeyPgOpShiftLeft shl]] 8) [[KeyPgOpOr or]] (blue [[KeyPgOpShiftLeft shl]] 16)##
Where red, green and blue must range ##0##-##63##. Please note that color values accepted by ##**Palette**## are **not** the in the same form as returned by the ##[[KeyPgRgb RGB]]## macro (the red and blue fields are inverted, and the range is different); this is for backward compatibility with QB.
In the second form, you specify the red, green and blue components for a palette entry directly, by calling ##**Palette**## with 4 parameters. In this case ##//r//##, ##//g//## and ##//b//## must be in the range ##0##-##255##.
Calling ##**Palette Using**## allows to set a list of color values all at once; you should pass an array holding enough elements as the color indices available for your current graphics mode color depth (2 for 1bpp, 4 for 2bpp, 16 for 4bpp or 256 for 8bpp). The array elements must be integer color values in the form described above. The colors stored into ##//arrayname//## starting with given ##//idx//## index are then assigned to each palette index, starting with index 0.
If the ##**Get**## option is specified, ##**Palette**## retrieves instead of setting color values for the current palette. The parameters have the same meaning as specified for the form being used, but in this case color, ##//r//##, ##//g//## and ##//b//## must be variables passed by reference that will hold the color RGB values on function exit.
- ##[[KeyPgUsing Using]]##
Deletions:
In screen modes 1, 2, 7, 8 and 9 you can assign to each color index one of the colors in the available range. In other screen modes, the color must be specified in the form &hBBGGRR, where BB, GG and RR are the blue, green and red components ranging &h0-&h3F in hexadecimal (0-63 in decimal). If you don't like hexadecimal form, you can use the following formula to compute the integer value to pass to this parameter:
##color = red or (green shl 8) or (blue shl 16)##
Where red, green and blue must range 0-63. Please note that color values accepted by ##**Palette**## are **not** the in the same form as returned by the ##[[KeyPgRgb RGB]]## macro (the red and blue fields are inverted, and the range is different); this is for backward compatibility with QB.
In the second form, you specify the red, green and blue components for a palette entry directly, by calling ##**Palette**## with 4 parameters. In this case ##//r//##, ##//g//## and ##//b//## must be in the range 0-255.
Calling ##**Palette** USING## allows to set a list of color values all at once; you should pass an array holding enough elements as the color indices available for your current graphics mode color depth (2 for 1bpp, 4 for 2bpp, 16 for 4bpp or 256 for 8bpp). The array elements must be integer color values in the form described above. The colors stored into ##//arrayname//## starting with given ##//idx//## index are then assigned to each palette index, starting with index 0.
If the ##GET## option is specified, ##**Palette**## retrieves instead of setting color values for the current palette. The parameters have the same meaning as specified for the form being used, but in this case color, ##//r//##, ##//g//## and ##//b//## must be variables passed by reference that will hold the color RGB values on function exit.


Revision [12614]

The oldest known version of this page was created on 2008-02-27 12:11:55 by MaDdogg6 [Formatting; QB differences; explicit CamelCase link; example 3]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki



sf.net phatcode