fb0d415d29a5786b48478ef7fb87b8adc8d8af61 kent Sun Feb 17 10:51:11 2013 -0800 Changing way transparency is done so that it shows up in PDF, and also can be normalized when we add more cell lines. diff --git src/hg/hgTracks/wigCommon.h src/hg/hgTracks/wigCommon.h index a430345..2643d37 100644 --- src/hg/hgTracks/wigCommon.h +++ src/hg/hgTracks/wigCommon.h @@ -24,95 +24,102 @@ int defaultHeight; /* requested height from cart */ int minHeight; /* minimum pixels height from trackDb */ double yLineMark; /* user requested line at y = */ char *colorTrack; /* Track to use for coloring wiggle track. */ int graphColumn; /* column to be graphing (bedGraph tracks) */ boolean bedGraph; /* is this a bedGraph track ? */ boolean isMultiWig; /* If true it's a multi-wig. */ boolean overlay; /* Overlay multiple wigs on top of each other? */ boolean transparent; /* Doing transparency? */ }; struct wigCartOptions *wigCartOptionsNew(struct cart *cart, struct trackDb *tdb, int wordCount, char *words[]); /* Create a wigCartOptions from cart contents and tdb. */ struct preDrawContainer -/* A list of preDraws */ +/* A preDraw array with a little bit of extra info */ { - struct preDrawContainer *next; - struct preDrawElement *preDraw; + struct preDrawContainer *nextPlaceholder; /* Refactoring code so not in list really. */ + struct preDrawElement *preDraw; /* Array of values. */ int preDrawSize; /* Size of preDraw */ int preDrawZero; /* Offset from start of predraw array to data requested. We * get more because of smoothing */ int width; /* Passed in width, number of pixels to display without smooth */ }; struct preDrawElement { double max; /* maximum value seen for this point */ double min; /* minimum value seen for this point */ unsigned long long count; /* number of datum at this point */ double sumData; /* sum of all values at this point */ double sumSquares; /* sum of (values squared) at this point */ double plotValue; /* raw data to plot */ double smooth; /* smooth data values */ }; struct bedGraphItem /* A bedGraph track item. */ { struct bedGraphItem *next; int start, end; /* Start/end in chrom coordinates. */ char *name; /* Common name */ float dataValue; /* data value from bed table graphColumn */ double graphUpperLimit; /* filled in by DrawItems */ double graphLowerLimit; /* filled in by DrawItems */ }; +typedef void (*WigVerticalLineVirtual)(void *image, int x, int y, int height, Color color); +/* Draw a vertical line somewhere, maybe a regular image, maybe a transparent one. */ + +struct wigGraphOutput +/* Info on where to draw a wig - may be pretty indirect in transparent case. */ + { + WigVerticalLineVirtual vLine; + void *image; /* Some type in reality that goes with vLine. */ + int xOff, yOff; /* Where to offset output within image. */ + }; + +struct wigGraphOutput *wigGraphOutputSolid(int xOff, int yOff, struct hvGfx *image); +/* Get appropriate wigGraphOutput for non-transparent rendering */ + /* source to these routines is in wigTrack.c */ struct preDrawContainer *initPreDrawContainer(int width); /* initialize a preDraw array of size width */ void preDrawWindowFunction(struct preDrawElement *preDraw, int preDrawSize, enum wiggleWindowingEnum windowingFunction, enum wiggleTransformFuncEnum transformFunc); /* apply windowing function to the values in preDraw array */ void preDrawSmoothing(struct preDrawElement *preDraw, int preDrawSize, enum wiggleSmoothingEnum smoothingWindow); /* apply smoothing function to preDraw array */ double preDrawLimits(struct preDrawElement *preDraw, int preDrawZero, int width, double *overallUpperLimit, double *overallLowerLimit); /* scan preDraw array and determine graph limits */ double preDrawAutoScale(struct preDrawElement *preDraw, int preDrawZero, int width, enum wiggleScaleOptEnum autoScale, double *overallUpperLimit, double *overallLowerLimit, double *graphUpperLimit, double *graphLowerLimit, double *overallRange, double *epsilon, int lineHeight, double maxY, double minY, enum wiggleAlwaysZeroEnum alwaysZero); /* if autoScaling, scan preDraw array and determine limits */ -void graphPreDraw(struct preDrawElement *preDraw, int preDrawZero, int width, - struct track *tg, struct hvGfx *hvg, int xOff, int yOff, - double graphUpperLimit, double graphLowerLimit, double graphRange, - double epsilon, Color *colorArray, enum trackVisibility vis, - struct wigCartOptions *wigCart); -/* graph the preDraw array */ - void drawZeroLine(enum trackVisibility vis, enum wiggleGridOptEnum horizontalGrid, double graphUpperLimit, double graphLowerLimit, struct hvGfx *hvg, int xOff, int yOff, int width, int lineHeight); /* draw a line at y=0 on the graph */ void drawArbitraryYLine(enum trackVisibility vis, enum wiggleGridOptEnum horizontalGrid, double graphUpperLimit, double graphLowerLimit, struct hvGfx *hvg, int xOff, int yOff, int width, int lineHeight, double yLineMark, double graphRange, enum wiggleYLineMarkEnum yLineOnOff); /* draw a line at y=yLineMark on the graph */ void wigMapSelf(struct track *tg, struct hvGfx *hvg, int seqStart, int seqEnd, int xOff, int yOff, int width);