Computer Science Canada Palettes |
Author: | Daetyrnis [ Fri Aug 24, 2007 4:17 pm ] |
Post subject: | Palettes |
Anyone who's looked into how graphics in video games (at least the general 2D ones as far as I know) will learn what palettes are. At first, these limitations can seem annoying, but upon rethinking various situations, palettes can make your life much easier. The simplest benefit of palettes is - of course - recolouring images, right? This enemy is normally green, but later on, he's blue! See what I mean? Anyways, I was wondering if there is a way to implement palettes in Turing that work with pictures. I am aware of the 256 colours available, able to be changed at a whim (and added onto, I believe the maximum was 1024?). This serves perfectly as a palette for Turing-based draw operations, such as drawing text, boxes, lines, dots, et cetera. But, what about pictures? Is there a way that I could display a picture file with the colours in the palette? So far, all I can think of is to create a sort of custom-Pic.Draw process that draws a given picture pixel by pixel, and possibly with palette functionality. Is there a simpler way? |
Author: | rizzix [ Fri Aug 24, 2007 4:22 pm ] |
Post subject: | RE:Palettes |
As far as a custom Pic.Draw is concerned, this might help: bitmap library ![]() |
Author: | Flikerator [ Mon Aug 27, 2007 11:55 pm ] | ||
Post subject: | Re: Palettes | ||
Drawing pixel-by pixel in turing is extremely slow. Heres to show the speed difference:
The reason is, and this is a guess, cls applies a single colored buffer, and drawing pixel-by-pixel changes a buffer (Its even slower without offscreenonly, since it changes directly to the screen instead of a buffer). However, you will notice that without offscreenonly, cls is still just as fast, since it applies a buffer to the screen rather then redrawing; so it takes the same time as View.Update takes anytime. Thats my guess anyway. |