I've figured out a way to get my animations to work fast and still have the 
quality of aggpas.  The problem I have is that even though I've managed to 
accelerate putimage() and it's pretty fast, it's still not fast enough and my 
animations in my program happen too slow, especially on slow computers.  I can 
build the screen fast with aggpas, and I can do putimage() pretty fast, but for 
some reason making a change with aggpas then putimage, then change aggpas then 
putimage... is slower.  So I came up with a solution.  I do the animations with 
ptcgraph commands at the same time I build the screen with aggpas, then when 
the animation is finished, I do my putimage() and replace the screen with the 
aggpas rendered version.  It works out that during the animation, the screen is 
changing distractingly fast that you really don't notice the lower quality 
graphics produced by ptcgraph routines, and when it stops and now you have a 
chance to look a it, the screen has been replaced with the aggpas version so 
everything looks nice and smooth 😊   With this method I actually had to put a 
delay in my animation cycle or it was too fast and I lost the animation effect 
I was looking for.   

Now I'm ready to start integrating everything I learned into my real 
application and I have a question.
My original application used only 8bit colors, but now I am upgrading it to 
16bit colors because it will give aggpas more to work with for it's 
anti-aliasing.   Is there some formula or maybe even some function in 
freepascal somewhere that converts 8bit colors to their 16bit equivalents?   
The two color schemes are nothing alike.  16bit is using this RGB565 format, 
but 8bit colors (at least the version I was using) the colors have no real 
relation to their bits (see this https://pasteboard.co/2K38l6Gk1.png)  I can't 
figure out any pattern to this at all and while some colors I can figure out, 
others would be quite difficult.  I'm wondering if maybe there is already some 
translation from these 8bit color designations into 16bit color designations so 
all I would have to do is a global search and replace of setcolor(x) to 
setcolor(8bit_to_16bit(x)); and then all my colors would be the same as they 
were.

I'm also wondering if there is already some function to either convert the 
16bit RGB565 colors into separate 8bit values of red, green, and blue suitable 
to plug into aggpas procedures like 
agg^.lineColor(red, green, blue, 255);  I could probably manage something for 
this because it's pretty well defined that I have 5bits red, 6 bits green, and 
5 bits blue, but still I'm not exactly clear how it would get from 5 or 6 bits 
up to 8 bits per color...  but if it's already available somewhere I might as 
well use what's done already.

James


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to