Posts: 50
Threads: 12
Joined: Nov 2023
Reputation:
3
hi, i am using qb64 pe... I am trying to change a pallete color of one pixel to another (copy a pixel using point(x,y)
i have a screen mode of (512,256 in 32) screen
screen _newimage (512,256,32)
// old point
a=point (oldx,oldy)
// new color
b=point (newx,newy)
_palletcolor a,b
i am reading the pallet color from a palette image i made with colors... it is a pop up so i click the old color. window pops up. i click the new color from pallet and it changes to new color
help please. i is only changing to blue....
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
IF E = -1 THEN
PA! = POINT(_MOUSEX, _MOUSEY)
_PUTIMAGE (104, 80), GPALETTE,: _DISPLAY
DO
A = _MOUSEINPUT
IF _MOUSEBUTTON(1) = -1 THEN PB! = POINT(_MOUSEX, _MOUSEY): _PALETTECOLOR PA!, PB!: _DISPLAY: EXIT DO
LOCATE 1, 1: PRINT _MOUSEX, _MOUSEY, A: _DISPLAY
LOOP
END IF
Posts: 3,447
Threads: 376
Joined: Apr 2022
Reputation:
345
There is no palette in 32-bit screens. Every RGBA color is directly available for use.
Posts: 4,697
Threads: 222
Joined: Apr 2022
Reputation:
322
Use _Unsigned Long type for those colors in RGBA
MyPointColor~& = Point(x, y)
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 1,215
Threads: 162
Joined: Apr 2022
Reputation:
34
07-13-2025, 04:06 PM
(This post was last modified: 07-13-2025, 04:06 PM by madscijr.)
(07-13-2025, 04:26 AM)SMcNeill Wrote: There is no palette in 32-bit screens. Every RGBA color is directly available for use. I was thinking about the color limitation with using a palette, and it occurred to me that unless the program is displaying photos, for the most part my progs only use 30 or so colors, so limited colors shouldn't be a problem. My only question is, with a palette, can you use alpha, or at least make one of the colors transparent? (I'm not at a PC right now where I can try that out.)
Posts: 4,697
Threads: 222
Joined: Apr 2022
Reputation:
322
@madscijr transparencies is the A in RGBA
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 3,447
Threads: 376
Joined: Apr 2022
Reputation:
345
(07-13-2025, 04:06 PM)madscijr Wrote: (07-13-2025, 04:26 AM)SMcNeill Wrote: There is no palette in 32-bit screens. Every RGBA color is directly available for use. I was thinking about the color limitation with using a palette, and it occurred to me that unless the program is displaying photos, for the most part my progs only use 30 or so colors, so limited colors shouldn't be a problem. My only question is, with a palette, can you use alpha, or at least make one of the colors transparent? (I'm not at a PC right now where I can try that out.)
Sure you can. All the 32-bit values are available for you to use in a palette.
_PaletteColor 1, _RGBA32(128,0,0,128) <-- this would set the palette color 1 to have 128 alpha
There's no palette in 32-bit screens however, as all 32-bit colors are available. To use a palette, you'd need to be in 256 color mode (or less).
Posts: 485
Threads: 24
Joined: May 2022
Reputation:
91
_CLEARCOLOR might also be helpful for indexed images.
Posts: 1,215
Threads: 162
Joined: Apr 2022
Reputation:
34
07-13-2025, 11:51 PM
(This post was last modified: 07-13-2025, 11:54 PM by madscijr.)
(07-13-2025, 05:53 PM)SMcNeill Wrote: Sure you can. All the 32-bit values are available for you to use in a palette.
_PaletteColor 1, _RGBA32(128,0,0,128) <-- this would set the palette color 1 to have 128 alpha
There's no palette in 32-bit screens however, as all 32-bit colors are available. To use a palette, you'd need to be in 256 color mode (or less).
Yep, which is what I was talking about, that except for programs that need to display 32-bit color images, like color photographs, for the most part the games and programs I write only use a limited number of colors (usually 32 or 48) so that wouldn't be a problem for me.
(07-13-2025, 06:31 PM)a740g Wrote: _CLEARCOLOR might also be helpful for indexed images. That's good to know!
(07-13-2025, 05:09 PM)bplus Wrote: @madscijr transparencies is the A in RGBA  Right, I just wasn't sure if that was available with indexed color modes. But it is, so cool beans.
|