Example #1
0
void djvStyle::setPalettes(const QVector<Palette> & palettes)
{
    if (palettes == _p->palettes)
        return;
    
    _p->palettes = palettes;
    
    colorUpdate();
}
Example #2
0
ENTRYPOINT void
draw_noof (ModeInfo *mi)
{
  int i;
  noof_configuration *bp = &bps[MI_SCREEN(mi)];

  if (!bp->glx_context)
    return;
  glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));

  /**
  if((random() & 0xff) == 0x34){
    glClear(GL_COLOR_BUFFER_BIT);
  }

  if((tko & 0x1f) == 0x1f){
    glEnable(GL_BLEND);
    glColor4f(0.0, 0.0, 0.0, 0.09);
    glRectf(0.0, 0.0, wd, ht);
    glDisable(GL_BLEND);
#ifdef __sgi
    sginap(0);
#endif
  }
  */

  gravity(bp, -2.0);
  for (i = 0; i < N_SHAPES; i++) {
    motionUpdate(bp, i);
    colorUpdate(bp, i);
    drawleaf(bp, i);
  }

  if (mi->fps_p) do_fps (mi);
  glFinish();

/* For some reason this hack screws up on Cocoa if we try to double-buffer it.
   It looks fine single-buffered, so let's just do that. */
/*  glXSwapBuffers(MI_DISPLAY(mi), MI_WINDOW(mi)); */
}
Example #3
0
ENTRYPOINT void
draw_noof (ModeInfo *mi)
{
    int i;
    noof_configuration *bp = &bps[MI_SCREEN(mi)];

    if (!bp->glx_context)
        return;
    glXMakeCurrent(MI_DISPLAY(mi), MI_WINDOW(mi), *(bp->glx_context));
    mi->polygon_count = 0;

    /**
    if((random() & 0xff) == 0x34){
      glClear(GL_COLOR_BUFFER_BIT);
    }

    if((tko & 0x1f) == 0x1f){
      glEnable(GL_BLEND);
      glColor4f(0.0, 0.0, 0.0, 0.09);
      glRectf(0.0, 0.0, wd, ht);
      glDisable(GL_BLEND);
    #ifdef __sgi
      sginap(0);
    #endif
    }
    */

    gravity(bp, -2.0);
    for (i = 0; i < N_SHAPES; i++) {
        motionUpdate(bp, i);
        colorUpdate(bp, i);
        mi->polygon_count += drawleaf(bp, i);
    }

    if (mi->fps_p) do_fps (mi);
    glFinish();

    if (dbuf_p)
        glXSwapBuffers(MI_DISPLAY(mi), MI_WINDOW(mi));
}
Example #4
0
void
oneFrame(void)
{
  int i;

  /**
  if((random() & 0xff) == 0x34){
    glClear(GL_COLOR_BUFFER_BIT);
  }

  if((tko & 0x1f) == 0x1f){
    glEnable(GL_BLEND);
    glColor4f(0.0, 0.0, 0.0, 0.09);
    glRectf(0.0, 0.0, wd, ht);
    glDisable(GL_BLEND);
#ifdef __sgi
    sginap(0);
#endif
  }
  */
  gravity(-2.0);
  for (i = 0; i < N_SHAPES; i++) {
    motionUpdate(i);
#ifdef __sgi
    sginap(0);
#endif
    colorUpdate(i);
#ifdef __sgi
    sginap(0);
#endif
    drawleaf(i);
#ifdef __sgi
    sginap(0);
#endif

  }
  glFlush();
}
Example #5
0
djvStyle::djvStyle(QObject * parent) :
    QObject(parent),
    _p(new djvStylePrivate)
{
    //DJV_DEBUG("djvStyle::djvStyle");
    
    // Load preferences.
    
    djvPrefs prefs("djvStyle", djvPrefs::SYSTEM);
    
    int paletteCount = 0;
    
    prefs.get("paletteCount", paletteCount);
    
    //DJV_DEBUG_PRINT("paletteCount = " << paletteCount);
    
    for (int i = 0; i < paletteCount; ++i)
    {
        Palette palette;
        prefs.get(QString("palette%1").arg(i), palette);
        
        //DJV_DEBUG_PRINT("palette = " << palette.name);
        
        int j = 0;
        
        for (; j < _p->palettes.count(); ++j)
        {
            if (palette.name == _p->palettes[j].name)
            {
                _p->palettes[j] = palette;
                
                break;
            }
        }
        
        if (j == _p->palettes.count())
        {
            _p->palettes += palette;
        }
    }
    
    prefs.get("palettesIndex", _p->palettesIndex);
    
    //DJV_DEBUG_PRINT("palettesIndex = " << _p->palettesIndex);

    int sizeMetricsCount = 0;
    
    prefs.get("sizeMetricsCount", sizeMetricsCount);
    
    for (int i = 0; i < sizeMetricsCount; ++i)
    {
        SizeMetric sizeMetric;
        
        prefs.get(QString("sizeMetric%1").arg(i), sizeMetric);
        
        int j = 0;
        
        for (; j < _p->sizeMetrics.count(); ++j)
        {
            if (sizeMetric.name == _p->sizeMetrics[j].name)
            {
                _p->sizeMetrics[j] = sizeMetric;
                
                break;
            }
        }
        
        if (j == _p->sizeMetrics.count())
        {
            _p->sizeMetrics += sizeMetric;
        }
    }
    
    prefs.get("sizeMetricsIndex", _p->sizeMetricsIndex);
    
    prefs.get("fonts", _p->fonts);
    
    //DJV_DEBUG_PRINT("sizeMetricsIndex = " << _p->sizeMetricsIndex);

    // Initialize.
    
    colorUpdate();
    sizeUpdate();
    fontsUpdate();
}
Example #6
0
void ColorPicker::chooseColor(const QColor& color, bool shouldSignal) {
    if (shouldSignal) {
        emit colorUpdate(color);
    }
}
Example #7
0
int main (void) {
	word cycle = 0;
	word d, base = 0;
	int yb, rg, avx, avy, red, green, blue;

	// init
	PORTB = 0;
	DDRB = (1<<GREEN)|(1<<BLUE)|(1<<RED);
	
	//setup timer0
	bitClear(TCCR0B, CS01);
	bitSet(TCCR0B, CS00);
	bitSet(TIMSK, TOIE0);

	//init adc
	ADCSRA |= bit(ADPS2) | bit(ADPS1) | bit(ADPS0);  // Set ADC prescalar to 128 - 125KHz sample rate @ 16MHz 
	bitClear(ADCSRA, ADIE); // deactivate ADC interrupt
	ADMUX &= ~(bit(REFS1) | bit(REFS0));	 /* vref = Vcc */
	bitClear(ADMUX,ADLAR); // right adjust
	
	ADCSRB &= ~(bit(ADTS2) | bit(ADTS1) | bit(ADTS0)); // free running mode
	bitSet(ADCSRA,ADEN);
	
	
	sei();
	/*
	for (d = 0; d < 10; d++) {
		avx = (avx+read_adc(1))/2;
		avy = (avy+read_adc(2))/2;
	} */
	setColor(0,0,0);
	counter = 0;
	
	d = 1023;
	while(1) {
		/*
		if (cycle % 235 == 0) {
			base = 55;
		} else if (cycle % 237 == 0) {
			base = 48;
		} else if ( cycle % 3041 == 0) {
			base = 13;
		}*/
		switch(cycle %2) {
			case 0:
				rg = read_adc(1);
				break;
			case 1:
				yb = read_adc(2);
				break;
		}
		red = min(127, (max(rg-512,0)>>1));
		green = min(127, max(512-rg,0)>>1);
		blue = min(127, max(yb - 512,0)>>1);
		red = min(127, red+5*(max(512-yb,0)>>1)/8);
		green = min(127, green+5*(max(512-yb,0)>>1)/4);
		setColor(red,green,blue);
		_delay_us(d);
		colorUpdate();
//		lightControl();
		cycle++;
	}
	
    
}