Esempio n. 1
0
	/// <summary>
	/// Flood fill the specified block on the specified texture using the specified color
	/// </summary>
	/// <param name="tex">
	/// A <see cref="Texture2D"/>
	/// </param>
	/// <param name="x">
	/// A <see cref="System.Int32"/>
	/// </param>
	/// <param name="y">
	/// A <see cref="System.Int32"/>
	/// </param>
	/// <param name="width">
	/// A <see cref="System.Int32"/>
	/// </param>
	/// <param name="height">
	/// A <see cref="System.Int32"/>
	/// </param>
	/// <param name="col">
	/// A <see cref="Color"/>
	/// </param>
	/// <param name="apply">
	/// A <see cref="ApplyMode"/>
	/// </param>
	public static void FloodFill(Texture2D tex, int x, int y, int width, int height, Color col, ApplyMode apply)
	{
		int size = width*height;
		Color[] colors = new Color[size];
		for (int i=0; i<size; i++) colors[i] = col;
		tex.SetPixels(x, y, width, height, colors);
		if (apply==TextureHelpers.ApplyMode.Apply) tex.Apply();
	}
        /// <summary>
        /// Sets the selector tree store.
        /// </summary>
        private void VerifyConfigurators()
        {
            // Go through the tree store and make sure the settings are
            // correct and that we don't have a conflict with the buttons. We
            // use a delegate to avoid creating a member variable.
            ApplyMode?localApplyMode = null;

            SelectorTreeStore.Foreach(
                delegate(TreeModel model,
                         TreePath path,
                         TreeIter iter)
            {
                // Pull out the configurator which may be null.
                var configurator = (IGtkConfigurator)model.GetValue(iter, 2);

                if (configurator == null)
                {
                    // Continue parsing through the store.
                    return(false);
                }

                // Add the configurator to the list.
                configurators.Add(configurator);

                // Get the apply mode and look for conflicts with the
                // other existing configurators.
                ApplyMode configuratorApplyMode = configurator.ApplyMode;

                if (!localApplyMode.HasValue)
                {
                    localApplyMode = configuratorApplyMode;
                }

                if (localApplyMode.Value != configuratorApplyMode)
                {
                    throw new InvalidOperationException(
                        string.Format(
                            "Cannot add configurator \"{0}\" because of a conflicting apply mode of {1}.",
                            configurator.HierarchicalPath,
                            configurator.ApplyMode));
                }

                // Continue parsing through the store.
                return(false);
            });

            // If we don't have an apply mode at this point, we didn't get a
            // configurator.
            if (!localApplyMode.HasValue)
            {
                throw new InvalidOperationException(
                          "Cannot verify without at least one configurator in the tree store.");
            }

            // Set the apply mode, which is used with the initialization.
            ApplyMode = localApplyMode.Value;
        }
        private void applyAllToolStripMenuItem_CheckedChanged(object sender, EventArgs e)
        {
            if (!MuteEvents)
            {
                MuteEvents = true;
                string            title = "";
                ToolStripMenuItem item  = sender as ToolStripMenuItem;

                if (!item.Checked)
                {
                    item.Checked = true;
                }
                else
                {
                    switch (item.Name)
                    {
                    case "applyIgnoringSelectionToolStripMenuItem":
                        title = "(ignore selection)";
                        applyOnSelectionToolStripMenuItem.Checked = false;
                        applyAllToolStripMenuItem.Checked         = false;

                        mode = ApplyMode.IgnoreSelection;
                        break;

                    case "applyOnSelectionToolStripMenuItem":
                        title = "(on selection)";
                        applyIgnoringSelectionToolStripMenuItem.Checked = false;
                        applyAllToolStripMenuItem.Checked = false;
                        mode = ApplyMode.OnSelection;
                        break;

                    default:
                        title = "(all)";
                        applyIgnoringSelectionToolStripMenuItem.Checked = false;
                        applyOnSelectionToolStripMenuItem.Checked       = false;
                        mode = ApplyMode.All;
                        break;
                    }

                    applyToolStrip.Text = title;
                }

                MuteEvents = false;

                if (ModifierKeys == Keys.Shift)
                {
                    applyToolStrip.ShowDropDown();
                }
            }
        }
Esempio n. 4
0
        public NiTexturingProperty(NiFile niFile) : base(niFile)
        {
            var flags = niFile.Reader.ReadInt16();

            applyMode = (ApplyMode)niFile.Reader.ReadInt32();
            var textureCount = niFile.Reader.ReadInt32();

            textureDescriptions = new TexDesc[textureCount];
            for (var i = 0; i < textureDescriptions.Length; i++)
            {
                var hasTexture = niFile.Reader.ReadInt32() != 0;
                if (hasTexture)
                {
                    textureDescriptions[i] = new TexDesc(niFile);
                }
            }
        }
Esempio n. 5
0
    public static void SetupMaterialWithApplyMode(Material material, ApplyMode mode)
    {
        switch (mode)
        {
        case ApplyMode.Base:
            material.EnableKeyword(DY_SKY_MATCAP_BASE);
            material.DisableKeyword(DY_SKY_MATCAP_MASK);
            material.DisableKeyword(DY_SKY_MATCAP_MASK_BLEND);
            break;

        case ApplyMode.Mask:
            material.DisableKeyword(DY_SKY_MATCAP_BASE);
            material.EnableKeyword(DY_SKY_MATCAP_MASK);
            material.DisableKeyword(DY_SKY_MATCAP_MASK_BLEND);
            break;

        case ApplyMode.MaskBlend:
            material.DisableKeyword(DY_SKY_MATCAP_BASE);
            material.DisableKeyword(DY_SKY_MATCAP_MASK);
            material.EnableKeyword(DY_SKY_MATCAP_MASK_BLEND);
            break;
        }
    }
Esempio n. 6
0
            /*  ConfigOptions
             *      -----------------------------------------------------------------------------------------------*/

            /// <summary>
            ///
            /// </summary>
            public virtual StoreParameter.Builder ApplyMode(ApplyMode applyMode)
            {
                this.ToComponent().ApplyMode = applyMode;
                return(this as StoreParameter.Builder);
            }
            /*  ConfigOptions
             *      -----------------------------------------------------------------------------------------------*/

            /// <summary>
            ///
            /// </summary>
            public virtual TBuilder ApplyMode(ApplyMode applyMode)
            {
                this.ToComponent().ApplyMode = applyMode;
                return(this as TBuilder);
            }
 /// <summary>
 ///     Creates an TSQL Apply statement
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="query">The query.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="innerText">The inner text.</param>
 /// <returns></returns>
 public static ElementProducer <T> Apply <T>(this ElementProducer <T> query,
                                             ApplyMode mode,
                                             Func <RootQuery, IQueryBuilder> innerText)
 {
     return(new ElementProducer <T>(new RootQuery(query.QueryText(mode.ApplyType)).InBracket(innerText), query.CurrentIdentifier));
 }
 /// <summary>
 ///     Creates an TSQL Apply statement
 /// </summary>
 /// <param name="query">The query.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="innerText">The inner text.</param>
 /// <returns></returns>
 public static RootQuery Apply(this RootQuery query,
                               ApplyMode mode,
                               Func <RootQuery, IQueryBuilder> innerText)
 {
     return(new RootQuery(query.QueryText(mode.ApplyType).InBracket(innerText)));
 }
 public void SetMode(ApplyMode mode)
 {
     _manager.SetMode(mode);
 }
Esempio n. 11
0
	/// <summary>
	/// Flood fill the specified texture with the specified color
	/// </summary>
	/// <param name="tex">
	/// A <see cref="Texture2D"/>
	/// </param>
	/// <param name="col">
	/// A <see cref="Color"/>
	/// </param>
	/// <param name="apply">
	/// A <see cref="ApplyMode"/>
	/// </param>
	public static void FloodFill(Texture2D tex, Color col, ApplyMode apply)
	{
		FloodFill(tex, 0, 0, tex.width, tex.height, col, apply);
	}
Esempio n. 12
0
 public virtual void ApplyActions(List <TK_Action> inActions, double inFrame, ApplyMode inMode, double inRetime)
 {
 }