Example #1
0
void IconList::AttachedToWindow( void )
{
	SetFgColor( get_default_color( COL_MENU_TEXT ) );
	SetEraseColor( get_default_color( COL_SHINE ) );
	SetBgColor( get_default_color( COL_SHINE ) );

	_Layout();
}
Example #2
0
void LoginImageView::Paint(const Rect& cRect)
{
	FillRect(GetBounds(),get_default_color(COL_NORMAL));
	SetBgColor(get_default_color(COL_NORMAL));
	SetFgColor(255,255,255);
	SetDrawingMode(DM_OVER);
	GetFont()->SetSize(25);
	pcImage->Draw(Point(0,0),this);
	DrawText(Rect(0,0,100,100),GetSystemInfo(),DTF_ALIGN_CENTER);
}
Example #3
0
void EditView::Paint( const Rect& cUpdateRect )
{
  FillRect( cUpdateRect, get_default_color( COL_NORMAL ) );

  Rect cLargeRect = m_cLargeRect;
  Rect cSmallRect = m_cSmallRect;

  cLargeRect.left   -= 2.0f;
  cLargeRect.top    -= 2.0f;
  cLargeRect.right  += 2.0f;
  cLargeRect.bottom += 2.0f;

  cSmallRect.left   -= 2.0f;
  cSmallRect.top    -= 2.0f;
  cSmallRect.right  += 2.0f;
  cSmallRect.bottom += 2.0f;

  if ( m_bLargeSelected ) {
    DrawFrame( cLargeRect, FRAME_RECESSED | FRAME_TRANSPARENT );
    DrawFrame( cSmallRect, FRAME_RAISED | FRAME_TRANSPARENT );
  } else {
    DrawFrame( cLargeRect, FRAME_RAISED | FRAME_TRANSPARENT );
    DrawFrame( cSmallRect, FRAME_RECESSED | FRAME_TRANSPARENT );
  }
  SetDrawingMode( DM_BLEND );
  if ( m_pcLargeBitmap != NULL ) {
    DrawBitmap( m_pcLargeBitmap, m_pcLargeBitmap->GetBounds(), m_cLargeRect );
  }
  if ( m_pcSmallBitmap != NULL ) {
    DrawBitmap( m_pcSmallBitmap, m_pcSmallBitmap->GetBounds(), m_cSmallRect );
  }
  SetDrawingMode( DM_COPY );
}
Example #4
0
File: prefs.c Project: phako/ignuit
void
prefs_csvstr_to_colors (Prefs *p, const gchar *csvstr)
{
    gchar **v;
    gint i;


    /* Set card colours from a string of comma separated values. */

    v = g_strsplit (csvstr, ",", N_CARD_COLORS);
    for (i = 0; i < N_CARD_COLORS; i++) {
        if (v[i] == NULL) {
#if 1
            gchar *s = get_default_color (i);
            prefs_set_color (p, i, s);
            g_free (s);
#else
            break;
#endif
        }
        else {
            prefs_set_color (p, i, v[i]);
        }
    }
    g_strfreev (v);
}
Example #5
0
void CalcDisplay::Paint(const Rect &update)
{
	Rect cBounds = GetBounds();

	DrawFrame(cBounds, FRAME_RECESSED);

	SetFgColor(0,0,0,0);
	SetBgColor(get_default_color(COL_NORMAL));

	char *text = m_Contents;
	if(!text) text = "0";

	font_height fh;
	GetFontHeight(&fh);
	float fontheight = fh.ascender + fh.descender;
	float baseline = cBounds.top + (cBounds.Height() + 1)/2 - fontheight/2 + fh.ascender;
	float tw = GetStringWidth(text);

	MovePenTo(cBounds.right - 3.0f - tw, baseline);
	DrawString(text);

	float flagpos = cBounds.left + 5.0f;

	if(m_Mem) {
		MovePenTo(flagpos, baseline);
		DrawString("M");
		flagpos += GetStringWidth("M ");
	}

	if(m_Inv) {
		MovePenTo(flagpos, baseline);
		DrawString("INV");
		flagpos += GetStringWidth("INV ");
	}

	if(m_Hyp) {
		MovePenTo(flagpos, baseline);
		DrawString("HYP");
		flagpos += GetStringWidth("HYP ");
	}

	if(m_Par != 0) {
		char bfr[10];
		sprintf(bfr, "(%d ", m_Par);
		MovePenTo(flagpos, baseline);
		DrawString(bfr);
		flagpos += GetStringWidth(bfr);
	}
}
Example #6
0
unsigned raster_colorizer::get_color(float value) const
{
    int stopCount = stops_.size();

    //use default color if no stops
    if (stopCount == 0)
    {
        return default_color_.rgba();
    }

    //1 - Find the stop that the value is in
    int stopIdx = -1;
    bool foundStopIdx = false;

    for(int i=0; i<stopCount; ++i)
    {
        if(value < stops_[i].get_value())
        {
            stopIdx = i-1;
            foundStopIdx = true;
            break;
        }
    }

    if(!foundStopIdx)
    {
        stopIdx = stopCount-1;
    }

    //2 - Find the next stop
    int nextStopIdx = stopIdx + 1;
    if(nextStopIdx >= stopCount)
    {
        //there is no next stop
        nextStopIdx = stopCount - 1;
    }

    //3 - Work out the mode
    colorizer_mode stopMode;
    if( stopIdx == -1 )
    {
        //before the first stop
        stopMode = default_mode_;
    }
    else
    {
        stopMode = stops_[stopIdx].get_mode();
        if(stopMode == COLORIZER_INHERIT)
        {
            stopMode = default_mode_;
        }
    }

    //4 - Calculate the colour
    color stopColor;
    color nextStopColor;
    float stopValue = 0;
    float nextStopValue = 0;
    color outputColor = get_default_color();
    if(stopIdx == -1)
    {
        stopColor = default_color_;
        nextStopColor = stops_[nextStopIdx].get_color();
        stopValue = value;
        nextStopValue = stops_[nextStopIdx].get_value();
    }
    else
    {
        stopColor = stops_[stopIdx].get_color();
        nextStopColor = stops_[nextStopIdx].get_color();
        stopValue = stops_[stopIdx].get_value();
        nextStopValue = stops_[nextStopIdx].get_value();
    }

    switch(stopMode)
    {
    case COLORIZER_LINEAR:
    {
        //deal with this separately so we don't have to worry about div0
        if(nextStopValue == stopValue)
        {
            outputColor = stopColor;
        }
        else
        {
            float fraction = (value - stopValue) / (nextStopValue - stopValue);

            unsigned r = interpolate(stopColor.red(), nextStopColor.red(),fraction);
            unsigned g = interpolate(stopColor.green(), nextStopColor.green(),fraction);
            unsigned b = interpolate(stopColor.blue(), nextStopColor.blue(),fraction);
            unsigned a = interpolate(stopColor.alpha(), nextStopColor.alpha(),fraction);

            outputColor.set_red(r);
            outputColor.set_green(g);
            outputColor.set_blue(b);
            outputColor.set_alpha(a);
        }

    }
    break;
    case COLORIZER_DISCRETE:
        outputColor = stopColor;
        break;
    case COLORIZER_EXACT:
    default:
        //approximately equal (within epsilon)
        if(std::fabs(value - stopValue) < epsilon_)
        {
            outputColor = stopColor;
        }
        else
        {
            outputColor = default_color_;
        }
        break;
    }


    /*
      MAPNIK_LOG_DEBUG(raster_colorizer) << "raster_colorizer: get_color " << value;
      MAPNIK_LOG_DEBUG(raster_colorizer) << "\tstopIdx: " << stopIdx;
      MAPNIK_LOG_DEBUG(raster_colorizer) << "\tnextStopIdx: " << nextStopIdx;
      MAPNIK_LOG_DEBUG(raster_colorizer) << "\tstopValue: " << stopValue;
      MAPNIK_LOG_DEBUG(raster_colorizer) << "\tnextStopValue: " << nextStopValue;
      MAPNIK_LOG_DEBUG(raster_colorizer) << "\tstopColor: " << stopColor.to_string();
      MAPNIK_LOG_DEBUG(raster_colorizer) << "\tnextStopColor: " << nextStopColor.to_string();
      MAPNIK_LOG_DEBUG(raster_colorizer) << "\tstopMode: " << stopMode.as_string();
      MAPNIK_LOG_DEBUG(raster_colorizer) << "\toutputColor: " << outputColor.to_string();
    */

    return outputColor.rgba();
}