resizing images for hdpi - Android Apps and Games

Hi, I am using libgdx which means all my images have to be in the assets folder. I have undertaken to provide 3 versions of every sprite, a mdpi version, a hdpi (1.5x the size) and a xdpi version (2x).
The problem is that the world coordinates are 320x480 which means my original sprites were tailored for this for example I have a bullet that is 8x8. When I resize this for hdpi I get 12x12.
The problem is that this is no longer a power of 2 so my app crashes when it tries to load it. Do I need to add padding to every sprite sheet to make it a power? or can I force it to load NP2 sizes? or is there something I'm missing?

Related

App modification request

I'm not sure if this will work or how this works but I'm wondering if there are any avenues to request a feature or modification to an app when the original developer is unresponsive to requests? Obviously this would only be for personal use and not for redistribution of the app.
App: BattStatt
Mod: I love the look and simplistic nature of this widget. My only grip is that I'm running it on an Evo 4g with a large 800x480 display and when I use the widget in a 4x1 configuration the text only takes up a small portion of this defined area. I want the text to scale up to where it fills the 4x1 space as much as possible so space isn't wasted. Can this modification be done easily by any of the developers around here? I'm not sure how this works so don't flame me lol.
Typically, the source code needs to be available to modify how it works. Is it?
All I have is the app itself as downloaded through the market. I'm not sure how to go about getting the source code.
Hmm.. this app uses "sp" units to set font size, so text should automatically scale to constant physical size.
I won't modify it for you, because I would have to create 5 different sizes, so you would choose the best for you. But you could quite easily do it by yourself using apktool. Link is in my signature.
EDIT:
Or just tell me, how much bigger you want this text.

Timescape themes (Update for 2.1)

For 2.1 themes see post #17 on page 2: http://forum.xda-developers.com/showpost.php?p=9049613&postcount=17
I decided to open a thread to share the knowledge I have collected on timescape themes. This also partially applies to mediascape and up until now has been split between these two threads:
http://forum.xda-developers.com/showthread.php?t=737778&page=46
http://forum.xda-developers.com/showthread.php?t=765686 Please read this!
I thought it would be better to combine this into one thread that will be easier to find. If anyone disagrees then please post with reasons and alternatives. I will update this first post as we figure out more tweeks etc. (hopefully it will need a big rework soon because SE finally gets us 2.1 )
Before I start, thanks to Chewitt for finding the acet files, and for inspiring me to start messing with the look of my x10 with his Dark10 themes.
Timescape (and mediascape) do not store all of their images in the .apk resources. Oh no, that would just be too logical, and we are talking about Sony Ericsson here
The timescape theme .apk resources do contain some of the images used (e.g. the trash can and app drawer handles), and the actual Timescape .apk has the resources for the tile images etc. I'm not going to go into this as there is enough content about modifying these sorts of resources here. What I will go into is where the timescape background, wave animation, pagination slider colours and the tile alpha blending and default colours.
1. The background: This is stored in an .acet file (see the first of the above posts). This is an file that basically just contains a samll header and then rgb information (or sometimes argb, this is specified in the header which I haven't got 100% sussed yet). The background images are in the assets/ts folder in the theme .apk and are called ts_bg_app.acet and ts_bg_home.acet for the application and timescape home respectively. These can be modified with acetConverter.exe. You can load an image and export an acet file or you can go the other way. TS uses acet backgrounds without an alpha channel so leave the alpha checkbox unticked when creating them (it might work with alpha... never tried...).
2. The Tiles: I'm pretty sure the alpha blend images for the tiles are found in the system/usr/semc/seee/files folder (alpha_tile.acet and alpha_tile_fade*.acet) but I haven't modified these yet. As an aside the background for the first page of mediascape is here too. More important is the default background for a tile. This file, ts_tile_empty.acet, is a single pixel file found in the assets/ts folder for each theme. This specifies the solid colour to be used as a background for the alpha overlay on empty tiles.
3. Animation files: Wave and Pagination. This is all stored in three .afx java animation files in the themes assets/ts folder (ts_bg_wave.afx, pagination_glow.afx and pagination_area.afx). pagination_area is the square around the selected item in the scroll menu at the bottom (or the top if TS is the home page) and pagination_glow defines the lines at the top and bottom of this area. I haven't got these files fully sussed either, at the moment I'm restricted to doing some awful byte replacement to change the color (I can also change the wave pitch, but it doesn't look any good). I have attached an exe to generate these files (SetTimescapeAnimationColor.exe). Click on the white square to choose a base color and use the buttons to generate whichever of the files you want. If anyone knows how to edit these files properly please let me know, I come from a c# and c++ background and don't really know what I'm doing with java...
Thats pretty much it. Just sort out 6 files, update the png resources (the thumbnails for the theme selection are in the Timescape.apk resources folder) and you're done.
Note: I have had problems when I modified the wrong bytes in the afx files. Basically, after selecting the theme timescape just crashed. If you replace the theme file it still won't start, you need to clear the application data to get it running again. Along the same lines, after modifying a theme you need to reselect it from the themes menu as the files are cached.
Please let me know if I missed anything.
Update: I have attached the source code for the animation color tool. Please keep in mind that this was just a bit of code quickly thrown together so we can modify the animation color, I don't usually write code that looks like that
The project is a C# project from visual studio 2010 but the meat of it is in MainForm.cs so just open that if you use a different language/dev environment.
Here is the code from one of the buttons. Resources.pagination_glow is a byte array from an embedded resource (pagination_glow.afx).
Code:
string r = string.Format("{0:000}", (int)(((double)colorPanel.BackColor.R / 255.0) * 100));
string g = string.Format("{0:000}", (int)(((double)colorPanel.BackColor.G / 255.0) * 100));
string b = string.Format("{0:000}", (int)(((double)colorPanel.BackColor.B / 255.0) * 100));
byte[] bytes = new byte[Resources.pagination_glow.Length];
Array.Copy(Resources.pagination_glow, bytes, Resources.pagination_glow.Length);
bytes[949] = (byte)r[0];
bytes[950] = (byte)'.';
bytes[951] = (byte)r[1];
bytes[952] = (byte)r[2];
bytes[953] = (byte)',';
bytes[954] = (byte)g[0];
bytes[955] = (byte)'.';
bytes[956] = (byte)g[1];
bytes[957] = (byte)g[2];
bytes[958] = (byte)',';
bytes[959] = (byte)b[0];
bytes[960] = (byte)'.';
bytes[961] = (byte)b[1];
bytes[962] = (byte)b[2];
bytes[963] = (byte)',';
using (FileStream stream = new FileStream(saveDialog.FileName, FileMode.Create))
{
stream.Write(bytes, 0, bytes.Length);
}
What is important to note is that the embedded afx resources came from the orange theme, the other themes will require different offsets for the byte modification. I'm not sure why the different themes have different code here, I haven't looked closely at the wave animation code for each theme so there may only be a difference there, or there could just be one more space here and there in the preceeding lines or four spaces instead of a single byte tab ('\t')...
Anyway, the next step is to try and modify the number of bytes in the code and see if it still works, on my first few tests timescape just crashed so I thought that the number of bytes of clear-text code may be stored in the header. I'm not so sure now as I think I may have just been having problems while mixing the use of the .Net stream classes for reading an writing. I'll check this out though.
If we can modify the code however we want then I just need to learn a bit more java
The code for the wave animation is in the comments at the bottom of MainForm.cs. Here is the line with the characters being modified in bold:
fcolor.rgb = vec3(1.0, 0.91, 0.72) * ambientRatio + vec3(1.0, 0.516, 0.0) * specularRatio;
LOL this is just lazy lol, Thanks for the guide i will get the other 3 i need for Dark10 sorted on sunday.
this all sounds awesome =)
May I suggest posting the source code to your .exe files? that way others can pitch in and help improve the tools, too. slap on the GPL for a decent licence and it should be no problem
ttxdragon said:
this all sounds awesome =)
May I suggest posting the source code to your .exe files? that way others can pitch in and help improve the tools, too. slap on the GPL for a decent licence and it should be no problem
Click to expand...
Click to collapse
Good idea I have just updated the first post. I have only added the animation tool source as the .acet converter is just a direct color translation except for the header which is post in the acet thread linked in the first post.
I can post this code as well if anyone is really interested, but it will have to wait until I am back at work on the 14th, or until the VPN starts working again
VPN's up - posted the rest of the source.
calum.. just got a new charger today lol so back on track.. although some reason i cant seem to get my colour to change at al? ive rebooted, tried task managers n al but no luck..
Edit: ignore that.. managed to get it working! like an idiot i forgot to add the code at the top for mount/remount lol.. feel like a blonde
Has anyone got an original version of ms_bg_background_home_icn.acet?
Being the genius that I am, I tried to edit it without backing it up first.
I tried to convert a png image to an acet file using that acet converter but ended up with a background with a similar issue to what's in this post. Will read through all the posts tomorrow and try again.
Hey buddy any more progress with this project?
Sorry, on the road at the moment. I'll be back onto this next week.
@Mobzter: glad you got it sorted.
@Sixpence: you may have exported the image with the alpha channel. Make sure the alpha option is off for the timescape and mediascape backgrounds. I'll add complete backups to the first post next week
heres a backup of that file
_calum_ said:
@Sixpence: you may have exported the image with the alpha channel. Make sure the alpha option is off for the timescape and mediascape backgrounds. I'll add complete backups to the first post next week
Click to expand...
Click to collapse
Ah, yeh, I think that's what I did. I'll try again and see how I go. Cheers!
Thanks for backup Mobz!
EDIT: Sweet, that worked!
I just thought I'd post a link to my dark Timescape theme here.
Timescape (Dark)
If anyone else has got any modified timescape themes please post them (including the modified framework and thumbnail images). It would be nice if we didn't just all modify the Indigo them (as I did above) as if we use neutral images for the default contacts etc. then we can easily change between the different themes.
Any interest
Just a bump to see if anyone is interested in doing anything with the Timescape animation except changing the color.
If they are then I might get back into modifying the .afx files, otherwise I'll probably just move on....
I don't actually use it that much and now I've got rid of the blue I'm sorta happy, but it might be kinda cool if we can add our own animations to replace the wave...
How about the mediascape animation? I wanna make it melt into the next screen. Do u think that's doable?
How can i chnge theme for x10i
Sent from my X10i using XDA App
gavriel18 said:
How about the mediascape animation? I wanna make it melt into the next screen. Do u think that's doable?
Click to expand...
Click to collapse
Do you mean instead of the spline/fade animation when you hit the 'more' button? I think a melting animation would be pretty ambitious and probably only doable if the fade is actually part of the animation. I'll see if I can get an editor slapped together so we can just modify the afx code directly. I'll have a look at the mediascape animation files once I've got that done...
xian08 said:
How can i chnge theme for x10i
Click to expand...
Click to collapse
Sorry, I need a bit more information here. Where exactly are you stuck? Do you just want to install a different theme that you have from one of the x10 themes in another forum, or do you want to create you own?
That's exactly what I was thinking, a melt to a fade into the next screen.
I'm trying to understand how it works but i don't have enough spare time right now.
OK, 2.1 is here and the file formats for timescape themes have changed...
First off, the apk names have changed. They are now named like this:
TimescapeLargeUITheme[ThemeName].apk (e.g. TimescapeLargeUIThemeSakura)
The .acet files are now .uxraw files. The file header and content has also changed: the header is now 8 bytes, that can be split into 4 16bit integers. The first two I'm not sure about, (second one always seems to be 8...) but the 3rd and 4th are width and height respectively. After the header we still have the color info, but it seems that alpha is always included. The bytes are in the order R G B A (the alpha is now the 4th byte instead of the first).
I have attached the new converter and source.
Edit: I originally wrote an incorrect value for the first byte in the header (20 instead of 0x20... oops ) this resulted in a black background...
The afx files have also changed to uxsh. There seems to be a bit more in these files but the animation code is still in plain text. I'm working on an editor, and will update this post when it's done.
2.1 or 1.6 ?
Is this for 2.1 or 1.6 ?
Looks a silly question... But, am little cautious and more excited to see this on my 2.1update1.
Thx for such a great work.
_calum_ said:
OK, 2.1 is here and the file formats for timescape themes have changed...
Click to expand...
Click to collapse
mitalbr said:
Is this for 2.1 or 1.6 ?
Click to expand...
Click to collapse
2.1 (I had also changed the thread title to make this clearer )
_calum_ said:
2.1 (I had also changed the thread title to make this clearer )
Click to expand...
Click to collapse
I was just adb'ed the file system and I found I have following files...
TimescapeLargeUI.apk
TimescapeLargeUIThemeBlue.apk
TimescapeLargeUIThemeGreen.apk
TimescapeLargeUIThemeIndigo.apk
TimescapeLargeUIThemeOrange.apk
TimescapeLargeUIThemeSakura.apk
TimescapePluginManager.apk
I couldn't locate...
Timescape.apk
TimescapeThemeIndigo.apk

[Q] Android porting, widgets are all black.

My situation the same as that another man in the following post has.
(I am new and unable to embed outside URL's in my post. Please search Google for 'when switch to 32 bit graphics icons go black'.)
I am porting Android to a MIPS-based device. After modifying the frame buffer and gralloc, the wallpaper is displayed in the correct colours. But all widgets are black.
Since the frame buffer's post() function just received composed data, and the wallpaper's colour is correct, I guess the code that draws widgets has some problems. This may be the display data I set is different (or wrong) from what the code expects.
If it is not too much trouble, could you give me any hint about the files I should check? Or which files are related to drawing widgets?
I have spent a few days debugging this but there was no progress.

how to: 1440x800 images

what is the easiest way to make wallpaper images 1440x800 using any image i find online or have already? i would like to make my own. thank you.
Using free GIMP.
If You will download picture smaller then 1440x800 :
- Open it with GIMP
- You need to stretch it to bigger (then 800pix) size (Picture/Resize)
- Copy the one [Ctrl+C]
- Create new blank file [File/New/1440x800]
- Paste previously copied (and stretched) picture [Ctrl+P]
- Cut Frames to targeted size [Layer/Set layer size to picture]
- Save as [xxx.jpg]
I'm only using 960x800 (Wide) & 480x800 (Home,CHTlock,Tabs) and it's OK.
Another free program that makes re-sizing images much simpler is: Irfanview
hi i'm using gimp aswell, but You can use PAINT which You have in Your system (vista or win7) not sure that the older version (XP) have crop or resize tool. Cheers
I hear you can also use photobucket but cant confirm that.
then again photoshop is a lovely tool.
thanks guys, i thought i could do it with paint. but gimp is free anyway so maybe i'll get it. could i just google search for pics in the size i want also?

[Guide]A simple approach for mdpi - HyperDroid

Tired of those huge buttons on HDPI?
yeah, we are tired of them as well.
In our infinite quest to make pongster's eagle eyes happy at mdpi, we finally found a workaround that works with most (not all) apps.
First of all thanks to pongster for his persistence in making mdpi roms across several devices now
The guide is intended for Rom makers/chefs who want to add mdpi support to their roms.
First of all mdpi (dpi=160) is natively supported on many apps nowadays, but still, there are some applications that do not display correctly. To identify those apps, first change to mdpi, then see what apps do not display correctly XD. I would also add that this is intended not for commercial applications, but to system/app applications that you would want to use in mdpi.
You will need basic knowledge about editing xmls, usage of copy paste functions and renaming folders.
The described method below has been working successfully when the application desired in mdpi
Immediately force closes
Doesn't display correctly
In samsung based roms, calendar did not displayed correctly (and I could sign it with test keys, adding density support in AndroidManifest) and Musicapp simply Foced Closed upon launching. They are now working correctly at mdpi .
Decompile the desired app you want to add mdpi support.
Then navigate to its AndroidManifest.xml and add the following line just below
Code:
</application>
Code:
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
in a way that it would look like this
Code:
</application>
<supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" />
now, go to its /res/ folder and find all the folders that contain hdpi in its name, duplicate them and rename them replacing the "hdpi" for "mdpi".
for instance for "drawable-hdpi" you will now have it duplicated as "drawable-mdpi". You must have both folders.
Now compile the apk back and sign with test keys and push into system/app, that will work for some applications that do not need special keys for they to be signed.
If the application force closes or does not show on app drawer, then I am afraid you will have to copy the original meta-inf folder and the original AndroidManifest.xml from the unedited compiled apk into the freshly compiled apk. That way you would have copied over the original sign keys. again, push into system/app and check.
Click to expand...
Click to collapse
Click to expand...
Click to collapse
Now, for very detailed themers, pngs in those mdpi folders will have to be resized to fit your theme. I personally like using mdpi applications with hdpi pngs, I found them still usable and not too small to read/press, but if you are a truly perfectionist, you will be forced to resize them.
For the applications that do not show appropriately in mdpi (for instance dialer) with the above method, I would suggest this great guide. I think they both compliment each other, at least in our rom at the S2,
There are other applications that needs to be resized, making them locked at certain dpi. For those, editing /res/drawable.xml and modifying its values adapting them for the desired dpi work most of the time. If you have more suggestions and you are a mdpi freak like us, please share your knowledge.
PD: Newest Marketplace works at 240 (hdpi) and 160 (mdpi) without any issues so far.
Have fun!!
Another Super Tutorial Again
doctorcete said:
Tired of those huge buttons on HDPI?
yeah, we are tired of them as well.
In our infinite quest to make pongster's eagle eyes happy at mdpi, we finally found a workaround that works with most (not all) apps.
First of all thanks to pongster for his persistence in making mdpi roms across several devices now
The guide is intended for Rom makers/chefs who want to add mdpi support to their roms.
First of all mdpi (dpi=160) is natively supported on many apps nowadays, but still, there are some applications that do not display correctly. To identify those apps, first change to mdpi, then see what apps do not display correctly XD. I would also add that this is intended not for commercial applications, but to system/app applications that you would want to use in mdpi.
You will need basic knowledge about editing xmls, usage of copy paste functions and renaming folders.
The described method below has been working successfully when the application desired in mdpi
Immediately force closes
Doesn't display correctly
In samsung based roms, calendar did not displayed correctly (and I could sign it with test keys, adding density support in AndroidManifest) and Musicapp simply Foced Closed upon launching. They are now working correctly at mdpi .
Now, for very detailed themers, pngs in those mdpi folders will have to be resized to fit your theme. I personally like using mdpi applications with hdpi pngs, I found them still usable and not too small to read/press, but if you are a truly perfectionist, you will be forced to resize them.
For the applications that do not show appropriately in mdpi (for instance dialer) with the above method, I would suggest this great guide. I think they both compliment each other, at least in our rom at the S2,
There are other applications that needs to be resized, making them locked at certain dpi. For those, editing /res/drawable.xml and modifying its values adapting them for the desired dpi work most of the time. If you have more suggestions and you are a mdpi freak like us, please share your knowledge.
PD: Newest Marketplace works at 240 (hdpi) and 160 (mdpi) without any issues so far.
Have fun!!
Click to expand...
Click to collapse
Nice to see my noobish hack actually work...
Enjoy multi-DPI for most apps.

Categories

Resources