I want to make application like this in android . I had made applications using Canvas but how to make application like this ?
https://play.google.com/store/apps/details?id=photo.text.typography
Thats not very specific.
You do exactly that just by using a canvas.
The Processing is done in the background, and then they just display the image on the canvas.
And this app looks like they are just overlaying the original image with a preset alpha image. Not even really processing much.
Related
Can I upload a picture (in a ImageView) and draw rectangles using the canvas in the same ImageView? all the examples I've seen so far used two. I wonder if you can use only one? if so, how?
If you are new to android.
Open android studio, .
File ->New->import Sample ,
search for image.
Choose basic render script, this will give you basics of image handling.
However for your usage, you can simply create a view with border and add imageview inside it.
I'm currently able to blur a whole bitmap (by resizing it down than up for example).
The effect I'm trying to accomplish is a selective blur : the result bitmap would be blurred, minus a round / oval part of it which would still be sharp :
The difficult part is that the sharp oval part could be smaller or bigger, and should be movable (its coordinates aren't always the center of the original bitmap).
I already found a solution, but I don't think of it as a good performance wise solution :
Copy the original bitmap into two different bitmaps (background and foreground)
Blur the background one
Crop the foreground one into the desired shape (round or oval)
Erase the borders of the foreground a bit (to avoid a too sharp difference between foreground and background images)
Put back the two images together
Export it as a bitmap
One another solution could be to recreate a blur algorithm which would run through every pixel of the original bitmap and apply an amount of blur higher or lower depending on the portion of the bitmap.
I finally decided to follow my first idea, using #DerGolem links. Here is the updated version of the chart :
The algorithm is quite simple:
We create two copies of the bitmap : the first one will serve as the background, while the other one will be used as the sharp part of the picture. To avoid the second one to be too sharp, we'll use a prepared mask (stored in the drawables folder)
We blur the first one as much as we want
We apply the mask to the second bitmap
We create a bitmap from those two previous steps
I created a sample demo application, hosted on BitBucket. You can clone the project and try it, the performances are much better than what I expected!
In order to achieve this, I used the following resources:
RenderScript to blur the background, much better than resizing the image down and up : 1, 2
Understand Porter/Duff
As said in the project's readme, the provided code is far from being perfect, but it works.
I have two situations/projects where I have to use a large bitmap as background activity.
The first project ports a WP7 application to Android! The WP7 app is using a panorama control with a bitmap as large as 3 screens. I would like to reuse the large bitmap similar in a way that I use the left part for the first activity, the middle part for the second activity and the right part for the third activity. In other words I would like to define which part to crop.
In the second project we try to develop an app which should run on various screen sizes (including tablet), the app should also use a background image. Is it a good idea to provide only one picture with a quadratic size (as long as the largest screen width) and use this picture through every resolution and just crop the background image depending on the actual size of the display?
Is it possible to crop pictures on Android?
Is it possible to define the part of the picture which is kept?
Is it possible to use this croped pictures as background image or may I encounter performance penalties?
What do you think of this technique? Is it a good idea?
Thanks for your help!
answering your questions:
yes it is possible to crop pictures in Android (I've done so)
you can define wich part of the picture is shown in each activity
with a canvas and only drawing the rect that corresponds to the part
of the image that you want to display (eventough I wouldnt suggest
the approach of having diferent activities with the "same" content)
yes, you can use cropped pictures as background image for whatever
you want. Once you cropped the image use that bitmap and save it in
the device and then you might use it as you wish, and eventought is not recommended to have the whole image as background you can do so.
I suggest that you use a SurfaceView since you will be able to move it (the image) all around the screen without having to create a new activity. Here is a good tutorial to SurfaceView Playing with graphics in Android – Part I and this approach will also work with Tablets.
I want to produce moving effect in the background image of Android Live Wallpaper it seems like moving corresponding to other images ,i am using a single image (NOTE: It's not moving cause of user swap so can't use onOffsetChanged()). Can anyone Provide me with some code or anything.
I have an image that is circular and I want to make the other junk in the image to be transparent. I've spent the last hour looking around and I can't seem to figure out how this is done for android. Any help is greatly appreciated!
I haven't worked with Android but on iOS pngs weren't loading for me when I made them in photoshop but when I made them in flash all of a sudden they would work! Try that first :)
Anyways, you want to google something along the line of "pixel arrays android code" you can create an array of each pixel, find an individual color, then make it transparent...
But I really think this is just a GIMP issue and you don't need to go through all of that hassle.
what i can understand from your uncleared words is that you want to display transparent image of a normal image you have . so i would suggest don't do it through programming . create a transparent image through any image editor tool and use it .
if image is dynamic that you cant go in this way so use Matrix and setAlpha . search over net for both the terms