static void Main(string[] args) { Bitmap inputImage = new Bitmap("1024cat.png"); Bitmap overlayImg = new Bitmap("test2.png"); bitmapfilters.brightness(inputImage, 0.4f).Save("brightness.png"); return; //How to use the heatmaps example densitymap denstest = new densitymap(); //setup a new density map Random r = new Random(); for (int i = 0; i < (1024 * 2); i++) { int rposx = r.Next(0, 1024); int rposy = r.Next(0, 1024); denstest.createHeatMapSplodge(rposx, rposy); //Add all your data, in this case it was random } denstest.averageBlur3x3(); //Add a bit of kernal blur denstest.normalise(); //Normalise the results so they fit between 0-255 (mid point can be adjusted for more interesting effects) gradients.gradients.fire.applyToImage(denstest.toBitMap()).Save("test2.png"); //Apply a gradient to it, in this case I added the fire gradient which works well }
/// <summary> /// This method handles all the sequencing required to generate data from the mapData file /// </summary> /// <param name="mapfile">The mapfile to process</param> static void doProcessing(mapData mapfile, DemoParser parser) { Debug.Success("Starting processing"); //First step: Make a grey dark version of the radar. Bitmap backgroundRadar = bitmapfilters.brightness(bitmapfilters.greyScaleAverage(mapfile.image_radar), 0.3f); //Second step: Load the demo into a demodatainstance, so that it parses into different lists. demodatainstance demo = new demodatainstance(parser); //Third step: Start making heatmaps densitymap density_shotsfired = new densitymap(); //Legacy, Make the camera object camera cam = new camera(); cam.offset = new vector2(mapfile.radar.pos_x, mapfile.radar.pos_y); cam.scale = mapfile.radar.scale; foreach (p_Player plyr in demo.players.Values.ToList()) { foreach (p_Round rnd in plyr.rounds) { foreach (vector3 shot in rnd.shotsFired) { vector2 screenPos = transforms.worldToScreenSpace(shot, cam); density_shotsfired.createHeatMapSplodge((int)screenPos.x, (int)screenPos.y, 20); } } } density_shotsfired.averageBlur3x3(); density_shotsfired.normalise(0.4f); Bitmap output = density_shotsfired.toBitMap(); output = gradients.fire.applyToImage(output); output = bitmapfilters.alphaOver(backgroundRadar, output); output.Save("test_shotsfired.png"); }