v8::Handle<v8::Value> timestep_view_get_filterColor(v8::Local<v8::String> property, const v8::AccessorInfo &info) {
	//LOG("in timestep_view get filterColor");
	v8::Local<v8::Object> thiz = info.Holder();
	timestep_view *obj = (timestep_view*) v8::Local<v8::External>::Cast(thiz->GetInternalField(0))->Value();
	
	rgba prop = obj->filter_color;
char buf[64];
rgba_to_string(&prop, buf);
return v8::String::New(buf);

	
}
示例#2
0
static void  lunar_calendar_day_selected(GtkCalendar *gcalendar)
{
	guint year, month, day;
	GError *error = NULL;
	LunarCalendar *calendar;
	gchar *holiday, *format, *strtime, *color;

	calendar = LUNAR_CALENDAR(gcalendar);

	if (getenv("LUNAR_CALENDAR_IGNORE_NON_CHINESE") != NULL)
	{
		const gchar* const * langs =  g_get_language_names();

		if (langs[0] && langs[0][0] != '\0')
			if (!g_str_has_prefix(langs[0], "zh_")) {
				g_object_set (gcalendar, "show-details", FALSE, NULL);
				return;
			}
	}

	gtk_calendar_get_date(gcalendar, &year, &month, &day);
	lunar_date_set_solar_date(calendar->date, year, month + 1, day, 3, &error);
	if (error != NULL) {
		g_clear_error (&error);
		return;
	}

	color = rgba_to_string(calendar->rgba);
	holiday = lunar_date_get_holiday(calendar->date, "\n");
	if (holiday != NULL) {
		format = g_strdup_printf("%s\n%s\n%s\n%s\n<span color=\"%s\">%s</span>",
				_("%(year)-%(month)-%(day)"),
				_("%(YUE)yue%(RI)"),
				_("%(Y60)nian%(M60)yue%(D60)ri"),
				_("shengxiao: %(shengxiao)"),
				color,
				holiday);
	} else {
		format = g_strdup_printf("%s\n%s\n%s\n%s",
				_("%(year)-%(month)-%(day)"),
				_("%(YUE)yue%(RI)"),
				_("%(Y60)nian%(M60)yue%(D60)ri"),
				_("shengxiao: %(shengxiao)"));
	}
	strtime = lunar_date_strftime(calendar->date, format);
	g_free(color);
	g_free(holiday);
	g_free(format);

	gtk_widget_set_tooltip_markup(GTK_WIDGET(gcalendar), strtime);
	g_free(strtime);
}
CEXPORT JSBool def_timestep_view_get_filterColor(JSContext *cx, JSHandleObject obj, JSHandleId id, JSMutableHandleValue vp) {
	JS_BeginRequest(cx);
	timestep_view *thiz = (timestep_view*)JS_GetPrivate(obj.get());
	if (thiz) {
		
		rgba prop = thiz->filter_color;

char buf[64];
int len = rgba_to_string(&prop, buf);

vp.setString(JS_NewStringCopyN(cx, buf, len));

		
	}
	JS_EndRequest(cx);
	return JS_TRUE;
}
示例#4
0
/**
 * @name	rgba_print
 * @brief	pretty print the given rgba color
 * @param	color - (rgba *)
 * @retval	NONE
 */
void rgba_print(rgba *color) {
	char buf[RGBA_MAX_STR_LEN];
	rgba_to_string(color, buf);
	LOG("%s", buf);
}