11a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb/*
21a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * Copyright (C) 2013 The Android Open Source Project
31a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb *
41a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * Licensed under the Apache License, Version 2.0 (the "License");
51a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * you may not use this file except in compliance with the License.
61a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * You may obtain a copy of the License at
71a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb *
81a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb *      http://www.apache.org/licenses/LICENSE-2.0
91a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb *
101a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * Unless required by applicable law or agreed to in writing, software
111a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * distributed under the License is distributed on an "AS IS" BASIS,
121a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
131a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * See the License for the specific language governing permissions and
141a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb * limitations under the License.
151a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb */
161a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb
171a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolbpackage com.android.gallery3d.filtershow.ui;
181a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb
191a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolbimport android.graphics.Canvas;
201a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolbimport android.graphics.Paint;
211a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb
221a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolbpublic class SelectionRenderer {
231a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb
241a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb    public static void drawSelection(Canvas canvas, int left, int top, int right, int bottom,
251a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb            int stroke, Paint paint) {
261a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb        canvas.drawRect(left, top, right, top + stroke, paint);
271a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb        canvas.drawRect(left, bottom - stroke, right, bottom, paint);
281a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb        canvas.drawRect(left, top, left + stroke, bottom, paint);
291a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb        canvas.drawRect(right - stroke, top, right, bottom, paint);
301a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb    }
311a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb
322fa659f93347df6a78392679092bf9af42a64635Michael Kolb    public static void drawSelection(Canvas canvas, int left, int top, int right, int bottom,
332fa659f93347df6a78392679092bf9af42a64635Michael Kolb            int stroke, Paint selectPaint, int border, Paint borderPaint) {
342fa659f93347df6a78392679092bf9af42a64635Michael Kolb        canvas.drawRect(left, top, right, top + stroke, selectPaint);
352fa659f93347df6a78392679092bf9af42a64635Michael Kolb        canvas.drawRect(left, bottom - stroke, right, bottom, selectPaint);
362fa659f93347df6a78392679092bf9af42a64635Michael Kolb        canvas.drawRect(left, top, left + stroke, bottom, selectPaint);
372fa659f93347df6a78392679092bf9af42a64635Michael Kolb        canvas.drawRect(right - stroke, top, right, bottom, selectPaint);
382fa659f93347df6a78392679092bf9af42a64635Michael Kolb        canvas.drawRect(left + stroke, top + stroke, right - stroke,
392fa659f93347df6a78392679092bf9af42a64635Michael Kolb                top + stroke + border, borderPaint);
402fa659f93347df6a78392679092bf9af42a64635Michael Kolb        canvas.drawRect(left + stroke, bottom - stroke - border, right - stroke,
412fa659f93347df6a78392679092bf9af42a64635Michael Kolb                bottom - stroke, borderPaint);
422fa659f93347df6a78392679092bf9af42a64635Michael Kolb        canvas.drawRect(left + stroke, top + stroke, left + stroke + border,
432fa659f93347df6a78392679092bf9af42a64635Michael Kolb                bottom - stroke, borderPaint);
442fa659f93347df6a78392679092bf9af42a64635Michael Kolb        canvas.drawRect(right - stroke - border, top + stroke, right - stroke,
452fa659f93347df6a78392679092bf9af42a64635Michael Kolb                bottom - stroke, borderPaint);
462fa659f93347df6a78392679092bf9af42a64635Michael Kolb    }
472fa659f93347df6a78392679092bf9af42a64635Michael Kolb
481a266f16edbef7cb0a770d37fcad958fc55a5862Michael Kolb}
49