[Q] Android 1.6 saving PNG bitmap doesn't maintain alpha component - General Questions and Answers

Hello all,
So I have searched many api libraries and tried many different ways to save, but I cant seem to keep the alpha channel for an image.
So here is the problem
Step 1: Load an image that is some file type ... say rgb 565..., and convert that to argb 8888. This works great, and the bitmap's hasAlpha flag is true, and I tested it and was able to write to alpha, and read it properly.
Step 2: Save the converted image to a file using something like this:
Code:
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
Where out is my FileOutputStream.
Step 3: Once saved I try to load that file again using:
Code:
bitmap = BitmapFactory.decodeFile(bmapFileName, bfo);
Where bfo is my BitmapFactory.Options, which has no prefferedConfig or whatnot.
At each step i print bitmap.getConfig() and bitmap.hasAlpha()
Prints:
Step 1 -> bitmap.getConfig() = rgb565 (or whateverfiletype), hasAlpha = false
Step 2 -> bitmap.getConfig() = argb8888 (or whateverfiletype), hasAlpha = true
Step 3 -> bitmap.getConfig() = argb8888 (or whateverfiletype), hasAlpha = false
So why am I getting hasAlpha in step 3 to be false. And how can I make sure that writing the bitmap to file will maintain its alpha component.
Thanks for any input

Multiple images Animated in Portable Network Graphics
I'm sorry I do not have the answer for you, though since there are two animation formats for PNG related graphics, you could consider using MNG. That most API's do not support them is because (currently) programmers are (still) not familiar with these file formats. Solution; create your own API
Here is some insight in APNG (Animated Portable Network Graphics) and MNG (Multiple-images Network Graphics) obtained from WiKiPEDiA for others to obtain more information regarding this subject.
Read here what w3c.org had to say about PNG.
An APNG image example -=[HERE]=- taken from en.wikipedia (not all browsers support this format)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
We need more input from others regarding this interesting subject

Related

QUICK TIP: Changing the bar system color (the base hue) under WM5+

I’ve just been asked in the Smartphone & PPC Mag VIP section (where I’m the lead helper) of how you can easily change your upper / lower / scrollbar colors on WM5+ (WM5, WM6, WM6.1 etc.) Windows Mobile devices with touchscreens (NOT models without them!), also often referred to as the “base hue”.
I’ve published a lot of system color-related information back in the pre-WM5 days (see for example THIS). In WM5, the situation has changed drastically with the introduction of the “base hue”. This means old utilities and Registry hacks no longer work under WM5+. Fortunately, there are a lot of tools to help the situation.
Probably the easiest (and free!) way of doing this is getting VJBaseHue from HERE. To do this, download the CAB file at the bottom and also download “Example themes by ZeBoxx”. Install the former to the built-in storage of your device (NOT to a storage card) so that you don’t need to modify the .lnk files in the latter, ZeBoxx file.
Now, uncompress the contents of the ZeBoxx file and copy the lnk files to anywhere on your Windows Mobile phone; I recommend \Windows\Start Menu\Programs or a subdirectory of them so that you can easily access them from the Start menu. Now, by just going to clicking Start / Programs (or the folder you’ve created) and clicking any of these links, the color of the upper/lower/scroll bars immediately change.
Just some examples:
A QVGA Pocket PC Phone Edition (Windows Mobile Professional in the new, WM6+ parlance) device with black base hue:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Now, clicking the “Magneta” link makes the base hue to magneta as can be seen in the following screenshot:
Note that you can use any color (not just the pre-defined ones in the ZeBoxx file) if you follow the tutorial on the homepage.

[Tutorial] How to search any file on your pc through YOUR MOBILE/Tablet in < 1 sec

Everything Search is a lightweight program that allows you to locate files and folders instantly , as you type.This is a must have tool for everyone.Bind it with a hotkey (Eg: Win+S).You can search anything almost instantly on Windows.
http://www.voidtools.com/download.php (download free < 500kb)
Preview on Windows
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This short & simple tutorial will allow anyone to remotely/locally search files on your home pc/local network/laptop in less than a second.Tried & tested this method on edge/wifi.
Step 1: (Ctrl+P) Goto Tools -> Options -> HTTP Tab
Fill in the desired port or leave as is.
Fill in the user name and password for authentication
Note : I have an android phone , so for me downloading only worked when the authentication was removed during configuration.
You can remove this authentication if download fails.
Step 2: Start the HTTP Server.
Step 3: Url Formation - http://[yourip]:[port]
If you are accessing your files remotely. You can find your global ip using http://whatismyip.com
Eg: Remote Url http://123.231.31.192:8080
If you are accessing files locally through wifi , find out your host pc's ip address
Eg: Local Url http://192.168.2.1:8080
Open the url in your mobile browser and search your entire pc/laptop
You can see search takes less than a second.Download speed as per your network.
This is just a straightforward method , so it should work on any mobile/tablet with a basic browser.I am not affiliated with the software in anyway.Hope this tutorial was helpful to you.
Update: It did'nt work for me on Opera Mini. For every other browser works fine.
Would highly appreciate a feedback.
Press 'Thanks' if this post was useful in anyway.
Well written and laid out. I'll give this a go. Thanks!
Good post.. Cheers

[ FREE APP ] GPS Tracking+PhotoBlogging

I'm announcing our free service for ATracker here. No limits.
Example what you get when you have it all working :
http://tracker1.reperion.com/vemap.aspx?name=d-8498&calDate=12/14/2011%2012:00:00%20AM&gpasswd=0000
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
We got some reports about the client not working on SOME rom's. Please create an account in step 1, and report back if it works for you.
This is a Galaxy Note announcement, if succesfull I'll ask to put it in Android General.
So help testing and serve yourself and awesome freebee!
0. DOWNLOAD - https://market.android.com/details?i...atracker&hl=nl
1. If you want a free account for the GPS Tracking+PhotoBlogging software
all you need to do is join here : http://live.reperion.com
2. in your client, you should put tracker1.reperion.com (no http://) as server,
and of course, your username and password that you create in step 1.
3. If you are driving, and have power, set the update interval to 15 (is seconds) instead of 60
4. BE PATIENT with first use, it always waits for GPS even IF IT IS on already.
5. Upload photos at max 1600x1200 otherwise crash.(2MP) (meaning 800x600) untll someone figures out where the hell all the resolution options below 5MP have gone, I mean 1280x800, 1600x1200 )
6. To review or view your tracks live , enter your username behind this url :
http://tracker1.reperion.com/vemap.aspx?name= then copy paste it, a working one looks like this
[URL="http://tracker1.reperion.com/vemap.aspx?name=eyesea"]http://tracker1.reperion.com/vemap.aspx?name=eyesea[/URL]
7. Try the realtime Google Earth link (they are the small red links bottom right)
8. (on your PC) IE users / FF - Add site to trusted sites, or at least enable scripting and status bar access/
Best photo+location for q1 2012 will get a real and nice surprise (gadgetwise)
Spread the word it's free
~~~~ reserved ~~~~~~
Please comment about FAIL/SUCCESS
05-februari - ^^ Many new downloads - no errors/questions reported yet^^
18-februari - ^^ ICS GPS errors reported. Does it work for you? Please post.

Is possible to modify "website error" dialog?

Hi!
I'm not sure if this is the correct place where to ask this, but at least Subforum name rings a bell for me.
I've recently installed "AdAway" on my "Huawei U8350" (Android 2.2.2) in order to block ads on websites.
Since this application doesn't work as "AdBlock Plus" does for "Mozilla Firefox" (hiding blocked elements, etc), the places where ads were used to be displayed have been replaced with a "website error" dialog, telling me that these sites couldn't be loaded.
Here's an example (taken from "Dolphin Browser":
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
In some cases, these dialogs are pretty long, and sometimes they change the visible area on websites, so, their layout is affected (height gets increased):
Since my phone's Display is quite small, I'd like to know if there's a way to change/customize these dialogs in order to gain working areas.
I'd like to know if were possible to modify these dialogs to something like these (being C my favorite):
I could see that inside "framework-res.apk" (assets folder) there's the "upside down Android" image under the name "android-weberror.png".
The problem is that I don't know where the dialog text could be located at (or if it is located inside Dolphin Browser apk files).
I've to add that I couldn't find any "SystemUI.apk" file; it has "framework-res.apk" only (as I've read, it seems to be usual, since it's still a Froyo, but I could've been searching on the wrong path).
I hope that someone could guide me to complete this little mission, by providing me of necessary info and help.
Thanks in advance!!
Framework-res.apk file
/res/raw(-locale) has the html file
/res/values/strings.xml has the texts depending on the error:
<string name="httpErrorUnsupportedAuthScheme">The site authentication scheme is not supported.</string> for example
This is the syntaxis (string name="httpErrorxxxxxxxxx")
Thank you so much!
I've been able to edit "loaderror" and "nodomain" files from "raw" folder.
This is what I did for "nodomain":
Code:
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
<title>Site Unavailable</title>
<style type="text/css">
body { margin: 0px; padding: 0px; }
</style>
<body>
<p><img src="file:///android_asset/webkit/android-weberror.png"></p>
</body>
</head>
</html>
I hid URLs inside that upside down Android image, making it like a link object.
I haven't changed anything from "strings.XML" yet (probably unnecessary for now).
However, ads areas (height/width specified by website itself) are still there, but all has been replaced by that upside down Android only
Thanks again for your help Browser's visible area looks cleaner now!

[APP][2.1+] Matrix Calculator 1.1 [school-app]

Matrix Calculator 1.1​
Hello XDA
I proudly want to show you an app I developed about half a year ago.
As the name tells, it's an app to solve every kind of Matrix / SLE plus it has some nice extra features to take the pain to calculate all these matrices from you
Here is a full list of Functions
Solve every matrix / SLE as far as possible (this also contains underdetermined Matrices)
It solves the matrices in a very clear way (best shortening when possible and it also detects zero-lines)
you can see EVERY step the program made to solve the matrix PLUS you can click every step to see the matrix at this steps state and even edit it there and use the new matrix as starting point
it tells you when the matrix is unsolvable
you can calculate matrices up to a size of 10 by 10 fields
you can calculate the steady-state-distribution
it can multiply matrices up to 10 by 10
if you usualy only reduce your matirces as last step, you cann tell the program to act the same way
you can set how accurate the program calculates ant how accurate the numbers are shown
there is a detailed help-text when you push the menu button and click help
Because of the fact that I'm german this app is set to german by default, but you can easily set it to english by pressing "Einstellungen" and set the language to english under Sprache
for testing purposes you can tell the programm to fill all your matrices with random numbers between 0 and 10
here you have the Download: Matrix Calculator 1.1 (~77 KB)
Don't worry the file says Matrix Rechner, thats the german name
and here are some screenshots for you, most of them as link becase the note has an epic resolution:
pic 1, pic 2, pic 3, pic 4, pic 5, pic 6, pic 7, pic 8, pic 9, pic 10
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
And as most of the non-nativ-english speaker i apologize if my english is too bad
i really would like to get some feedback

Categories

Resources