3-Colored Sliced Squares

If you color sliced squares with up to three colors at the three sides you get 3^3=27 different pieces. If you are allowed to flip them you have only 18 distinct pieces. With this set it's possible to fill various polygons. The colors at touching sides must match and all sides at the border must have the same color.
In the following applet some patterns are given to solve. Move the pieces by drag&drop, rotate them by a left mouse click and flip them by a right one.