// Jason Rohrer // Plot.cpp /** * * Scrolling Plot Gui element implementation * * * Created 11-7-99 * Mods: * Jason Rohrer 11-8-99 Changed to use GraphicBuffer object as screen buffer * */ #include "Plot.h" Plot::Plot( int x, int y, int w, int h, Color bordC, Color bC, Color lnC ) { startX = x; startY = y; wide = w; high = h; innerWide = wide - 2*borderWide; innerHigh = high - 2*borderWide; borderC = bordC; bgC = bC; lineC = lnC; imageMap = new unsigned long[high * wide]; mapYOffset = new int[high]; // precalc y offsets into 2d image map for( int y=0; yhigh-borderWide-1 || x>wide-borderWide-1 ) { imageMap[ yContrib + x ] = borderC.composite; // border } else { imageMap[ yContrib + x ] = bgC.composite; // background } } } plotVals = new float[innerWide]; for( int i=0; i 0) { invLargest = 1/largest; } // fill plot with bg color for( int y=borderWide; y innerHigh + borderWide ) y = innerHigh + borderWide -1; if( y < borderWide ) y = borderWide; imageMap[ mapYOffset[y] + x ] = lineC.composite; // line } /* for( int x=0; x