Permalink
Browse files

add texture border plugin

  • Loading branch information...
1 parent 36e373e commit 9d0e03ad1fb0f1152bae825849f2a162f6d80582 @hejiann committed Jul 20, 2012
Showing with 782 additions and 93 deletions.
  1. +4 −2 .gitignore
  2. +32 −17 Makefile
  3. +4 −2 README
  4. +26 −72 rip-border.c
  5. +177 −0 texture-border-textures.list
  6. +539 −0 texture-border.c
  7. BIN textures/texture-border/art/12841.jpg
  8. BIN textures/texture-border/art/12852.jpg
  9. BIN textures/texture-border/art/12854.jpg
  10. BIN textures/texture-border/art/12855.jpg
  11. BIN textures/texture-border/art/12856.jpg
  12. BIN textures/texture-border/art/14662.jpg
  13. BIN textures/texture-border/art/14913.jpg
  14. BIN textures/texture-border/art/14914.jpg
  15. BIN textures/texture-border/art/15322.jpg
  16. BIN textures/texture-border/art/15323.jpg
  17. BIN textures/texture-border/art/15324.jpg
  18. BIN textures/texture-border/art/200543.jpg
  19. BIN textures/texture-border/art/200650.jpg
  20. BIN textures/texture-border/art/200763.jpg
  21. BIN textures/texture-border/art/200835.jpg
  22. BIN textures/texture-border/cloth/13027.jpg
  23. BIN textures/texture-border/cloth/13029.jpg
  24. BIN textures/texture-border/cloth/13030.jpg
  25. BIN textures/texture-border/cloth/13031.jpg
  26. BIN textures/texture-border/cloth/13041.jpg
  27. BIN textures/texture-border/cloth/13043.jpg
  28. BIN textures/texture-border/cloth/15312.jpg
  29. BIN textures/texture-border/cloth/15321.jpg
  30. BIN textures/texture-border/cloth/201367.jpg
  31. BIN textures/texture-border/grid/114547.jpg
  32. BIN textures/texture-border/grid/13034.jpg
  33. BIN textures/texture-border/grid/13036.jpg
  34. BIN textures/texture-border/grid/13055.jpg
  35. BIN textures/texture-border/grid/14661.jpg
  36. BIN textures/texture-border/grid/14664.jpg
  37. BIN textures/texture-border/grid/14912.jpg
  38. BIN textures/texture-border/grid/15314.jpg
  39. BIN textures/texture-border/grid/15320.jpg
  40. BIN textures/texture-border/grid/200622.jpg
  41. BIN textures/texture-border/other/12846.jpg
  42. BIN textures/texture-border/other/13028.jpg
  43. BIN textures/texture-border/other/13035.jpg
  44. BIN textures/texture-border/other/13037.jpg
  45. BIN textures/texture-border/other/13044.jpg
  46. BIN textures/texture-border/other/13045.jpg
  47. BIN textures/texture-border/other/13047.jpg
  48. BIN textures/texture-border/other/13048.jpg
  49. BIN textures/texture-border/other/13057.jpg
  50. BIN textures/texture-border/other/15315.jpg
  51. BIN textures/texture-border/other/200022.jpg
  52. BIN textures/texture-border/other/200285.jpg
  53. BIN textures/texture-border/other/200286.jpg
  54. BIN textures/texture-border/paper/114548.jpg
  55. BIN textures/texture-border/paper/114549.jpg
  56. BIN textures/texture-border/paper/114550.jpg
  57. BIN textures/texture-border/paper/114551.jpg
  58. BIN textures/texture-border/paper/114552.jpg
  59. BIN textures/texture-border/paper/114553.jpg
  60. BIN textures/texture-border/paper/114554.jpg
  61. BIN textures/texture-border/paper/114823.jpg
  62. BIN textures/texture-border/paper/114861.jpg
  63. BIN textures/texture-border/paper/14663.jpg
  64. BIN textures/texture-border/paper/15313.jpg
  65. BIN textures/texture-border/paper/200230.jpg
  66. BIN textures/texture-border/paper/201122.jpg
  67. BIN textures/texture-border/texture/114860.jpg
  68. BIN textures/texture-border/texture/13032.jpg
  69. BIN textures/texture-border/texture/13038.jpg
  70. BIN textures/texture-border/texture/13039.jpg
  71. BIN textures/texture-border/texture/13040.jpg
  72. BIN textures/texture-border/texture/13042.jpg
  73. BIN textures/texture-border/texture/13046.jpg
  74. BIN textures/texture-border/texture/15311.jpg
  75. BIN textures/texture-border/texture/15316.jpg
  76. BIN textures/texture-border/texture/15317.jpg
  77. BIN textures/texture-border/texture/15319.jpg
  78. BIN textures/texture-border/texture/15325.jpg
  79. BIN textures/texture-border/texture/15326.jpg
  80. BIN textures/texture-border/texture/200034.jpg
  81. BIN textures/texture-border/texture/200153.jpg
  82. BIN textures/texture-border/wall/13049.jpg
  83. BIN textures/texture-border/wall/13050.jpg
  84. BIN textures/texture-border/wall/13051.jpg
  85. BIN textures/texture-border/wall/13053.jpg
  86. BIN textures/texture-border/wall/13054.jpg
  87. BIN textures/texture-border/wall/13056.jpg
  88. BIN textures/texture-border/wall/13058.jpg
  89. BIN textures/texture-border/wall/13059.jpg
  90. BIN textures/texture-border/wall/13060.jpg
  91. BIN textures/texture-border/wall/200542.jpg
View
@@ -1,7 +1,9 @@
*.o
beautify
beautify-textures.h
-rip-border
-rip-border-textures.h
skin-whitening
skin-whitening-images.h
+rip-border
+rip-border-textures.h
+texture-border
+texture-border-textures.h
View
@@ -25,36 +25,42 @@ CFLAGS = $(GIMP_CFLAGS)
GDK_PIXBUF_CSOURCE = gdk-pixbuf-csource
-all: beautify rip-border skin-whitening
+all: beautify skin-whitening rip-border texture-border
-install: beautify rip-border skin-whitening
+install: beautify skin-whitening rip-border texture-border
# need fix: --install-admin-bin has issue in x86_64,
# it install the plug-in into /usr/lib/gimp/2.0/plug-ins/
# but the correct directory is /usr/lib64/gimp/2.0/plug-ins/
$(GIMPTOOL) --install-admin-bin beautify
- $(GIMPTOOL) --install-admin-bin rip-border
$(GIMPTOOL) --install-admin-bin skin-whitening
+ $(GIMPTOOL) --install-admin-bin rip-border
+ $(GIMPTOOL) --install-admin-bin texture-border
ln -sf /usr/lib/gimp/2.0/plug-ins/beautify /usr/lib64/gimp/2.0/plug-ins/beautify
- ln -sf /usr/lib/gimp/2.0/plug-ins/rip-border /usr/lib64/gimp/2.0/plug-ins/rip-border
ln -sf /usr/lib/gimp/2.0/plug-ins/skin-whitening /usr/lib64/gimp/2.0/plug-ins/skin-whitening
+ ln -sf /usr/lib/gimp/2.0/plug-ins/rip-border /usr/lib64/gimp/2.0/plug-ins/rip-border
+ ln -sf /usr/lib/gimp/2.0/plug-ins/texture-border /usr/lib64/gimp/2.0/plug-ins/texture-border
uninstall:
$(GIMPTOOL) --uninstall-admin-bin beautify
- $(GIMPTOOL) --uninstall-admin-bin rip-border
$(GIMPTOOL) --uninstall-admin-bin skin-whitening
+ $(GIMPTOOL) --uninstall-admin-bin rip-border
+ $(GIMPTOOL) --uninstall-admin-bin texture-border
rm -f /usr/lib64/gimp/2.0/plug-ins/beautify
- rm -f /usr/lib64/gimp/2.0/plug-ins/rip-border
rm -f /usr/lib64/gimp/2.0/plug-ins/skin-whitening
+ rm -f /usr/lib64/gimp/2.0/plug-ins/rip-border
+ rm -f /usr/lib64/gimp/2.0/plug-ins/texture-border
-userinstall: beautify rip-border skin-whitening
+userinstall: beautify skin-whitening rip-border texture-border
$(GIMPTOOL) --install-bin beautify
- $(GIMPTOOL) --install-bin rip-border
$(GIMPTOOL) --install-bin skin-whitening
+ $(GIMPTOOL) --install-bin rip-border
+ $(GIMPTOOL) --install-bin texture-border
-useruninstall: beautify rip-border skin-whitening
+useruninstall:
$(GIMPTOOL) --uninstall-bin beautify
- $(GIMPTOOL) --uninstall-bin rip-border
$(GIMPTOOL) --uninstall-bin skin-whitening
+ $(GIMPTOOL) --uninstall-bin rip-border
+ $(GIMPTOOL) --uninstall-bin texture-border
beautify: beautify.o beautify-effect.o
$(CC) -o $@ $^ $(LIBS)
@@ -68,24 +74,33 @@ beautify-effect.o: beautify-effect.c beautify-textures.h
beautify-textures.h: beautify-textures.list
$(GDK_PIXBUF_CSOURCE) --raw --build-list `cat beautify-textures.list` > $(@F)
+skin-whitening: skin-whitening.o
+ $(CC) -o $@ $^ $(LIBS)
+
+skin-whitening.o: skin-whitening.c skin-whitening-images.h
+ $(CC) $(CFLAGS) -c skin-whitening.c -o skin-whitening.o
+
+skin-whitening-images.h: skin-whitening-images.list
+ $(GDK_PIXBUF_CSOURCE) --raw --build-list `cat skin-whitening-images.list` > $(@F)
+
rip-border: rip-border.o
- $(CC) $(CFLAGS) -o $@ $^ $(LIBS)
+ $(CC) -o $@ $^ $(LIBS)
rip-border.o: rip-border.c rip-border-textures.h
$(CC) $(CFLAGS) -c rip-border.c -o rip-border.o
rip-border-textures.h: rip-border-textures.list
$(GDK_PIXBUF_CSOURCE) --raw --build-list `cat rip-border-textures.list` > $(@F)
-skin-whitening: skin-whitening.o
+texture-border: texture-border.o
$(CC) -o $@ $^ $(LIBS)
-skin-whitening.o: skin-whitening.c skin-whitening-images.h
- $(CC) $(CFLAGS) -c skin-whitening.c -o skin-whitening.o
+texture-border.o: texture-border.c texture-border-textures.h
+ $(CC) $(CFLAGS) -c texture-border.c -o texture-border.o
-skin-whitening-images.h: skin-whitening-images.list
- $(GDK_PIXBUF_CSOURCE) --raw --build-list `cat skin-whitening-images.list` > $(@F)
+texture-border-textures.h: texture-border-textures.list
+ $(GDK_PIXBUF_CSOURCE) --raw --build-list `cat texture-border-textures.list` > $(@F)
clean:
- rm -f *.o beautify rip-border skin-whitening
+ rm -f *.o beautify skin-whitening rip-border texture-border
View
6 README
@@ -23,8 +23,9 @@ USING
GIMP menu:
Tools -> Beautify -> Beautify
-Tools -> Beautify -> Rip Border
Tools -> Beautify -> Skin whitening
+Tools -> Beautify -> Rip Border
+Tools -> Beautify -> Texture Border
Support: #beautify on FreeNode
@@ -41,6 +42,7 @@ beautify: add black and white effect
beautify: add retro LOMO effect
beautify: add cold purple effect
beautify: add old photos effect
+add texture border plugin
2012-07-19
beautify: fix memory leak
@@ -62,7 +64,7 @@ beautify: add christmas eve effect
2012-07-16
add Makefile
-add skin whitening tool
+add skin whitening plugin
2012-07-15
beautify: add warm yellow effect
View
@@ -24,8 +24,6 @@
#define PLUG_IN_BINARY "rip-border"
#define PLUG_IN_ROLE "gimp-rip-border"
-#define TEXTURE_PATH "textures/borders"
-
#define PREVIEW_SIZE 480
#define THUMBNAIL_SIZE 80
@@ -59,7 +57,7 @@ const GimpPlugInInfo PLUG_IN_INFO =
static RipBorderValues rbvals =
{
- NULL, /* texture file */
+ NULL, /* texture */
{1.0, 1.0, 1.0, 1.0}, /* color */
100, /* opacity */
};
@@ -179,7 +177,6 @@ query (void)
gimp_install_procedure (PLUG_IN_PROC,
"Create an rip border effect",
- "Beautify, most easiest way for beautify photo."
"Rip border is one of the beautify serial plugin.",
"Hejian <hejian.he@gmail.com>",
"Hejian <hejian.he@gmail.com>",
@@ -292,15 +289,6 @@ rip_border (gint32 image_ID)
}
}
-static inline gboolean
-is_hidden (const gchar *filename)
-{
- /* skip files starting with '.' so we don't try to parse
- * stuff like .DS_Store or other metadata storage files
- */
- return (filename[0] == '.');
-}
-
static void
preview_update (GtkWidget *preview)
{
@@ -469,31 +457,12 @@ rip_border_dialog ()
gtk_box_pack_start (GTK_BOX (right_vbox), notebook, FALSE, FALSE, 0);
gtk_widget_show (notebook);
- /*const gchar *home = g_get_home_dir();
- gchar *dirname = g_build_filename(home, TEXTURE_PATH, NULL);
- GDir *dir = g_dir_open(dirname, 0, NULL);
- if (dir)
- {
- const gchar *dir_ent;
- while (dir_ent = g_dir_read_name(dir))
- {
- if (is_hidden (dir_ent))
- continue;
-
- gchar *filename = g_build_filename (dirname, dir_ent, NULL);
- if (g_file_test(filename, G_FILE_TEST_IS_DIR)) {*/
- create_texture_page (GTK_NOTEBOOK (notebook), "Stars", stars_textures, G_N_ELEMENTS (stars_textures));
- create_texture_page (GTK_NOTEBOOK (notebook), "Border", border_textures, G_N_ELEMENTS (border_textures));
- create_texture_page (GTK_NOTEBOOK (notebook), "Art", art_textures, G_N_ELEMENTS (art_textures));
- create_texture_page (GTK_NOTEBOOK (notebook), "Flowers", flowers_textures, G_N_ELEMENTS (flowers_textures));
- create_texture_page (GTK_NOTEBOOK (notebook), "Lights", lights_textures, G_N_ELEMENTS (lights_textures));
- create_texture_page (GTK_NOTEBOOK (notebook), "Others", others_textures, G_N_ELEMENTS (others_textures));
- /*}
-
- //g_free(filename);
- }
- g_dir_close (dir);
- }*/
+ create_texture_page (GTK_NOTEBOOK (notebook), "Stars", stars_textures, G_N_ELEMENTS (stars_textures));
+ create_texture_page (GTK_NOTEBOOK (notebook), "Border", border_textures, G_N_ELEMENTS (border_textures));
+ create_texture_page (GTK_NOTEBOOK (notebook), "Art", art_textures, G_N_ELEMENTS (art_textures));
+ create_texture_page (GTK_NOTEBOOK (notebook), "Flowers", flowers_textures, G_N_ELEMENTS (flowers_textures));
+ create_texture_page (GTK_NOTEBOOK (notebook), "Lights", lights_textures, G_N_ELEMENTS (lights_textures));
+ create_texture_page (GTK_NOTEBOOK (notebook), "Others", others_textures, G_N_ELEMENTS (others_textures));
run = (gimp_dialog_run (GIMP_DIALOG (dialog)) == GTK_RESPONSE_OK);
@@ -503,7 +472,6 @@ rip_border_dialog ()
}
static void
-//create_texture_page (GtkNotebook *notebook, const gchar* category, const gchar* path) {
create_texture_page (GtkNotebook *notebook, const gchar* category, const guint8** textures, guint n_textures) {
GtkWidget *label = gtk_label_new (category);
@@ -523,41 +491,27 @@ create_texture_page (GtkNotebook *notebook, const gchar* category, const guint8*
gint row = 1;
gint col = 1;
- /*GDir *dir = g_dir_open(path, 0, NULL);
- if (dir)
- {*/
- //const gchar *dir_ent;
- //while (dir_ent = g_dir_read_name(dir))
- gint i;
- for (i = 0; i < n_textures; i++)
+ gint i;
+ for (i = 0; i < n_textures; i++)
+ {
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_inline (-1, textures[i], FALSE, NULL);
+ pixbuf = gdk_pixbuf_scale_simple (pixbuf, THUMBNAIL_SIZE, THUMBNAIL_SIZE, GDK_INTERP_BILINEAR);
+ GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
+ GtkWidget *event_box = gtk_event_box_new ();
+ gtk_container_add (GTK_CONTAINER (event_box), image);
+ gtk_widget_show (image);
+ gtk_table_attach_defaults (GTK_TABLE (table), event_box, col - 1, col, row - 1, row);
+ gtk_widget_show (event_box);
+
+ col++;
+ if (col > cols)
{
- /*if (is_hidden (dir_ent))
- continue;
-
- gchar *filename = g_build_filename (path, dir_ent, NULL);
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, NULL);*/
- GdkPixbuf *pixbuf = gdk_pixbuf_new_from_inline (-1, textures[i], FALSE, NULL);
- pixbuf = gdk_pixbuf_scale_simple (pixbuf, THUMBNAIL_SIZE, THUMBNAIL_SIZE, GDK_INTERP_BILINEAR);
- GtkWidget *image = gtk_image_new_from_pixbuf (pixbuf);
- GtkWidget *event_box = gtk_event_box_new ();
- gtk_container_add (GTK_CONTAINER (event_box), image);
- gtk_widget_show (image);
- gtk_table_attach_defaults (GTK_TABLE (table), event_box, col - 1, col, row - 1, row);
- gtk_widget_show (event_box);
-
- col++;
- if (col > cols)
- {
- row++;
- col = 1;
- }
-
- g_signal_connect (event_box, "button_press_event", G_CALLBACK (select_texture), (gpointer)textures[i]);
-
- //g_free(filename);
+ row++;
+ col = 1;
}
- //g_dir_close (dir);
- //}
+
+ g_signal_connect (event_box, "button_press_event", G_CALLBACK (select_texture), (gpointer)textures[i]);
+ }
gtk_notebook_append_page_menu (notebook, thispage, label, NULL);
}
Oops, something went wrong.

0 comments on commit 9d0e03a

Please sign in to comment.