File: carouselcheck.cpp

package info (click to toggle)
photoprint 0.4.1-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,568 kB
  • ctags: 4,517
  • sloc: cpp: 46,643; sh: 10,360; ansic: 4,755; makefile: 543; sed: 16
file content (65 lines) | stat: -rw-r--r-- 1,577 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>

#include <gtk/gtk.h>

#include "imagesource/imagesource_util.h"
#include "imagesource/pixbuf_from_imagesource.h"
#include "imagesource/imagesource_montage.h"
#include "imagesource/imagesource_segmentmask.h"
#include "imagesource/imagesource_mask.h"
#include "miscwidgets/pixbufview.h"

#include "support/debug.h"

#include "layout_carousel.h"

#include "config.h"
#include "gettext.h"
#define _(x) gettext(x)


using namespace std;

int main(int argc,char**argv)
{
	gtk_init(&argc,&argv);

	try
	{
		GtkWidget *win=gtk_window_new(GTK_WINDOW_TOPLEVEL);
		gtk_window_set_title (GTK_WINDOW (win), _("PixBufView Test"));
		gtk_signal_connect (GTK_OBJECT (win), "delete_event",
			(GtkSignalFunc) gtk_main_quit, NULL);

		GtkWidget *pview=pixbufview_new(NULL,false);
		gtk_container_add (GTK_CONTAINER (win), pview);
		gtk_widget_show(pview);
		gtk_widget_show(win);

		if(argc>1)
		{
			ImageSource_Montage *mon=new ImageSource_Montage(IS_TYPE_RGBA,300);
			CircleMontage c(512,512);
			c.SetSegments(6,25,25);
			c.SetInnerRadius(20);
			CMSegment *targetseg=c.GetSegmentExtent(0);
			ImageSource *is=ISLoadImage(argv[1]);
			ImageSource *mask=new ImageSource_SegmentMask(targetseg,true);
			is=ISScaleImageBySize(is,mask->width,mask->height);
			is=new ImageSource_Mask(is,mask);
			mon->Add(is,0,0);
			GdkPixbuf *pb=pixbuf_from_imagesource(mon,128,128,128);
			pixbufview_set_pixbuf(PIXBUFVIEW(pview),pb);
//			g_object_unref(G_OBJECT(pview));
		}

		gtk_main();
	}
	catch(const char *err)
	{
		Debug[ERROR] << "Error: " << err << endl;
	}

	return(0);
}