コード例 #1
0
static gboolean fading_label_real_draw (GtkWidget* base, cairo_t* c) {
	FadingLabel * self;
	gboolean result = FALSE;
	cairo_surface_t* _tmp0_;
	cairo_t* _tmp3_;
	cairo_surface_t* _tmp4_;
	cairo_t* _tmp5_;
	self = (FadingLabel*) base;
	g_return_val_if_fail (c != NULL, FALSE);
	_tmp0_ = self->priv->cached_surface;
	if (_tmp0_ == NULL) {
		cairo_t* _tmp1_;
		cairo_surface_t* _tmp2_ = NULL;
		_tmp1_ = c;
		_tmp2_ = fading_label_make_surface (self, _tmp1_);
		_cairo_surface_destroy0 (self->priv->cached_surface);
		self->priv->cached_surface = _tmp2_;
	}
	_tmp3_ = c;
	_tmp4_ = self->priv->cached_surface;
	cairo_set_source_surface (_tmp3_, _tmp4_, (gdouble) 0, (gdouble) 0);
	_tmp5_ = c;
	cairo_paint (_tmp5_);
	result = FALSE;
	return result;
}
コード例 #2
0
static void fading_label_real_size_allocate (GtkWidget* base, GtkAllocation* allocation) {
	FadingLabel * self;
	GtkAllocation _tmp0_;
	self = (FadingLabel*) base;
	g_return_if_fail (allocation != NULL);
	_tmp0_ = *allocation;
	GTK_WIDGET_CLASS (fading_label_parent_class)->size_allocate ((GtkWidget*) G_TYPE_CHECK_INSTANCE_CAST (self, GTK_TYPE_LABEL, GtkLabel), &_tmp0_);
	_cairo_surface_destroy0 (self->priv->cached_surface);
	self->priv->cached_surface = NULL;
}
コード例 #3
0
static void fading_label_finalize (GObject* obj) {
	FadingLabel * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_FADING_LABEL, FadingLabel);
	_cairo_surface_destroy0 (self->priv->cached_surface);
	G_OBJECT_CLASS (fading_label_parent_class)->finalize (obj);
}
コード例 #4
0
ファイル: sgk2png.c プロジェクト: couchjd/playground
void soy_sg_k2_png_converter_sgk2png (soySGK2PNGConverter* self, guchar* sgk_data, int sgk_data_length1) {
	RsvgHandle* handle = NULL;
	cairo_surface_t* surface = NULL;
	cairo_t* context = NULL;
	GError * _inner_error_ = NULL;
#line 29 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
	g_return_if_fail (self != NULL);
#line 138 "sgk2png.c"
	{
		RsvgHandle* _tmp0_ = NULL;
		guchar* _tmp1_ = NULL;
		gint _tmp1__length1 = 0;
		RsvgHandle* _tmp2_ = NULL;
		RsvgHandle* _tmp3_ = NULL;
		gint _tmp4_ = 0;
		gint _tmp5_ = 0;
		RsvgHandle* _tmp6_ = NULL;
		gint _tmp7_ = 0;
		gint _tmp8_ = 0;
		cairo_surface_t* _tmp9_ = NULL;
		cairo_surface_t* _tmp10_ = NULL;
		cairo_t* _tmp11_ = NULL;
		RsvgHandle* _tmp12_ = NULL;
		cairo_t* _tmp13_ = NULL;
		cairo_surface_t* _tmp14_ = NULL;
#line 35 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp1_ = sgk_data;
#line 35 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp1__length1 = sgk_data_length1;
#line 35 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp2_ = rsvg_handle_new_from_data (_tmp1_, _tmp1__length1, &_inner_error_);
#line 35 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp0_ = _tmp2_;
#line 35 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		if (_inner_error_ != NULL) {
#line 166 "sgk2png.c"
			goto __catch9_g_error;
		}
#line 35 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_g_object_unref0 (handle);
#line 35 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		handle = _tmp0_;
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp3_ = handle;
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		g_object_get (_tmp3_, "width", &_tmp4_, NULL);
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp5_ = _tmp4_;
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp6_ = handle;
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		g_object_get (_tmp6_, "height", &_tmp7_, NULL);
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp8_ = _tmp7_;
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp9_ = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, _tmp5_, _tmp8_);
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_cairo_surface_destroy0 (surface);
#line 36 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		surface = _tmp9_;
#line 37 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp10_ = surface;
#line 37 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp11_ = cairo_create (_tmp10_);
#line 37 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_cairo_destroy0 (context);
#line 37 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		context = _tmp11_;
#line 38 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp12_ = handle;
#line 38 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp13_ = context;
#line 38 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		rsvg_handle_render_cairo (_tmp12_, _tmp13_);
#line 39 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp14_ = surface;
#line 39 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		cairo_surface_write_to_png_stream (_tmp14_, _soy_sg_k2_png_converter_writefunc_cairo_write_func_t, self);
#line 209 "sgk2png.c"
	}
	goto __finally9;
	__catch9_g_error:
	{
		GError* g = NULL;
		FILE* _tmp15_ = NULL;
		GError* _tmp16_ = NULL;
		const gchar* _tmp17_ = NULL;
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		g = _inner_error_;
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_inner_error_ = NULL;
#line 41 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp15_ = stdout;
#line 41 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp16_ = g;
#line 41 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_tmp17_ = _tmp16_->message;
#line 41 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		fprintf (_tmp15_, "Error: %s\n", _tmp17_);
#line 42 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_g_error_free0 (g);
#line 42 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_cairo_destroy0 (context);
#line 42 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_cairo_surface_destroy0 (surface);
#line 42 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_g_object_unref0 (handle);
#line 42 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		return;
#line 240 "sgk2png.c"
	}
	__finally9:
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
	if (_inner_error_ != NULL) {
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_cairo_destroy0 (context);
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_cairo_surface_destroy0 (surface);
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		_g_object_unref0 (handle);
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		g_clear_error (&_inner_error_);
#line 34 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
		return;
#line 257 "sgk2png.c"
	}
#line 44 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
	_cairo_destroy0 (context);
#line 44 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
	_cairo_surface_destroy0 (surface);
#line 44 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
	_g_object_unref0 (handle);
#line 44 "/home/jeff/Documents/libraries/libsoy/src/sgk2png.gs"
	return;
#line 267 "sgk2png.c"
}
コード例 #5
0
GdkPixbuf* ease_slide_button_panel_pixbuf (EaseSlide* slide, gint width) {
#line 428 "ease-slide-button-panel.c"
	GdkPixbuf* result = NULL;
	gint height;
	cairo_surface_t* surface;
	cairo_t* context;
	char* _tmp0_;
	char* _tmp1_;
	char* _tmp2_;
	char* path;
	GError * _inner_error_ = NULL;
#line 178 "ease-slide-button-panel.vala"
	g_return_val_if_fail (slide != NULL, NULL);
#line 180 "ease-slide-button-panel.vala"
	height = (gint) ((((float) width) * ease_slide_get_height (slide)) / ease_slide_get_width (slide));
#line 182 "ease-slide-button-panel.vala"
	surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height);
#line 184 "ease-slide-button-panel.vala"
	context = cairo_create (surface);
#line 185 "ease-slide-button-panel.vala"
	cairo_save (context);
#line 186 "ease-slide-button-panel.vala"
	cairo_scale (context, (double) (((float) width) / ease_slide_get_width (slide)), (double) (((float) height) / ease_slide_get_height (slide)));
#line 450 "ease-slide-button-panel.c"
	{
#line 191 "ease-slide-button-panel.vala"
		ease_slide_cairo_render_small (slide, context);
#line 454 "ease-slide-button-panel.c"
	}
	goto __finally17;
	__catch17_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
#line 195 "ease-slide-button-panel.vala"
			g_critical (_ ("Error drawing slide preview: %s"), e->message);
#line 465 "ease-slide-button-panel.c"
			_g_error_free0 (e);
		}
	}
	__finally17:
	if (_inner_error_ != NULL) {
		_cairo_destroy0 (context);
		_cairo_surface_destroy0 (surface);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
#line 199 "ease-slide-button-panel.vala"
	cairo_restore (context);
#line 201 "ease-slide-button-panel.vala"
	cairo_rectangle (context, (double) 0, (double) 0, (double) width, (double) height);
#line 202 "ease-slide-button-panel.vala"
	cairo_set_source_rgb (context, (double) 0, (double) 0, (double) 0);
#line 203 "ease-slide-button-panel.vala"
	cairo_stroke (context);
#line 206 "ease-slide-button-panel.vala"
	path = (_tmp2_ = g_build_filename (ease_slide_button_panel_get_temp_dir (), _tmp1_ = g_strconcat (_tmp0_ = g_strdup_printf ("%i", ease_slide_button_panel_temp_count++), ".png", NULL), NULL), _g_free0 (_tmp1_), _g_free0 (_tmp0_), _tmp2_);
#line 208 "ease-slide-button-panel.vala"
	cairo_surface_write_to_png (surface, path);
#line 489 "ease-slide-button-panel.c"
	{
		GdkPixbuf* pb;
#line 212 "ease-slide-button-panel.vala"
		pb = gdk_pixbuf_new_from_file (path, &_inner_error_);
#line 494 "ease-slide-button-panel.c"
		if (_inner_error_ != NULL) {
			goto __catch18_g_error;
		}
#line 213 "ease-slide-button-panel.vala"
		g_remove (path);
#line 500 "ease-slide-button-panel.c"
		result = pb;
		_g_free0 (path);
		_cairo_destroy0 (context);
		_cairo_surface_destroy0 (surface);
#line 214 "ease-slide-button-panel.vala"
		return result;
#line 507 "ease-slide-button-panel.c"
	}
	goto __finally18;
	__catch18_g_error:
	{
		GError * e;
		e = _inner_error_;
		_inner_error_ = NULL;
		{
#line 216 "ease-slide-button-panel.vala"
			g_error ("ease-slide-button-panel.vala:216: %s", e->message);
#line 518 "ease-slide-button-panel.c"
			_g_error_free0 (e);
		}
	}
	__finally18:
	{
		_g_free0 (path);
		_cairo_destroy0 (context);
		_cairo_surface_destroy0 (surface);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
		g_clear_error (&_inner_error_);
		return NULL;
	}
	_g_free0 (path);
	_cairo_destroy0 (context);
	_cairo_surface_destroy0 (surface);
}
コード例 #6
0
ファイル: tag.c プロジェクト: MerelyAPseudonym/SmartSim
void tag_calculate_bounds (Tag* self) {
	gint tagWidth = 0;
	cairo_text_extents_t textExtents = {0};
	cairo_surface_t* imageSurface = NULL;
	cairo_surface_t* _tmp0_ = NULL;
	cairo_t* context = NULL;
	cairo_surface_t* _tmp1_ = NULL;
	cairo_t* _tmp2_ = NULL;
	cairo_t* _tmp3_ = NULL;
	cairo_t* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	cairo_text_extents_t _tmp6_ = {0};
	cairo_text_extents_t _tmp7_ = {0};
	gdouble _tmp8_ = 0.0;
	gint _tmp9_ = 0;
	Flow _tmp10_ = 0;
	Direction _tmp13_ = 0;
	g_return_if_fail (self != NULL);
	_tmp0_ = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 0, 0);
	imageSurface = _tmp0_;
	_tmp1_ = imageSurface;
	_tmp2_ = cairo_create (_tmp1_);
	context = _tmp2_;
	_tmp3_ = context;
	cairo_set_font_size (_tmp3_, (gdouble) 12);
	_tmp4_ = context;
	_tmp5_ = self->text;
	cairo_text_extents (_tmp4_, _tmp5_, &_tmp6_);
	textExtents = _tmp6_;
	_tmp7_ = textExtents;
	_tmp8_ = _tmp7_.width;
	tagWidth = ((gint) _tmp8_) + 2;
	_tmp9_ = tagWidth;
	if (_tmp9_ < 50) {
		tagWidth = 50;
	}
	_tmp10_ = self->flow;
	if (_tmp10_ == FLOW_BIDIRECTIONAL) {
		gint _tmp11_ = 0;
		_tmp11_ = tagWidth;
		tagWidth = _tmp11_ + 20;
	} else {
		gint _tmp12_ = 0;
		_tmp12_ = tagWidth;
		tagWidth = _tmp12_ + 10;
	}
	_tmp13_ = self->direction;
	switch (_tmp13_) {
		case DIRECTION_RIGHT:
		{
			gint _tmp14_ = 0;
			gint _tmp15_ = 0;
			gint _tmp16_ = 0;
			gint _tmp17_ = 0;
			gint _tmp18_ = 0;
			_tmp14_ = self->xTag;
			_tmp15_ = tagWidth;
			self->rightBound = _tmp14_ + _tmp15_;
			_tmp16_ = self->yTag;
			self->downBound = _tmp16_ + 10;
			_tmp17_ = self->xWire;
			self->leftBound = _tmp17_;
			_tmp18_ = self->yTag;
			self->upBound = _tmp18_ - 10;
			break;
		}
		case DIRECTION_DOWN:
		{
			gint _tmp19_ = 0;
			gint _tmp20_ = 0;
			gint _tmp21_ = 0;
			gint _tmp22_ = 0;
			gint _tmp23_ = 0;
			_tmp19_ = self->xTag;
			self->rightBound = _tmp19_ + 10;
			_tmp20_ = self->yTag;
			_tmp21_ = tagWidth;
			self->downBound = _tmp20_ + _tmp21_;
			_tmp22_ = self->xTag;
			self->leftBound = _tmp22_ - 10;
			_tmp23_ = self->yWire;
			self->upBound = _tmp23_;
			break;
		}
		case DIRECTION_LEFT:
		{
			gint _tmp24_ = 0;
			gint _tmp25_ = 0;
			gint _tmp26_ = 0;
			gint _tmp27_ = 0;
			gint _tmp28_ = 0;
			_tmp24_ = self->xWire;
			self->rightBound = _tmp24_;
			_tmp25_ = self->yTag;
			self->downBound = _tmp25_ + 10;
			_tmp26_ = self->xTag;
			_tmp27_ = tagWidth;
			self->leftBound = _tmp26_ - _tmp27_;
			_tmp28_ = self->yTag;
			self->upBound = _tmp28_ - 10;
			break;
		}
		case DIRECTION_UP:
		{
			gint _tmp29_ = 0;
			gint _tmp30_ = 0;
			gint _tmp31_ = 0;
			gint _tmp32_ = 0;
			gint _tmp33_ = 0;
			_tmp29_ = self->xTag;
			self->rightBound = _tmp29_ + 10;
			_tmp30_ = self->yWire;
			self->downBound = _tmp30_;
			_tmp31_ = self->xTag;
			self->leftBound = _tmp31_ - 10;
			_tmp32_ = self->yTag;
			_tmp33_ = tagWidth;
			self->upBound = _tmp32_ - _tmp33_;
			break;
		}
		default:
		break;
	}
	_cairo_destroy0 (context);
	_cairo_surface_destroy0 (imageSurface);
}