[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Forcing sprites to use specific palette entries?



That isnt the issue actually, I want to be able to use the palette modification functions in pygame in 8-bit colour mode to alter colours on surfaces, my workaround seems to work fine, I can even blit any surface now, if I convert a blank surface and blit the unconverted palette-swapped .gif onto it.

On Tue, Aug 17, 2010 at 11:59 AM, Lenard Lindstrom <len-l@xxxxxxxxx> wrote:
Palette surfaces blit to 24 bit or 32 bit surfaces without any color changes. So unless the screen is set to 16 bit colors, there will be no problem.

Lenard Lindstrom


On 16/08/10 04:36 PM, John Anderson wrote:
Okay, I think I have a workaround, if I don't .convert() any images, and modify the palettes from the surface itself, it seems to work fine, hopefully I can get unconverted surfaces to blit properly though, it seems that sprites have no issues blitting, its just plain surfaces which wont blit.

On Sun, Aug 15, 2010 at 10:00 PM, Thiago Chaves <shundread@xxxxxxxxx <mailto:shundread@xxxxxxxxx>> wrote:

   Have you seen this?
   http://www.pygame.org/docs/ref/display.html#pygame.display.set_palette

   If that's not the missing piece in your puzzle, then it's time for you
   to start posting sample code and images so we can reproduce your
   issue.

   -Thiago

   On Sun, Aug 15, 2010 at 10:12 PM, John Anderson
   <corporalmustard@xxxxxxxxx <mailto:corporalmustard@xxxxxxxxx>> wrote:
   > I actually have one, but I would like if it were possible to
   alter which
   > palette entries are used by pygame in real-time, what it seems
   happens when
   > I .convert() an image, it loses it's unique palette data and
   just uses the
   > basic pygame palette, but if I don't convert it, it makes it
   difficult to
   > blit images and adds extra performance issues which might be a
   problem
   > later.  The weird thing is that when I choose not to convert the
   images, it
   > seems to make no difference, the sprites just seem to use
   whatever indicies
   > they want anyway, is there some parameter in convert i dont know
   about, or
   > is it my display setup?
   >
   > On Sun, Aug 15, 2010 at 10:01 AM, Thiago Chaves
   <shundread@xxxxxxxxx <mailto:shundread@xxxxxxxxx>> wrote:
   >>
   >> You need an image editor that gves you an easy way to keep track of
   >> the color index of your palettes. =)
   >>
   >> -Thiago
   >>
   >> On Fri, Aug 13, 2010 at 6:32 PM, John Anderson
   >> <corporalmustard@xxxxxxxxx <mailto:corporalmustard@xxxxxxxxx>>

   wrote:
   >> > yes, I have, unfortunatley that still doesnt mean I can
   specify where
   >> > the
   >> > colours are placed on even the sprite's palette.  For
   example, I have a
   >> > particular sprite with a slightly coloured outline, in the
   sprite's
   >> > palette,
   >> > entries from 0 - 15 are empty, and the outline is entry 16.     I'm not
   >> > even
   >> > sure where any of the other colours are, and that position
   might change
   >> > with
   >> > an excess of differently coloured sprites on screen, or
   worse, even
   >> > disappear entirely.  What I would like to do is have the
   palette fill
   >> > from
   >> > the bottom, or preferably from a specified index with new palette
   >> > entries
   >> > loaded from .gif files, rather than try and find a close
   approximate
   >> > colour
   >> > on the existing palette, is this possible to do without
   changing the
   >> > surface
   >> > implementation in pygame, or even SDL?
   >> >
   >> > On Fri, Aug 13, 2010 at 4:59 AM, Thiago Chaves
   <shundread@xxxxxxxxx <mailto:shundread@xxxxxxxxx>>

   >> > wrote:
   >> >>
   >> >> Have you looked at the palette functions on surfaces?
   >> >>
   >> >> http://www.pygame.org/docs/ref/surface.html#Surface.get_palette
   >> >>
   >> >> -Thiago
   >> >>
   >> >> On Thu, Aug 12, 2010 at 8:56 PM, John Anderson
   >> >> <corporalmustard@xxxxxxxxx
   <mailto:corporalmustard@xxxxxxxxx>> wrote:
   >> >> > Hi, I was wondering if it was possible to force an 8-bit
   colour
   >> >> > sprite
   >> >> > to
   >> >> > use a very particular set of palette entries, like say,
   Sprite A uses
   >> >> > colour
   >> >> > indicies 0 - 16, and Sprite B uses 17 - 32.  As it stands,
   pygame
   >> >> > automatically assigns the colours in a sprite to the
   closest colour
   >> >> > on
   >> >> > the
   >> >> > main palette, meaning that it is very hard to predict
   which colours
   >> >> > are
   >> >> > where, and thus makes palette swapping a nightmare, is
   there any way
   >> >> > around
   >> >> > this?
   >> >> >
   >> >
   >> >
   >
   >