b8180d9f6d41dc708a2f249ba892cbca311e7a06 jcasper Mon Feb 27 11:38:55 2023 -0800 Adding transparency support for colors refs #30569 diff --git src/hg/cgilib/hvGfx.c src/hg/cgilib/hvGfx.c index 8ea8bec..2853541 100644 --- src/hg/cgilib/hvGfx.c +++ src/hg/cgilib/hvGfx.c @@ -44,41 +44,42 @@ { vgClose(&hvg->vg); freez(pHvg); } } void hvGfxMakeColorGradient(struct hvGfx *hvg, struct rgbColor *start, struct rgbColor *end, int steps, Color *colorIxs) /* Make a color gradient that goes smoothly from start to end colors in given * number of steps. Put indices in color table in colorIxs */ { double scale = 0, invScale; double invStep; int i; -int r,g,b; +int r,g,b,a; steps -= 1; /* Easier to do the calculation in an inclusive way. */ invStep = 1.0/steps; for (i=0; i<=steps; ++i) { invScale = 1.0 - scale; r = invScale * start->r + scale * end->r; g = invScale * start->g + scale * end->g; b = invScale * start->b + scale * end->b; - colorIxs[i] = hvGfxFindColorIx(hvg, r, g, b); + a = invScale * start->a + scale * end->a; + colorIxs[i] = hvGfxFindAlphaColorIx(hvg, r, g, b, a); scale += invStep; } } static long figureTickSpan(long totalLength, int maxNumTicks) /* Figure out whether ticks on ruler should be 1, 5, 10, 50, 100, 500, * 1000, etc. units apart. */ { int roughTickLen = totalLength/maxNumTicks; int i; int tickLen = 1; for (i=0; i<9; ++i) { if (roughTickLen < tickLen)