예제 #1
0
        void addGumpImage(List <AAtom> outHTML, List <string> openTags, List <HREF_Attributes> openHREFs)
        {
            ImageAtom atom = new ImageAtom(-1);

            atom.Alignment = getAlignmentFromOpenTags(openTags);

            if (openHREFs.Count > 0)
            {
                atom.HREFAttributes = openHREFs[openHREFs.Count - 1];
            }

            outHTML.Add(atom);
        }
예제 #2
0
        // pass bool = false to get the width of the line to be drawn without actually drawing anything. Useful for aligning text.
        unsafe void writeTexture_Line(List <AAtom> atoms, uint *rPtr, ref int x, int y, int linewidth, int maxHeight, ref int lineheight, bool draw)
        {
            for (int i = 0; i < atoms.Count; i++)
            {
                AFont font = TextUni.GetFont((int)atoms[i].Font);
                if (lineheight < font.Height)
                {
                    lineheight = font.Height;
                }

                if (draw)
                {
                    if (atoms[i] is CharacterAtom)
                    {
                        CharacterAtom atom      = (CharacterAtom)atoms[i];
                        ACharacter    character = font.GetCharacter(atom.Character);
                        // HREF links should be colored white, because we will hue them at runtime.
                        uint color = atom.IsHREF ? 0xFFFFFFFF : Utility.UintFromColor(atom.Color);
                        character.WriteToBuffer(rPtr, x, y, linewidth, maxHeight, font.Baseline,
                                                atom.Style_IsBold, atom.Style_IsItalic, atom.Style_IsUnderlined, atom.Style_IsOutlined, color, 0xFF000008);
                    }
                    else if (atoms[i] is ImageAtom)
                    {
                        ImageAtom atom = (ImageAtom)atoms[i];
                        if (lineheight < atom.Height)
                        {
                            lineheight = atom.Height;
                        }
                        Images.AddImage(new Rectangle(x, y + (lineheight - atom.Height) / 2, atom.Width, atom.Height),
                                        atom.Texture, GumpData.GetGumpXNA(atom.ValueOver), GumpData.GetGumpXNA(atom.ValueDown));
                        atom.AssociatedImage = Images[Images.Count - 1];
                    }
                }
                x += atoms[i].Width;
            }
        }