1/* 2 * Copyright (C) 2013 The Android Open Source Project 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 17package com.android.gallery3d.filtershow.ui; 18 19import android.graphics.Canvas; 20import android.graphics.Paint; 21 22public class SelectionRenderer { 23 24 public static void drawSelection(Canvas canvas, int left, int top, int right, int bottom, 25 int stroke, Paint paint) { 26 canvas.drawRect(left, top, right, top + stroke, paint); 27 canvas.drawRect(left, bottom - stroke, right, bottom, paint); 28 canvas.drawRect(left, top, left + stroke, bottom, paint); 29 canvas.drawRect(right - stroke, top, right, bottom, paint); 30 } 31 32 public static void drawSelection(Canvas canvas, int left, int top, int right, int bottom, 33 int stroke, Paint selectPaint, int border, Paint borderPaint) { 34 canvas.drawRect(left, top, right, top + stroke, selectPaint); 35 canvas.drawRect(left, bottom - stroke, right, bottom, selectPaint); 36 canvas.drawRect(left, top, left + stroke, bottom, selectPaint); 37 canvas.drawRect(right - stroke, top, right, bottom, selectPaint); 38 canvas.drawRect(left + stroke, top + stroke, right - stroke, 39 top + stroke + border, borderPaint); 40 canvas.drawRect(left + stroke, bottom - stroke - border, right - stroke, 41 bottom - stroke, borderPaint); 42 canvas.drawRect(left + stroke, top + stroke, left + stroke + border, 43 bottom - stroke, borderPaint); 44 canvas.drawRect(right - stroke - border, top + stroke, right - stroke, 45 bottom - stroke, borderPaint); 46 } 47 48} 49