Using an example found here:
http://www.vogella.com/tutorials/AndroidTouch/article.html I'm able to draw a path every time a finger touches the screen and that works great, Is there any way that I can capture that drawn path and reproduce it in another view in other coordinates? Like capturing the full drawn image and reproducing it scaled in a segment of the other view?
Sorry for my bad english
You can save your drawn image and save it as a bitmap. Then you can scale it with Matrix or Canvas and redraw it by calling to where you want to draw
Related
First of all I'm sorry for my English language because it is not perfect.
This is my code to moving, zooming image:
http://www.mediafire.com/view/6572cu99v9942xd/SandboxView.java
I want to rotate image also with that point called x=250 and y=200, How can I do that with saving zoom and move image?
call Canvas.concat(Matrix) before drawing anything on the canvas
I am using the Multitouch Controller made by Luke Hutchison found here
https://code.google.com/p/android-multitouch-controller/
My problem is this. I can place an image onto the canvas. I can select it, move it, rotate it and scale it perfectly fine. The problem is I also allow the user to move the canvas by translating it on drag. On the screen the images seem to appear in the correct location following the translation of the entire canvas. The problem is trying to select them afterwards.
I don't know if it's an issue with the touch point after the canvas translation not taking into account the new canvas location/offset or the location of the images haven't been updated with the canvas translation. Does anyone have any experience with this or be able to point me in the right direction!?
Fellow Programmers,
I am new to android and I am trying to draw on a image based on giving the x and y axis of the image as the input.So that he pixel value corresponding to the coordinate gets filled with a color that I mention. Say Red color for now.
User Story: Render a image through image view and on a button click I need to pass the co-ordinate value for the image that represents the pixel of the image and fill it with red color. Keep on doing it looks like drawing on the image that I render using image view.
Is this user story is possible to do in Android? If then help me on this. I referred the draw class and canvas class and not sure how to implement.
Looking forward to ur help on developing this user story on android application.
Best,
Googler
Take a blank canvas.
Draw your image on the canvas.
Draw points on the canvas by specifying x and y co-ordinates and red color in paint.
I need to move a bitmap image on a path drawn in background of my layout, it can be also a movement of the bitmap inside another bitmap. The movement is caused by smartphone's accelerometer. Any suggestion?
Shortest answer ever - 'Use OpenGL, Luke'
You can also use one of OGL frameworks i.e. AndEngine.
I want to get a bitmap and manipulate it in the following way:
I have created an empty bitmap, on this bitmap, I drew what I needed. Now I need to distorted in a way similar to this because I will then be drawing the whole thing ontop of another bitmap. Think of it as applying a texture to a box. The box simply being a picture of a box. The way that I see myself doing this is creating bitmaps off the main bitmap and drawing them onto the final bitmap through a matrix modified by Graphics.Camera.getMatrix().
I already have this working, but my problem is understanding just exactly how to manipulate the camera. I don't know where the camera creates its X Y and Z axis within the matrix. Or where does the matrix get applied. Or just how it all comes together.
When drawing on canvas set to view, I know I can rotate the canvas and draw from there to create a straight diagonal line, for example in a game engine to draw a projectile acting on two vectors. And I know when working on OpenGL, there is a state machine approach and I can imagine where the matrix is in 3D space. But I just don't understand how Camera, Matrix, and bitmap all relate.
From what I've looked up, I managed to set up the basic solution to this but havent been able to understand just exactly how to tweak this in order to get the right rotations. I have read the documentation but it doesn't really explain the relationship between Camera, Matrix, and canvas beyond the fact that Camera modifies a matrix and then canvas can draw something based on that matrix.
Can anyone explain how I would go about doing what I have in the picture? I already know that I'll be creating a bitmap from region in original bitmap. Then combining the two, to create what is on the right column , and then rotating the canvas/bitmap and getting another bitmap from green section and repeat the whole thing again.
Thanks
Camera is just a utility class that generates a Matrix you can use on Canvas. The generated Matrix contains the appropriate transform. You said it yourself:
it doesn't really explain the relationship between Camera, Matrix, and
canvas beyond the fact that Camera modifies a matrix and then canvas
can draw something based on that matrix.
That's all there is to it really :)