public CloudsEffectConfigDialog() { // Required for Windows Form Designer support InitializeComponent(); this.Text = CloudsEffect.StaticName; this.Amount1Label = PdnResources.GetString("CloudsEffect.ConfigDialog.ScaleLabel"); this.Amount1Minimum = 2; this.Amount1Maximum = 1000; this.Amount1Default = 250; this.Amount2Label = PdnResources.GetString("CloudsEffect.ConfigDialog.RoughnessLabel"); this.Amount2Minimum = 0; this.Amount2Maximum = 100; this.Amount2Default = 50; this.Icon = Utility.ImageToIcon(CloudsEffect.StaticImage); this.seedHeader.Text = PdnResources.GetString("CloudsEffect.ConfigDialog.SeedHeader.Text"); this.headerBlendMode.Text = PdnResources.GetString("CloudsEffect.ConfigDialog.BlendModeHeader.Text"); this.reseedButton.Text = PdnResources.GetString("CloudsEffect.ConfigDialog.ReseedButton.Text"); this.usageLabel.Text = PdnResources.GetString("CloudsEffect.ConfigDialog.UsageLabel"); // populate the blendOpComboBox with all the blend modes they're allowed to use foreach (Type type in UserBlendOps.GetBlendOps()) { this.comboBlendModes.Items.Add(UserBlendOps.CreateBlendOp(type)); } }
protected override void Render (ImageSurface src, ImageSurface dst, Gdk.Rectangle roi) { RenderClouds(dst, roi, Data.Scale, (byte)(Data.Seed ^ instanceSeed), Data.Power/100.0, PintaCore.Palette.PrimaryColor.ToColorBgra (), PintaCore.Palette.SecondaryColor.ToColorBgra ()); Type blendOpType = (Type)CloudsData.BlendOps[Data.BlendMode]; var blendOp = UserBlendOps.CreateBlendOp(blendOpType); if (blendOp != null) { blendOp.Apply (dst, roi.Location, src, roi.Location, dst, roi.Location, roi.Size); } }
public BitmapLayerPropertiesDialog() { // This call is required by the Windows Form Designer. InitializeComponent(); this._blendingHeader.Text = PdnResources.GetString("BitmapLayerPropertiesDialog.BlendingHeader.Text"); this.blendModeLabel.Text = PdnResources.GetString("BitmapLayerPropertiesDialog.BlendModeLabel.Text"); this.opacityLabel.Text = PdnResources.GetString("BitmapLayerPropertiesDialog.OpacityLabel.Text"); // populate the blendOpComboBox with all the blend modes they're allowed to use foreach (Type type in UserBlendOps.GetBlendOps()) { blendOpComboBox.Items.Add(UserBlendOps.CreateBlendOp(type)); } }
public void SetParameters(int scale, byte seed, double power, Type blendOpType, ColorBgra primaryColor, ColorBgra secondaryColor) { this.scale = scale; int intSeed = seed; this.power = power; this.seed = (byte)(intSeed ^ instanceSeed); this.blendOp = UserBlendOps.CreateBlendOp(blendOpType); this.primaryColor = primaryColor; this.secondaryColor = secondaryColor; if (this.blendOp is UserBlendOps.NormalBlendOp && primaryColor.A == 255 && secondaryColor.A == 255) { // this is just an optimization this.blendOp = null; } }
protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.scale = newToken.GetProperty <Int32Property>(PropertyNames.Scale).Value; int intSeed = newToken.GetProperty <Int32Property>(PropertyNames.Seed).Value; this.seed = (byte)(intSeed ^ instanceSeed); this.power = newToken.GetProperty <DoubleProperty>(PropertyNames.Power).Value; Type blendOpType = (Type)newToken.GetProperty <StaticListChoiceProperty>(PropertyNames.BlendOp).Value; this.blendOp = UserBlendOps.CreateBlendOp(blendOpType); if (this.blendOp is UserBlendOps.NormalBlendOp && EnvironmentParameters.PrimaryColor.A == 255 && EnvironmentParameters.SecondaryColor.A == 255) { // this is just an optimization this.blendOp = null; } base.OnSetRenderInfo(newToken, dstArgs, srcArgs); }
private UserBlendOp BlendModeKeyToBlendOp(PhotoshopFile.Layer layer) { UserBlendOp blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.NormalBlendOp)); switch (layer.BlendModeKey) { case "norm": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.NormalBlendOp)); break; case "dark": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.DarkenBlendOp)); break; case "lite": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.LightenBlendOp)); break; case "hue ": break; case "sat ": break; case "colr": break; case "lum ": break; case "mul ": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.MultiplyBlendOp)); break; case "scrn": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.ScreenBlendOp)); break; case "diss": break; case "over": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.OverlayBlendOp)); break; case "hLit": break; case "sLit": break; case "diff": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.DifferenceBlendOp)); break; case "smud": break; case "div ": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.ColorDodgeBlendOp)); break; case "idiv": blendOp = UserBlendOps.CreateBlendOp(typeof(UserBlendOps.ColorBurnBlendOp)); break; } return(blendOp); }