Images/Sprites question in Cocos2d - iphone

Okay, so I have a background image of a desert for my app, it is in the .gif format, and is #2x. I have it scaled down like so:
background.scale = 0.5;
and it appears fine. I have another image for a health bar that is in .png format, and is also #2x. I also have it scaled down like above. But the health bar is WAY pixelated on the edges, and the desert's edges are not AS pixelated, but WAY better. I've tried changing the health bar's format to .gif, that didn't do anything. And note: When I view the images in Preview/Xcode, they look just fine! Am I missing something? I use Inkscape, if that helps. Any help is appreciated. Thanks!

Generally, scaling in cocos2d is not recommended as it is low quality (as you observe) and it becomes a performance bottleneck (or it used to be, I don't know this could have changed). Why don't you just pre-scale the images to the exact dimensions you want and display them without scaling? If this is for a universal app, just pre-scale the images to each intended resolution and load them depending on the screen scale/size.

Related

UNITY: Everything looks Low Resolution. Even SVG vectors

I'm new to Unity so Hopefully this is an easy fix.
So everything looks super low res for me. I wish my images looked high res.
Even SVG looks low res even though they're vector nodes, I don't get that at all but I assume Unity doesn't play with svg yet? the black outline graphic is SVG, the rest are PNG with alpha.
Take a peek at my three different windows. Let me know your suggestions (remember I don't know anything so the easiest thing can been overlooked)
There is a "Scale" slider on top of the game view. Right now it is set to 2.8x. When you do that Unity just zooms in but it doesn't set the the resolution or actually change anything at all. It's like moving the screen really close to your face :D Nothing else besides that particulat window is affected by this setting. So my advice would be to always keep it at 1. Unless you want to see something specific at the screen of course

UITableViewCell Background stretching

I have a problem in Swift with UITableViewCell background image. Let's say that it shows quite fine one iPhone5 but on iPhone 6Plus it is stretch and thus it looks bad. This is probably due to Aspect fill or something which I really couldn't manage to change and achieve what I want so would be the best if someone could poke sample code I am providing as well as image how it should look, so anyone can check it out and maybe give me some hint or tip or sample code or even fixed demo version.
So here it is:
Note that on left side there is a curve (like half a circle) around right side of icon. On bigger phones or tablet, that curve gets super stretch thus completely destroying the look.
Demo code link
Thanks all in advance for any help. I am pretty stuck with this one.
You can stretch an image while preserving the aspect ratio of a portion of that image using slicing. Xcode offers a graphical interface for doing this. The idea is that you decide what parts of the image are allowed to stretch and which aren't.
https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/chapters/SlicinganImage.html

really high resolutions become pixelated, as if the camera is zoomed in too much

I'm working on a Unity 2D project and making the levels at the moment.
For some reason even really high resolutions (higher than 1920x1080) become really pixelated. It's like the camera is zoomed in too much. My player is rendered at a scale of 0.2x0.2.
I've tried changing the z-depth of camera back but everything still becomes very pixelated. Really frustrating because edges of tiles on the screen become really pixelated.
Anyone had any issue or can think of anything that will help solve this?
here's a picture of it in the editor mode. Based on the tile grid you can see everything's really tiny and it's awfully zoomed in. Not sure how to fix this.
In game:
Noticed how pixelated it is. Thanks
On your first screenshot the sprites are also pixelated.
Every time you see bad image quality - checkout import settings. Try to increase max size. Also try different format. You should find the suitable values for yourself.
I find that when I set the export settings to Android, everything gets pixelated, even skies (I suppose it does that in order to adapt to the device's lower capacity). Turning export settings back to web player for example, solves this issue.

Why does my text look so bad in my ios App?

I have a uiscrollview that has a custom child view that contains text and images.
The text items are UILabels. I have attached an image representing the quality issue:
Do you guys think it might be worth a shot to draw the text, then convert to a uiimage and display that instead? Maybe it would scale better? Or perhaps there is a way to smooth the text?
There's no reason to expect that you're going to draw the text better than UILabel does. Your picture is very hard to make out, but here's what you want to look at:
Are you just adding a UILabel to the UIScrollView's contentView, or are you doing something else fancier. That "something else fancier" could easily be the problem.
Make sure you're drawing on pixel-aligned boundaries. The easiest way is to make sure the origin of your UILabel is integral (not a fraction). On a retina display, you can get away with half-points, but it's usually easier just to make everything integers.
I thinks it is the position issue. I bet you set the x or y value to float value like 12.3 or 12.5 .
What I have done now is I have created a uiimage version of my text and am showing that now instead of the uilabels, the quality is soo much better, you can really see the difference when you are looking at it scaled up on the ipad, it must just do a better job scaling images then text?
Before:
After:
The above images show how the text renders on the ipad with my app scaled up, before and after my change.

Changing color of part of an image

I have a png image file that is partly opaque and partly transparent. I display it in a UIImageView as a mask of sorts over another UIImageView layered behind it (as a sibling subview of a common superview). It gives me perfect borders around something painted using a finger on the lower UIImageView in my stack of UIImageViews. Perhaps there are better ways to do this, but I am new-ish, and this is the best way I came up with thus far. None the less, my app is in the App Store and now I want to enhance it to provide more images to use as the mask of sorts over the finger painting. But I don't want to bloat my bundle size by adding more static mask images as I did for the initial implementation. Not to mention I don't want to spend lots of time in photoshop making 100 masks. I'd rather programmatically change the color of the mask, without affecting the clear portion in the middle, which is not a simple regtangle or circle, but rather a complex shape. So my question is this: How can I change the colored portion of my loaded image without affecting the clear color portion in the middle? Is there a reasonably easy way to do this? Essentially I want to do what is described in this post (How would I tint an image programmatically on the iPhone?) without affecting the clear portion of my image. Thanks for any insights.
Have a look at the Tinted Image sample project. Try out the different modes until you get the effect you want.