WPF style info from external text file - wpf

Not sure if this is possible, but I have a WPF application that now has a requirement to be skinnable.
Basically, this equates to several key colours and a couple of logos.
Is there any way of grabbing the hex values for the colours in defined styles from an external (ie comes with the application but isn't compiled) text/xml file?
I want to be able to select the colours, create the file and then deploy to the user with the application so that I don't have to maintain multiple versions.
I'm not even sure that this is the best way to achieve what i'm after.
Has anyone done anything akin to this?
I would be extremely grateful if someone could point me in the right direction.
Thanks

just hold the color values in a config file simple text file will suffice.
though you can use VisualStudio Resource file..
file will contain lines in each:
item_enum_name item_type item_value
for example:
main_screen_bg_color Color Black
company_logo URI \logos\logo1.jpg
and so on..
just load the file parse it and use bind to the values...

Related

How to insert a psd file into a separate LAYER of an already OPEN psd file APPLESCRIPT

I am trying to write a code that automizes a creation of a file. I need to insert another psd file as a separate layer into the one that the program is creating. I also need to adjust the size and position of the inserted file. The inserted file is psd. I am currently working in photoshop-cc15. I am working in AppleScript and need the solution in AppleScript as well. I am also working in Photoshop CC15
I have tried load and open commands, but for some reason photoshop does not see the file. I have checked the path of the file multiple times and it is definitely correct.
tell application "Adobe Photoshop CC 2015"
-- Create a new document.
set docRef to make new document with properties ¬
{width:5 as inches, height:6 as inches, resolution:300}
tell docRef
-- Unlock the background layer and fill it with gray color
set background layer of layer 1 of docRef to false
fill selection with contents {class:RGB color, red:200, green:200, blue:200}
-- Insert the first diamond into the file
set myPath to alias ¬
"Macintosh HD⁩/Users/⁨tikhonpachin/⁨Documents⁩/⁨Work⁩/⁨VK⁩/⁨Word of the Day/Diamond.psd"
load myPath
end tell
end tell
The expected result is a diamond inserted into my canvas as a separate layer. The diamond is the file that I want to insert. I also need to know how to adjust its properties, such as height, width and position on the canvas related to other layers. Thank you very much in advance!
First problem is that you're specifying the path incorrectly. Photoshop wants a POSIX path, and local POSIX paths never show the disk name. Further, you don't want/need to use the 'alias' keyword, which creates a different kind of path specifier. You should code the path like so:
set myPath to "⁩/Users/⁨tikhonpachin/⁨Documents⁩/⁨Work⁩/⁨VK⁩/⁨Word of the Day/Diamond.psd"
I have an ancient version of Photoshop (CS4) so terminology may have changed and features you have may not be available on my end. That being said, I don't see a way to load an image directly into a layer on another image. You'll probably have to create a new layer in your docRef document, open the diamond image in a separate window, then copy/paste or move the image across into the new layer. If you look at the Photoshop Scripting dictionary in Script Editor, you'll see that most of the image manipulation routines have the same names as they have in the the menus and panels: Resize image, rotate, scale, translate... It shouldn't be too difficult to figure out which you need to use.
If you have any more specific question, please feel free to ask, but toss-all questions like "I also need to know how to..." don't work well. It's like getting in the driver's seat, starting down the road, and then saying "Oh, can you also tell me how to avoid hitting other cars?" There's really no good answer to give to that kind of thing.

Adding an image (icon/symbol) into the font

Is there any way I can add images to the font I'm using?
I've been working on my card game (see link in my profile) and the symbols I use are a part of the language of the game. I want to be able to freely use my icons/symbols in my text to any program I use. Ultimately, I need to create a database and would need to put the text (that includes the icons/symbols) in an area of an app or website.
For the past 4 years, I've gotten away with manually inserting the symbols as pictures and shrinking them, but it's too inflexible for my plans.
The icons/symbols are full color vector images created in either Illustrator or Fireworks CS5 (my wife made them). The color is important as part of the symbol.
Thank you! hewhocomes
You should try font awesome: http://fortawesome.github.io/Font-Awesome/
It is a library of icons easy to use and install and you can change the color of the icons or any other attribute just as you would regular text using: color: #some-color.
I hope this helps.
Good luck!

how can i auto-generate sets of 3 colors (border, fill & text) that go together

I am trying to automatically generate a bunch of images all
containing a border, a fill and a text label within.
I am using a script to generate a svg file that I subsequently rasterize using batik
I'm looking for either
an algorithm to generate distinct color sets that go together
or a pre-canned set of colors that someone has put together
Pointers appreciated
I have used this online colour scheme generator for "quick fixes".
http://www.colorschemer.com/online.html
I came across sassafras that provides a good building block
https://github.com/teejayvanslyke/sassafras
and it references
http://www.tigercolor.com/color-lab/color-theory/color-theory-intro.htm
to help with color theory

How should I use .ico files in a Winforms Application?

I'm developing a WinForms c# 3.0 application. Our designer created quite a lot of .ico files containing all the needed art. The choice of .ico was made because quite often, the same image is needed in several places in different dimensions.
Now, it seems .ico files are really annoying to use in visual studio. The only way to use those images seems to be through images list (which aren't supported by all controls).
Compared to other resources, you can't write this :
foo.Image = global::RFQHUB.RFQHUBClient.Properties.Resources.foo; // Cannot implicitly convert type 'System.Drawing.Icon' to 'System.Drawing.Image'
Here are the options I'm considering :
create ImageLists of all possible sizes referencing all my icons in my main window. Link these ImageLists from other windows and find a way to export Image objects from the ImageList when I can't use it directly ; since ImageList contains a Draw() method, this should probably be possible.
convert all the x.ico I've got in several x16.gif ...x48.gif, and use those through resources.
I'd be interested to know if some people have been successfully using .ico resources in a Winform application. In so, how did you set up things ?
ICO isn't quite an obsolete format, but it's close. It's still useful for your application icon, but for almost everything else, it's better to use an ImageList for each size that you need. And it's much faster to populate an ImageList from a bitmap that contains multiple images layed out in a grid.
You also want to use an Alpha channel transparency in your bitmaps to get the best result, so storing them as .PNG files in your resources is the best way to go, since PNG supports an alpha channel. ICO and GIF files support only single bit for transparency - every pixel is either fully opaque or fully transparent. An 8 bit alpha channel for transparency looks much nicer.
If you can send your artist back to the drawing board then you should do so, and have him/her do full anti-aliased images with alpha. If you can't, then I suggest that you write a small program to convert all of your icon files into bitmaps suitable for loading into ImageLists.
Convert the images into PNG. Point. Whoever decided to use .ico files to start with should get talked to in private - the argument holds no ground.

Get path geometry from image

If i have a logo, let's say done as a jpg or even a png. Any suggestion for how I can use that to define a path geometry? It would be really good if any suggestions could be provided for how i can do it in blend.
Thanks
Yes - I just tackled this problem for an LOB application two days ago.
I can't offer advice for Blend (though I've read that it can be done in Expression Designer). However, the best free tool I've found for this is called InkScape (http://www.inkscape.org).
It's opensource, and while it's intended primarily for editing SVG vector-based images, it has two key features that are useful to us WPFers:
It can vectorize (i.e. "trace") raster images like bitmaps and jpegs, albeit not as well as one would hope, and
It can export the vector image as XAML
You'll invariably find that you get better results from loading vector formats (like SVG, EMF, WMF, etc) and saving to XAML, than if you try to convert a bitmap/jpeg... simply because the process of vectorizing a raster image is error prone at best. So if you want to bring a company logo into XAML, try to get hold of the source files used to create the logo (perhaps done in Illustrator?) and import that into InkScape.
If this post is helpful, please be kind and give it a one-up.
Jasema is a terrific tool right for the job.
Also, don't be shy to use Blend - it is somewhat more difficult to use (drawing shapes using pen) but it gets easier pretty fast. Switch on gridlines and optionally snap to them for good results.
What both Jasema and Blend are lacking, is the ability to easily create shapes with a central symmetry (like stars), so I took parts from Jasema and created my own tool (named Radius) that works a bit like a combination of a ruler and compass.
I have a good idea but you're png, bmp, jpg or other non vector file is must be very simple because we need best scan results and only use inkscape.
Step: Drag and drop your file workspace on Inkscape, download free.
Tip: If your image is color white, Top menu item File->Document Properties-> heck Checkerboard Background and if you want uncheck Page border show.
Step: Top menu item Path-> Trace Bitmap-> Mode check what you want property, i usually use color property and if your file is png check Remove Background then click OK, then wait again Ok button is Enable and close window.
Step: Now you have a two layer, top layer vektor file and bottom layer your file. Select vector file and top menu item Edit-> XML Editor-> select svg path and look side column, d name propery in your data path value.
But this method may not always work or may not give the desired results and draw your own shapes with the scape so you can get the path data from the XML editor.
Example, my first tests this like:
and after working on it some more:
I've solved my problem (export an image as XAML) using Microsoft Expression Design 4 (Free Version). I've downloaded from the link
http://www.microsoft.com/en-us/download/confirmation.aspx?id=36180
As input, I had Adobe Ilustrator files.
Adobe Illustrator / CorelDraw is perhaps the best tool out there for these operations that I have used.
Personally, I prefer illustrator for on-screen media. These tracings can be exported into several formats such as EPS, SVG, AI, or even XAML (with this plugin)
Best of Luck !!!!
I have recently been struggling with this myself. I had a set of icons done in data and needed to update them to look nicer.
I tried everything, manually typing them out. drawing in svg, converting svg to xaml.
in the end i found a list of open source icons from google material icons.
I then used this to convert from the svg files to data
https://github.com/BerndK/SvgToXaml
It works well but not for the icons i drew myself.
I decided to place all the icons data i convert into an app i built myself that will give you the data and a preview of the icon. feel free to use and contribute. I will keep updating as much as i can.
https://github.com/sgreaves1/XamlIcons
Convert your image from png to svg in online converter, then drop file into this site http://inloop.github.io/svg2android/ and you will see pathData of your image like below shown in my image.

Resources