Using the look and feel (Swing's default Metal) and using it for frames too results in really fast rendering. I suppose there is a slowdown for the GTK based widgets.


I really like how LCDUI is turning out now. I think I can really implement all of it using these methods. The code is clean and quite concise.


Okay so this will be the one spot I have always had difficulty doing because I was not sure how it would be handled. But right now I will have to work on fonts. Currently how the font system works is a bit complicated. Fonts and their glyphs need to be visible for rendering. But I cannot really render anything right now. So before I go into fonts I need to implement all of the graphics drawing routines. Then develop the font rasterization routines when I get there and develop the fonts. I will also need to draw all the glyphs by hand too for the most part, but at least with FontForge that is just tedious.


When it comes to indexed mode, I still need to support alpha levels even for indexed things when drawing graphics. So I think for indexed modes, that when a color is set there are pre-calculated alpha blended values for each palette entry. Since I will make these always opaque (having alpha indexed values does not really make sense and these indexed ones will in most cases be used for target device drawing in pretty much all cases) there would only be about a given amount based on the size of the palette calculations to be done when a color is actually changed. But this could be done regardless but for speed purposes I will not do that.


Oh yeah, so removing the primitive horizontal line will make rendering faster because I want to avoid method calls whereever possible when it comes to the bulk drawing operations. But in the end, the code will be far faster although lots of it will be duplicated. At least I only need to change a single class now.


Next thing to do after this base code is setting of colors since that is really important first step. I need a way for indexed code to have a kind of scoring system based on HSV or similar. But I think I want to move the bits around so that some bits have more effect. So it will basically be a speed code for a value.


Before that though, I should choose a better color for the initial canvas color and such.


Well, HSV would be more accurate, but I think something which would be fastest would be if it just operated on the integer parts. Would want it to work in whole bits first. But basically HSV would be more accurate, but for indexed modes where colors might not be matched, I want something fast and simple to calculate.


Okay so I have an idea, basically I can compare colors by lightness first and have that as a higher part of the score. Then there can be a kind of color component additionally to hopefully find a better match after that.


Okay so my initial setup will be turning 0xRRGGBB, adding them together and then dividing that by three. But division by three can be done with basically some magic: (n * 0x5555556) >> 32. So I need to do some tests to see if I can avoid 64-bit math.


Okay so according to Stack Overflow a good fast divide by three would be this: (n * 341) >> 10. So let me see.


A bit inaccurate and off by one, but it is good enough for me as it is only being used as a score of sorts.