Esempio n. 1
0
struct Screen * openscreen(void)
{
  struct Screen * screen;
  UWORD pens[] = { ~0 };
ULONG patterncoltab[] = { 
    (16L << 16) + 0,	/* 16 colors, loaded at index 0 */
    
    0xB3B3B3B3, 0xB3B3B3B3, 0xB3B3B3B3, /* Grey70	*/
    0x00000000, 0x00000000, 0x00000000, /* Black	*/
    0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, /* White	*/
    0x66666666, 0x88888888, 0xBBBBBBBB, /* AMIGA Blue   */
    
    0x00000000, 0x00000000, 0xFFFFFFFF, /* Blue		*/
    0x00000000, 0xFFFFFFFF, 0x00000000, /* Green	*/
    0xFFFFFFFF, 0x00000000, 0x00000000, /* Red		*/
    0x00000000, 0xFFFFFFFF, 0xFFFFFFFF, /* Cyan		*/
    
    0x33333333, 0x33333333, 0x33333333, /* Pattern Col 1 */
    0xcdcdcdcd, 0x6c6c6c6c, 0xc7c7c7c7, /* Pattern Col 2 */
    0x8e8e8e8e, 0x85858585, 0x93939393, /* Pattern Col 3 */
    0x22222222, 0x22222222, 0x22222222, /* Pattern Col 4 */
    
    0x77777777, 0x77777777, 0x77777777, /* Pattern Col 5 */
    0x66666666, 0x66666666, 0x66666666, /* Pattern Col 6 */
    0x55555555, 0x55555555, 0x55555555, /* Pattern Col 7 */
    0x44444444, 0x44444444, 0x44444444, /* Pattern Col 8 */
    
    0L		/* Termination */
};    
   
  printf("Opening screen\n");
  if ((screen = OpenScreenTags(NULL,
                          SA_Width, 	640,
                          SA_Height, 	480,
			  SA_Depth,	24,
			  SA_Title,	"gfx hidd demo",
			  SA_Pens,	pens,
                          TAG_END))) {
  } else {
      screen = OpenScreenTags(NULL,
                          SA_Width, 	640,
                          SA_Height, 	480,
			  SA_Title,	"gfx hidd demo",
			  TAG_END);
  }

  if (screen)
        LoadRGB32(&screen->ViewPort, patterncoltab);

/*  screen->RastPort.longreserved[0] = window->RPort->longreserved[0];

  Draw(&screen->RastPort, 100, 100);
*/
  return screen;
}
Esempio n. 2
0
void AMI_ILBM_setScreenPalette(const amiVideo_Palette *palette, struct Screen *screen)
{
    if(AMI_ILBM_agaIsSupported())
    {
        amiVideo_ULong *colorSpecs = amiVideo_generateRGB32ColorSpecs(palette);
        LoadRGB32(&screen->ViewPort, (ULONG*)colorSpecs);
        free(colorSpecs);
    }
    else
    {
        amiVideo_UWord *colorSpecs = amiVideo_generateRGB4ColorSpecs(palette);
        LoadRGB4(&screen->ViewPort, (UWORD*)colorSpecs, palette->bitplaneFormat.numOfColors);
        free(colorSpecs);
    }
}
// Load a 32 bit palette, even under <39
void LIBFUNC L_LoadPalette32(
	REG(a0, struct ViewPort *vp),
	REG(a1, unsigned long *palette))
{
	// Under 39 pass to Gfx library
	if( ((struct Library *)GfxBase)->lib_Version>=39) 
	{
		LoadRGB32(vp,palette);
	}

	// Otherwise, convert to 4 bit
	else
	{
		unsigned short *backup_palette;
		short pen,numcols;

		// Get count
		numcols=*(unsigned short *)palette;
		++palette;

		// Allocate backup palette
		if ((backup_palette=AllocVec(numcols*sizeof(unsigned short),0)))
		{
			// Convert to 4 bit colour
			for (pen=0;pen<numcols;pen++)
			{
				backup_palette[pen]=((*palette++)&0xf0000000)>>20;
				backup_palette[pen]|=((*palette++)&0xf0000000)>>24;
				backup_palette[pen]|=((*palette++)&0xf0000000)>>28;
			}

			// Load palette
			LoadRGB4(vp,backup_palette,numcols);

			// Free backup
			FreeVec(backup_palette);
		}
	}
}
Esempio n. 4
0
static void SetPalette(PaletteT *palette) {
  size_t j = 0;

  Display->Palette->Start = palette->start;
  Display->Palette->Count = 0;

  while (palette) {
    size_t i;

    for (i = 0; i < palette->count; i++) {
      Display->Palette->Colors[j++] = palette->colors[i].r << 24;
      Display->Palette->Colors[j++] = palette->colors[i].g << 24;
      Display->Palette->Colors[j++] = palette->colors[i].b << 24;
    }

    Display->Palette->Count += palette->count;
 
    palette = palette->next;
  }

  Display->Palette->Colors[j] = 0;

  LoadRGB32(&Display->Screen->ViewPort, (ULONG *)Display->Palette);
}