Ejemplo n.º 1
0
        /*public TextLayer (Size size) : this(size.Width, size.Height) {
         * }*/

        /// <summary>
        /// Appends a TextMap to this TextLater
        /// </summary>
        /// <returns>True if the map had to be clipped</returns>
        /// <param name="map">TextMap.</param>
        /// <param name="applyMode">Apply mode.</param>
        /// <param name="appendSpaces">If set to <c>true</c> append spaces.</param>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        /// <param name="width">Width.</param>
        /// <param name="height">Height.</param>
        public bool AppendMap(TextMap map, TextMapApplyMode applyMode, bool appendSpaces, int x, int y, int width, int height)
        {
            TextMap subj       = map.Clip(width, height);
            bool    forcedClip = false;

            char[][] data = Data;
            for (int i = x; i < width; i++)
            {
                int k = i - x;
                for (int j = y; j < height; j++)
                {
                    int l = j - y;
                    try {
                        if (!appendSpaces && subj.Data[k][l] == ' ')
                        {
                            continue;
                        }
                        if (applyMode == TextMapApplyMode.OverwriteAll)
                        {
                            data[i][j] = subj.Data[k][l];
                        }
                        else if (applyMode == TextMapApplyMode.OverwriteSpacesOnly && data[i][j] == ' ')
                        {
                            data[i][j] = subj.Data[k][l];
                        }
                        else if (applyMode == TextMapApplyMode.OverwriteCharsOnly && data[i][j] != ' ')
                        {
                            data[i][j] = subj.Data[k][l];
                        }
                    }
                    catch (ArgumentOutOfRangeException) {
                        forcedClip = true;
                        continue;
                    }
                }
            }
            Data = data;
            return(forcedClip);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Appends a TextMap to this TextLater
 /// </summary>
 /// <returns>True if the map had to be clipped</returns>
 /// <param name="map">TextMap.</param>
 /// <param name="applyMode">Apply mode.</param>
 public bool AppendMap(TextMap map, TextMapApplyMode applyMode)
 {
     return(AppendMap(map, applyMode, false));
 }
Ejemplo n.º 3
0
        /*
         * public bool AppendMap(TextMap map, TextMapApplyMode applyMode, bool appendSpaces, Rectangle rect) {
         *      return AppendMap (map, applyMode, appendSpaces, rect.Location, rect.Size);
         * }
         */

        /// <summary>
        /// Appends a TextMap to this TextLater
        /// </summary>
        /// <returns>True if the map had to be clipped</returns>
        /// <param name="map">TextMap.</param>
        /// <param name="applyMode">Apply mode.</param>
        /// <param name="appendSpaces">If set to <c>true</c> append spaces.</param>
        public bool AppendMap(TextMap map, TextMapApplyMode applyMode, bool appendSpaces)
        {
            return(AppendMap(map, applyMode, appendSpaces, 0, 0, map.Size.Width, map.Size.Height));
        }
Ejemplo n.º 4
0
        /*public bool AppendMap(TextMap map, TextMapApplyMode applyMode, bool appendSpaces, Point point, Size size) {
         *      return AppendMap (map, applyMode, appendSpaces, point.X, point.Y, size.Width, size.Height);
         * }*/

        /*
         *  public bool AppendMap(TextMap map, TextMapApplyMode applyMode, bool appendSpaces, Point point) {
         *          return AppendMap (map, applyMode, appendSpaces, point, map.Size);
         *  }*/

        /// <summary>
        /// Appends a TextMap to this TextLater
        /// </summary>
        /// <returns>True if the map had to be clipped</returns>
        /// <param name="map">TextMap.</param>
        /// <param name="applyMode">Apply mode.</param>
        /// <param name="appendSpaces">If set to <c>true</c> append spaces.</param>
        /// <param name="x">The x coordinate.</param>
        /// <param name="y">The y coordinate.</param>
        public bool AppendMap(TextMap map, TextMapApplyMode applyMode, bool appendSpaces, int x, int y)
        {
            return(AppendMap(map, applyMode, appendSpaces, x, y, map.Width, map.Height));
        }