Home | History | Annotate | Download | only in util
      1 /*
      2  * Copyright 2012 AndroidPlot.com
      3  *
      4  *    Licensed under the Apache License, Version 2.0 (the "License");
      5  *    you may not use this file except in compliance with the License.
      6  *    You may obtain a copy of the License at
      7  *
      8  *        http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  *    Unless required by applicable law or agreed to in writing, software
     11  *    distributed under the License is distributed on an "AS IS" BASIS,
     12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  *    See the License for the specific language governing permissions and
     14  *    limitations under the License.
     15  */
     16 
     17 package com.androidplot.util;
     18 
     19 import android.graphics.RectF;
     20 
     21 /**
     22  * Convenience class for managing BoxModel data
     23  */
     24 public class DisplayDimensions {
     25 
     26     public final RectF canvasRect;
     27     public final RectF marginatedRect;
     28     public final RectF paddedRect;
     29 
     30     // init to 1 to avoid potential divide by zero errors (yet to be observed in practice)
     31     private static final RectF initRect;
     32 
     33     static {
     34         initRect = new RectF(1, 1, 1, 1);
     35     }
     36 
     37     public DisplayDimensions() {
     38         this(initRect, initRect, initRect);
     39     }
     40     public DisplayDimensions(RectF canvasRect, RectF marginatedRect, RectF paddedRect) {
     41         this.canvasRect = canvasRect;
     42         this.marginatedRect = marginatedRect;
     43         this.paddedRect = paddedRect;
     44     }
     45 }
     46