Advertisements:




Copy Pixels From One Bitmap To Another Shaped Like A Circle


I am using setpixel and getpixel functions but they are using matrices which is naturally rectangle. I am trying to copy pixels shaped like circle !

Update :
Now i am using this but i hope there is something more efficient than this one code.


View Full Post With 2 Replies

Related Forum Messages:

Please Follow Index to Quick Jump to the Message.


Unable To Access Pixels Of A Bitmap Image On Droid / Solution For It

In short i am unable to access all the pixels of a bitmap image.

I have used an intent to fire the native camera app and returned a bitmap image to my application activity. The data is definitely a bitmap object and i am able to display, get the height/width etc and access some pixels using getpixel(). However when i use the values of getheight() and getwidth() i get an array out of bounds error. By trail and error i have found i can only access a reduced number of pixels of the image, for example with one image which returned a height and width value of 420, 380, i could also access 200, 100. I then do some image processing and used setpixel() on the original image. When i display the image it shows the, say 200, 100, processing pixels and the rest normal, therefore the pixels are obviously there and accessible by android but not by me. I have to spoken to other people who have also had this problem with images.

Does anyone know anything more about this, reasons? Or a work around?


Posted On: Nov 20 at 15:04 . View Related Posts . . View 2 Replies .

Draw Map From Textfile Onto Bitmap But Bitmap Is All Black

I'm trying to draw a map from a textfile onto a bitmap, but the bitmap is all black

First i load a textfile that looks like this (shortened):

0000000000 (200 width)
0111111110
0111100010
0000111110
0000111000
0000000000
(120 height)

Where "1" is ground and "0" is a wall, 1 should be white and 0 should be black.

Code:.


Posted On: Oct 12 at 16:05 . View Related Posts . . View 1 Replies .

Tile Bitmap - Bitmap As A Background Image In App

I'm trying to load a bitmap in android which i want to tile. I'm currently using the following in my view to display a bitmap: canvas. Drawbitmap(bitmap, srcrect, destrect, null)

I essentially want to use this bitmap as a background image in my app and would like to repeat the bitmap in both the x and y directions.

I've seen the tilemode. Repeat constant for the bitmapshader class but am unsure if this is to do with repeating he actual bitmap or to do with applying a filter to the bitmap.


Posted On: Aug 21 09 at 9:56 . View Related Posts . . View 4 Replies .

Small Circle Sometimes Appears In Center Of Mapview

I'm seeing some strange behavior with mapview. Sometimes when i display the map, i'll get a small circle drawn in the center of the map - it is just stroked black. As soon as i tap anywhere in the map, it disappears. This happens about 20% of the time i display the map. I don't have any overlays or anything like that. Does any one else get this? I'm not sure where this artifact is coming from.

Posted On: Oct 28 2009 . View Related Posts . . View 3 Replies .

Htc Evo 4g - Cut Perfect Circle Right Size - What To Use To Do So

I have an extra screen protector and i wanted to try the cut out a circle the exact size of the camera lense. What can i use to cut a perfect circle the right size? Any suggestions are appreciated. Thanks guys.

Posted On: 07-12-2010, 11:35 AM . View Related Posts . . View 3 Replies .

Samsung Fascinate - Circle Battery With Percent For Rooted Phone

Does anyone know where to get the circle battery with the percent for the rooted fascinate?

Posted On: 11-05-2010, 01:09 AM . View Related Posts . . View 3 Replies .

How To Know In Which Pixels Of A Image User Clicked

I want to draw a image filling the complete screen.
Then when user clicks in any pixel or group of pixels they turn black.
How can i know where the user clicked exactly and how can i turn the touched pixels black?


Posted On: Sep 6 at 18:26 . View Related Posts . . View 1 Replies .

Get Real Width Of Pixels Of A String

The string contains different kinds of characters.

Posted On: Jan 28 . View Related Posts . . View 2 Replies .

Qvga Screen Hides Some Pixels - Solution For This

I have a problem with missing pixels on qvga screen on android (all versions including 2. 2). The original problem was with linearlayout and margin="1px". It was ok on the normal screen but on qvga there was sometimes no space between gui controls, like if margin="0px" and not 1px. So i tried to make the example simple (to be sure that it is not a linearlayout bug), i have just put transparent (height = 10px) and white (height = 1px) images into imageviews into the main screen. 25% of the white images are not shown on the qvga screen. The behaviour on the normal screen is ok. The screenshots are from the emulator but the problem exists on real devices too.

See screenshots on my web page.

Is it an android bug? Can i do anything with it? Note that my original problem was with linearlayout and margin="1px". Is there something like margin="1px_that_is_not_hidden"? (Pt, dp, dip, . Don't seem to be solution


Posted On: Sep 16 at 8:59 . View Related Posts . . View 1 Replies .

Pixels Of Background Image Looks Blurry When Using Its Attribute For Layout / How To Do This

When i am using the background attribute for a layout, the pixels of the background image looks like blurry. I think there must be a resolution problem. For example in api demos there is a module in this path graphics/bitmapspixels. My background image is looks like a third image. I would need to show my background image like the second one. How to do this?

Posted On: May 12 at 12:38 . View Related Posts . . View 1 Replies .

New Sdcard With Copy Of Old One

I have bought a new, larger sdcard for my n1. I want to copy the contents of my old sdcard to the new sdcard, and then start using the new one. I want to make sure i understand the best way to do this, before i dive in.

Does this procedure look reasonable? .

1.connect my computer to my n1 via usb and mount the sdcard.
2.copy the entire contents of my sdcard to an empty directory on my computer.
3. Dismount the n1.
4. Shut down the n1 and install the new sdcard.
5. Restart the n1 and go through any sdcard initialization.
6.connect my computer to my n1 via usb and mount the sdcard.
7. Delete everything on the mounted sdcard.
8.copy the old sdcard contents back onto the new sdcard.
9. Dismount the n1 from my computer and then and restart it.

Will that do the job? Or do i have to perform the copy by mounting each sdcard to my computer via an external sdcard drive ("external" meaning not the n1)?


Posted On: 2011-02-19 . View Related Posts . . View 4 Replies .

How To Copy Draw-able Object

So i have two instances of progressbar but applying a colorfilter of one will affect the other, how do i copy this drawable object? Any ideas?

Posted On: Dec 15 2009 . View Related Posts . . View 2 Replies .

How To Copy / Paste From Gmail?

Is there a way to copy and paste from a gmail message?

Posted On: January 7th 2012 . View Related Posts . . View 2 Replies .

Copy Android.r.layout To My Project

I'm trying to copy android. R. Layout to my project to ensure consistency.

How do you do this?

I looked in eclipse's package explorer and under
Android 1. 5>android. Jar>android>r. Class>r>layout and find r$layout. Class.

Do i copy the code out of there into my own class? From my very limited knowledge of java, the following code doesn't make much sense:

Code:.

Inner classes:

Code:.


Posted On: Apr 1 at 20:32 . View Related Posts . . View 2 Replies .

Copy And Paste Function Or App

I can't figure out how to copy n paste names and numbers n stuff like that, its really frustrating for me to go back n forth between apps just so that i can remember a name or something. Is there an app? Or is there a function built in.

Posted On: 2009-01-26 . View Related Posts . . View 8 Replies .

Get Bitmap From An Uri

How to get bitmap object from an uri (i suppose i succeed to store it in /data/data/myfolder/myimage.png or file///data/data/myfolder/myimage.png i used both path) to use it in my application. But i failed to get it.

Posted On: Oct 7 at 8:43 . View Related Posts . . View 1 Replies .

Button Over Bitmap

I am a beginner android developer and i am trying to have a button display on top of the bitmaps i am outputting.

Here is what i have:

My activity sets this:

Code:.

Main.xml is framelayout that i stuck a button on top of, that's it.

I guess my question is, how do i insert something into the main.xml as a "canvas" in order to paste my bitmaps to, but still have the button always on top regardless of how many bitmaps i draw?


Posted On: Oct 1 at 13:32 . View Related Posts . . View 1 Replies .

Motorola Droid - Copy All Content From One Sd Card To Other

So i want to move everything from my current 16gb sd card to my new 32gb sd card.

Is it as simple as copying all content from one to the other?
Can this be done with the phone on and connected to the computer?


Posted On: 07-21-2010, 02:43 PM . View Related Posts . . View 10 Replies .

Motorola Droid X - Get Copy Of Backupassistant.apk

Can someone point me in the right direction to get a copy of this file? It was removed in tranquility and i need it back on my phone. I can't seem to find it anywhere.

Posted On: 09-28-2010, 09:05 PM . View Related Posts . . View 2 Replies .

Htc V Galaxy - Copy Sms To Email

Can you copy an sms to email, ie when you get an sms can you copy it to an email account and paste it to forward it on.

Posted On: 2011-02-27 . View Related Posts . . View 1 Replies .

G1 Error - Cannot Copy - Usb Device Problem

I am trying to copy some music on to my g1, (connected to the computer through usb). But every time i try adding anything i get the following error: "cannot copy 14: the disk is write-protected. Remove the write-protection or use another disk. " Does any one have any ideas on how to fix this? Also its not letting me delete anything either.

Posted On: 2008-10-29 . View Related Posts . . View 56 Replies .

Can I Copy Everything To Pc And Back To Phone After Installing New Sd Card ?

I just picked up 2 16 gig cards and want to use one. Can i copy everything to my pc and install the new card, and copy everything back to it? I dont have a sd card reader. Not bad, picked up 2 16 gig cards locally for 15 for both!

Posted On: January 9th 2010 . View Related Posts . . View 3 Replies .

Can't Copy / Move Anything Using Samsung Galaxy S2 (international)

What i want to do is just simple plug my mobile into my pc via the usb and for the phone to be recognized as a disk drive so i can quickly copy/move stuff but when it's plugged in and recognized. I can't copy/move anything, it says the phone is in use. I factory reset and it still didn't work, the only way i can do it is if i connect via kies then download it which seems a bit long and winding when i'm trying to do something quick.

Also i have problems with scrolling and pinch and zoom, on several sites i'm getting transparency in the background, it's going back anyway as it's only a day old but i would really like to know about it not being recognized as a disk drive.


Posted On: January 23rd 2012 . View Related Posts . . View 6 Replies .

Copypixelsfrombuffer() To Particular Bitmap Offset

I am working on an android application that deals with graphical operations in native code on a shared memory buffer. I have made functions to call my native code from java using jni, and my native code uses the jni api to call java from native code. Since copying large arrays of pixels has a significant effect on performance, i need to avoid it as much as possible.

The android documentation for the bitmap class talks of two ways for copying pixels onto the bitmap internal buffer: http://developer.android.com/reference/android/graphics/bitmap.html

Setpixels(int[] pixels, int offset, int stride, int x, int y, int width, int height) replace pixels in the bitmap with the colors in the array.copypixelsfrombuffer(buffer src) copy the pixels from the buffer, beginning at the current position, overwriting the bitmap's pixels.

The problem with the api documentation is that it is very vague about what is happening behind the scenes when you use those functions. However, it is mentioned somewhere that copypixelsfrombuffer() copies pixels directly without any internal color format conversion, as opposed to setpixels() which will in all case do that conversion even if the original pixels are in the target pixel format. Obviously, that is not something i want, since the pixels in my buffer are in the good format already.

Now, copypixelsfrombuffer() looks very nice since it won't do that conversion, but the documentation does not talk of how to copy pixels from a buffer to a particular offset in the target bitmap. Oops, that is something very important, since i don't want to copy the entire buffer every time, but only a region on it. Yes, the documentation says that it is going to copy from the current position in the source buffer but nothing is said about the destination buffer. Setpixels() does the unnecessary conversion, but allows you to specify an offset in the destination buffer.

So, i am stuck between:

Copying only the region that i want at the cost of having pixel conversion

Or

Avoiding pixel conversion at the cost of copying the entire buffer every time

To get an idea, i may have a buffer representing a 1024x768 screen, with an invalid region that goes from (300, 300) to (400, 400).

If i copy only the region i need to update, i can copy and convert 100*100 pixels or copy without converting 1024*768 pixels. A 100x100 invalid region is small and only a particular case, most invalid regions would take a much larger portion of the buffer. Both methods have very negative effects on performance.

Does anybody have an idea on how i could copy pixels from my buffer to a particular offset on the target buffer, without forced pixel conversion? That would be the best of both worlds, and i don't see why it does not appear to be available.


Posted On: Nov 4 at 18:33 . View Related Posts . . View 1 Replies .

How To Convert A Drawable To Bitmap

How can i convert a drawable to a bitmap?
I would like to set a certain drawable as the device's wallpaper, but all wallpaper functions accept bitmaps only (i cannot use wallpapermanager - i'm pre 2. 1).
Also, my drawables are downloaded from the web and do not reside in r. Drawable.


Posted On: Jun 14 at 7:46 . View Related Posts . . View 2 Replies .

Bitmap Allocation Weirdness

I'm having some trouble understanding why this code:

Code:.


Posted On: Aug 24 . View Related Posts . . View 7 Replies .

Merge Bitmap Overtop Of Another

Ok so i have sort of a picture frame type bitmap and a picture bitmap so think of it like this i have a 64x64 frame image where (5, 6) to like (56, 54) is where the picture should be, how can i merge the picture bitmap into the frame bitmap with those bounds and make it one bitmap? Ive been searching everywhere to no avail.

Posted On: Jul 13 . View Related Posts . . View 2 Replies .

Bitmap Encoding Is Always Lossy

I have a case where i need to retrieve the bitmap from an imageview and write that bitmap to a file so that i can later on retrieve it back again and set it on a new imageview. I do this using bitmap.compress() method. However, the problem is that after i do this about 5 times, the quality of the bitmap degenerates badly. The format i use for the bitmap.compress() is jpeg with the quality as 100. In my mind 100 would mean no compression of the source bitmap and that the bitmap should be lossless, but it doesnt seem to be that way. Is this a bug or is this how it is meant to be?

I want a lossless compression and i tried to use png as the format with bitmap.compress() but that doesnt seem to work either. After digging around i found out that png encoding is not supported, which basically leads me to believe there is no way of storing (in a lossless way) a bitmap isnt that weird? How else can i achieve this lossless writing of bitmap to the file. Why doesn the bitmap class simply have an encode() method to write the bitmap in memory as is?


Posted On: Jun 12 2009 . View Related Posts . . View 4 Replies .

Overlaying Text On Bitmap

I'd like to know if there is a way to get bitmaps corresponding to a glyph of a font. I have a bitmap and was looking for an api that would let me overlay some text on top of it and give me the output bitmap. I could not find any such api so was thinking of doing a custom implementation.

The issue is that i couldn't find a way to get the bitmaps corresponding to the glyphs either. Is there api that i may have overlooked or some round about way to achieve this?


Posted On: Aug 14 2009 . View Related Posts . . View 2 Replies .