Create Mosaic on image - iphone

In image app i have to blur the selected areas of image. Something like create mosaic at selected area of image. i have to get each pixel color of selected area and then increase the size of each pixel. here is the reference link that i am using http://soulwithmobiletechnology.blogspot.in/2011/05/create-mosaic-with-your-image-part-1.html . But not able to implement this practically for selected area. Can any one have some sample for the same.

There are two solutions for this
1. Get the screen shot of the area where you want the mosaic effect and apply effect to the same portion. Then add the image(with mosaic effect) to the original image.
2.Get the pixel of the area you want to be effected and then gave effect to those pixels.*

Related

how to calculate PPU for image sprites

I have an image for creating rounded button in unity, but, If I don't account for the correct PPU value, the button gets distorted (I'm even using sliced images):
Through trial and error, the PPU value of 300 seems to look like the original image:
but, I don't know a way to confirm if that is correct. How would we actually calculate the PPU value to use for images?
I think you just need rounded rectangle image and need to slice it as follow
I have sliced the image as shown above and added an Image component in scene like following
Notice the Pixel per unit multiplier it is to control the border radius, and now I can stretch the image and it won't get distorted. Check the screenshots for that
And for the text I have used TextMeshProUGUI as the child of the Image.

Custom Shaped Buttons Unity UI

Hi I am trying to create custom buttons on unity (trapeziums). I successfully created the visible area on Photoshop and imported it as Sprite 2D UI as per the following image:
The issue arises, when I'm trying to select one of the buttons in game, their border overlap each other, since the transparent area is still being considered as part of the clickable button area. How can I remove this?
EDIT:
Practically when I import I want the squared boxes to not be counted with the image. I need the edges of the orange area to be cut flush with that and not the entire area(i.e. including the transparent boxes).
You may achieve this by using Alpha Hit Test Minimum Threshold. Take a look at this nice video tutorial.
There is one extra step that is not shown in the video but mentioned in the comments: you have to change "Mesh Type" to "Full Rect" and not "Tight" as it is.
Hope that helps.
The clickable area is based on the Rect Transform component of the GameObject. Adjust the width and height to the clickable area you want. You may have to crop your image in photoshop accordingly. If you select 'Gizmos' in the editor you can toggle viewing the click region.

How to merge an image to fill in other image with shape?

I want to merge an image to another image in one shape. Example:
1- People image
2- Shape Image:
So how to do draw that. I already implement for merging but it's not fill to that shape.
It's possible to do this using the masking functions in the Quartz 2D framework. It's a little bit more involved than using the higher level image functions of UI Kit, but Quartz 2D gives you a lot more power to do cool graphics techniques.
The relevant Apple Developer guide to this can be found here: https://developer.apple.com/library/mac/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_images/dq_images.html
For this example, you'd want to create a mask shape for the inside part of the shape image. There are two ways you can do this. One way is to use image editing software to create a second mask image, with the same size as your shape image, with pure black in the area where you want the people image to appear, and white where you don't want to appear. In this example, that would be the area inside the blue shape. It is important to not crop this image, or else they won't match up exactly.
The other way to create the masking image would be to do that dynamically based on the shape image, and honestly, this is the way I would do it. This would mean that you're including fewer images in your app, and if you made any changes to the shape image, you wouldn't have to recreate the mask image as well. You could do this by making a small change to the way your shape image is formatted. You would need to use a format that allows transparency - png is preferred - so that there is alpha transparency in the part of the image outside of the shape, which is white in your JPEG image. Make sure the section in the center of the image is white (really, any color that is NOT USED in the wanted part of the shape image would work, but I'll say white for this example) and that you don't have parts of it that aren't pure white after image compression.
You will then use Quartz to select the area that's white, and create a mask from that. This technique is a bit more involved, but what you need can be found in the document I linked to above. Because of this, you might start with a static masking image, and then convert to the more involved technique after you've got the code to make the first technique work.
When you have your masking image, you would create the mask itself with the function CGImageMaskCreate(::::::::). You can then apply the mask to the people image using the function CGImageCreateWithMask(::), which will give you an image with the person's portrait, with the correct shape cropped from the center.
Finally, you would display this in your app by placing the masked people image on top of the shape image, and voila, you'll have what you're looking for.
Also, keep in mind, when using the Quartz 2D framework, you'll have to make sure you release images when they are no longer needed, or else you could have memory leaks.

Image getting stretched when creating MBTiles using TileMills to use as an Image on Whirly Globe Framework

I am struck with issue .
I want to use My personal Image as an image on whirly globe.I used a Jpeg file and changed into .tiff file and added to Tile Mills as a Layer (Following the rules specified in the crash course of tile mills).Now i am facing an issue while exporting the image as MbTiles .
I looked into this Link for taking reference on what should be 'Dimensions' of the image to be used on whirly globe.
Right now i have an image whose dimensions are 10184X7638. But this image is not able to wrap the complete Whirly Globe.
Please guide me on
what the dimensions should be there of the image to be used for whirly globe.
can i use this values while creating a frame for the image as the image gets strected when is added to the globe .Image1
.
This is the Image i am talking about it has a dimensions of 10184 X 7638 pixels and when i select these bounds as specified Image1 (-180,-85.11,180,85).then i get this Image2
. Here you can see the image is not able to cover the complete bounds and hence the globe also is not fully wrapped with this image.
Thanks!!
The image is less about dimensions and more about mapping it to geographic coordinates so that it can completely cover the globe. You need to make sure the image takes up your whole TileMill map if you want it to completely cover the globe in WhirlyGlobe.

how to swap images using Cocoa Touch

I am trying to build 15-puzzle game.
Here I need to swap a blank image with a clicked on image. I would like to know how to swap these images.
I have stored the co-ordinates of the two images,but don't know the format to identify the blank image and then set its origin to clicked image.
Present each tile as a CALayer. To swap two tiles, set each layer's position to the other's position.