Android :: Draw A Scalable Rectangle - Should Change Colours On Input - Around A Bitmap

Feb 9, 2010

To draw a scalable rectangle around a bitmap

And such that

1) The rectangle should scale based on the size of my bitmap

2) The colour of my rectangle should change on my input

Android :: Draw a scalable rectangle - Should change colours on input - around a bitmap


Android :: Draw A Scalable Rectangle?

Feb 9, 2010

How to draw a scalable rectangle around a bitmap And such that

1) The rectangle should scale based on the size of my bitmap.

2) The colour of my rectangle should change on my input.

View 2 Replies View Related

Android :: Draw Transparent Lines On Bitmap Via Touch Input

Jul 23, 2010

I am working on a paint application for Android. Now I want to implement an eraser to allow erasing parts of a loaded bitmap by using touch input and making the bitmap transparent along the finger's path.

A very good example of what I try to achieve is shown in the application Steamy Window for Android. Steamy Window simulates a fogged window, where a user can wipe parts of the fog via touch input.

UPDATE: I have posted the most important sections of my current code below. I am not really happy with it for the following reasons:

Drawing is quite sluggish. What can I improve here?
I am looking for a way to use an alpha mask in order to set the pixel transparency/alpha of the pixels as I want to simulate a paint brush. Any suggestions how this could be achieved?

CODE:...................

View 1 Replies View Related

Android :: Draw Text In Rectangle?

Aug 4, 2009

I have just started looking at developing for Google Android and want to draw a rectangle with some text in it that I then want to position where i want on screen. I have got as far as drawing a rectangle on screen using a ShapeDrawable and RectShape I now want to put some text in the rectangle. How can I best do this? Should I be looking at somehow adding a textView to the RectShape? Or am i going down the the wrong avenue completely?

View 3 Replies View Related

Android :: Draw Text As Big As Possible Inside Rectangle?

Apr 11, 2009

Is there any convenient method to draw a string (custom true type font) as big is possible inside a supplied rectangle or to calculate the font size of a paint object based on a string and some rectangle dimensions.

View 3 Replies View Related

Android :: Draw Rectangle And Put Some Text Inside?

Jul 24, 2010

i have an activity and in the activity i have some buttons and textviews, and i would like to draw a rectangle with text inside. i saw some examples online but the all say to create my on view , override onDraw and the set this view as my layout, but i have my layout already.

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

TextView baramzona = (TextView) findViewById(R.id.TextView01);
baramzona.setText(R.string.baram_zona_textview);
final Button pocniparking = (Button) findViewById(R.id.ButtonStart);
final TextView momentalnazona = (TextView) findViewById(R.id.TextView02);

//momentalnazona.setText("Моментално се наоѓате во зоната");
pocniparking.setText(R.string.btn_Start_Parking);
pocniparking.setEnabled(false);
}
}

View 1 Replies View Related

Android :: Create Mutable Bitmap From Camera - Draw Another Bitmap On Top - And Save It

Apr 2, 2009

I am 1) taking a picture and 2) then draw another Bitmap on top of it 3) then I store it

I am doing it as follows and it works on the emulator.

On the device I get a OutOfMemoryError: bitmap size exceeds VM budget android.graphics.Bitmap.nativeCopy(Native Method) android.graphics.Bitmap.copy(Bitmap.java:199) in the line copy the Bitmap to get a mutable Bitmap.

CODE:...........

What I am asking:

a) Is there a better way to do what I am doing? 1) take a picture 2) draw another Bitmap on top of it 3) then I store it

b) What is the best way to create a mutable Bitmap from the picture I just took with the camera?

In my app, resolution is not an issue. If it works better for small photos that would be fine.

View 3 Replies View Related

Android :: Overlay Bitmap - Draw Over A Bitmap

Oct 8, 2009

I have two questions actually:

Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise... which one is better?

If I want to draw something transparent over a bitmap, how would I go about doing it?

If I want to overlay one transparent bitmap over another, how would I do it?

View 1 Replies View Related

Android :: Draw A Bitmap Rotated Onto Another Bitmap

Mar 22, 2009

My goal is the draw a bitmap onto another bitmap but rotated 90 degress. whats the most efficient way to do that. My current method is as follows which is horribly bad because it creates a new bitmap every time.

CODE:.....................

View 4 Replies View Related

Android :: Draw Shape Or Bitmap Into Another Bitmap - Java - Android

Jun 22, 2010

I want to draw a shape(many circles particularly) into a Specific Bitmap. I have never used canvas / 2D graphs etc. As i see it i create a Drawable put the bitmap in it then "canvas-it" to the shapes i want etc.

View 1 Replies View Related

Android :: Draw On Bitmap

Nov 11, 2010

I'm trying to figure out how to draw on a bitmap in android, and keep a copy of these changed bitmaps for an undo function.

Bitmap b = ...
Paint p = new Paint();
canvas.drawBitmap(b, new Matrix(), null);
canvas.drawCircle(0,0,20,20);
//does Bitmap b have the circle drawn on it next time?

Or how do I get the bitmap after its been drawn on with the canvas(I want to preserve a stack of bitmaps with the changes applied by canvas drawing)? Maybe I'm going about this entirely wrong.

View 1 Replies View Related

Android :: Draw Text On A Bitmap

Jun 14, 2009

Can i draw text on a bitmap? I cannot find any API support this.

View 4 Replies View Related

Android :: Draw GLSurfaceView To A Bitmap

Nov 4, 2009

I have an application that uses GLSurfaceView to draw OpenGL ES graphics. This is all working (mostly) how I would expect.

Now, I would like to implement a screenshot feature. For normal views, it seems that the standard practice is to create a new Canvas with a Bitmap and then draw to that Canvas using View.onDraw(Canvas).

I've tried using SurfaceView.draw(Canvas) in a similar fashion, but it always results in a blank (black) image.

I've also tried using the drawing cache with the exact same result.

View 3 Replies View Related

Android :: Draw A Bitmap Image?

Dec 2, 2009

Any one know about how to draw a bitmap image?...

View 6 Replies View Related

Android :: Draw Bitmap On Overlay

Nov 12, 2009

I've been trying almost everything and been searching and reading everywhere on the net. I just can't seem to find the correct way of doing this.

I have a MapActivity with a MapView and I want to draw something on an Overlay. I'm overwriting the draw-method, and I can easily draw straight on the canvas using a paint. My problem is I want to merge some circles and afterwards color them. Therefore I want to create a Bitmap and then draw on that. I just don't know what to use. Should I use a mutable Bitmap, a BitmapDrawable or am I simply going in the wrong direction.

The reason I want to do this is because I want to draw some kind of heatmap upon the Google Maps, and I need to merge and blend different circles, so they appear to be just one big blob.

View 6 Replies View Related

Android :: Draw A Piece Of Bitmap

Mar 9, 2009

I'm creating a simple game for Android and faced with a problem: Idea is to have a huge "map" image file and re-draw only small part of it (320*480) depending on user actions.

I didn't find a better solution than using "public static Bitmap createBitmap (Bitmap source, int x, int y, int width, int height)" method and decided to try it (expected huge performance degradation), but actually it's appeared that this method changes source bitmap and when i call it second time source size is significantly reduced. For instance this code:

CODE:.................

View 4 Replies View Related

Android :: Draw A Bitmap - Using OpenGL

Aug 30, 2010

I have a byte array of RGB values, just like the contents(without header) of a *.bmp file. What I want to do is, draw the corresponding bitmap on Android, using OpenGL.

It seems that OpenGL ES doesn't have a single API that will do, it true?

If true, how can I do this?

Actually, I can draw it in JAVA code, but it's too slow and costs too much CPU time. So I want to try drawing it with OpenGL. Is there any other advises? Or maybe OpenGL can't be the right answer?

View 2 Replies View Related

Android :: Draw Bitmap Fastest Mode

Dec 25, 2009

What 's the fastest way to display a bitmap? Now I am using Bitmap.setPixels and ImageView.setImageBitmap all time that this change. It has a refresh of 15 fps. It work good, but I am not sure that is the best method to get best performance. Is better use Canvas.drawBitmap with a SurfaceView ? or opengl ?

View 3 Replies View Related

Android :: Draw A Circular Region Of A Bitmap

Mar 26, 2009

In my Java code I am setting the content of an ImageView to a Bitmap. However, before doing so I want to clip the Bitmap to a circular region. How would I go about this? I've been looking for some API that would let me set the alpha channel of the Bitmap to fully transparent for all pixels outside the circular region.

View 4 Replies View Related

Android :: Draw A Bitmap By Specifying The X Y Locations Of Four Corners

Mar 1, 2010

I want to draw a bitmap on the screen by specifying the x,y locations of the four corners. I.e. I have a square bitmap and I would like to draw the:

CODE:.........

I have seen the Canvas method: public void drawBitmap (Bitmap bitmap, Rect src, RectF dst, Paint paint)

However I believe this takes the top, right, bottom and left coordinates to draw the Bitmap and not the corner coordinates. I need to specify the CORNER coordinates to draw the bitmap as I may need to stretch/distort the Bitmap (I am drawing the Bitmap on a 3D spherical model).

View 9 Replies View Related

Android :: Draw Inflated Layout Xml On An Bitmap

Aug 6, 2009

I created a layout xml file that contains an extended textview. What I want is to draw the textview in a bitmap. What do I have to do after inflating the view so that I can use the draw method on the my canvas?

View 2 Replies View Related

Android :: Draw A Spot In The Bitmap Image

Oct 12, 2010

Hints to draw a spot(small filled circle) on a bitmap image.

View 1 Replies View Related

Android :: Cannot Create New Map View To Draw To Off Screen Bitmap

Oct 29, 2010

I'm trying to create a MapView in a service (live wallpaper), but have it hidden so that I can render it to a Bitmap, and then map it to a texture to render in opengl. I have a Canvas and a Bitmap, and I intended to call myMap.draw(myCanvas) in order to get it into the correct bitmap so that I could then bind it as a texture.

When I Initialize I do the following:
myMap = new MapView(ctx, APPSTATICS.MAP_API_KEY);
I get an error:
java.lang.RuntimeException: stub at com.google.android.maps.MapView.<init> (Unknown Source)
Why I can't create a new mapview which I can use to draw to a offscreen bitmap?

View 7 Replies View Related

Android :: DrawBitmapMesh - Draw A Bitmap Transformed To Fit Shape

Jul 2, 2010

I want to draw a bitmap into a shape (in this case an isosceles trapezoid); not clipped, but with the bitmap transformed to fit the shape. For example, if the height of the left side is greater than that of the right side then I want the bitmap evenly transformed in height from left to right to match the height difference. The only method I can find to do this is drawBitmapMesh, however this produces some strange results. I have searched extensively and can find no concrete information on drawBitmapMesh.

To demonstrate the example, I have a bitmap which contains an even grid of vertical and horizontal lines. I use bitmap mesh with the code shown below. However, the horizontal lines of the grid do not evenly merge downwards from the top and upwards from the bottom towards the target. Rather, horizontal lines to the left of the line dissecting the top-left to bottom-right diagonal of the shape slant downwards to the left, lines to the right of the same diagonal slant downwards to the right. I also note that that the top line of the bitmap increases slightly in height from left before descending again to the right.

Perhaps drawBitmapMesh is not the method I should be using, or perhaps I am using it incorrectly.

CODE:...................

View 2 Replies View Related

Android :: Load And Draw Partially A Bitmap From File

Sep 13, 2010

I have a somewhat large (i.e. not fit in most phones' memory) bitmap on disk. I want to draw only parts of it on the screen in a way that isn't scaled (i.e. inSampleSize == 1)

Is there a way to load/draw just the part I want given a Rect specifying the area without loading the entire bitmap content?

View 2 Replies View Related

General :: How To Change Colours On Android

Mar 22, 2013

I would like to know how I can change colours on my Android... Just like the blueish thing on the top bar, I can't stand it... Can't I just change it to white or else???

Why is'nt there any options to change that... I mean it's not a big ask is it

View 3 Replies View Related

Android :: Draw RTL Text - Arabic - Onto Bitmap And Have Ordered Properly

Sep 13, 2009

I'm trying to draw Arabic text onto a Bitmap for display:

CODE:...........

However, the bitmap that is generated looks like this:

When it should look like............

I believe the issue is because, unlike a TextView, the Bitmap class is not BiDi aware, so it draws the letters from left to write.

Try as I might, I can't figure out how to draw the text in the correct order.

View 2 Replies View Related

Android :: Bitmap.Config.ARGB 4444 Slow To Draw

May 18, 2009

I'm doing performance tweaks for my new game and I seem to have come across something that isn't discussed much but I think is strange.

I have a static background bitmap loaded as RGB_565 and it draws lightning fast to the SurfaceView.

I then have all of the dynamic stuff, one of which is a full view width/height bitmap and all of these things need transparency so they are ARGB_8888. I thought that switching to ARGB_4444 for everything would speed up drawing because that's half the number of bytes to process but what I'm finding is that under no circumstances is 2D drawing any faster with ARGB_4444. All my tests are showing that it's actually twice as slow to draw an ARGB_4444 bitmap than a ARGB_8888 one on to the default RGB_565 surface!

Would any engineers care to enlighten me as to why this is? Is ARGB_8888 the fastest way to draw bitmaps with transparency?

My target platform is 1.0, btw. My friend just got a new phone and out of the box it was 1.0, not even 1.1, so I want to make sure this works as a first app on new phones. If there are 1.5-specific tweaks, I will incorporate them in a few months but for now it's gotta run well on 1.0.

View 2 Replies View Related

Android :: Draw And Scale A Bitmap On A Canvas Using Bicubic Interpolation

Mar 25, 2010

I want to draw a bitmap on a canvas with bigger size than it is. I can use canvas.drawBitmap(bitmap, null, destRect, null); but that gives a poor quality, as the result is pixelated, if the source image is sightly smaller than the destination rectangle. How can i draw my bitmap using bilinear or bicubic resampling?

View 1 Replies View Related

Android :: Sample Code To Draw A Circular Gradient Mask On Bitmap In Droid?

Nov 11, 2010

Is there a way to draw a circular gradient mask on a bitmap in Android? Trying to produce something similar to a foggy window. Click the window and a transparent circle shows up revealing whats behind the window. Prefferably using a gradient so the center of the circle is completely transparent and the further out from the center the less transparent. Is this possible?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved