Esempio n. 1
0
        public void printColor(RgbColor rgbColor)
        {
            string hexColor = "#" + rgbColor.red.ToString("X2") + rgbColor.green.ToString("X2") + rgbColor.blue.ToString("X2");

            HexColor hex = new HexColor(hexColor, 0);

            this.Printer.printColor(hex);
            Console.WriteLine(hexColor);
        }
Esempio n. 2
0
        public void Run()
        {
            OldColorPrinter printer  = new OldColorPrinter();
            HexColor        hexColor = new HexColor("#00ff00", 50);

            printer.printColor(hexColor);
            RgbColor rgbColor = new RgbColor(85, 255, 132);

            // UTWORZ ADAPTER I ODKOMENTUJ PONIZSZY KOD
            // Nazwa klasy adaptera to - RgbOldPrinterAdapter
            // Prosze wyslac tylko klase adaptera na e-wsei

            IPrintable adapter = new RgbOldPrinterAdapter(printer);

            adapter.printColor(rgbColor);
        }
Esempio n. 3
0
 public void printColor(HexColor hexColor)
 {
     Console.WriteLine(hexColor.value + " with alpha: " + hexColor.alpha);
 }