⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fbpict.h

📁 按照官方的说法:Cairo is a vector graphics library with cross-device output support. 翻译过来
💻 H
📖 第 1 页 / 共 2 页
字号:
/* * Copyright © 2000 Keith Packard *             2005 Lars Knoll & Zack Rusin, Trolltech * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting * documentation, and that the name of Keith Packard not be used in * advertising or publicity pertaining to distribution of the software without * specific, written prior permission.  Keith Packard makes no * representations about the suitability of this software for any purpose.  It * is provided "as is" without express or implied warranty. * * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */#ifndef _FBPICT_H_#define _FBPICT_H_#include "pixman-xserver-compat.h"#include "renderedge.h"#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) )#define FbIntDiv(a,b)	 (((CARD16) (a) * 255) / (b))#define FbGet8(v,i)   ((CARD16) (CARD8) ((v) >> i))/* * There are two ways of handling alpha -- either as a single unified value or * a separate value for each component, hence each macro must have two * versions.  The unified alpha version has a 'U' at the end of the name, * the component version has a 'C'.  Similarly, functions which deal with * this difference will have two versions using the same convention. */#define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i),\			   (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i))#define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i),\			    (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i))#define FbInU(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),(a),(t)) << (i))#define FbInC(x,i,a,t) ((CARD32) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i))#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (FbIntMult(FbGet8(y,i),ay,(u)) + \					 FbIntMult(FbGet8(x,i),ax,(v))),\				  (CARD32) ((CARD8) ((t) | \						     (0 - ((t) >> 8)))) << (i))#define FbAdd(x,y,i,t)	((t) = FbGet8(x,i) + FbGet8(y,i), \			 (CARD32) ((CARD8) ((t) | (0 - ((t) >> 8)))) << (i))#define Alpha(x) ((x) >> 24)#define Red(x) (((x) >> 16) & 0xff)#define Green(x) (((x) >> 8) & 0xff)#define Blue(x) ((x) & 0xff)#define IsRGB(pict) ((pict)->image_format.red > (pict)->image_format.blue)#define fbComposeGetSolid(pict, dest, bits) { \    FbBits	*__bits__; \    FbStride	__stride__; \    int		__bpp__; \    int		__xoff__,__yoff__; \\    fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \    switch (__bpp__) { \    case 32: \	(bits) = *(CARD32 *) __bits__; \	break; \    case 24: \	(bits) = Fetch24 ((CARD8 *) __bits__); \	break; \    case 16: \	(bits) = *(CARD16 *) __bits__; \	(bits) = cvt0565to0888(bits); \	break; \    case 8: \	(bits) = *(CARD8 *) __bits__; \	(bits) = (bits) << 24; \	break; \    case 1: \	(bits) = *(CARD32 *) __bits__; \	(bits) = FbLeftStipBits((bits),1) ? 0xff000000 : 0x00000000;\	break; \    default: \	return; \    } \    /* manage missing src alpha */ \    if ((pict)->image_format.alphaMask == 0) \	(bits) |= 0xff000000; \    /* Handle RGB/BGR mismatch */ \    if (dest && IsRGB(dest) != IsRGB(pict)) \        bits = (((bits & 0xff000000)) | \		((bits & 0x00ff0000) >> 16) | \		((bits & 0x0000ff00)) | \		((bits & 0x000000ff) << 16)); \}#define fbComposeGetStart(pict,x,y,type,stride,line,mul) {\    FbBits	*__bits__; \    FbStride	__stride__; \    int		__bpp__; \    int		__xoff__,__yoff__; \\    fbGetDrawable((pict)->pDrawable,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \    (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \    (line) = ((type *) __bits__) + (stride) * ((y) + __yoff__) + (mul) * ((x) + __xoff__); \}#define cvt8888to0565(s)    ((((s) >> 3) & 0x001f) | \			     (((s) >> 5) & 0x07e0) | \			     (((s) >> 8) & 0xf800))#define cvt0565to0888(s)    (((((s) << 3) & 0xf8) | (((s) >> 2) & 0x7)) | \			     ((((s) << 5) & 0xfc00) | (((s) >> 1) & 0x300)) | \			     ((((s) << 8) & 0xf80000) | (((s) << 3) & 0x70000)))#if IMAGE_BYTE_ORDER == MSBFirst#define Fetch24(a)  ((unsigned long) (a) & 1 ? \		     ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \		     ((*((CARD16 *) (a)) << 8) | *((a)+2)))#define Store24(a,v) ((unsigned long) (a) & 1 ? \		      ((*(a) = (CARD8) ((v) >> 16)), \		       (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \		      ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \		       (*((a)+2) = (CARD8) (v))))#else#define Fetch24(a)  ((unsigned long) (a) & 1 ? \		     ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \		     ((*((CARD16 *) (a))) | (*((a)+2) << 16)))#define Store24(a,v) ((unsigned long) (a) & 1 ? \		      ((*(a) = (CARD8) (v)), \		       (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \		      ((*((CARD16 *) (a)) = (CARD16) (v)),\		       (*((a)+2) = (CARD8) ((v) >> 16))))#endif/*  The methods below use some tricks to be able to do two color  components at the same time.*//*  x_c = (x_c * a) / 255*/#define FbByteMul(x, a) do {                                      \        CARD32 t = ((x & 0xff00ff) * a) + 0x800080;               \        t = (t + ((t >> 8) & 0xff00ff)) >> 8;                     \        t &= 0xff00ff;                                            \                                                                  \        x = (((x >> 8) & 0xff00ff) * a) + 0x800080;               \        x = (x + ((x >> 8) & 0xff00ff));                          \        x &= 0xff00ff00;                                          \        x += t;                                                   \    } while (0)/*  x_c = (x_c * a) / 255 + y*/#define FbByteMulAdd(x, a, y) do {                                \        CARD32 t = ((x & 0xff00ff) * a) + 0x800080;               \        t = (t + ((t >> 8) & 0xff00ff)) >> 8;                     \        t &= 0xff00ff;                                            \        t += y & 0xff00ff;                                        \        t |= 0x1000100 - ((t >> 8) & 0xff00ff);                   \        t &= 0xff00ff;                                            \                                                                  \        x = (((x >> 8) & 0xff00ff) * a) + 0x800080;                 \        x = (x + ((x >> 8) & 0xff00ff)) >> 8;                       \        x &= 0xff00ff;                                              \        x += (y >> 8) & 0xff00ff;                                   \        x |= 0x1000100 - ((t >> 8) & 0xff00ff);                     \

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -