private double R2; // def: 0.1 public Background0001(string discJacketFile, double r1 = 0.2, double r2 = 0.1) { this.DiscJacket = new Canvas2(discJacketFile); this.BluredDiscJacket = PictureUtils.Blur(this.DiscJacket, 5); // 要調整 this.MarginedDiscJacket = PictureUtils.PutMargin(this.DiscJacket); this.R1 = r1; this.R2 = r2; }
private void DrawToFrameImg() { if (this.Value != 0) { double a = this.Value * 1.0 / this.MaxValue; PictureUtils.Filter(this.FrameImg, Color.Black, a); } }
public override IEnumerable <Canvas2> GetImageSequence() { for (; ;) { PictureUtils.Filter(this.FrameImg, this.Color, this.A); yield return(null); } }
public void DisposePictures() { if (this.imageList_Large.Images != null && this.imageList_Large.Images.Count > 0) { foreach (Image i in this.imageList_Large.Images) { PictureUtils.DisposeImage(i); } } }
private void DisposePictures() { if (this.imageList_Medias.Images != null && this.imageList_Medias.Images.Count > 0) { foreach (Image i in this.imageList_Medias.Images) { PictureUtils.DisposeImage(i); } } }
public Background0002(string discJacketFile, bool leftToRight) { this.DiscJackets[0] = new Canvas2(discJacketFile); for (int index = 1; index < BLUR_COUNT; index++) { this.DiscJackets[index] = PictureUtils.Blur(this.DiscJackets[index - 1], index); } this.LeftToRight = leftToRight; }
public static IHtmlString Picture(this HtmlHelper helper, UrlBuilder imageUrl, ImageType imageType, string cssClass = "", LazyLoadType lazyLoadType = LazyLoadType.None, string altText = "") { if (imageUrl == null) { return(new MvcHtmlString(string.Empty)); } var pictureData = PictureUtils.GetPictureData(imageUrl, imageType, lazyLoadType == LazyLoadType.Progressive, altText); var pictureElement = BuildPictureElement(pictureData, cssClass, lazyLoadType); return(new MvcHtmlString(HttpUtility.HtmlDecode(pictureElement))); }
public void MakeVideo(WaveData wave, WorkingDir wd, Action <Canvas2> addImage) { int frameNum = DoubleTools.ToInt((wave.Length * 1.0 / wave.WavHz) * AudioPicMP4Props.FPS); foreach (AbstractVideoImageMaker videoImageMaker in this.VideoImageMakers) { videoImageMaker.FrameNum = frameNum; videoImageMaker.Wave = wave; videoImageMaker.WD = wd; // ---- videoImageMaker.GetImage = EnumerableTools.Supplier(videoImageMaker.GetImageSequence()); } for (int frame = 0; frame < frameNum; frame++) { Canvas2 frameImg = new Canvas2(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H); foreach (AbstractVideoImageMaker videoImageMaker in this.VideoImageMakers) { videoImageMaker.FrameImg = frameImg; videoImageMaker.Frame = frame; videoImageMaker.Rate = frame * 1.0 / (frameNum - 1); videoImageMaker.InvRate = 1.0 - videoImageMaker.Rate; { Canvas2 currFrameImg = videoImageMaker.GetImage(); if (currFrameImg != null) { PictureUtils.Paste(frameImg, currFrameImg); } } videoImageMaker.FrameImg = null; videoImageMaker.Frame = -1; videoImageMaker.Rate = -1.0; videoImageMaker.InvRate = -1.0; } addImage(frameImg); } foreach (AbstractVideoImageMaker videoImageMaker in this.VideoImageMakers) { videoImageMaker.FrameNum = -1; videoImageMaker.Wave = null; videoImageMaker.WD = null; // ---- videoImageMaker.GetImage = null; } }
private void Draw(int index) { Canvas2 discJacket = this.DiscJackets[index]; double rate = this.LeftToRight ? this.Rate : this.InvRate; double l = this.DrawPos1.X + (this.DrawPos2.X - this.DrawPos1.X) * rate; double t = this.DrawPos1.Y + (this.DrawPos2.Y - this.DrawPos1.Y) * rate; double w = this.DrawSize.W; double h = this.DrawSize.H; PictureUtils.Paste(this.FrameImg, discJacket, l, t, w, h); }
private void InitData() { this.Closing += new CancelEventHandler(this.Form_Closing); Image image = PictureUtils.GenerateImage(this.image); int height = image.Height; int width = image.Width; this.Width = width + 10; this.Height = height + 20; this.pictureBox.Width = width; this.pictureBox.Height = height; PictureUtils.RenderPicture(this.pictureBox, this.image); }
public void textBox_LargeURL_Double_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); fileDialog.Filter = "Picture(*.jpg;*.jpeg;*.bmp;*.gif;*.png)|*.jpg;*.jpeg;*.bmp;*.gif;*.png|所有文件(*.*)|*.*"; fileDialog.CheckFileExists = true; fileDialog.CheckPathExists = true; if (fileDialog.ShowDialog(this) == DialogResult.OK) { this.currentFileName_large = fileDialog.FileName; this.destFileName_large = this.RefreshUrl(this.currentFileName_large, this.textBox_LargeURL); PictureUtils.RenderPicture(this.pictureBox_Large, this.currentFileName_large); this.textBox_Name.Text = Utils.GetSafeFileNameWithoutExt(this.destFileName_large); this.textBox_Alt.Text = this.textBox_Name.Text; } }
public override IEnumerable <Canvas2> GetImageSequence() { for (; ;) { double r1 = 1.0 + this.R1 * this.Rate; double r2 = 1.0 + this.R2 * this.InvRate; D4Rect wallRect; D4Rect frntRect; { D2Size size = Utils.TangentSize( new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()), false ); size.W *= r1; size.H *= r1; wallRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size); } { D2Size size = Utils.TangentSize( new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()), true ); size.W *= r2; size.H *= r2; // マージン分 size.W *= this.MarginedDiscJacket.GetWidth() * 1.0 / this.DiscJacket.GetWidth(); size.H *= this.MarginedDiscJacket.GetHeight() * 1.0 / this.DiscJacket.GetHeight(); frntRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size); } PictureUtils.Paste(this.FrameImg, this.BluredDiscJacket, wallRect); PictureUtils.Filter(this.FrameImg, Color.Black, 0.5); // 要調整 PictureUtils.Paste(this.FrameImg, this.MarginedDiscJacket, frntRect); yield return(null); } }
public override IEnumerable <Canvas2> GetImageSequence() { ShadowSpectraData ss = new ShadowSpectraData(); for (; ;) { this.Wave.SetWavPart(DoubleTools.ToInt((this.Frame * 1.0 / AudioPicMP4Props.FPS + AudioPicMP4Props.AUDIO_DELAY_SEC) * this.Wave.WavHz)); SpectrumGraph0001 sg = new SpectrumGraph0001(hz => this.Wave.GetSpectrum(hz)); ss.Projection(sg.Spectra); int w = sg.Spectra.Length * (BAR_WIDTH + BAR_INTERVAL) + BAR_INTERVAL; Canvas2 frameImg = new Canvas2(w, AudioPicMP4Props.VIDEO_H); PictureUtils.Fill(frameImg, Color.Transparent); this.DrawSpectra(frameImg, sg, ss); yield return(frameImg); } }
public override void renderEntity() { if (this.entity == null) { return; } if (!string.IsNullOrWhiteSpace(this.entity.project_id)) { this.comboBox_Project.SelectedItem = Utils.getSelectedProject(this.projectList, this.entity.project_id); } this.textBox_Name.Text = this.entity.name; this.textBox_LargeURL.Text = this.entity.large_url; if (!string.IsNullOrWhiteSpace(this.entity.large_url)) { this.savedFileName_large = PathUtils.GenerateAbsoluteMediaPath(this.entity.large_url); this.currentFileName_large = this.savedFileName_large; this.destFileName_large = this.savedFileName_large; PictureUtils.RenderPicture(this.pictureBox_Large, this.currentFileName_large); } this.textBox_Alt.Text = this.entity.alt; this.comboBox_MediaType.SelectedItem = Utils.getSelected(this.mediaTypeList, this.entity.media_type); this.comboBox_ContentType.SelectedItem = Utils.getSelected(this.contentTypeList, this.entity.content_type); }
public override IEnumerable <Canvas2> GetImageSequence() { ShadowSpectraData ssL = new ShadowSpectraData(); ShadowSpectraData ssR = new ShadowSpectraData(); for (; ;) { this.Wave.SetWavPart(DoubleTools.ToInt((this.Frame * 1.0 / AudioPicMP4Props.FPS + AudioPicMP4Props.AUDIO_DELAY_SEC) * this.Wave.WavHz)); SpectrumGraph0001 sgL = new SpectrumGraph0001(hz => this.Wave.GetSpectrum_L(hz)) { R1 = 0.5, R2 = 0.5 }; SpectrumGraph0001 sgR = new SpectrumGraph0001(hz => this.Wave.GetSpectrum_R(hz)) { R1 = 0.5, R2 = 0.5 }; ssL.Projection(sgL.Spectra); ssR.Projection(sgR.Spectra); int w = sgL.Spectra.Length * (BAR_WIDTH + BAR_INTERVAL) + BAR_INTERVAL; Canvas2 frameImg_L = new Canvas2(w, AudioPicMP4Props.VIDEO_H); Canvas2 frameImg_R = new Canvas2(w, AudioPicMP4Props.VIDEO_H); PictureUtils.Fill(frameImg_L, Color.Transparent); PictureUtils.Fill(frameImg_R, Color.Transparent); this.DrawSpectra(frameImg_L, sgL, ssL, Color.FromArgb(255, 255, 200), false); this.DrawSpectra(frameImg_R, sgR, ssR, Color.FromArgb(200, 255, 255), true); Canvas2 frameImg = new Canvas2(w * 2, AudioPicMP4Props.VIDEO_H); PictureUtils.Paste(frameImg, frameImg_L, 0, 0, w, AudioPicMP4Props.VIDEO_H); PictureUtils.Paste(frameImg, frameImg_R, w, 0, w, AudioPicMP4Props.VIDEO_H); yield return(frameImg); } }
public void MakeVideo(WaveData wave, WorkingDir wd, Action <Canvas2> addImage) { this.DiscJacket = new Canvas2(this.DiscJacketFile); this.BluredDiscJacket = PictureUtils.Blur(this.DiscJacket, 5); // 要調整 this.MarginedDiscJacket = PictureUtils.PutMargin(this.DiscJacket); ShadowSpectraData ss = new ShadowSpectraData(); FadeInOutData f1 = new FadeInOutData() { MaxValue = 20 }; FadeInOutData f2 = new FadeInOutData(); f1.Rate = 1.0; int frameNum = DoubleTools.ToInt((wave.Length * 1.0 / wave.WavHz) * AudioPicMP4Props.FPS); for (int frame = 0; frame < frameNum; frame++) { if (frame == 2 * AudioPicMP4Props.FPS) { f1.TargetRate = 0.0; } if (frame == frameNum - 10 - f2.MaxValue) { f2.TargetRate = 1.0; } f1.Approach(); f2.Approach(); double rate = frame * 1.0 / (frameNum - 1); double invRate = 1.0 - rate; double r1 = 1.0 + 0.2 * rate; double r2 = 1.0 + 0.1 * invRate; D4Rect wallRect; D4Rect frntRect; { D2Size size = Utils.TangentSize( new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()), false ); size.W *= r1; size.H *= r1; wallRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size); } { D2Size size = Utils.TangentSize( new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()), true ); size.W *= r2; size.H *= r2; // マージン分 size.W *= this.MarginedDiscJacket.GetWidth() * 1.0 / this.DiscJacket.GetWidth(); size.H *= this.MarginedDiscJacket.GetHeight() * 1.0 / this.DiscJacket.GetHeight(); frntRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size); } Canvas2 frameImg = new Canvas2(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H); PictureUtils.Paste(frameImg, this.BluredDiscJacket, wallRect); PictureUtils.Filter(frameImg, Color.Black, 0.5); // 要調整 PictureUtils.Paste(frameImg, this.MarginedDiscJacket, frntRect); PictureUtils.Filter(frameImg, Color.Black, 0.1); // 要調整 PictureUtils.Filter(frameImg, Color.Black, f1.Rate); // 背景カーテン wave.SetWavPart(DoubleTools.ToInt((frame * 1.0 / AudioPicMP4Props.FPS + AudioPicMP4Props.AUDIO_DELAY_SEC) * wave.WavHz)); SpectrumGraph0001 sg = new SpectrumGraph0001(hz => wave.GetSpectrum(hz)); ss.Projection(sg.Spectra); this.DrawSpectra(frameImg, sg, ss); PictureUtils.Filter(frameImg, Color.Black, f2.Rate); // 前景カーテン addImage(frameImg); } }
private void MakeMovie_Main() { this.DiscJacket = new Canvas2(this.DiscJacketFile); this.BluredDiscJacket = PictureUtils.Blur(this.DiscJacket, 5); // 要調整 this.MarginedDiscJacket = PictureUtils.PutMargin(this.DiscJacket); { string wavFile = this.WD.GetPath("audio.wav"); string masterWavFile = this.WD.GetPath("audio2.wav"); FFmpegConv.MakeWavFile(this.SourceMediaFile, wavFile); if (this.MasterFlag && MasterUtils.Mastering(wavFile, masterWavFile)) { this.Wave = new WaveData(masterWavFile); this.FFmpeg.Audio.PutAudioFile(masterWavFile); } else { this.Wave = new WaveData(wavFile); this.FFmpeg.Audio.PutAudioFile(this.SourceMediaFile); } } ShadowSpectraData ss = new ShadowSpectraData(); FadeInOutData f1 = new FadeInOutData() { MaxValue = 20 }; FadeInOutData f2 = new FadeInOutData(); f1.Rate = 1.0; int frameNum = DoubleTools.ToInt((this.Wave.Length * 1.0 / this.Wave.WavHz) * AudioPicMP4Props.FPS); for (int frame = 0; frame < frameNum; frame++) { if (frame == 2 * AudioPicMP4Props.FPS) { f1.TargetRate = 0.0; } if (frame == frameNum - 10 - f2.MaxValue) { f2.TargetRate = 1.0; } f1.Approach(); f2.Approach(); double rate = frame * 1.0 / (frameNum - 1); double invRate = 1.0 - rate; double r1 = 1.0 + 0.2 * rate; double r2 = 1.0 + 0.1 * invRate; D4Rect wallRect; D4Rect frntRect; { D2Size size = Utils.TangentSize( new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()), false ); size.W *= r1; size.H *= r1; wallRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size); } { D2Size size = Utils.TangentSize( new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), new D2Size(this.DiscJacket.GetWidth(), this.DiscJacket.GetHeight()), true ); size.W *= r2; size.H *= r2; // マージン分 size.W *= this.MarginedDiscJacket.GetWidth() * 1.0 / this.DiscJacket.GetWidth(); size.H *= this.MarginedDiscJacket.GetHeight() * 1.0 / this.DiscJacket.GetHeight(); frntRect = Utils.Centering(new D2Size(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H), size); } Canvas2 frameImg = new Canvas2(AudioPicMP4Props.VIDEO_W, AudioPicMP4Props.VIDEO_H); PictureUtils.Paste(frameImg, this.BluredDiscJacket, wallRect); PictureUtils.Filter(frameImg, Color.Black, 0.5); // 要調整 PictureUtils.Paste(frameImg, this.MarginedDiscJacket, frntRect); PictureUtils.Filter(frameImg, Color.Black, 0.1); // 要調整 PictureUtils.Filter(frameImg, Color.Black, f1.Rate); // 背景カーテン this.Wave.SetWavPart(DoubleTools.ToInt((frame * 1.0 / AudioPicMP4Props.FPS + AudioPicMP4Props.AUDIO_DELAY_SEC) * this.Wave.WavHz)); SpectrumGraph0001 sg = new SpectrumGraph0001(hz => this.Wave.GetSpectrum(hz)); ss.Projection(sg.Spectra); this.DrawSpectra(frameImg, sg, ss); PictureUtils.Filter(frameImg, Color.Black, f2.Rate); // 前景カーテン frameImg.Save(this.FFmpeg.GetImageFile(frame), ImageFormat.Jpeg, AudioPicMP4Props.JPEG_QUALITY); GC.Collect(); } this.FFmpeg.MakeMovie(); File.Copy(this.FFmpeg.GetMovieFile(), this.DestMP4File); }
private void DisposePictures() { PictureUtils.DisposePicture(this.pictureBox); }
//上传文件 public static void UploadFile(string ID, string fileType, string docType, HttpPostedFileBase file) { if (file != null) { var fileName = file.FileName; var fileID = System.Guid.NewGuid().ToString(); var fileEx = new FileInfo(fileName).Extension; var paths = GetUploadFilePath(fileType, ID, fileID, fileName); // 保存文件 file.SaveAs(paths.FullPath); if (IsPicture(fileName))//如果是图片,就保存缩略图 { // 保存缩略图片 Image image = Image.FromStream(file.InputStream); image = PictureUtils.GetHvtThumbnail(image, 200); image.Save(paths.TFullPath); } // 保存到数据库中 // 文件ID,门牌记录的ID,图片相对路径,缩略图相对路径,文件名称等 using (var dbContext = SystemUtils.NewEFDbContext) { if (fileType == Enums.UploadFileCategory.HouseBZ) { HOUSEBZOFUPLOADFILES data = new HOUSEBZOFUPLOADFILES(); data.ID = fileID; data.FILENAME = fileName; data.TYPE = docType; data.HOUSEBZID = ID; data.FILEEX = fileEx; data.STATE = Enums.State.Enable; dbContext.HOUSEBZOFUPLOADFILES.Add(data); } if (fileType == Enums.UploadFileCategory.MPPic) { MPOFUPLOADFILES data = new MPOFUPLOADFILES(); data.ID = fileID; data.FILENAME = fileName; data.TYPE = Enums.UploadFileCategory.MPPic; data.MPID = ID; data.FILEEX = fileEx; data.STATE = Enums.State.Enable; dbContext.MPOFUPLOADFILES.Add(data); } if (fileType == Enums.UploadFileCategory.RoadPic) { DMOFUPLOADFILES data = new DMOFUPLOADFILES(); data.ID = fileID; data.FILENAME = fileName; data.TYPE = Enums.UploadFileCategory.RoadPic; data.DMID = ID; data.FILEEX = fileEx; data.STATE = Enums.State.Enable; dbContext.DMOFUPLOADFILES.Add(data); } if (fileType == Enums.UploadFileCategory.HousePic) { DMOFUPLOADFILES data = new DMOFUPLOADFILES(); data.ID = fileID; data.FILENAME = fileName; data.TYPE = Enums.UploadFileCategory.HousePic; data.DMID = ID; data.FILEEX = fileEx; data.STATE = Enums.State.Enable; dbContext.DMOFUPLOADFILES.Add(data); } dbContext.SaveChanges(); } } }
private void renderPicture() { this.textBox_PictureId.Text = this.picture.id.ToString(); PictureUtils.RenderPictureFromUrl(this.pictureBox_Picture, this.picture.default_url); }
private void renderLogo() { this.textBox_LogoId.Text = this.logo.id.ToString(); PictureUtils.RenderPictureFromUrl(this.pictureBox_Logo, this.logo.default_url); }
private void renderSalePicture() { this.textBox_SalePictureId.Text = this.salePicture.id; PictureUtils.RenderPictureFromUrl(this.pictureBox_SalePicture, this.salePicture.default_url); }
private Image parseImage(Media media) { return(PictureUtils.GenerateImageFromUrl(media.default_url)); }
private void DisposePictures() { PictureUtils.DisposePicture(this.pictureBox_Picture); PictureUtils.DisposePicture(this.pictureBox_Logo); this.mediaListView_Overview.DisposePictures(); }
private void DisposePictures() { PictureUtils.DisposePicture(this.pictureBox_Picture); PictureUtils.DisposePicture(this.pictureBox_SalePicture); }
private Image parseImage(string media) { return(PictureUtils.GenerateImage(media)); }