package com.kickstarter.libs.transformations;

import android.graphics.Bitmap;
import android.support.annotation.NonNull;

import com.squareup.picasso.Transformation;

/**
 * From https://github.com/square/picasso/blob/000a72859ca82f28975d0ef5099b01ec110e73ea/website/index.html#L78-L91
 */
public class CropSquareTransformation implements Transformation {
  @Override public @NonNull Bitmap transform(final @NonNull Bitmap source) {
    final int size = Math.min(source.getWidth(), source.getHeight());
    final int x = (source.getWidth() - size) / 2;
    final int y = (source.getHeight() - size) / 2;
    final Bitmap result = Bitmap.createBitmap(source, x, y, size, size);
    if (result != source) {
      source.recycle();
    }
    return result;
  }

  @Override public String key() {
    return "square()";
  }
}

@@ -1,8 +1,815 @@
+/**%0A * Copyright 2013 Square, Inc.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A *%0A * ***%0A *%0A * Original: https://github.com/square/picasso/blob/000a72859ca82f28975d0ef5099b01ec110e73ea/website/index.html#L78-L91%0A * Modifications: Some modifiers and annotations have been added by Kickstarter.%0A */%0A
 package 
@@ -972,131 +972,8 @@
 n;%0A%0A
-/**%0A * From https://github.com/square/picasso/blob/000a72859ca82f28975d0ef5099b01ec110e73ea/website/index.html#L78-L91%0A */%0A
 publ

Add apache header for CropSquareTransformation