--- rxvt-unicode/src/rxvtimg.h 2012/06/14 19:31:17 1.38 +++ rxvt-unicode/src/rxvtimg.h 2012/11/13 08:45:35 1.47 @@ -1,4 +1,27 @@ -#ifndef IMG_H), +/*----------------------------------------------------------------------* + * File: rxvtimg.h + *----------------------------------------------------------------------* + * + * All portions of code are copyright by their respective author/s. + * Copyright (c) 2012 Marc Lehmann + * Copyright (c) 2012 Emanuele Giaquinta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + *---------------------------------------------------------------------*/ + +#ifndef IMG_H #define IMG_H #if HAVE_BG_PIXMAP @@ -11,12 +34,8 @@ #include -class rxvt_img +struct rxvt_img { - void destroy (); - Picture picture (); - -public: typedef double nv; // *could* also hold the Pixmap itself @@ -70,10 +89,12 @@ void unshare (); // prepare for write void fill (const rgba &c); + void fill (const rgba &c, int x, int y, int w, int h); void add_alpha (); //void linear_gradient (const XLinearGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); //void radial_gradient (const XRadialGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); //void conical_gradient (const XConicalGradient *gradient, const XFixed *stops, const XRenderColor *colors, int nstops); + void brightness (int32_t r, int32_t g, int32_t b, int32_t a); void contrast (int32_t r, int32_t g, int32_t b, int32_t a); @@ -94,25 +115,37 @@ } void draw (rxvt_img *img, int op = PictOpOver, nv mask = 1.); +#if 0 + void draw (rxvt_img *img, int op = PictOpOver, nv mask = 1., + nv px, nv py, nv qx, nv qy, nv rx, nv ry, nv sx, nv sy); +#endif // copy rxvt_img *reify (); // make x, y 0, make real width/height rxvt_img *blur (int rh, int rv); rxvt_img *clone (); rxvt_img *sub_rect (int x, int y, int width, int height); - rxvt_img *transform (nv matrix[3][3]); + rxvt_img *transform (const nv matrix[3][3]); rxvt_img *scale (int new_width, int new_height); rxvt_img *rotate (int cx, int cy, nv phi); rxvt_img *convert_format (XRenderPictFormat *format, const rgba &bg); - rxvt_img *blend (rxvt_img *img, nv factor = 1.); + rxvt_img *tint (const rgba &c); + rxvt_img *filter (const char *name, int nparams = 0, nv *params = 0); + rxvt_img *muladd (nv mul, nv add); // general multiply and add, implemented as the biggest hack ever :/ - // egregiuous helper category + // egregious helper category rxvt_img *replace (rxvt_img *&p) { delete p; p = this; return this; } + + /* these are considered private */ + void destroy (); + rxvt_img *new_empty (); + Picture picture (); + rxvt_img *transform (const nv *matrix); }; #endif