package nz.gen.geek_central.GPSSatPointer;
/*
    Useful 2D graphics stuff.

    Copyright 2012 by Lawrence D'Oliveiro <ldo@geek-central.gen.nz>.

    Licensed under the Apache License, Version 2.0 (the "License"); you may not
    use this file except in compliance with the License. You may obtain a copy of
    the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    License for the specific language governing permissions and limitations under
    the License.
*/

public class GraphicsUseful
  {
    public final static float Pi = (float)Math.PI;

    public static float ToRadians
      (
        float Degrees
      )
      {
        return Pi * Degrees / 180.0f;
      } /*ToRadians*/

    public static float ToDegrees
      (
        float Radians
      )
      {
        return 180.0f * Radians / Pi;
      } /*ToDegrees*/

    public static android.graphics.Paint FillWithColor
      (
        int TheColor
      )
      /* returns a Paint that will fill with a solid colour. */
      {
        final android.graphics.Paint ThePaint = new android.graphics.Paint();
        ThePaint.setStyle(android.graphics.Paint.Style.FILL);
        ThePaint.setColor(TheColor);
        ThePaint.setAntiAlias(true);
        return
            ThePaint;
      } /*FillWithColor*/

    public static void DrawCenteredText
      (
        android.graphics.Canvas Draw,
        String TheText,
        android.graphics.PointF Where,
        android.graphics.Paint UsePaint
      )
      /* draws text at position x, vertically centred around y. */
      {
        final android.graphics.Rect TextBounds = new android.graphics.Rect();
        UsePaint.getTextBounds(TheText, 0, TheText.length(), TextBounds);
        Draw.drawText
          (
            TheText,
            Where.x, /* depend on UsePaint to align horizontally */
            Where.y - (TextBounds.bottom + TextBounds.top) / 2.0f,
            UsePaint
          );
      } /*DrawCenteredText*/

  } /*GraphicsUseful*/

@@ -1070,1128 +1070,8 @@
 */%0A%0A
-    public static android.graphics.Paint FillWithColor%0A      (%0A        int TheColor%0A      )%0A      /* returns a Paint that will fill with a solid colour. */%0A      %7B%0A        final android.graphics.Paint ThePaint = new android.graphics.Paint();%0A        ThePaint.setStyle(android.graphics.Paint.Style.FILL);%0A        ThePaint.setColor(TheColor);%0A        ThePaint.setAntiAlias(true);%0A        return%0A            ThePaint;%0A      %7D /*FillWithColor*/%0A%0A    public static void DrawCenteredText%0A      (%0A        android.graphics.Canvas Draw,%0A        String TheText,%0A        android.graphics.PointF Where,%0A        android.graphics.Paint UsePaint%0A      )%0A      /* draws text at position x, vertically centred around y. */%0A      %7B%0A        final android.graphics.Rect TextBounds = new android.graphics.Rect();%0A        UsePaint.getTextBounds(TheText, 0, TheText.length(), TextBounds);%0A        Draw.drawText%0A          (%0A            TheText,%0A            Where.x, /* depend on UsePaint to align horizontally */%0A            Where.y - (TextBounds.bottom + TextBounds.top) / 2.0f,%0A            UsePaint%0A          );%0A      %7D /*DrawCenteredText*/%0A%0A
   %7D 

remove unneeded stuff