亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fl_color.cxx

?? flnx 0.17 是做嵌入linux gui 必備工具箱
?? CXX
字號:
//// "$Id: fl_color.cxx,v 1.1.1.1 2003/08/07 21:18:41 jasonk Exp $"//// Color functions for the Fast Light Tool Kit (FLTK).//// Copyright 1998-1999 by Bill Spitzak and others.//// This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Library General Public// License as published by the Free Software Foundation; either// version 2 of the License, or (at your option) any later version.//// This library 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// Library General Public License for more details.//// You should have received a copy of the GNU Library General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307// USA.//// Please report all bugs and problems to "fltk-bugs@easysw.com".//// Implementation of fl_color(i), fl_color(r,g,b).#ifdef WIN32#include "fl_color_win32.cxx"#else// Also code to look at the X visual and figure out the best way to turn// a color into a pixel value.// SGI compiler seems to have problems with unsigned char arguments// being used to index arrays.  So I always copy them to an integer// before use.#include "Fl_XColor.H"#include <FL/Fl.H>#include <FL/x.H>#include <FL/fl_draw.H>////////////////////////////////////////////////////////////////// figure_out_visual() calculates masks & shifts for generating// pixels in true-color visuals:uchar fl_redmask, fl_greenmask, fl_bluemask;int fl_redshift, fl_greenshift, fl_blueshift, fl_extrashift;static uchar beenhere;static voidfigure_out_visual(){    beenhere = 1;#ifndef NANO_X			//tanghao    if (!fl_visual->red_mask || !fl_visual->green_mask	|| !fl_visual->blue_mask) {#if USE_COLORMAP	fl_redmask = 0;	return;#else	Fl::fatal("Requires true color visual");#endif    }#endif //tanghao    // get the bit masks into a more useful form:    int i, j;#ifndef NANO_X			//tanghao    int m;    for (i = 0, m = 1; m; i++, m <<= 1)	if (fl_visual->red_mask & m)	    break;    for (j = i; m; j++, m <<= 1)	if (!(fl_visual->red_mask & m))	    break;#else    j = 64;    i = 8;#endif //tanghao    fl_redshift = j - 8;    fl_redmask = (j - i >= 8) ? 0xFF : 0xFF - (255 >> (j - i));#ifndef NANO_X			//tanghao    for (i = 0, m = 1; m; i++, m <<= 1)	if (fl_visual->green_mask & m)	    break;    for (j = i; m; j++, m <<= 1)	if (!(fl_visual->green_mask & m))	    break;#endif //tanghao    fl_greenshift = j - 8;    fl_greenmask = (j - i >= 8) ? 0xFF : 0xFF - (255 >> (j - i));#ifndef NANO_X			//tanghao    for (i = 0, m = 1; m; i++, m <<= 1)	if (fl_visual->blue_mask & m)	    break;    for (j = i; m; j++, m <<= 1)	if (!(fl_visual->blue_mask & m))	    break;#endif //tanghao    fl_blueshift = j - 8;    fl_bluemask = (j - i >= 8) ? 0xFF : 0xFF - (255 >> (j - i));    i = fl_redshift;    if (fl_greenshift < i)	i = fl_greenshift;    if (fl_blueshift < i)	i = fl_blueshift;    if (i < 0) {	fl_extrashift = -i;	fl_redshift -= i;	fl_greenshift -= i;	fl_blueshift -= i;    } else	fl_extrashift = 0;}////////////////////////////////////////////////////////////////// Get an rgb color.  This is easy for a truecolor visual.  For// colormapped it picks the closest color out of the fltk colormap// but be warned that this results in *two* approximations: one// to the fltk colormap, and another to whatever colors X allocates.ulongfl_xpixel(uchar r, uchar g, uchar b){    if (!beenhere)	figure_out_visual();#if USE_COLORMAP    if (!fl_redmask) {	Fl_Color i;	if (r == g && r == b) {	// get it out of gray ramp	    i = fl_gray_ramp(r * FL_NUM_GRAY / 256);	} else {		// get it out of color cube:	    i = fl_color_cube(r * FL_NUM_RED / 256, g * FL_NUM_GREEN / 256,			      b * FL_NUM_BLUE / 256);	}	return fl_xpixel(i);    }#endif#ifdef NANO_X    return GR_RGB(r, g, b);#else    return	(((r & fl_redmask) << fl_redshift) +	 ((g & fl_greenmask) << fl_greenshift) +	 ((b & fl_bluemask) << fl_blueshift)	) >> fl_extrashift;#endif}voidfl_color(uchar r, uchar g, uchar b){#ifdef NANO_X			//tanghao    GrSetGCForeground(fl_gc, fl_xpixel(r, g, b));	//(GR_GC_ID gc, GR_COLOR foreground);    GrSetGCBackground(fl_gc, GR_RGB(200, 200, 200));#else    XSetForeground(fl_display, fl_gc, fl_xpixel(r, g, b));#endif //tanghao}////////////////////////////////////////////////////////////////// Get a color out of the the fltk colormap.  Again for truecolor// visuals this is easy.  For colormap this actually tries to allocate// an X color, and does a least-squares match to find the closest// color if X cannot allocate that color.static unsigned fl_cmap[256] = {#include "fl_cmap.h"		// this is a file produced by "cmap.C":};#if HAVE_OVERLAYFl_XColor fl_xmap[2][256];uchar fl_overlay;Colormap fl_overlay_colormap;XVisualInfo *fl_overlay_visual;ulong fl_transparent_pixel;#elseFl_XColor fl_xmap[1][256];#endif// calculate what color is actually on the screen for a mask:static inline ucharrealcolor(uchar color, uchar mask){#if 1    // accurate version if the display has linear gamma, but fl_draw_image    // works better with the simpler version on most screens...    uchar m = mask;    uchar result = color & m;    for (;;) {	while (m & mask) {	    m >>= 1;	    color >>= 1;	}	if (!m)	    break;	mask = m;	result |= color & m;    }    return result;#else    return (color & mask) | (~mask) & (mask >> 1);#endif}ulongfl_xpixel(Fl_Color i){#if HAVE_OVERLAY    Fl_XColor & xmap = fl_xmap[fl_overlay][i];#else    Fl_XColor & xmap = fl_xmap[0][i];#endif    if (xmap.mapped)	return xmap.pixel;    if (!beenhere)	figure_out_visual();    uchar r, g, b;    {	unsigned c = fl_cmap[i];	r = uchar(c >> 24);	g = uchar(c >> 16);	b = uchar(c >> 8);    }#if USE_COLORMAP    Colormap colormap;#if HAVE_OVERLAY    if (fl_overlay) {	colormap = fl_overlay_colormap;	goto J1;    }#endif    if (!fl_redmask) {	colormap = fl_colormap;#if HAVE_OVERLAY      J1:	static XColor *ac[2];	XColor *&allcolors = ac[fl_overlay];	static int nc[2];	int &numcolors = nc[fl_overlay];#else#ifdef NANO_X	//static GR_COLOR *allcolors;	static int numcolors;#else	static XColor *allcolors;	static int numcolors;#endif#endif	// I don't try to allocate colors with XAllocColor once it fails	// with any color.  It is possible that it will work, since a color	// may have been freed, but some servers are extremely slow and this	// avoids one round trip:	if (!numcolors) {	// don't try after a failure#ifdef NANO_X	    GR_COLOR xcol;	    xcol = GR_RGB(r, g, b);	    xmap.mapped = 1;	    xmap.r = r >> 8;	    xmap.g = g >> 8;	    xmap.b = b >> 8;	    return xcol;#else	    XColor xcol;	    xcol.red = r << 8;	    xcol.green = g << 8;	    xcol.blue = b << 8;	    if (XAllocColor(fl_display, colormap, &xcol)) {		xmap.mapped = 1;		xmap.r = xcol.red >> 8;		xmap.g = xcol.green >> 8;		xmap.b = xcol.blue >> 8;		return xmap.pixel = xcol.pixel;#endif	    }#ifndef NANO_X	    // I only read the colormap once.  Again this is due to the slowness	    // of round-trips to the X server, even though other programs may alter	    // the colormap after this and make decisions here wrong.#if HAVE_OVERLAY	    if (fl_overlay)		numcolors = fl_overlay_visual->colormap_size;	    else#endif		numcolors = fl_visual->colormap_size;	    if (!allcolors)		allcolors = new XColor[numcolors];	    for (int p = numcolors; p--;)		allcolors[p].pixel = p;	    XQueryColors(fl_display, colormap, allcolors, numcolors);	}	// find least-squares match:	int mindist = 0x7FFFFFFF;	unsigned int bestmatch = 0;	for (unsigned int n = numcolors; n--;) {#if HAVE_OVERLAY	    if (fl_overlay && n == fl_transparent_pixel)		continue;#endif	    XColor & a = allcolors[n];	    int d, t;	    t = int (r) - int (a.red >> 8);	    d = t * t;	    t = int (g) - int (a.green >> 8);	    d += t * t;	    t = int (b) - int (a.blue >> 8);	    d += t * t;	    if (d <= mindist) {		bestmatch = n;		mindist = d;	    }	}	XColor & p = allcolors[bestmatch];	// It appears to "work" to not call this XAllocColor, which will	// avoid another round-trip to the server.  But then X does not	// know that this program "owns" this value, and can (and will)	// change it when the program that did allocate it exits:	if (XAllocColor(fl_display, colormap, &p)) {	    xmap.mapped = 1;	    xmap.pixel = p.pixel;	} else {	    // However, if that XAllocColor fails, I have to give up and	    // assumme the pixel is ok for the duration of the program.  This	    // is due to bugs (?) in the Solaris X and some X terminals	    // where XAllocColor *always* fails when the colormap is full,	    // even if we ask for a color already in it...	    xmap.mapped = 2;	// 2 prevents XFreeColor from being called	    xmap.pixel = bestmatch;	}	xmap.r = p.red >> 8;	xmap.g = p.green >> 8;	xmap.b = p.blue >> 8;	return xmap.pixel;#endif //tanghao    }#endif    // return color for a truecolor visual:    xmap.mapped = 2;		// 2 prevents XFreeColor from being called    xmap.r = realcolor(r, fl_redmask);    xmap.g = realcolor(g, fl_greenmask);    xmap.b = realcolor(b, fl_bluemask);    return xmap.pixel = fl_xpixel(r, g, b);}Fl_Color fl_color_;#include <stdio.h>voidfl_color(Fl_Color i){    fl_color_ = i;#ifdef NANO_X    //GR_COLOR c = fl_xpixel(i);    GrSetGCForeground(fl_gc, fl_xpixel(i));	//(GR_GC_ID gc, GR_COLOR foreground);    GrSetGCBackground(fl_gc, GR_RGB(255, 255, 255));#else    XSetForeground(fl_display, fl_gc, fl_xpixel(i));#endif //tanghao}voidFl::free_color(Fl_Color i, int overlay){#if HAVE_OVERLAY#else    if (overlay)	return;#endif    if (fl_xmap[overlay][i].mapped) {#if USE_COLORMAP#if HAVE_OVERLAY	Colormap colormap = overlay ? fl_overlay_colormap : fl_colormap;#else#ifndef NANO_X	Colormap colormap = fl_colormap;#endif#endif#ifndef NANO_X	if (fl_xmap[overlay][i].mapped == 1)	    XFreeColors(fl_display, colormap, &(fl_xmap[overlay][i].pixel), 1,			0);#endif //tanghao#endif	fl_xmap[overlay][i].mapped = 0;    }}voidFl::set_color(Fl_Color i, unsigned c){    if (fl_cmap[i] != c) {	free_color(i, 0);#if HAVE_OVERLAY	free_color(i, 1);#endif	fl_cmap[i] = c;    }}#endif // end of X-specific codeunsignedFl::get_color(Fl_Color i){    return fl_cmap[i];}voidFl::set_color(Fl_Color i, uchar red, uchar green, uchar blue){    Fl::set_color(i,		  ((unsigned) red << 24) + ((unsigned) green << 16) +		  ((unsigned) blue << 8));}voidFl::get_color(Fl_Color i, uchar & red, uchar & green, uchar & blue){    unsigned c = fl_cmap[i];    red = uchar(c >> 24);    green = uchar(c >> 16);    blue = uchar(c >> 8);}Fl_Colorfl_color_average(Fl_Color color1, Fl_Color color2, float weight){    Fl_Color avg;    unsigned rgb1 = fl_cmap[color1];    unsigned rgb2 = fl_cmap[color2];    uchar r, g, b;    r = (uchar) (((uchar) (rgb1 >> 24)) * weight +		 ((uchar) (rgb2 >> 24)) * (1 - weight));    g = (uchar) (((uchar) (rgb1 >> 16)) * weight +		 ((uchar) (rgb2 >> 16)) * (1 - weight));    b = (uchar) (((uchar) (rgb1 >> 8)) * weight +		 ((uchar) (rgb2 >> 8)) * (1 - weight));    if (r == g && r == b) {	// get it out of gray ramp	avg = fl_gray_ramp(r * FL_NUM_GRAY / 256);    } else {			// get it out of color cube:	avg =	    fl_color_cube(r * FL_NUM_RED / 256, g * FL_NUM_GREEN / 256,			  b * FL_NUM_BLUE / 256);    }    return avg;}Fl_Colorinactive(Fl_Color c){    return fl_color_average(c, FL_GRAY, .33f);}Fl_Colorcontrast(Fl_Color fg, Fl_Color bg){    int c1 = int (fl_cmap[fg]);    int c2 = int (fl_cmap[bg]);    if ((c1 ^ c2) & 0x80800000)	return fg;    else if (c2 & 0x80800000)	return FL_GRAY_RAMP;	// black from gray ramp    else	return (Fl_Color) (FL_COLOR_CUBE - 1);	// white from gray ramp}//// End of "$Id: fl_color.cxx,v 1.1.1.1 2003/08/07 21:18:41 jasonk Exp $".//

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美中文字幕不卡| 精品制服美女久久| 国产精品久久久久三级| 国产精品视频一区二区三区不卡| 日韩欧美国产三级电影视频| 在线观看91av| 91精品国产色综合久久久蜜香臀| 91精品蜜臀在线一区尤物| 51久久夜色精品国产麻豆| 欧美一区二区在线免费观看| 欧美tk—视频vk| 国产欧美一区二区精品久导航 | 奇米影视在线99精品| 国产一区二区三区四区五区美女| 蜜桃久久精品一区二区| 经典一区二区三区| 大桥未久av一区二区三区中文| 94-欧美-setu| 欧美色偷偷大香| 精品国产一二三区| 国产精品久久久久久福利一牛影视| 中文字幕日韩av资源站| 亚洲一二三四在线| 久久se这里有精品| 成人黄色网址在线观看| 亚洲成人动漫av| 精品午夜久久福利影院| 波多野结衣欧美| 欧美日韩精品一区视频| 久久你懂得1024| 亚洲欧美乱综合| 久久99九九99精品| 日本韩国一区二区三区| 日韩一区二区免费视频| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 欧美日韩国产一级二级| 久久综合久久鬼色| 亚洲一区二区视频在线| 国产一区二区影院| 欧美日韩视频第一区| 国产亚洲欧美色| 亚洲图片欧美色图| 国产69精品久久99不卡| 欧美巨大另类极品videosbest| 久久精品欧美一区二区三区麻豆| 亚洲国产wwwccc36天堂| 波多野结衣视频一区| 精品三级av在线| 亚洲国产成人av好男人在线观看| 成人午夜大片免费观看| 日韩一二三区视频| 一区二区三区自拍| 成人在线视频一区二区| 欧美大片国产精品| 亚洲成av人片在线观看无码| 91在线你懂得| 国产精品亲子乱子伦xxxx裸| 精品一区二区三区在线播放| 精品视频在线视频| 一区二区视频免费在线观看| 成人97人人超碰人人99| 精品免费视频一区二区| 水野朝阳av一区二区三区| 91福利小视频| 亚洲激情图片一区| 99视频在线精品| 国产三级三级三级精品8ⅰ区| 卡一卡二国产精品 | 国产精品一区专区| 精品国产网站在线观看| 老司机精品视频在线| 3atv一区二区三区| 天天色综合天天| 欧美日韩成人在线| 丝袜诱惑亚洲看片 | 日本视频中文字幕一区二区三区| 在线视频国内自拍亚洲视频| 亚洲精品乱码久久久久| 色综合色综合色综合色综合色综合| 欧美国产精品一区二区三区| 国产成人av电影在线| 国产片一区二区| 成人免费视频一区| 亚洲六月丁香色婷婷综合久久| 成人激情免费电影网址| 亚洲精品乱码久久久久| 欧美日韩免费一区二区三区视频| 亚洲国产日韩在线一区模特| 欧美日韩国产精品自在自线| 婷婷亚洲久悠悠色悠在线播放 | 久久亚洲精精品中文字幕早川悠里| 激情综合色综合久久| 国产三级精品视频| 99久久国产免费看| 丝袜亚洲精品中文字幕一区| 精品国产成人在线影院 | 欧美性xxxxx极品少妇| 五月婷婷色综合| 精品久久久久一区| 成人的网站免费观看| 亚洲综合在线电影| 日韩欧美一区二区在线视频| 国产精品污www在线观看| 成人sese在线| 国产精品系列在线| 欧美日韩在线不卡| 久久国产麻豆精品| 国产精品久久综合| 亚洲国产精品视频| 伊人开心综合网| 亚洲品质自拍视频网站| 中文字幕一区av| 国产精品福利一区二区三区| 中文字幕第一区| 日本一区二区久久| 中文字幕av在线一区二区三区| 久久久久久久久久久久久夜| 精品播放一区二区| 久久精品欧美日韩精品| 亚洲国产成人午夜在线一区| 欧美国产视频在线| 亚洲图片激情小说| 亚洲另类在线一区| 一区二区三区成人在线视频| 亚洲一区二区三区小说| 亚洲3atv精品一区二区三区| 天天影视网天天综合色在线播放| 日韩精品91亚洲二区在线观看| 日韩成人av影视| 狠狠色综合播放一区二区| 国产成人精品亚洲日本在线桃色| 国产69精品久久久久毛片 | 国产电影一区二区三区| 成人激情免费视频| 欧美日韩在线播放一区| 欧美一级黄色片| 久久欧美中文字幕| 亚洲欧美日韩系列| 亚洲国产精品人人做人人爽| 久久国产精品免费| 成人免费毛片aaaaa**| 色成年激情久久综合| 91精品国产免费| 久久免费视频一区| 日韩毛片精品高清免费| 日本视频一区二区三区| 国产.欧美.日韩| 欧美日韩一二区| 久久蜜桃香蕉精品一区二区三区| 国产精品久久久久久久久图文区 | 成人免费在线观看入口| 亚洲国产欧美在线人成| 国产一区二区美女诱惑| 91麻豆自制传媒国产之光| 日韩一区二区精品葵司在线| 中文在线资源观看网站视频免费不卡 | 美女视频黄免费的久久 | 成人亚洲一区二区一| 欧美性感一区二区三区| 久久精品欧美一区二区三区不卡 | 亚洲欧美视频在线观看| 麻豆精品一区二区三区| 91丨国产丨九色丨pron| 欧美精品一区二区三区蜜桃视频| 亚洲视频狠狠干| 国产精品系列在线播放| 91麻豆精品国产| 亚洲人妖av一区二区| 国产精品一卡二卡在线观看| 欧美精品一二三区| 亚洲视频一区在线| 国产精品1024| 日韩女优毛片在线| 五月天欧美精品| 色妞www精品视频| 国产精品日韩精品欧美在线| 精品午夜久久福利影院| 制服丝袜日韩国产| 一区二区三区免费| 处破女av一区二区| 久久欧美一区二区| 精彩视频一区二区三区 | 欧美高清视频不卡网| 亚洲乱码精品一二三四区日韩在线| 国产成人鲁色资源国产91色综 | 国产精品1区二区.| 日韩一区二区三区av| 丝袜亚洲另类欧美| 欧美日韩不卡一区二区| 亚洲福利一二三区| 色诱亚洲精品久久久久久| 国产精品久久毛片av大全日韩| 韩日av一区二区| 精品国内二区三区| 国产一区二区三区四区五区入口| 久久综合久久鬼色| 国模套图日韩精品一区二区| 精品国产免费人成电影在线观看四季 | 欧美r级电影在线观看| 日本免费新一区视频|