mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-26 17:55:52 +00:00
Added new _STRCMP and _STRICMP commands for quick string comparisons. Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders. Altered UCASE and LCASE routines to be faster in some situations for us.
53 lines
2.3 KiB
Plaintext
53 lines
2.3 KiB
Plaintext
The {{KW|PALETTECOLOR}} function is used to return the 32 bit attribute color setting of an image or screen page handle's palette.
|
|
|
|
|
|
{{PageSyntax}}
|
|
:{{Parameter|color32value&}} = {{KW|_PALETTECOLOR}}({{Parameter|attribute_number%}}, {{Parameter|handle&}})
|
|
|
|
|
|
|
|
{{PageDescription}}
|
|
* {{Parameter|attribute_number&}} is the color attribute value from 0 to 255 for 1, 4 or 8 bit images.
|
|
* {{Parameter|handle&}} is the image handle being read for color data. Zero can be used to read the present screen mode palette.
|
|
* Returns the 32 bit color value to be used by the 32 bit RGB functions.
|
|
* For 32 bit images send the _PALETTECOLOR return value to {{KW|_RED32}}, {{KW|_GREEN32}} and {{KW|_BLUE32}} functions to get the Red, Green, and Blue intensity settings.
|
|
* '''Although 32 bit palette values are returned, the function cannot be used with 32 bit images or screen modes!'''
|
|
|
|
|
|
''Example:'' How _PALETTECOLOR works on 32 bit RGB compared to a 4 BPP(SCREEN 12) Qbasic procedure.
|
|
{{CodeStart}} '' ''
|
|
SCREEN 12 'can use any Qbasic legacy screen mode
|
|
DIM RGB(0 TO 47) AS INTEGER 'color intensity array
|
|
FOR c& = 0 TO 15
|
|
'OUT &H3C7, c& 'set color attribute to read
|
|
value32& = {{Cl|_PALETTECOLOR (function)|_PALETTECOLOR}}(c&, 0) 'sets color value to read of an image page handle.
|
|
'red% = INP(&H3C9)
|
|
red% = {{Cl|_RED32}}(value32&)
|
|
'green% = INP(&H3C9)
|
|
green% = {{Cl|_GREEN32}}(value32&)
|
|
'blue% = INP(&H3C9)
|
|
blue% = {{Cl|_BLUE32}}(value32&)
|
|
RGB(c& * 3) = red%: RGB((c& * 3) + 1) = green%: RGB((c& * 3) + 2) = blue%
|
|
NEXT
|
|
FOR i = 0 TO 47 STEP 3
|
|
RGBval$ = LTRIM$(STR$(RGB(i))) + "," + STR$(RGB(i + 1)) + "," + STR$(RGB(i + 2)) + ")"
|
|
PRINT "Color"; i / 3, "_RGB(" + RGBval$;
|
|
PRINT
|
|
NEXT
|
|
END '' ''
|
|
{{CodeEnd}}
|
|
|
|
:''Explanation:'' To save a bitmap or other image you need the RGB color settings or the colors will look all wrong. You can store that information into a larger image array and [[GET (graphics statement)|GET]] the image AFTER the color settings. Just GET the image starting at Array(48).
|
|
|
|
|
|
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_PALETTECOLOR]] (statement)
|
|
* [[_NEWIMAGE]], [[_LOADIMAGE]]
|
|
* [[SAVEIMAGE]] (example code)
|
|
|
|
|
|
|
|
{{PageNavigation}} |