Changing color of an image - at runtime - wpf

Im going to make a new application for a car dealership. They basically want a WPF/silverlight application where one can slect a car (model) and then via a color palette choose the color of the car (from predefined colors). They also need to be able to different kind of rims, headlights and interior.
what is the best/easiest approach for this. Been thinking on having all the different images and then just swap them out when the selection changes. This, however has the potentional problem of all images with all combinations does not exist (eg. a red VW, metallic rims, white leather interior) etc.
Is there any other approach to this? replacing colors? Having a basic model and then copying the "body" of the car on top, copy rims on top etc. and then just having to enable/disable a particular "layer" of the images?

I would do this by using different layers: the basic model with the car's color as translucent part, on top of this pictures with the different add-ons, the background color is the car's color. The trick is to fit everything together that it looks good.
Depending on the color (maybe you want to have shadows or chrome effects), you could have one model's picture for each color, and then add the add-ons and the interior on top of this.

Related

How to go about changing the tint color of an image?

Sorry for the vague title, I have no idea how to really ask this question to be honest so I'll describe what I'm trying to do
I'm attempting to make an app where users can change the colors of different parts of a car. They can change the door for instance to a green as shown, or any other color they wish. They would then be able to change the color of the hood, or the roof, etc.
I've thought about having seperate images for each component and then lining them up to match. However this seems practically impossible when it comes to different screen sizes and scales. I also thought about making a blanket white image, and then creating views over the top with the selected color.
Does anyone have any ideas how I could possibly approach this?
Thankyou
I dont know about the performance of this. But, how about, an overlay of the different parts of the car, but using the same size of the whole car. For example, you have the image of the whole car, and erase all but the door. In other image, you erase all but the hood. If you lay one image above another, it will make the whole car, and the size of the screen will not affect you, because all the images will have the same size.
Then you can use the tint style to change the color of each layer.

How to interpolate between colors for a polygon in Bing Maps

I have a WPF application with the Bing Maps API. What I have is a polygon rendering on many countries as well as real time statistics being display. I'm using this to keep track of where my server traffic is mainly coming from. The project is coming along nicely, but I hit a small roadblock. What I have are polygons that go from green to red and vice versa if there is a change in the statistics. If someone logs off then it would go into the green, if someone logged on it would go into the red. What I'd like to do is given a set number of users, let's say 20, I can gradually change the colors over a period of a second.
An example is 0 would be green and 20 would be red. So 10 would be yellow. With this, is there a way to gradually change colors?
Thanks in advance
There might be a fancy way of doing what you are looking for in xaml, but I imagine it would be a lot easier to to just have the color of the polygon bound to a property in your viewmodel/code-behind and then update the color whenever necessary.
For color interpolation, there is another SO question on it here.

Displaying a user-customized part on a web site

I'm building a web site (asp.net) for a company that manufactures small customizable anodized aluminum products. Products are a variety of shapes. but mostly flat, domed or ring-shaped. Products can be colored in one of about 15 colors.
The user can specify one or more lines of text and a font, a simple line drawing (e.g., a heart or four-leafed clover), or both. Text is limited to about 5-15 characters per line. The text or drawing is milled into the part and can be colored in a contrasting color.
What I want to do is display the customized product to the user, so that after selecting product, colors, text,, font and artwork the site will display an image of how the finished product will look. Ideally they would be able to rotate the image but that's not critical.
I have digital descriptions (CAD and CNC milling instructions) of all the parts, fonts, and artwork and can translate them into whatever format is needed.
Can this be done with Flash, SilverLight, or some similar technology? Ideas, references, suggestions, and tutorials welcome! Thanks
It can be done in Flash, but it requires a lot of work:
To get a realistic version of the product displayed, you have to produce pictures, videos and whatever other depictions of all possible shapes and colors of your product, then you simply have to switch between those depending on the user's choice.
Adding the writing is a bit trickier when the surface isn't flat, but you can model a dome or ring-shaped surface with 3D polygons and add the text as an image texture.
It is best to have a set of standard views, maybe 4 or 5 angles, so that you only have to figure each position out once for each similar shape, and afterwards you can just copy the positioning etc.

WPF Colour Picker/Wheel with Multiple Selection

I am looking for a free WPF Colour Picker/Wheel which has the ability to allow multiple colour selections. Does anything like this exist. The ones I have seen allow only one colour to be selected. I want to be able to easily select two or three colors.
Take a look at color wheel for silverlight (you can adapt it for wpf): http://asyrovprog.host22.com/colorwheel.html. Source code is located here: timeline.codeplex.com.

WPF Custom Draw Multiple Progress Bar

In processing a group of items, I wanted to display a unified image of the status of the group, so I essentially made a Grid of a number of progressbars with transparent backgrounds and various colored foregrounds all at the same cell.
I'm running into some transparency artifacts (purple bar is actually purple under the green, and sometimes it draws over the top, etc) and it just seems a bit wasteful. So, I decided to make my own, but now I've got a bit of paralysis on how to do it. Do I use the DrawingContext in FrameworkElement's OnRender, or is there something simpler? Is there a set of general rules when it comes to making your own control?
I pondered switching to a pie chart since those are easy to come by, but its high time I did something not off-the-shelf.
Thanks!
I'm not quite sure how you intend the progressbar to combine different progresses, but if say the furthest along progress is at the bottom of the z-index and the least along progress is at the top, then I'd do something on the lines of this:
1) I would probably create a user control for this new progresbar.
2) It would have a property called NumberOfProgresses, that is tied with an array containing status of said progresses.
3) Each progress would be represented by a Border item (or perhaps something more suitable up the visual tree), because it's a simple wpf control with a background property. The background property would be set to nice a looking progress style and the progress color can be bound in the style to say the border's borderbrush property. Making it easy to set the color of the progress.
4) The user control would have a method UpdateProgress which takes the percentage value and the index of the progress in the array as parameters.
5) As progresses are updated you can either, just calculate the appropriate width (user control actual width * percentage) for the border and play around with the Z index to get it displayed at the top/bottom, or stack the borders horizontaly, set the least along progress as first, then for the rest of the progresses you'd have to substract previous progresses lengths to get the same effect.
This way there would be no transparency induced artifacts and no OnRender()...
Mind you, in WPF there should be no reason to mess with OnRender this and OnRender that, like it was required in WinForms with OnPaint.
Just set up the elements via code to get the look you want, and let WPF do it's rendering ;)
I can imagine one problem with this user control though. You'd have to provide feedback to the user as to which color belongs to which progress. But that would probably take you back to square one, meaning it's better/simpler to just display multiple progressbars.

Resources