FJMovieEditor Pré-Alpha
A GTK video editor for GNOME. Designed for Artists to do, special effects, compositing and animation.

trunk/libfjme/video.h

Go to the documentation of this file.
00001 /*
00002 A GTK video editor Designed for Artists to do, special effects, compositing and animation.
00003 Copyright (C) 2011  Fabio J. Gonzalez
00004 
00005 This program is free software: you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation, either version 3 of the License, or
00008 (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #include <gdk-pixbuf/gdk-pixbuf.h>
00020 #include <gtk/gtk.h>
00021 #include "basic.h"
00022 
00023 #ifndef FJME_VIDEO_H
00024 #define FJME_VIDEO_H 1
00025 
00031 #define GetPixeIntf(pixbuf, x,  y) \
00032         GetPixelf( pixbuf, gdk_pixbuf_get_width(pixbuf) / 2 + x, gdk_pixbuf_get_height(pixbuf) / 2 + y )
00033 
00039 #define SetPixeIntf(pixbuf, x,  y, p) \
00040         SetPixelf( pixbuf, gdk_pixbuf_get_width(pixbuf) / 2 + x, gdk_pixbuf_get_height(pixbuf) / 2 + y, p )
00041 
00042 
00043 #define GetPixelFloatf( pixbuf, x, y ) \
00044         GetPixeIntf( pixbuf, x*(gdk_pixbuf_get_width(pixbuf) / 2) ,  y*(gdk_pixbuf_get_height(pixbuf)/2) )
00045 
00046 #define SetPixelFloatf( pixbuf, x, y, p ) \
00047         SetPixeIntf( pixbuf, x*(gdk_pixbuf_get_width(pixbuf) / 2) ,  y*(gdk_pixbuf_get_height(pixbuf)/2), p )
00048 
00049 #define fjme_image_from_file(file) \
00050         gtk_image_new_from_pixbuf( gdk_pixbuf_new_from_file(file, NULL) )
00051 
00052 struct Layer;
00053 typedef struct Layer Layer;
00054 
00055 struct Pixel;
00056 typedef struct Pixel Pixel;
00057 
00058 struct Pixelf;
00059 typedef struct Pixelf Pixelf;
00060 
00061 struct Pixeld;
00062 typedef struct Pixeld Pixeld;
00063 
00064 struct VideoFrame {
00065     GdkPixbuf* pixels;
00066     gdouble* audio;
00067 };
00068 
00069 typedef struct VideoFrame VideoFrame;
00070 
00078 struct Layer {
00079     gchar* name;
00080 
00081     union {
00082 
00083         struct {
00084             GdkPixbuf* pixels;
00085             gdouble* audio;
00086         };
00087 
00088         VideoFrame video;
00089     };
00090 
00091     //Animated values
00092 
00098     gdouble *volume;
00099 
00114     gdouble *opacity;
00115 
00124     gdouble* x;
00125 
00134     gdouble* y;
00135 
00142     gdouble* width;
00143 
00150     gdouble* height;
00151 
00157     gboolean selected;
00158 
00168     gboolean central;
00169 
00175     gdouble *rotation;
00176 
00183     gdouble* pos;
00184 
00193     guint32 frame;
00194 
00199     gdouble* end;
00200 
00206     gdouble* fps;
00207 
00212     GList* plugins;
00213 };
00214 
00215 struct Pixelf {
00216     //range from 0 to 1
00217 
00218     union {
00219         gfloat c[4];
00220 
00221         struct {
00222             gfloat r;
00223             gfloat g;
00224             gfloat b;
00225             gfloat a;
00226         };
00227 
00228         struct {
00229             gfloat red;
00230             gfloat green;
00231             gfloat blue;
00232             gfloat alpha;
00233         };
00234 
00235     };
00236 };
00237 
00238 struct Pixeld {
00239     //range from 0 to 1
00240 
00241     union {
00242         gdouble c[4];
00243 
00244         struct {
00245             gdouble r;
00246             gdouble g;
00247             gdouble b;
00248             gdouble a;
00249         };
00250 
00251         struct {
00252             gdouble red;
00253             gdouble green;
00254             gdouble blue;
00255             gdouble alpha;
00256         };
00257 
00258     };
00259 };
00260 
00261 struct Pixel {
00262     //range from 0 to 255
00263 
00264     union {
00265         guchar c[4];
00266 
00267         struct {
00268             guchar r;
00269             guchar g;
00270             guchar b;
00271             guchar a;
00272         };
00273 
00274         struct {
00275             guchar red;
00276             guchar green;
00277             guchar blue;
00278             guchar alpha;
00279         };
00280     };
00281 };
00282 
00287 void SetPixel(GdkPixbuf *pixbuf, guint32 x, guint32 y, Pixel* p);
00288 
00294 Pixel* GetPixel(GdkPixbuf *pixbuf, guint32 x, guint32 y);
00295 
00296 Pixelf GetPixelf(GdkPixbuf *pixbuf, guint32 x, guint32 y);
00297 void SetPixelf(GdkPixbuf *pixbuf, guint32 x, guint32 y, Pixelf pf);
00298 
00299 Layer* addEmptyVideoLayer(guint32 width, guint32 height);
00300 
00305 gboolean LayerSet(Layer* layer);
00306 
00307 Layer* findLayerByName(gchar* name);
00308 
00321 gboolean pixbuf_draw(GdkPixbuf* dst, GdkPixbuf* src,
00322         guint32 x, guint32 y, guint32 width, guint32 height);
00323 
00332 gboolean pixbuf_draw_simple(GdkPixbuf* dst, GdkPixbuf* src,
00333         guint32 x, guint32 y);
00334 
00343 #define pixbuf_draw_fullcreen( dst, src ) pixbuf_draw( dst, src, 0, 0, \
00344 gdk_pixbuf_get_width(dst), gdk_pixbuf_get_height(dst))
00345 
00346 void layer_window_show( GtkWidget* widget, gpointer data );
00347 
00348 #endif
All Data Structures Files Functions Variables Typedefs Defines