📄 qxpmhandler.cpp
字号:
{ QRGB(207,207,207), "grey81" }, { QRGB(209,209,209), "grey82" }, { QRGB(212,212,212), "grey83" }, { QRGB(214,214,214), "grey84" }, { QRGB(217,217,217), "grey85" }, { QRGB(219,219,219), "grey86" }, { QRGB(222,222,222), "grey87" }, { QRGB(224,224,224), "grey88" }, { QRGB(227,227,227), "grey89" }, { QRGB( 23, 23, 23), "grey9" }, { QRGB(229,229,229), "grey90" }, { QRGB(232,232,232), "grey91" }, { QRGB(235,235,235), "grey92" }, { QRGB(237,237,237), "grey93" }, { QRGB(240,240,240), "grey94" }, { QRGB(242,242,242), "grey95" }, { QRGB(245,245,245), "grey96" }, { QRGB(247,247,247), "grey97" }, { QRGB(250,250,250), "grey98" }, { QRGB(252,252,252), "grey99" }, { QRGB(240,255,240), "honeydew" }, { QRGB(240,255,240), "honeydew1" }, { QRGB(224,238,224), "honeydew2" }, { QRGB(193,205,193), "honeydew3" }, { QRGB(131,139,131), "honeydew4" }, { QRGB(255,105,180), "hotpink" }, { QRGB(255,110,180), "hotpink1" }, { QRGB(238,106,167), "hotpink2" }, { QRGB(205, 96,144), "hotpink3" }, { QRGB(139, 58, 98), "hotpink4" }, { QRGB(205, 92, 92), "indianred" }, { QRGB(255,106,106), "indianred1" }, { QRGB(238, 99, 99), "indianred2" }, { QRGB(205, 85, 85), "indianred3" }, { QRGB(139, 58, 58), "indianred4" }, { QRGB(255,255,240), "ivory" }, { QRGB(255,255,240), "ivory1" }, { QRGB(238,238,224), "ivory2" }, { QRGB(205,205,193), "ivory3" }, { QRGB(139,139,131), "ivory4" }, { QRGB(240,230,140), "khaki" }, { QRGB(255,246,143), "khaki1" }, { QRGB(238,230,133), "khaki2" }, { QRGB(205,198,115), "khaki3" }, { QRGB(139,134, 78), "khaki4" }, { QRGB(230,230,250), "lavender" }, { QRGB(255,240,245), "lavenderblush" }, { QRGB(255,240,245), "lavenderblush1" }, { QRGB(238,224,229), "lavenderblush2" }, { QRGB(205,193,197), "lavenderblush3" }, { QRGB(139,131,134), "lavenderblush4" }, { QRGB(124,252, 0), "lawngreen" }, { QRGB(255,250,205), "lemonchiffon" }, { QRGB(255,250,205), "lemonchiffon1" }, { QRGB(238,233,191), "lemonchiffon2" }, { QRGB(205,201,165), "lemonchiffon3" }, { QRGB(139,137,112), "lemonchiffon4" }, { QRGB(173,216,230), "lightblue" }, { QRGB(191,239,255), "lightblue1" }, { QRGB(178,223,238), "lightblue2" }, { QRGB(154,192,205), "lightblue3" }, { QRGB(104,131,139), "lightblue4" }, { QRGB(240,128,128), "lightcoral" }, { QRGB(224,255,255), "lightcyan" }, { QRGB(224,255,255), "lightcyan1" }, { QRGB(209,238,238), "lightcyan2" }, { QRGB(180,205,205), "lightcyan3" }, { QRGB(122,139,139), "lightcyan4" }, { QRGB(238,221,130), "lightgoldenrod" }, { QRGB(255,236,139), "lightgoldenrod1" }, { QRGB(238,220,130), "lightgoldenrod2" }, { QRGB(205,190,112), "lightgoldenrod3" }, { QRGB(139,129, 76), "lightgoldenrod4" }, { QRGB(250,250,210), "lightgoldenrodyellow" }, { QRGB(211,211,211), "lightgray" }, { QRGB(144,238,144), "lightgreen" }, { QRGB(211,211,211), "lightgrey" }, { QRGB(255,182,193), "lightpink" }, { QRGB(255,174,185), "lightpink1" }, { QRGB(238,162,173), "lightpink2" }, { QRGB(205,140,149), "lightpink3" }, { QRGB(139, 95,101), "lightpink4" }, { QRGB(255,160,122), "lightsalmon" }, { QRGB(255,160,122), "lightsalmon1" }, { QRGB(238,149,114), "lightsalmon2" }, { QRGB(205,129, 98), "lightsalmon3" }, { QRGB(139, 87, 66), "lightsalmon4" }, { QRGB( 32,178,170), "lightseagreen" }, { QRGB(135,206,250), "lightskyblue" }, { QRGB(176,226,255), "lightskyblue1" }, { QRGB(164,211,238), "lightskyblue2" }, { QRGB(141,182,205), "lightskyblue3" }, { QRGB( 96,123,139), "lightskyblue4" }, { QRGB(132,112,255), "lightslateblue" }, { QRGB(119,136,153), "lightslategray" }, { QRGB(119,136,153), "lightslategrey" }, { QRGB(176,196,222), "lightsteelblue" }, { QRGB(202,225,255), "lightsteelblue1" }, { QRGB(188,210,238), "lightsteelblue2" }, { QRGB(162,181,205), "lightsteelblue3" }, { QRGB(110,123,139), "lightsteelblue4" }, { QRGB(255,255,224), "lightyellow" }, { QRGB(255,255,224), "lightyellow1" }, { QRGB(238,238,209), "lightyellow2" }, { QRGB(205,205,180), "lightyellow3" }, { QRGB(139,139,122), "lightyellow4" }, { QRGB( 50,205, 50), "limegreen" }, { QRGB(250,240,230), "linen" }, { QRGB(255, 0,255), "magenta" }, { QRGB(255, 0,255), "magenta1" }, { QRGB(238, 0,238), "magenta2" }, { QRGB(205, 0,205), "magenta3" }, { QRGB(139, 0,139), "magenta4" }, { QRGB(176, 48, 96), "maroon" }, { QRGB(255, 52,179), "maroon1" }, { QRGB(238, 48,167), "maroon2" }, { QRGB(205, 41,144), "maroon3" }, { QRGB(139, 28, 98), "maroon4" }, { QRGB(102,205,170), "mediumaquamarine" }, { QRGB( 0, 0,205), "mediumblue" }, { QRGB(186, 85,211), "mediumorchid" }, { QRGB(224,102,255), "mediumorchid1" }, { QRGB(209, 95,238), "mediumorchid2" }, { QRGB(180, 82,205), "mediumorchid3" }, { QRGB(122, 55,139), "mediumorchid4" }, { QRGB(147,112,219), "mediumpurple" }, { QRGB(171,130,255), "mediumpurple1" }, { QRGB(159,121,238), "mediumpurple2" }, { QRGB(137,104,205), "mediumpurple3" }, { QRGB( 93, 71,139), "mediumpurple4" }, { QRGB( 60,179,113), "mediumseagreen" }, { QRGB(123,104,238), "mediumslateblue" }, { QRGB( 0,250,154), "mediumspringgreen" }, { QRGB( 72,209,204), "mediumturquoise" }, { QRGB(199, 21,133), "mediumvioletred" }, { QRGB( 25, 25,112), "midnightblue" }, { QRGB(245,255,250), "mintcream" }, { QRGB(255,228,225), "mistyrose" }, { QRGB(255,228,225), "mistyrose1" }, { QRGB(238,213,210), "mistyrose2" }, { QRGB(205,183,181), "mistyrose3" }, { QRGB(139,125,123), "mistyrose4" }, { QRGB(255,228,181), "moccasin" }, { QRGB(255,222,173), "navajowhite" }, { QRGB(255,222,173), "navajowhite1" }, { QRGB(238,207,161), "navajowhite2" }, { QRGB(205,179,139), "navajowhite3" }, { QRGB(139,121, 94), "navajowhite4" }, { QRGB( 0, 0,128), "navy" }, { QRGB( 0, 0,128), "navyblue" }, { QRGB(253,245,230), "oldlace" }, { QRGB(107,142, 35), "olivedrab" }, { QRGB(192,255, 62), "olivedrab1" }, { QRGB(179,238, 58), "olivedrab2" }, { QRGB(154,205, 50), "olivedrab3" }, { QRGB(105,139, 34), "olivedrab4" }, { QRGB(255,165, 0), "orange" }, { QRGB(255,165, 0), "orange1" }, { QRGB(238,154, 0), "orange2" }, { QRGB(205,133, 0), "orange3" }, { QRGB(139, 90, 0), "orange4" }, { QRGB(255, 69, 0), "orangered" }, { QRGB(255, 69, 0), "orangered1" }, { QRGB(238, 64, 0), "orangered2" }, { QRGB(205, 55, 0), "orangered3" }, { QRGB(139, 37, 0), "orangered4" }, { QRGB(218,112,214), "orchid" }, { QRGB(255,131,250), "orchid1" }, { QRGB(238,122,233), "orchid2" }, { QRGB(205,105,201), "orchid3" }, { QRGB(139, 71,137), "orchid4" }, { QRGB(238,232,170), "palegoldenrod" }, { QRGB(152,251,152), "palegreen" }, { QRGB(154,255,154), "palegreen1" }, { QRGB(144,238,144), "palegreen2" }, { QRGB(124,205,124), "palegreen3" }, { QRGB( 84,139, 84), "palegreen4" }, { QRGB(175,238,238), "paleturquoise" }, { QRGB(187,255,255), "paleturquoise1" }, { QRGB(174,238,238), "paleturquoise2" }, { QRGB(150,205,205), "paleturquoise3" }, { QRGB(102,139,139), "paleturquoise4" }, { QRGB(219,112,147), "palevioletred" }, { QRGB(255,130,171), "palevioletred1" }, { QRGB(238,121,159), "palevioletred2" }, { QRGB(205,104,137), "palevioletred3" }, { QRGB(139, 71, 93), "palevioletred4" }, { QRGB(255,239,213), "papayawhip" }, { QRGB(255,218,185), "peachpuff" }, { QRGB(255,218,185), "peachpuff1" }, { QRGB(238,203,173), "peachpuff2" }, { QRGB(205,175,149), "peachpuff3" }, { QRGB(139,119,101), "peachpuff4" }, { QRGB(205,133, 63), "peru" }, { QRGB(255,192,203), "pink" }, { QRGB(255,181,197), "pink1" }, { QRGB(238,169,184), "pink2" }, { QRGB(205,145,158), "pink3" }, { QRGB(139, 99,108), "pink4" }, { QRGB(221,160,221), "plum" }, { QRGB(255,187,255), "plum1" }, { QRGB(238,174,238), "plum2" }, { QRGB(205,150,205), "plum3" }, { QRGB(139,102,139), "plum4" }, { QRGB(176,224,230), "powderblue" }, { QRGB(160, 32,240), "purple" }, { QRGB(155, 48,255), "purple1" }, { QRGB(145, 44,238), "purple2" }, { QRGB(125, 38,205), "purple3" }, { QRGB( 85, 26,139), "purple4" }, { QRGB(255, 0, 0), "red" }, { QRGB(255, 0, 0), "red1" }, { QRGB(238, 0, 0), "red2" }, { QRGB(205, 0, 0), "red3" }, { QRGB(139, 0, 0), "red4" }, { QRGB(188,143,143), "rosybrown" }, { QRGB(255,193,193), "rosybrown1" }, { QRGB(238,180,180), "rosybrown2" }, { QRGB(205,155,155), "rosybrown3" }, { QRGB(139,105,105), "rosybrown4" }, { QRGB( 65,105,225), "royalblue" }, { QRGB( 72,118,255), "royalblue1" }, { QRGB( 67,110,238), "royalblue2" }, { QRGB( 58, 95,205), "royalblue3" }, { QRGB( 39, 64,139), "royalblue4" }, { QRGB(139, 69, 19), "saddlebrown" }, { QRGB(250,128,114), "salmon" }, { QRGB(255,140,105), "salmon1" }, { QRGB(238,130, 98), "salmon2" }, { QRGB(205,112, 84), "salmon3" }, { QRGB(139, 76, 57), "salmon4" }, { QRGB(244,164, 96), "sandybrown" }, { QRGB( 46,139, 87), "seagreen" }, { QRGB( 84,255,159), "seagreen1" }, { QRGB( 78,238,148), "seagreen2" }, { QRGB( 67,205,128), "seagreen3" }, { QRGB( 46,139, 87), "seagreen4" }, { QRGB(255,245,238), "seashell" }, { QRGB(255,245,238), "seashell1" }, { QRGB(238,229,222), "seashell2" }, { QRGB(205,197,191), "seashell3" }, { QRGB(139,134,130), "seashell4" }, { QRGB(160, 82, 45), "sienna" }, { QRGB(255,130, 71), "sienna1" }, { QRGB(238,121, 66), "sienna2" }, { QRGB(205,104, 57), "sienna3" }, { QRGB(139, 71, 38), "sienna4" }, { QRGB(135,206,235), "skyblue" }, { QRGB(135,206,255), "skyblue1" }, { QRGB(126,192,238), "skyblue2" }, { QRGB(108,166,205), "skyblue3" }, { QRGB( 74,112,139), "skyblue4" }, { QRGB(106, 90,205), "slateblue" }, { QRGB(131,111,255), "slateblue1" }, { QRGB(122,103,238), "slateblue2" }, { QRGB(105, 89,205), "slateblue3" }, { QRGB( 71, 60,139), "slateblue4" }, { QRGB(112,128,144), "slategray" }, { QRGB(198,226,255), "slategray1" }, { QRGB(185,211,238), "slategray2" }, { QRGB(159,182,205), "slategray3" }, { QRGB(108,123,139), "slategray4" }, { QRGB(112,128,144), "slategrey" }, { QRGB(255,250,250), "snow" }, { QRGB(255,250,250), "snow1" }, { QRGB(238,233,233), "snow2" }, { QRGB(205,201,201), "snow3" }, { QRGB(139,137,137), "snow4" }, { QRGB( 0,255,127), "springgreen" }, { QRGB( 0,255,127), "springgreen1" }, { QRGB( 0,238,118), "springgreen2" }, { QRGB( 0,205,102), "springgreen3" }, { QRGB( 0,139, 69), "springgreen4" }, { QRGB( 70,130,180), "steelblue" }, { QRGB( 99,184,255), "steelblue1" }, { QRGB( 92,172,238), "steelblue2" }, { QRGB( 79,148,205), "steelblue3" }, { QRGB( 54,100,139), "steelblue4" }, { QRGB(210,180,140), "tan" }, { QRGB(255,165, 79), "tan1" }, { QRGB(238,154, 73), "tan2" }, { QRGB(205,133, 63), "tan3" }, { QRGB(139, 90, 43), "tan4" }, { QRGB(216,191,216), "thistle" }, { QRGB(255,225,255), "thistle1" }, { QRGB(238,210,238), "thistle2" }, { QRGB(205,181,205), "thistle3" }, { QRGB(139,123,139), "thistle4" }, { QRGB(255, 99, 71), "tomato" }, { QRGB(255, 99, 71), "tomato1" }, { QRGB(238, 92, 66), "tomato2" }, { QRGB(205, 79, 57), "tomato3" }, { QRGB(139, 54, 38), "tomato4" }, { QRGB( 64,224,208), "turquoise" }, { QRGB( 0,245,255), "turquoise1" }, { QRGB( 0,229,238), "turquoise2" }, { QRGB( 0,197,205), "turquoise3" }, { QRGB( 0,134,139), "turquoise4" }, { QRGB(238,130,238), "violet" }, { QRGB(208, 32,144), "violetred" }, { QRGB(255, 62,150), "violetred1" }, { QRGB(238, 58,140), "violetred2" }, { QRGB(205, 50,120), "violetred3" }, { QRGB(139, 34, 82), "violetred4" }, { QRGB(245,222,179), "wheat" }, { QRGB(255,231,186), "wheat1" }, { QRGB(238,216,174), "wheat2" }, { QRGB(205,186,150), "wheat3" }, { QRGB(139,126,102), "wheat4" }, { QRGB(255,255,255), "white" }, { QRGB(245,245,245), "whitesmoke" }, { QRGB(255,255, 0), "yellow" }, { QRGB(255,255, 0), "yellow1" }, { QRGB(238,238, 0), "yellow2" }, { QRGB(205,205, 0), "yellow3" }, { QRGB(139,139, 0), "yellow4" }, { QRGB(154,205, 50), "yellowgreen" } };#if defined(Q_C_CALLBACKS)extern "C" {#endifstatic int rgb_cmp(const void *d1, const void *d2){ return qstricmp(((XPMRGBData *)d1)->name, ((XPMRGBData *)d2)->name);}#if defined(Q_C_CALLBACKS)}#endifstatic bool qt_get_named_xpm_rgb(const char *name_no_space, QRgb *rgb){ XPMRGBData x; x.name = name_no_space; // Funtion bsearch() is supposed to be // void *bsearch(const void *key, const void *base, ... // So why (char*)? Are there broken bsearch() declarations out there? XPMRGBData *r = (XPMRGBData *)bsearch((char *)&x, (char *)xpmRgbTbl, xpmRgbTblSize, sizeof(XPMRGBData), rgb_cmp); if (r) { *rgb = r->value; return true; } else { return false; }}/***************************************************************************** Misc. utility functions *****************************************************************************/static QString fbname(const QString &fileName) // get file basename (sort of){ QString s = fileName; if (!s.isEmpty()) { int i; if ((i = s.lastIndexOf(QLatin1Char('/'))) >= 0) s = s.mid(i); if ((i = s.lastIndexOf(QLatin1Char('\\'))) >= 0) s = s.mid(i); QRegExp r(QLatin1String("[a-zA-Z][a-zA-Z0-9_]*")); int p = r.indexIn(s); if (p == -1) s.clear(); else s = s.mid(p, r.matchedLength()); } if (s.isEmpty()) s = QString::fromLatin1("dummy"); return s;}// Skip until ", read until the next ", return the rest in *buf// Returns false on error, true on successstatic bool read_xpm_string(QByteArray &buf, QIODevice *d, const char * const *source, int &index, QByteArray &state){ if (source) { buf = source[index++]; return true; } buf = ""; bool gotQuote = false; int offset = 0; forever { if (offset == state.size() || state.isEmpty()) { char buf[2048]; qint64 bytesRead = d->read(buf, sizeof(buf)); if (bytesRead <= 0) return false; state = QByteArray(buf, int(bytesRead)); offset = 0; } if (!gotQuote) { if (state.at(offset++) == '"') gotQuote = true; } else { char c = state.at(offset++); if (c == '"') break; buf += c; } } state.remove(0, offset); return true;}// Tests if the given prefix can be the start of an XPM color specificationstatic bool is_xpm_color_spec_prefix(const QByteArray& prefix){ return prefix == "c" || prefix == "g" || prefix == "g4" || prefix == "m" || prefix == "s";}// Reads XPM header.static bool read_xpm_header( QIODevice *device, const char * const * source, int& index, QByteArray &state, int *cpp, int *ncols, int *w, int *h)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -