How to add a mask with custom shape? [closed] - ios

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm trying to create a mask out of a custom shape. I tried it with image masking and the result is given below. While my desire result is not exactly.
Using this Mask Image
The visual effect that I want to have:
Can anyone provide some hints on how can I achieve my desire effect.

What you have achieved via masking is working correctly. Masking works on alpha channel, transparent area vs visible area and images you posted in your question show exactly that.
Masking won't be enough for the effect you want to achieve. You need to experiment with CIFilter api.
Check out cifilter.io that shows a few examples of how these are supposed to look like. You might want to check out the source code for the same.
If you run this iOS project in Xcode, it provides a very easy way to browse and choose which effect is the closest to what you want to achieve.
Good luck!

Related

How to resize the grouped element in KonvaJS [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 days ago.
Improve this question
I'm trying to build an application on KonvaJS with the Vue library. I've got a group layer where I'm drawing a circle inside the group. I am using the clip function to draw the circle.
While resizing the group, my circle strokes are uneven or get removed. I've made a sandbox for my code. You can find it here: https://codesandbox.io/s/elated-williams-51trtu
Please advise on how to resize the entire group without disturbing the strokes or circle.
Thanks.

Paint Bucket in iOS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I'm stuck on a problem and needed some help or guide for a possible solution.
Basically in my application there will be a map with several zones.
The user can select any of these areas, at that time this area is filled with a color.
Imagine a map like this one, so i need to be able to change the color of only one country.
Something like what happens in the books of paintings (https://itunes.apple.com/pt/app/colorfly-best-coloring-book/id1020187921?mt=8), or Paint Bucket command in the Photoshop .
Any idea how to get something like this on iOS ?
Thanks in advance
The paint bucket technique you're looking for is a set of graphics algorithms usually called "flood fill". There are different approaches to the implementation depending on the circumstances and performance needs. (There is more at that wikipedia link.)
I have no experience with it, but here is a library from GitHub that purports to implement this for iOS given a UIImage object: https://github.com/Chintan-Dave/UIImageScanlineFloodfill
Re: your question about doing this without user touch: yes, you'll want to keep a map of countries to (x,y) points so you can re-flood countries when required. That said, the intricacies of the county borders might make an algorithmic fill inexact without more careful normalization of the original source. If your overall map only contains a small set of possible states, there are other ways of achieving this goal, like keeping a complete set of possible images (created in ie Photoshop) and switching them out, or keeping a set of per-country "overlay" images that you swap in as needed. (But if the flood fill is accurate on that source image, and performant for your needs, then great.)

Extracting images from PSD for use in iOS app [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm not sure if this is the best forum for this, because it's not a programming question per se, but here goes.
I am the developer for an iOS application, and we contracted the design out to a third-party. They delivered to us a massive PhotoShop file with all of the the individual pieces of artwork done on individual layers, at double resolution. To get the artwork into XCode, my workflow is as follows:
Show only the layers containing a particular unit of artwork
Select all
Copy Merged
Create New image (fortunately, the dimensions are taken care of automatically)
Paste
Deselect pasted layer and delete Background, to preserve transparency
Save image as x.psd
Save copy as x#2x.png
Set image size to 50% of original dimensions
Save copy as x.png
Discard changes
This app is pretty large, so it's quite tedious to do this process for every little image. I'm not very Photoshop savvy, so I'm wondering if there is a better way. It seems to me that it should be easy enough to combine steps 3-11 into one macro or script or something. The only thing that changes in each iteration over these steps is the output name. Any suggestions?
Normal workflow is exactly as you described. You can write a Photoshop script to do the layer exporting and Apple provides an Automator tool that will allow you to resize those graphics from 2x down 50%. Great tutorial here. This can help get your graphics to scale quickly.
There are solutions to automate what your trying to accomplish. This video tutorial allows you to take your PSD or PNG and port it into an Xcode with all of the layers properly placed in a view for you, create view controllers, and segues.
Disclaimer - I am associated with the JUMPSTART Platform as mentioned in the video.
You can script Photoshop with Javascript and I've written scripts in the past to perform similar series of steps, it wasn't too hard to figure out even for someone like me who'd never written any Javascript before. Photoshop also has 'Actions' which are like macros and you can probably do something simple like this with Actions as well but it's not something I've personally tried. Check out the Adobe docs on scripting Photshop: Adobe Photoshop Scripting.

how do i change only the eye color on an image (uiimage)? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have an iphone app with a picture of a face in the uiimage. I want to only change the eye color on the face by tapping on a button or tapping on a color wheel. Can you give me some help in what code I would need.
I would suggest taking a look at OpenCV. It works quite well on iOS devices, the main code comes with examples on how to build iOS applications and there is a lot of material on how to do eye detection and from there you should be able to change the colors.
Keep in mind this is not a simple task and you could accomplish with a easier thing. But you could learn a lot and there are tons of good resources around this topics.
If you want to do something faster, you might be able to just detect the touch on the UIView(enable user interaction) and present a color picker, after the color has been presented you could create a simple view on top of the image that has a circle with the color that was selected. It would be crappy, but might be a good idea to do a simple simple prototype.

Transparency vs. White background in Inkscape [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am using Inkscape and I know how to use transparency within the image, but I am annoyed that the background of the workspace in Inkscape is white. I searched through a lot of settings, but had no luck.
How do I get the workspace checkered like in GIMP?
The white workspace is really bothersome if you design something in white
You can change the background color in Inkscape by changing the document properties (in the File menu).
In particular, you can check 'Checkerboard background' to show the checkerboard if the background is set to transparent.
A quite ugly solution is to design your own checker background and have it as locked bottom layer :) Im doing something similar when im fiddling around with iOS icons or items that will be on a background.
Also as Juve mention you could try out the grids property.
First of all, a hint on transparency. If you export images with transparency for example to PDF (for printing), they are converted to bitmaps inside the PDF or produce unwanted results. Export to non-vector formats should be fine. I suggest to avoid transparency, usually there is a way to mimic transparency, e.g., by just using a light gray for shadows. Also don't use blur effects; similar problems with PDF export.
Now to the checkboard:
It's not possible, one workaround would be to add full page sized box and choose black checker board as fill. Put this box on a separate layer and lock the layer. You might also lighten that box up using one of the filters. Unfortunately this board won't adapt when zooming.
Maybe not the solution, but a related option would be the grid (press #). This is not behind your drawing but in front. It can help you with positioning. Maybe you were looking for this?

Resources