close
Skip to content

stack icons into a composite image#12

Merged
PrideChung merged 1 commit intoPrideChung:masterfrom
alexshepard:master
Feb 9, 2014
Merged

stack icons into a composite image#12
PrideChung merged 1 commit intoPrideChung:masterfrom
alexshepard:master

Conversation

@alexshepard
Copy link
Copy Markdown
Contributor

It would be lovely to be able to stack multiple icons into the same image. Each icon could have a different color, alpha, shape and size, and the resulting image would be a composite of the various icons. In this way, we can create FAKIcons that have varying transparencies within the icon, as well as different colors within the icon. I don't know if others will use this, but I need it for my project! :)

@PrideChung
Copy link
Copy Markdown
Owner

Hi, Alex

Thanks for your pull request but stacked icons looks like a rarely used feature to me and I prefer not to merge this pull request. As I stressed before I want to keep FAK tiny because I believe reusable components are better than a giant library try to solve everything,

I recommend that you put your code into a factory object like StackedIconsFactory which inherited from NSObject. If you want to use this feature in multiple projects and want to share to others, you can create your own pod and mark FontAwesomeKit as it's dependency.

@alexshepard
Copy link
Copy Markdown
Contributor Author

Hi Pride,

Stacked icons are part of the FontAwesome project that FAK is named after. http://fortawesome.github.io/Font-Awesome/examples/#stacked
I'm not sure I understand why an implementation of FontAwesome on iOS wouldn't support them.

If you look at the stacked examples on the FontAwesome project page, how are icons like fa-ban, fa-square, and fa-circle supposed to be useful in FontAwesomeKit if they can't be stacked with other icons?

Best,
alex

@PrideChung
Copy link
Copy Markdown
Owner

OK I'm convinced that this is an useful feature, but putting stackedImageWithIcons:(NSArray *)icons withSize:(CGSize)imageSize in FAKIcon makes me feel a little bit weird since it doesn't return a FAKIcon instance, and every FAKIcon subclass will have access to it. would it be more appropriate to make an UIImage category, or just make a FAKUtils class?

@alexshepard
Copy link
Copy Markdown
Contributor Author

I understand your feeling about this implementation being weird.

FAK is your project, so I would be happy to follow your suggestion and make it whatever way that you'd prefer. :)

Best,
alex

PrideChung added a commit that referenced this pull request Feb 9, 2014
stack icons into a composite image
@PrideChung PrideChung merged commit 7869fc3 into PrideChung:master Feb 9, 2014
@lynchseattle
Copy link
Copy Markdown

@alexshepard - So how does this work? I saw this was merged but can't seem to get it to do anything (note, I'm using Swift).

@alexshepard
Copy link
Copy Markdown
Contributor Author

@lynchseattle - Pride transitioned this feature into a UIImage category (which in my opinion looks much nicer than the way I originally coded it).

In objective-c:

FAKIcon *pinBG = [FAKIonIcons iosLocationIconWithSize:25];
[pinBG addAttribute:NSForegroundColorAttributeName value:[UIColor grayColor]];
FAKIcon *pinFG = [FAKIonIcons iosLocationOutlineIconWithSize:25];
[pinFG addAttribute:NSForegroundColorAttributeName value:[UIColor blackColor]];
 UIImage *pinStacked = [UIImage imageWithStackedIcons:@[pinBG, pinFG] imageSize:CGSizeMake(25, 25)];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants