Binding to ImageView.Drawable with MvvmCross Xamarin.Android App - xamarin.android

I'd like to display circular images in my Xamarin.Android app. This blog post, looks like it'll give me what I want. But I'd like to use MvvmCross to data bind.
Before I begin, is it the correct approach to create a value converter that would take an image path (or some other reference to an image) and return my circular drawable, then bind that to the Drawable property of ImageView

I don't really think there will be just one "the correct approach", but the approach you've suggested looks plausible to me.
If it helps, MvvmCross provides a "Bitmap" pseudo-property on ImageView to allow you to bind to a Bitmap - eg from a value converter. Beyond this, you could also implement your own custom binding if you wanted to (the built-in bitmap binding targets are in https://github.com/MvvmCross/MvvmCross/tree/v3.1/Cirrious/Cirrious.MvvmCross.Binding.Droid/Target and are fairly easy to reuse)

Related

How to make Glitch/Static Effect Objective-c

I'm trying to make that effect, but I don't know how or the name
Of the effect?
That's not "an effect" but could be accomplished a few different ways. If it were me I'd look into Core Image filters (CIFIlters). If you've never used them, start with this Apple example:
https://developer.apple.com/library/prerelease/ios/samplecode/CIFunHouse/Introduction/Intro.html
Then look into changing the size and position of the type, applying pixellation and maybe a bit of blur.

Valid technique for scalable graphics on iOS?

A little background: I'm working on an iOS app that has a variety of status icons for various states. These icons are used in a variety of places and sizes including as UITableViewCell imageViews, as custom MKMapAnnotations and a few other spots. I actually have a couple sets which include a more static status icon as well as ones that have dynamic text injected into the design.
So at first I went the conventional route of using static raster assets, but because the sizes were dynamic this wasn't always the best solution and I wasn't thrilled with the quality of the scaling using CGAffineTransforms. So instead I changed gears a bit and tried something else:
Created a custom UIView subclass for each high level class of icon. It takes as input the model object that derives the status from (I suppose I could have also just used an enum and loaded this into some kind of model constructor but this is how I did it) so it can decide what it needs to draw, then does the necessary drawing in drawRect. Since all of the drawing is based on the view bounds it scales to any reasonable dimensions.
Created a Category which has class method constructors that take the model inputs as well as the size you want to use and constructs the custom views.
Since I also wanted the option to have rasterized versions of these icons to plug into certain places (such as a UITableViewCell imageView) I also created constructors that build the view and return a UIImage using the fast iOS7 snapshotting functions.
So what does this give me? Well here's the pros/cons that I can see.
Pros
Completely scalable graphics that can easily be used in a variety of different scenarios and contexts.
Easy compatibility with adding dynamic info to the graphics such as text. Because I have the exact shape data on everything I'm drawing I don't need to guesstimate on the bounds for a text box since I know how everything is laid out.
Compatibility with situations where I might want a rasterized asset but I still get all the advantages of the dynamic view since I'm not rasterizing it till I need it.
Reduces the size of the application since I don't need to include raster assets.
Cons
The workflow for creating the draw code in the first place isn't ideal. For simple stuff I can do it straight in code but for more complex things I'll need to create the vector asset in Illustrator or Sketch then bring it into PaintCode and clean up the generated draw code into something more streamlined. This is not the most ideal process.
So the question is: does anyone have any better suggestions for how to deal with this sort of situation? I haven't found an enormous amount of material on techniques for this sort of thing and I'm wondering if I'm missing a better way of handling this or if there are any hidden gotchas here...performance doesn't seem to be an issue from my testing with my approach but I haven't tested it on the iPad3 or iPhone 4 yet so there could still be some unknowns.
You could try SVGKit, which draws SVG files, and can export to a UIImage, if desired.

Best practices for defining FastImageCache FICImageFormats?

I'm using Path's FastImageCache library (https://github.com/path/FastImageCache) in order to have pre-resized images cached ready for use in UIImageViews.
To use FIC, you define FICImageFormats which include a bunch of data, including the image size. In order for best performance, this image size should be identical to the size of the UIImageView that the image will be used in.
This gives rise to a chicken-and-egg sort of problem: should the code that sets up FIC (in the AppDelegate or wherever you do the rest of your basic init work for your app, presumably?) know the sizes of the UIImageViews in the rest of your app? This has the obvious downside of very tight coupling of your app's startup code with UI implementation details.
An alternative is that you could have your UIs implement a protocol that defines a method such as
+(NSArray *)imageFormats;
which would return an array of FICImageFormat objects representing all image formats that would be required by that bit of UI. Then the startup code would only have to know which classes implement that protocol in order to get a full list of image formats required for the app.
This second approach has the downside of potential duplicate FICImageFormats. It would be non-optimal to have two (or more!) image formats for the same image format family that also have the same dimensions. Then you'd be caching the exact same data more than once.
Any other approaches you can think of? Best practices? All thoughts are welcome!
I think what could help here is to start at the design level - you should agree with the designers for a certain set of image formats for any image family and then you would have a central list of all your image formats and families in your style guide anyway.
It doesn't matter then so much if your code is in the AppDelegate or in the View layer, because neither the view layer nor the startup code really determine which formats exist, but your style guide. It's not an implementation detail anymore, but part of an external specification.

iCarousel with per image reflection

How can I add a reflection to card flow for each image where the reflection is made from the image?
OR
How can I add common reflection for images with various aspect ration.
I can understand the reflection is taken from background image from reusable view but I need to make some setup for each item.
I found some other similar questions but I can't see solution for me there.
There is an example on the library's github which is also referred to in the FAQ at the bottom.
Q. I want my carousel items to have a real reflection, but the reflection in the examples is just drawn on. How can I render reflections dynamically?
A. iCarousel doesn't have built-in reflection support, but you can use some additional libraries to do this. Check out the Dynamic View Reflections and Dynamic Image Effects examples.

Where can I find an image watermark control for Delphi?

Is there a good image watermark control for Delphi? It would be nice if it could receive both text and images to insert in a base photo.
I would also prefer it was free.
I couldn't find any pre-packaged controls. But watermarking is not very hard at all. All you simply need to do is draw an image on top of another image with the use of alpha blending. This site has a whole section on alpha blending in Delphi. They provide links to graphics libraries which have implemented it.
However if you're using Delphi.NET, and can access the relevant classes in the framework, there is an easier way using only framework methods.
Take a look at Graphics32 together with GraphicEX.
Or see if PascalMagick does the trick.

Resources