11-23-2025, 01:20 AM
(11-22-2025, 07:27 AM)SMcNeill Wrote: You need to catch up with QB64PE's capabilities. Here's all it takes to toggle from 32-bit to 256 colors:I saw the 256-color index _LOADIMAGE statement awhile back and tried it. I was curious to see what it looked like and tried it, but I was not impressed at all with it.
Here's a side-by-side comparison between the output of my demo vs mode 256:
This image mode, 256, in QB64pe's _LOADIMAGE, has low-level details, and the dithering is patterned, making it hard on the eyes. But, I assume this is by design as it is primarily used to load images that were originally drawn in QB64's master palette, which should be the color palette from VGA's 256-color palette screen modes.
Next is another screenshot, similar to the screenshot above, but for mode 257:
It's obvious what I shared here provides a way better conversion and dithering pattern, but also goes further than what QB64pe offers, by having the ability to convert full-color image to a 2-color palette, all the way up to 256-color palette. It also uses a perceptual palette, which is better for pictures and photos. but that aspect is neither here or there as adaptive colors has it's own usefulness, where perceptual will fail.
In saying all of this, this demo is not about one type of color system. It demonstrates and shows how to do one way of converting full-color images to palette images, and one way of dithering. There are many options for both in existence, and each have their usefulness. I'm sharing the source code to the project for others to enjoy and use in their projects if they so choose. The systems can even be implemented into QB64pe if you so choose.
This project was done in QB64pe for quick setup and testing, and to share with those in this community, the one I am working on, and other communities and people that use QB64. However, once all the core fundamentals are working, it all will be converted to shaders and used with my Vulkan projects, such as the sphere of rotating cubes I shared in the private "Freedom to Speak" sub forum on this forum.
Now that the 256-color palette conversion system is working, there are other conversion and dithering systems that looked intriguing and way better, but much more complex to implement. If they look like the better option, the next step is to do something that hasn't been done before. That is to up the palette system to 65'536-colors. This is all part of my "major project" that I have been working on for some years now, though better computer hardware was needed before the proper tools could be used, and a lot of learning was needed to be done. Thankfully, all of that has been accomplished and the wheels are spinning faster and faster.
(11-22-2025, 06:51 PM)ahenry3068 Wrote: Another reason to roll your own routine would be to map a whole bunch of images to an existing palette when porting from another platform too !Ooh... You hit on topic which are in my notes to do! Too funny! The "major project" (called this to keep the peace and not raise Steve's blood pressure anymore than it is) I mentioned focuses on palette screen modes and graphics as well. I always enjoyed palette screen modes and graphics, as well as pixelated graphics and games. This demo is part of that system, at least in concept.
(11-22-2025, 06:51 PM)ahenry3068 Wrote: Probably the built in options cover a lot of use cases. But there are still reasons to *Roll your own code here !*The built-in options do cover some use cases, but not all. I personally wouldn't use those built-in options as I never use the colors in the VGA 256-color palette for anything, outside of the first 16-colors. There's no need since they can be changed in QB64 as well as on the actual hardware for those real hardware screen modes, which sadly you can not access in GUI operating systems like Windows.
Some reasons for rolling your own code are to learn how to do things yourself, create your own system to suite your own needs, or to create better systems, just to name a few. Of course, all three of those reasons are why I am creating these things.
The Joyful Programmer has changed call signs. The Joyful Programmer is now called "AstroCosmic Systems".


