Metro App StorageFile GetThumbnailAsync Background - windows-runtime

In a Metro App, when retrieving the Thumbnail of a StorageFile using the GetThumbnailAsync() method, the Background Color is a Dark Blue/Navy Blue.
Is it possible to override this Color? I would like the Background to be Transparent.

From the documentation,
The thumbnail is an icon on a background of appropriate size. The background color is determined by the app that is associated with the file.
Combined with the following note:
Note If the associated app is a Windows Store app, the app's tile background color is used.
If your app has an association with the file, just make sure your apps Background color is Transparent (not 100% sure you can do that, actually).
The other option is to use something like WriteableBitmapEx to find every pixel of the tile color, then turn those pixels to Transparent. Shouldn't be too absolutely terrible, but will have an overhead (naturally).
Hope this helps and Happy Coding!

Related

How to Blur background behind the UI only unreal 5

I'm new to Unreal game engine,but have some idea about how things works. I recently working on an archviz project and want to add some UI blur effect behind the UI element only. Here are some reference video that I'm talking about. I can't upload screen shot because there are some server problem while uploading photos.
https://youtu.be/bOQAAE2Hfhs
You should use the UMG Background Blur widget: https://docs.unrealengine.com/5.0/en-US/using-the-background-blur-widget-in-unreal-engine/

iOS7 tint color only works after presenting and dismissing another ViewController

I'm having a very odd problem with tint color in iOS7.
When the ViewController that I'm having trouble with first loads, all of the tint is a light gray color, as if everything is inactive or behind a UIAlertView that has dimmed the screen. The buttons are still active and work just fine, but they are all gray. (I have the tint color set to orange, more on that in a bit).
Here's the odd part. If I present, and then immediately dismiss another ViewController, all of the orange tint appears and everything works as expected. That is the only way I have been able to get the tint to appear - nothing else seems to work.
I'm using the same basic code patterns throughout the app, and this problem really only affects one ViewController. This particular ViewController is presented UIModalPresentationFullScreen, and UIModalTransitionStyleCoverVertical, if those matter at all.
Here's how I'm setting tinting:
First, I have set a tint color on each view controller within interface builder, these settings are the same across both working and problematic VCs.
Next, I have set a tint color globally in my App Delegate like this:
[_window setTintColor:[UIColor orangeColor]];
The above two work on most of my ViewControllers, but not on all of them for some reason. For the ones that it was not working on, I've been using a handful of different techniques to get the tint color to work. For example:
self.view.tintColor = [UIColor orangeColor];
or
[_myUIBarButtonItem setTitleTextAttributes:
[NSDictionary dictionaryWithObject:[UIColor orangeColor]
forKey:NSForegroundColorAttributeName]
forState:UIControlStateNormal];
or to force a tintColor update:
[_myButtonOutlet setTitleColor:_cancelButtonOutlet.tintColor
forState:UIControlStateNormal];
Any ideas?
In iOS7, there are different tint behaviors you can choose from depending on what you want.
All you need to do is adjust the window's tintAdjustmentMode property to Normal in didFinishLaunching in app delegate.
self.window.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;

Windows Phone 8 tile doesn't show correct image

Does anyone know why my Win Phone 8 app tile doesn't show the icon I set? This is what I get (and yes, am am sure that's not my app's icon):
This is what I have so far and I ran out of ideas of what can be wrong:
The small icon is a png of 110x110
The medium icon is a png of 202x202
Both images have the build Type = Content
Both images have the copy to output property = Copy if newer
The application icon is the same as the small icon and it shows alright in the program list.
Here is a part of my app's manifest:
<TemplateIconic>
<SmallImageURI IsRelative="true" IsResource="false">Assets\Icons\AppIcon_small.png</SmallImageURI>
<Count>0</Count>
<IconImageURI IsRelative="true" IsResource="false">Assets\Icons\AppIcon_medium.png</IconImageURI>
<Title>
</Title>
<Message>
</Message>
<BackgroundColor>
</BackgroundColor>
<HasLarge>false</HasLarge>
<LargeContent1>
</LargeContent1>
<LargeContent2>
</LargeContent2>
<LargeContent3>
</LargeContent3>
<DeviceLockImageURI IsRelative="true" IsResource="false">
</DeviceLockImageURI>
</TemplateIconic>
If you use TemplateIconic tile the images need to be transparent icons as outlined in Iconic Tile template for Windows Phone 8 because it is just going to end up being a white icon inside a tile. Your image appears as a white square because it does not have any transparency. With the images you have, you would want to use the TemplateFlip tiles and adjust the size of your tiles accordingly.
I had the same problem.
After a lot of brainstorming I tried this and woah it worked!
Check if the image you are setting has a white (or other) background color. If it has, remove the background from the image using Photoshop(Tool: magic eraser) and keep the background transparent.
Replace this transparent background image and it will show up in emulator!
Hope this works at ur end too! :)
Did you look at the manifest file? You can choose the images in that file. I mean using the UI in the studio, open the manifest file and choose the image.
According to Iconic Tile sizing info in Iconic Tile template for Windows Phone 8, both small icon and medium icon must be design with transparent background.
The small icon is a png of 70x110
The medium icon is a png of 130x202
If you need to set the background color, set the BackgroundColor in WMAppManifest.xml as follow.
<BackgroundColor>[hex ARGB format color]</BackgroundColor>
I work with Xamarin.Forms (Shared) for my WP-app and also had problems to implement the Tile in the WP-part of my project.
To set the background to transparent to the tile image have done the job.
But I have used images with 158x158 and 336x336 what also works and allows to use the standard-icon (in a higher resolution) what - I think - most users want to do.
I have created a short description for all visitors, who use XF for WP-development (including app-icon, splash-screen and Tile).
How to add app-icon, splash-screen and Tile in a WP 8.0 XF-project

Choosing right live tile type

I'm a bit confused about what kind of tile I should choose to make my scenario work.
Scenario is as follows: my application supports small and medium tiles. By default in both these modes it shows an app icon on transparent background but user can choose a particular image to be a tile cover. When tile is covered with image I don't want it to flip or move - just a static image with app name on top of it.
I've tried TemplateCycle with app icon as default and user's selected image as an alternative but cycle tile moves these images up and down all the time and I don't want that. I've was considered TempalteIconic but it turned out it only supports images with transparent background so no option for user's image. So what kind of tile should I choose?
Use a normal fliptile but don't set anything(text, image) on the back. It won't flip if you do that.

How to capture an image of an HTML element, and maintain transparency?

I'm working on a page that will allow a webmaster to add styles to their twitter feed. Several of these styles use transparency in their display. I want to create a list of images for them to choose from. Currently I am taking screenshots on a checked background such as this:
But that isn't really what I want.
Is their some method of capturing an image of an HTML element, and maintaining the transparency?
EDIT: I'm just digging into this, so I'm coming across new topics, such as HTML5 Canvas, and -moz-element. Is it possible to set a canvas background to the html element using -moz-element, then extract the image data from the canvas? I'm going to try this unless someone who's 'been there done that' heads me off.
EDIT: The -moz-element and canvas was a deadend. -moz-element will set the item as a background, but will not allow you to save background image. And canvas doesn't save its background, even when the background is a normal image.
It requires a little bit of work, but it is doable, as long as it's HTML you're laying out. You can't recover the transparency of markup in pages you've downloaded without saving those pages and editing them locally. By rendering the HTML elements multiple times, on different background colors, the opacity can be derived using an image editor. You're going to need a decent image editor, I use GIMP.
Render the elements you want to save three times, on a black, a white and a neutral gray background(#888).
Using a screen capture program, capture those displays and crop them to the exact same areas.
In GIMP open those images as layers and order them black, white and gray, top to bottom.
Set the top, black layer to difference mode. This will give a grayscale difference between the black and white layers.
Merge down the top layer. This will leave us with two layers. The gray background layer and the grayscale difference. Invert the colors of the difference layer, and copy it to the clipboard.
Add a layer mask to the gray background layer and paste the clipboard into the layer mask.
Delete the grayscale layer and apply the layer mask on the gray background layer. That should leave one layer with opacity similar to the original.
The opacity is off by a bit, but if we duplicate the layer and merge it with itself, it's right in the ballpark.
It's probably not pixel perfect, but it is proof of concept. Opacity of HTML markup can be captured.
Using Puppeteer makes this much easier to do. It runs a web-page in-memory.
Start a local fileserver - python -m SimpleHTTPServer 8080
Then this script should do the trick:
const puppeteer = require('puppeteer')
;(async () => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('http://localhost:8080/index.html', {
waitUntil: 'networkidle0'
})
const elements = await page.$('body')
await page.evaluate(() => (document.body.style.background = 'transparent'))
await elements.screenshot({ path: 'myImg.png', omitBackground: true })
await browser.close()
})()
the docs for .screenshot() are here.
What you'd need is a web browser that can render into an image buffer in memory instead of the screen.
My guess is that all browsers can do this (that should be part of the renderers) but I'm not aware of any browser where you can access this function, at least not from JavaScript.
If you download the WebKit sources, there should be test cases which do something like that :-/
No, there's no software that will allow you to take screenshots and preserve the transparency of individual visual elements as a transparent spot in the image, because that's not how a screenshot works - screenshots are WYSIWYG, by definition, all elements in your screenshot will always have a non-transparent background.
I think your best bet here is to recreate the desired portion as an image, where you can control the transparency normally. It's not the best solution, but if you're doing this a lot with the same kinds of things, it will be much faster for you rather than cropping/editing screenshots.