Skip to main content

Posts

android kotlin - Bitmap color balance

MainActivity.kt package com.cfsuman.kotlintutorials import android.app.Activity import android.content.Context import android.graphics.* import android.os.Bundle import android.widget.* import java.io.IOException class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // get the widgets reference from XML layout val imageView = findViewById<ImageView>(R.id.imageView) val imageView2 = findViewById<ImageView>(R.id.imageView2) val textView = findViewById<TextView>(R.id.textView) val seekBarRed = findViewById<SeekBar>(R.id.seekBarRed) val seekBarGreen = findViewById<SeekBar>(R.id.seekBarGreen) val seekBarBlue = findViewById<SeekBar>(R.id.seekBarBlue) val tvIntensity = findViewById<TextView>(R.id.tvIntensity) // get the bitmap from asset...

android kotlin - Bitmap blur effect

MainActivity.kt package com.cfsuman.kotlintutorials import android.app.Activity import android.content.Context import android.graphics.* import android.os.Bundle import android.renderscript.* import android.widget.* import java.io.IOException class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // get the widgets reference from XML layout val imageView = findViewById<ImageView>(R.id.imageView) val imageView2 = findViewById<ImageView>(R.id.imageView2) val textView2 = findViewById<TextView>(R.id.textView2) val seekBar = findViewById<SeekBar>(R.id.seekBar) val context = this // get the bitmap from assets folder val bitmap = assetsToBitmap("rose.jpg") val duplicate = assetsToBitmap("rose.jpg") bitmap?.apply { ...

android kotlin - Bitmap sharpen

MainActivity.kt package com.cfsuman.kotlintutorials import android.app.Activity import android.content.Context import android.graphics.* import android.os.Bundle import android.renderscript.Allocation import android.renderscript.Element import android.renderscript.RenderScript import android.renderscript.ScriptIntrinsicConvolve3x3 import android.widget.* import java.io.IOException class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // get the widgets reference from XML layout val imageView = findViewById<ImageView>(R.id.imageView) val imageView2 = findViewById<ImageView>(R.id.imageView2) val context = this // different types of sharpen effect val sharp = floatArrayOf( -0.60f, -0.60f, -0.60f, -0.60f, 5.81f, -0.60f, -0.60f, -0.60f, -0.60f ...

android kotlin - Bitmap black and white effect

MainActivity.kt package com.cfsuman.kotlintutorials import android.app.Activity import android.content.Context import android.graphics.* import android.os.Bundle import android.widget.* import java.io.IOException class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // get the widgets reference from XML layout val imageView = findViewById<ImageView>(R.id.imageView) val imageView2 = findViewById<ImageView>(R.id.imageView2) val textView2 = findViewById<TextView>(R.id.textView2) val seekBar = findViewById<SeekBar>(R.id.seekBar) // get the bitmap from assets folder val bitmap = assetsToBitmap("flower2.jpg") bitmap?.apply { // show original bitmap in first image view imageView.setImageBitmap(this) // default thre...

android kotlin - Bitmap change brightness contrast

MainActivity.kt package com.cfsuman.kotlintutorials import android.app.Activity import android.content.Context import android.graphics.* import android.os.Bundle import android.widget.* import java.io.IOException class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // get the widgets reference from XML layout val imageView = findViewById<ImageView>(R.id.imageView) val imageView2 = findViewById<ImageView>(R.id.imageView2) val textView = findViewById<TextView>(R.id.textView) val seekBarBrightness = findViewById<SeekBar>(R.id.seekBarBrightness) val tvBrightness = findViewById<TextView>(R.id.tvBrightness) val seekBarContrast = findViewById<SeekBar>(R.id.seekBarContrast) val tvContrast = findViewById<TextView>(R.id.tvContrast) // get ...

android kotlin - Bitmap change saturation

MainActivity.kt package com.cfsuman.kotlintutorials import android.app.Activity import android.content.Context import android.graphics.* import android.os.Bundle import android.widget.* import java.io.IOException class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // get the widgets reference from XML layout val imageView = findViewById<ImageView>(R.id.imageView) val imageView2 = findViewById<ImageView>(R.id.imageView2) val textView2 = findViewById<TextView>(R.id.textView2) val seekBar = findViewById<SeekBar>(R.id.seekBar) // get the bitmap from assets folder val bitmap = assetsToBitmap("flower103.jpg") bitmap?.apply { // show original bitmap in first image view imageView.setImageBitmap(this) // initial bi...

android kotlin - Bitmap rotate color axis

MainActivity.kt package com.cfsuman.kotlintutorials import android.app.Activity import android.content.Context import android.graphics.* import android.os.Bundle import android.widget.* import java.io.IOException class MainActivity : Activity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // get the widgets reference from XML layout val imageView = findViewById<ImageView>(R.id.imageView) val imageView2 = findViewById<ImageView>(R.id.imageView2) val textView = findViewById<TextView>(R.id.textView) val textView2 = findViewById<TextView>(R.id.textView2) val seekBar = findViewById<SeekBar>(R.id.seekBar) val radioGroup = findViewById<RadioGroup>(R.id.radioGroup) // get the bitmap from assets folder val bitmap = assetsToBitmap("flower103.jpg") b...