When you want to add a variation to an attribute, you get this popup (I'm using Xcode 8) :
As far as I understand, gamut setting here is for a display type. But I don't understand what it really implies and when I should use it ?
You are correct it is for display types, specifically, for having content tailored for say, screens with P3 Gamut (wide color) like the iPadPro (and probably the new iPhone)
https://webkit.org/blog-files/color-gamut/
https://en.wikipedia.org/wiki/DCI-P3
I think you would mostly use it for images and video, if you have content made for the wide gamut.
I found this, http://asciiwwdc.com/2016/sessions/222 , search for gamut and you can get some of the intent.
Related
For a sizeable object (https://vaadin.com/api/framework/7.7.3/com/vaadin/server/Sizeable.html), we obtain the width and height using getWidth() and getHeight() respectively, and the unit via getWidthUnit() and getHeightUnit(). How do I set the width/height unit?
EDIT:
So, the reason I ask is because I have a Panel and I'm working on a function that automatically scrolls it to a certain line. The Scrollable interface only provides setScrollTop in terms of pixels, so I would want to do something like:
panel.setScrollTop(lineNumber/totalLines * heightOfPanelInPixels)
For that, I'm planning on using the SizeReporter addon to give me "heightOfPanelInPixels", but I'm not sure I can guarantee the height being in terms of pixels. If it's not, I would need some way to convert the units.
Also, I asked about setting the unit since I thought it was just a universal thing: like if I could just set the unit for all Sizeables to report in, say, inches or pixels
There isn't really any way of achieving what you want to do, short of setting all sizes as px values from the server. For any other kind of size definition, the actual size in pixels will vary depending on lots of different factors that only the browser keeps track of. Furthermore, there isn't any mechanism that would pass back the actual sizes to the server as they are resolved.
You might want try this add-on that makes the size of selected components available on the server: https://vaadin.com/directory/component/sizereporter.
Old answer below:
There are two ways of setting the size in either direction. They both lead to exactly the same end result - it's just two different ways of expressing the same intent.
Taking the height as an example, there's the setHeight(String) method that expects a CSS definition such as 20px or 3.5em. This method is convenient to use of you want to set a hardcoded size directly from code.
The other approach splits up the size into a numerical size and a separate unit: setHeight(float, Unit), e.g. setHeight(20, Unit.PX). This method is more practical if you want to do calculations with the size, e.g. doubling it by using setHeight(2 * getHeight(), getHeightUnit()).
Setting and getting widths also work in exactly the same way.
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.
Native android SDK supports media files differentiation with drawable-x, where x is one of ldpi (low), mdpi (medium), hdpi (high), and xhdpi (extra high) paths for media.
Is there a way to control which media should be used for which kind of pixel-density?
You can access the the dpi, density, resolution etc. through the kivy.metrics module, which on android uses the values reported by the system. Once you have that, you can easily choose a different image source depending on its value, though I don't think there is a standard property or widget to point at.
I'm not really famililar with the mechanism and advantages of the normal java method here, but it would probably be quite easy to make something very similar in kivy. For instance, you could easily make your own image widget subclass that chooses a specific image of a certain size depending on the pixel density.
I'm working on adding custom captions to my iOS app that plays videos. I'd like to support all the features of CEA-708 (which are essentially rich-text captions), but I can't figure out how to apply the necessary edge-styles using a UILabel.
The image below shows the edge styles I want to support. However, I am struggling to find a way to achieve raised/depressed edges. Any ideas?
I don't think that those behaviors are expected in iOS. The only idea that I can suggest is to use two labels to achieve those effects, with different z-indexes and positions and colors to obtain the offset similar to the edge.
Otherwise, you can try to take a look to this link https://developer.apple.com/library/ios/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_shadows/dq_shadows.html.
I would like to create custom tabbar items similar to the ones shown here:
I assume these have to be designed and created first in Photoshop or a similar application. Are there any resources or tutorials available that demonstrate the creation of such items in Photoshop and how these are then used in MonoTouch?
Creating and bundling bitmaps is one option - and likely the most common one (for which googling should turn up several tutorials). Now in order to get optimal quality you need to supply multiple sets for the old iPhone/iPod, the newer retina iPhone/iPod, the iPad (1,2) and the retina iPad 3. This can takes a lot of space to cover each case with beautiful icons (or it won't look as good).
An alternative is to create the bitmaps at runtime, e.g. using the CoreGraphics API. This might seems counterproductive (and can surely be in many cases) but it has the advantage of requiring less (storage) space and/or getting better quality (see note).
Why ? because if you create them at runtime then you'll only create the ones for the specific device you're executing on. You can even cache them and re-create them when missing (e.g. if iOS flush your application cache).
If you're not an artist (and I'm not) you might want to look at easily licensable vector icons. The ones from your screenshot looks monochrome and could even use (bundle or extra the outlines from a) custom font - like the one provided by FontAwesome (CC BY 3.0) or similar sources.
Note: Maybe you noticed (I know I did) that some iPad applications looked beautiful (compared to others) on the iPad3 even if they were released months before the hardware become available. Vector graphics wins ;-)
UPDATE: Someone already made a script to convert the FontAwesome characters to iOS tab bar icons. However since it's done outside the app you'll need multiple versions of each bitmap to get the best look on every devices.