Esempio n. 1
0
 public void add_text(string text, text_justify line_justify, rgb_t fgcolor, rgb_t bgcolor, float size = 1.0f)  //void add_text(std::string_view text, text_justify line_justify, rgb_t fgcolor = rgb_t::white(), rgb_t bgcolor = rgb_t::transparent(), float size = 1.0)
 {
     add_text(text, line_justify, new char_style()
     {
         fgcolor = fgcolor, bgcolor = bgcolor, size = size
     });
 }
Esempio n. 2
0
        //-------------------------------------------------
        //  render_triangle - render a triangle that
        //  is used for up/down arrows and left/right
        //  indicators
        //-------------------------------------------------
        static void render_triangle(bitmap_argb32 dest, bitmap_argb32 source, rectangle sbounds, object param)  //void *param)
        {
            int halfwidth = dest.width() / 2;
            int height    = dest.height();

            // start with all-transparent
            dest.fill(new rgb_t(0x00, 0x00, 0x00, 0x00));

            // render from the tip to the bottom
            for (int y = 0; y < height; y++)
            {
                int        linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height;
                PointerU32 target    = dest.pix(y, halfwidth); //uint32_t *const target = &dest.pix(y, halfwidth);

                // don't antialias if height < 12
                if (dest.height() < 12)
                {
                    int pixels = (linewidth + 254) / 255;
                    if (pixels % 2 == 0)
                    {
                        pixels++;
                    }
                    linewidth = pixels * 255;
                }

                // loop while we still have data to generate
                for (int x = 0; linewidth > 0; x++)
                {
                    int dalpha;

                    if (x == 0)
                    {
                        // first column we only consume one pixel
                        dalpha    = std.min(0xff, linewidth);
                        target[x] = new rgb_t((uint8_t)dalpha, 0xff, 0xff, 0xff);  //target[x] = rgb_t(dalpha, 0xff, 0xff, 0xff);
                    }
                    else
                    {
                        // remaining columns consume two pixels, one on each side
                        dalpha    = std.min(0x1fe, linewidth);
                        target[x] = target[-x] = new rgb_t((uint8_t)(dalpha / 2), 0xff, 0xff, 0xff);  //target[x] = target[-x] = rgb_t(dalpha / 2, 0xff, 0xff, 0xff);
                    }

                    // account for the weight we consumed
                    linewidth -= dalpha;
                }
            }
        }
Esempio n. 3
0
File: text.cs Progetto: kwanboy/mcs
        public void add_text(string text, rgb_t fgcolor = null, rgb_t bgcolor = null, float size = 1.0f)  // fgcolor = rgb_t.white, rgb_t bgcolor = rgb_t.transparent
        {
            if (fgcolor == null)
            {
                fgcolor = rgb_t.white();
            }
            if (bgcolor == null)
            {
                bgcolor = rgb_t.transparent();
            }


            // create the style
            char_style style;

            style.fgcolor = fgcolor;
            style.bgcolor = bgcolor;
            style.size    = size;

            // and add the text
            add_text(text, style);
        }
Esempio n. 4
0
        //virtual ~menu_dats_view() override;


        public static void add_info_text(text_layout layout, string text, rgb_t color, float size = 1.0f)
        {
            throw new emu_unimplemented();
        }
Esempio n. 5
0
 public void add_text(string text, text_justify line_justify, rgb_t fgcolor)
 {
     add_text(text, line_justify, fgcolor, rgb_t.transparent());
 }
Esempio n. 6
0
 public void add_text(string text, rgb_t fgcolor)
 {
     add_text(text, fgcolor, rgb_t.transparent());
 }