Update of /cvsroot/freenet/freenet/src/freenet/node/rt
In directory sc8-pr-cvs1:/tmp/cvs-serv19626/src/freenet/node/rt

Modified Files:
        StandardNodeEstimator.java 
Log Message:
Stopped clipping in Bitmap.setPixel(), throw exception instead. With a little luck 
this will encourage people in need of cumbersome coordinate-to-pixel mapping to make 
it easy for themself by using the Bitmap class viewport facilities to manage their 
coordinate conversion.
Made Bitmap.drawPlus() use bitmap ViewPort setting.
Modify viewport coordinate conversion so that valid coordinates is: 
viewport_left<=x<viewport_right viewport_bottom<=y<viewport_top. Previously the valid 
coordinates was more like 
(min+pix_to_viewport_scale*0.5)<=coord<(max-pix_to_viewport_scale*0.5) which is quite 
a bit harder to use.
Simplify drawing of estimate()-graphs by using a Bitmap viewport for the coordinate 
conversion.

Index: StandardNodeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/StandardNodeEstimator.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -w -r1.41 -r1.42
--- StandardNodeEstimator.java  14 Nov 2003 01:14:32 -0000      1.41
+++ StandardNodeEstimator.java  14 Nov 2003 10:40:40 -0000      1.42
@@ -26,6 +26,7 @@
 import freenet.support.graph.BitmapEncoder;
 import freenet.support.graph.Color;
 import freenet.support.graph.DibEncoder;
+import freenet.support.graph.Rectangle;
 import freenet.support.io.WriteOutputStream;
 
 class StandardNodeEstimator extends NodeEstimator {
@@ -869,13 +870,17 @@
                        long lowest=Integer.MAX_VALUE;
                        long highest=0;
                }
-               
+               //Draws high g.val[x]:s on the top of the graph, low values on the 
bottom
                private void drapGraphOnImage(Bitmap bmp, GraphDataSet g) {
-               
-                                       // lowest ... highest
-                                       // lowest mapped to 0
-                                       // highest mapped to height
-                                       double multiplier = ((double) bmp.getHeight() 
- 1) / ((double) (g.highest - g.lowest));
+                                       bmp.scaleView(new 
Rectangle(0,g.highest,bmp.getWidth(),g.lowest-1));
+                                       if (g.lineCol != null) {
+                                               bmp.setPenColor(g.lineCol);
+                                               bmp.moveTo(0,g.val[0]);
+                                               for (int i = 1; i < bmp.getWidth(); 
i++) {
+                                                       bmp.drawTo(i,g.val[i]);
+                                               }
+                                       }
+                                       /*double multiplier = ((double) 
bmp.getHeight() - 1) / ((double) (g.highest - g.lowest));
                                        if (g.lineCol != null) {
                                                bmp.setPenColor(g.lineCol);
                                                int initposition = (int) ((g.val[0] - 
g.lowest) * multiplier);
@@ -888,6 +893,7 @@
                                                        bmp.drawTo(i,position);
                                                }
                                        }
+                                       */
                                }
 
                

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to