Erase Only Color Not Bitmap in Canvas - android

Drawing App
when i put bitmap background on view i fill the color using finger and i select the erase button that will be also remove color and car image what should i do please help me i only remove color not bitmap image from the background
See the image]1

Add two views one for background and one for color so if you erase in one view it will not affect the below view

Related

How to replace color by another on ImageView in Android?

I would like to change (map) white color to blue color. How can I do this on ImageView in Android? I tried setColorFilter by PorterDuff / LightingColorFilter / ColorMatrixColorFilter but I can't figure out how to set it up. There is a transparent background around the image.
Try to use Background Tint color function in xml or java code.
or
I would suggest another way. Take on frame layout and place view and then image view.
white portion in image should be transparent use PNG image.
and you can give color to base view color which ever you want.

Android - move drawable with animation

I'm new to Android and need advice. I have a GridLayout with multiple ImageViews. Each ImageView has a drawable and a background color. On button click, I want to animate two things, depending on user's input: 1) move the entire view to a new position (this part is clear and doesn't cause problems), and 2) move only the image's drawable to a new cell, leaving the view with the background color at the original position. I'm completely stuck on this second task. How do I move drawables using animation? Thanks for any help.
move only the image's drawable to a new cell, leaving the view with the background color at the original position
I think you can't "move a drawable". But you can do the following:
introduce a View - let's call it movingDrawableView - showing just the drawable but with a transparent background, this View is hidden at first
Set the position of this movingDrawableView to overlap the View with the drawable and the colored background and make it visible
Set the drawable of the View with the colored background to null
start the animation for movingDrawableView
as soon as the animation is finished, fill the underlying View with the drawable and show a background as required
hide movingDrawableView

Dynamically change UI color according to image in android xamarin

I am building a music player in xamarin android, now i want to change the UI color of music player automatically according to mp3 thumbnail.
We want to change the purple layout color present at the bottom to the one present in the thumbnail i.e. orange color
Can anyone please help..
1)First you need to fetch color of that thumbnail image.
// Create a Bitmap object from an image file.
Bitmap myBitmap = new Bitmap("Grapes.jpg");
// Get the color of a pixel within myBitmap.
Color pixelColor = myBitmap.GetPixel(x, y);
2) so now you have your color you can simply set it to your view.
by using
view.SetBackgroundColor(pixelColor);
where view is your layout or button or any other view.
hope this helps..

Android FingerPaint SDK sample use as text/image highlighter

What I want to archive is, highlight a text or an image as we do in PDF or any other doc editor.
What I am doing is, in my xml layout I have added a TextView, ImageView, WebView in an RelativeLayout and depending on the type of the contents to be displayed, I change the visibility of the one, for example if I have an image to display then I set the image Path to ImageView and set it is as visible and others as invisible.
For drawing highlight, I am trying to use Android SDK demo FingerPaint.
On Top of all these views I have MyView, which draws the highlight, which is from FingerPaint SDK demo, I have made the canvas transparent so I am able to see widgets below MyView.
Questions that I have:
I am not able to get what is the use of mCanvas = new
Canvas(mBitmap); in onSizeChanged method, as mCanvas is not added to view, when I remove it then old lines that i draw does not display on the screen.
How to change the line size and make color of the line semi transparent, so that view below MyView is visible from the line.
How to draw only straight lines (Vertical/Horizontal).

Replace TRANSPARENT part of image set in imageview with another image?

How to change TRANSPARENT part of image set in imageview with another image?
Below is the main image, there is TRANSPARENT portion(here looks white), i want to set another image withing that portion of image.
any idea how to do it?
Question:
How to find TRANSPARENT portion starting point LEFT(x,y), RIGHT (x,y), BOTTOM LEFT (x,y), BOTTOM RIGHT(x,y) ? for image replacement.
How to process bitmap in runtime to add another image to make changes in imageview?
I've tried this to find transparent part of image.
You have a bitmap (B1) and there is only one rectangle transparent zone somewhere. And you want to place another bitmap (B2) inside it.
use monte-carlo method to find any transparent pixel on B1. You know
it's coordinates now.
go [left/right/top/bottom] from transparent pixel and find
first solid pixel. Now you know transparent rectangle coorditates.
There are several ways to put something inside transparent area. You can:
place second imageview (with B2) under the first one (with B1). Set B2 padding inside imageview accordingly transparent zone coordinates.
create new image from B1 and B2 and set it to imageview.
do it some other way...
try this example in this crop image with transparent part it will use full for you.
https://github.com/ketanpatel25/Image-Cropping-In-Transparent-Area

Categories

Resources