11 #include <QPainterPath>
15 const float Pi = 3.14159f;
21 QString strChar = QString(
"%1").arg((
char)(baseChar + index % 26));
27 QString tmpPath(
path);
29 params <<
"/select," << tmpPath.replace(
"/",
"\\");
30 QProcess::startDetached(
"explorer.exe", params);
35 QPainterPath starPath;
36 starPath.moveTo(30, 15);
37 for (
int i = 1; i < 5; ++i) {
38 starPath.lineTo(15 + 15 * qCos(0.8 * i *
Pi),
39 15 + 15 * qSin(0.8 * i *
Pi));
41 starPath.closeSubpath();
43 QImage
star(
size, QImage::Format_ARGB32);
44 star.fill(Qt::transparent);
46 QPainter painter(&
star);
47 painter.setRenderHint(QPainter::Antialiasing);
48 painter.setPen(QRgb(0xf6a625));
49 painter.setBrush(painter.pen().color());
50 painter.drawPath(starPath);
56 double f = (double)std::rand() / RAND_MAX;
57 return f * (high - low) + low;
60 void vtkColor(
const QColor& clr,
double* vtkClr) {
61 double r = (double)clr.red() / 255;
62 double g = (double)clr.green() / 255;
63 double b = (double)clr.blue() / 255;
70 return QColor(pClr[0] * 255, pClr[1] * 255, pClr[2] * 255);
73 static void RGB2HSV(
float r,
float g,
float b,
float* h,
float* s,
float* v) {
74 float min, max, delta;
75 min = qMin(r, qMin(g, b));
76 max = qMax(r, qMax(g, b));
90 *h = 2 + (b - r) / delta;
92 *h = 4 + (r - g) / delta;
94 if (*h < 0) *h += 360;
101 RGB2HSV(clrArr[0], clrArr[1], clrArr[2], &h, &s, &v);
102 hsv[0] = (
float)h / 360;
static void RGB2HSV(float r, float g, float b, float *h, float *s, float *v)
QColor qColor(double *pClr)
void vtkColor(const QColor &clr, double *vtkClr)
double random(int low, int high)
QString character(int index)
void qColor2HSV(const QColor &clr, double *hsv)
QImage star(const QSize &size)
void explorer(const QString &path)
static const std::string path