This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package com.liewjuntung.symbolicPlugin | |
| import org.gradle.api.DefaultTask | |
| import org.gradle.api.tasks.TaskAction | |
| import java.io.File | |
| abstract class SymbolicLink: DefaultTask() { | |
| var actualFilePath: String? = null | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | |
| plugins { | |
| kotlin("jvm") version "1.3.41" | |
| `java-gradle-plugin` | |
| id("com.gradle.plugin-publish") version "0.10.0" | |
| } | |
| pluginBundle { | |
| website = "<substitute your project website>" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | abstract class SymbolicLinkTask : DefaultTask() { | |
| var actualFilePath: String? = null | |
| var symbolicDirPath: String? = null | |
| var rename: String? = null | |
| @TaskAction | |
| fun link() { | |
| val aPath = actualFilePath ?: throw Exception("actualPath not set") | |
| val sPath = symbolicDirPath ?: throw Exception("symbolicPath not set") | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class RgbConversion(val rs: RenderScript, private val feedSize: Size, private val hasRotate: Boolean = true) { | |
| private var mInputAllocation: Allocation? = null | |
| private var mOutputAllocation: Allocation? = null | |
| private var mRotatedAllocation: Allocation? = null | |
| private val yuvToRgb = ScriptIntrinsicYuvToRGB.create(rs, Element.U8_4(rs)) | |
| private val rotator = ScriptC_rotator(rs) | |
| var bufferCallback: ((ByteBuffer) -> Unit)? = null | |
| val inputSurface: Surface | |
| get() = mInputAllocation!!.surface | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | fun rotateBitmap(context: Context, bitmap: Bitmap): Bitmap{ | |
| val rs = RenderScript.create(context) | |
| val allocation = Allocation.createFromBitmap(rs, bitmap) | |
| val rotated = Allocation.createTyped(rs, Type.createXY(rs, Element.RGBA_8888(rs), bitmap.height, bitmap.width)) | |
| ScriptC_rotator(rs).apply { | |
| _inImage = allocation | |
| _inHeight = bitmap.height | |
| _inWidth = bitmap.width | |
| forEach_rotate_270_clockwise(rotated, rotated) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package com.liewjuntung.cameraxfacetracking | |
| import android.content.pm.PackageManager | |
| import android.graphics.Bitmap | |
| import android.os.Bundle | |
| import android.os.Handler | |
| import android.os.HandlerThread | |
| import android.renderscript.RenderScript | |
| import android.util.Rational | |
| import android.util.Size | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class RsYuvToRgb(val rs: RenderScript) { | |
| private var rotateAllocation: Allocation? = null | |
| private var mOutputAllocation: Allocation? = null | |
| private var mInputAllocation: Allocation? = null | |
| private val rsYuvToRgb = ScriptIntrinsicYuvToRGB.create(rs, Element.U8_4(rs)) | |
| private var yArray: ByteArray? = null | |
| private var uArray: ByteArray? = null | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #pragma version(1) | |
| #pragma rs java_package_name(com.liewjuntung.image) | |
| rs_allocation inImage; | |
| int inWidth; | |
| int inHeight; | |
| float rotation = 0.0f; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class RsYuvToRgb(private val rs: RenderScript) { | |
| private var mOutputAllocation: Allocation? = null | |
| private var mInputAllocation: Allocation? = null | |
| private val rsYuvToRgb = ScriptIntrinsicYuvToRGB.create(rs, Element.U8_4(rs)) | |
| private var yArray: ByteArray? = null | |
| private var uArray: ByteArray? = null | |
| private var vArray: ByteArray? = null | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | package org.netvirta.thecamerax | |
| import android.graphics.Bitmap | |
| import android.graphics.ImageFormat | |
| import android.renderscript.Allocation | |
| import android.renderscript.Element | |
| import android.renderscript.RenderScript | |
| import android.renderscript.ScriptIntrinsicYuvToRGB | |
| import android.renderscript.Type | |
| import android.util.Log |