public ObjectImageManager(string name, string framesDir, bool flipped) { m_flipped = flipped; int idx = name.IndexOf(':'); // Get the file name (ex: "stuff.png") m_fileName = name; if (idx != -1) m_fileName = name.Substring(0, idx); // Get the parse name (ex: "<color>.<frame>", there is also <key>) m_parseName = ""; if (idx != -1) m_parseName = name.Substring(idx+1); // Get the image file string imagePath = Editor.EditorHelpers.FindAsset(framesDir, m_fileName); if ( imagePath == null ) { MessageBox.Show("Asset not found.\n" + m_fileName + "\nIn active directory: " + framesDir); } m_image = imagePath != null ? new ImageLoader(imagePath) : null; // Get frames file string framePath = Editor.EditorHelpers.FindAsset(framesDir, Path.GetFileNameWithoutExtension(m_fileName) + ".frames"); if ( framePath == null ) framePath = Editor.EditorHelpers.FindAsset(framesDir, "default.frames"); m_frames = framePath != null ? new JsonParser(framePath).ParseJson<ObjectFrames>() : null; }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.page_friend); imageLoader = ImageLoader.Instance; friends = Util.GenerateFriends(); var title = Intent.GetStringExtra("Title"); var image = Intent.GetStringExtra("Image"); title = string.IsNullOrWhiteSpace(title) ? "New Friend" : title; var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar); SetSupportActionBar (toolbar); if (string.IsNullOrWhiteSpace(image)) image = friends[0].Image; SupportActionBar.SetDisplayHomeAsUpEnabled (true); var collapsingToolbar = FindViewById<CollapsingToolbarLayout> (Resource.Id.collapsing_toolbar); collapsingToolbar.SetTitle (title); imageLoader.DisplayImage(image, FindViewById<ImageView> (Resource.Id.friend_image)); //var grid = FindViewById<GridView>(Resource.Id.grid); //grid.Adapter = new MonkeyAdapter(this, friends); //grid.ItemClick += GridOnItemClick; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState) { var ignored = base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.fragment_profile, null); imageLoader = ImageLoader.Instance; view.FindViewById<TextView>(Resource.Id.profile_name).Text = "James Montemagno"; imageLoader.DisplayImage("https://s.gravatar.com/avatar/7d1f32b86a6076963e7beab73dddf7ca?s=250", view.FindViewById<ImageView>(Resource.Id.profile_image)); view.FindViewById<ImageView>(Resource.Id.profile_image).Click += (sender, args) => { CrossShare.Current.OpenBrowser("http://github.com/jamesmontemagno"); }; view.FindViewById<CardView>(Resource.Id.copyright).Click += (sender, args) => { CrossShare.Current.OpenBrowser("http://www.wikipedia.org"); }; view.FindViewById<TextView>(Resource.Id.website).Click += (sender, args) => { CrossShare.Current.OpenBrowser("http://motzcod.es"); }; view.FindViewById<TextView>(Resource.Id.twitter).Click += (sender, args) => { CrossShare.Current.OpenBrowser("http://m.twitter.com/jamesmontemagno"); }; return view; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Android.OS.Bundle savedInstanceState) { var ignored = base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.fragment_profile, null); imageLoader = ImageLoader.Instance; view.FindViewById<TextView>(Resource.Id.profile_name).Text = "James Montemagno"; view.FindViewById<TextView>(Resource.Id.profile_description).Text = "James Montemagno is a Developer Evangelist at Xamarin and Microsoft MVP. He has been a .NET developer for over a decade working in a wide range of industries and before joining Xamarin was a professional mobile developer on the Xamarin platform for over 4 years. He can be found on Twitter @JamesMontemagno and blogs regularly at www.MotzCod.es"; imageLoader.DisplayImage("https://s.gravatar.com/avatar/7d1f32b86a6076963e7beab73dddf7ca?s=250", view.FindViewById<ImageView>(Resource.Id.profile_image)); view.FindViewById<ImageView>(Resource.Id.profile_image).Click += (sender, args) => { var builder = new NotificationCompat.Builder(Activity) .SetSmallIcon(Resource.Drawable.ic_launcher) .SetContentTitle("Click to go to friend details!") .SetContentText("New Friend!!"); var friendActivity = new Intent(Activity, typeof(FriendActivity)); PendingIntent pendingIntent = PendingIntent.GetActivity(Activity, 0, friendActivity, 0); builder.SetContentIntent(pendingIntent); builder.SetAutoCancel(true); var notificationManager = (NotificationManager) Activity.GetSystemService(Context.NotificationService); notificationManager.Notify(0, builder.Build()); }; return view; }
protected override void OnCreate(Android.OS.Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_detail); friends = Util.GenerateFriends(); imageLoader = ImageLoader.Instance; var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); if (monkey == null) { var t = Intent.GetStringExtra("Name"); monkey = friends.First(m => m.Name == t); } ShowMonkey(); client = new GoogleApiClient.Builder(this).AddApi(AppIndex.API).Build(); url = $"http://monkeysapp.com/Home/Detail/{monkey.Name.Replace(" ", "%20")}"; title = monkey.Name; description = monkey.Details; schemaType = "http://schema.org/Article"; }
public AvitoLoadImageDeferentSize(IHttpWeb httpweb, string pathFolder, MySqlDB _mySqlDB, string _ftpUsername, string _ftpPassword, ImageParsedCountHelper imageParsed) : base(httpweb, pathFolder, imageParsed) { mySqlDB = _mySqlDB; ftpUsername = _ftpUsername; ftpPassword = _ftpPassword; imageLoader = new ImageLoader(PathToFolder, ftpUsername, ftpPassword); }
public Player(GameManager gm,float x, float y) : base(x,y) { sprite = new ImageLoader(gm.getGraphicsDevice(),"Player",1); this.x = x; this.y = y; speed = 5; }
public void Dispose() { if ( m_image != null ) { m_image.Dispose(); m_image = null; } }
private Supervisor() { il = new ImageLoader(); subjectBatches = new Dictionary<string, SubjectBatch>(); resultBatches = new Dictionary<string, Dictionary<string, string[]>>(); focusSubjects = new Dictionary<string, Subject>(); assignBatchNum = 0; focusBatchName = DEFAULT_BATCH_PREFIX + assignBatchNum; }
public EbayLoadImage(IHttpWeb httpweb, string pathFolder, MySqlDB _mySqlDB, string _ftpUsername, string _ftpPassword) { PathToFolder = pathFolder; web = httpweb; mySqlDB = _mySqlDB; ftpUsername = _ftpUsername; ftpPassword = _ftpPassword; imageLoader = new ImageLoader(PathToFolder, ftpUsername, ftpPassword); }
public TileImageManager(string name, string framesDir) { // Get the image file m_fileName = Editor.EditorHelpers.FindAsset(framesDir, name); if ( m_fileName == null ) { System.Windows.Forms.MessageBox.Show("Failed asset acquisition of " + framesDir + " " + name); } m_image = new ImageLoader(m_fileName); }
public PlatformImageManager(string platformName, int platformVariants, string stairsName, int stairVariants, string framesDir) { // Get the image file m_platformFileName = Editor.EditorHelpers.FindAsset(framesDir, platformName); m_platformImage = new ImageLoader(m_platformFileName); m_platformVariants = platformVariants; m_stairFileName = Editor.EditorHelpers.FindAsset(framesDir, stairsName); m_stairImage = new ImageLoader(m_stairFileName); m_stairVariants = stairVariants; }
public void Dispose() { if ( m_platformImage != null ) { m_platformImage.Dispose(); m_platformImage = null; } if ( m_stairImage != null ) { m_stairImage.Dispose(); m_stairImage = null; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); // set up the image loader imageLoader = ImageLoader.Instance; options = new DisplayImageOptions.Builder() .CacheInMemory(true) .Build(); // to display a preview imageView = FindViewById<PhotoView>(Resource.Id.imageView); // create the Thumbor instance pointing to the Thumbor server thumbor = Thumbor.Create("http://thumbor.thumborize.me/"); // give us an image to start off with GetImage(Resource.Id.resize, GetString(Resource.String.resize)); }
public SimpleCarouselAdapter(List<string> urls, Context context) { Urls = urls; DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .CacheOnDisc(true) .ImageScaleType(ImageScaleType.Exactly) .BitmapConfig(Bitmap.Config.Rgb565) .CacheInMemory(false) .Build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( context) .WriteDebugLogs() .ThreadPoolSize(1) .DiskCacheExtraOptions(480, 320, null) .DefaultDisplayImageOptions(defaultOptions) //.DenyCacheImageMultipleSizesInMemory() .Build(); ImageLoader.Instance.Init(config); imageLoader = ImageLoader.Instance; }
private void button1_Click(object sender, EventArgs e) { InitialiseParams(); ImageLoader loader = new ImageLoader(); Bitmap bits = loader.LoadPicture(pathIn); if (bits == null) { LoadingFailed("Неверный путь к исходному файлу!"); return; } Binarisator binarisator = new Binarisator(bits, lev); Bitmap outBits; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); if (radioButton1.Checked) outBits = binarisator.Binarisation(); else if (radioButton2.Checked) outBits = binarisator.DoubleBinarisation(); else if (radioButton3.Checked) outBits = binarisator.Sobel(); else outBits = binarisator.Laplas(); stopWatch.Stop(); string errorMessage = loader.Save(outBits, pathOut); if (! String.IsNullOrEmpty(errorMessage)) { LoadingFailed(errorMessage); return; } label4.Text = "Программа отработала успешно! Время " + stopWatch.Elapsed; }
protected virtual void PrepareCell(UITableViewCell cell) { if (cell == null) { return; } // Visible is used here because StyledStringElement does not pass the Update*Detail calls down to its base classes // see https://github.com/slodge/MvvmCross/issues/403 cell.Hidden = !Visible; cell.Accessory = Accessory; var tl = cell.TextLabel; tl.Text = Caption; tl.TextAlignment = Alignment; tl.TextColor = TextColor ?? UIColor.Black; tl.Font = Font ?? UIFont.BoldSystemFontOfSize(17); tl.LineBreakMode = LineBreakMode; tl.Lines = Lines; // The check is needed because the cell might have been recycled. if (cell.DetailTextLabel != null) { cell.DetailTextLabel.Text = Value == null ? "" : Value; } if (_extraInfo == null) { ClearBackground(cell); } else { var imgView = cell.ImageView; UIImage img; if (imgView != null) { if (_extraInfo.Uri != null) { img = ImageLoader.DefaultRequestImage(_extraInfo.Uri, this); } else if (_extraInfo.Image != null) { img = _extraInfo.Image; } else { img = null; } imgView.Image = img; } if (cell.DetailTextLabel != null) { cell.DetailTextLabel.TextColor = _extraInfo.DetailColor ?? UIColor.Gray; } } if (cell.DetailTextLabel != null) { cell.DetailTextLabel.Lines = Lines; cell.DetailTextLabel.LineBreakMode = LineBreakMode; cell.DetailTextLabel.Font = SubtitleFont ?? UIFont.SystemFontOfSize(14); cell.DetailTextLabel.TextColor = (_extraInfo == null || _extraInfo.DetailColor == null) ? UIColor.Gray : _extraInfo.DetailColor; } }
private void export( FsPath directory, string setCodesStr, ISet <FsPath> exportedSmall, ISet <FsPath> exportedZoomed, bool small, bool zoomed, FsPath smallSubdir, FsPath zoomedSubdir, bool matchingSet, bool forceRemoveCorner, bool token) { var setCodes = setCodesStr?.Split(',').ToHashSet(StringComparer.OrdinalIgnoreCase); foreach ((string setCode, Set set) in _cardRepo.SetsByCode) { Console.WriteLine(setCode); if (setCodes?.Contains(setCode) == false) { continue; } FsPath smallSetSubdir = FsPath.None; FsPath zoomedSetSubdir = FsPath.None; if (small) { if (smallSubdir.HasValue()) { smallSetSubdir = directory.Join(smallSubdir).Join(setCode); } else { smallSetSubdir = directory.Join(setCode); } smallSetSubdir = ensureSetSubdirectory(smallSetSubdir); } if (zoomed) { if (zoomedSubdir.HasValue()) { zoomedSetSubdir = directory.Join(zoomedSubdir).Join(setCode); } else { zoomedSetSubdir = directory.Join(setCode); } zoomedSetSubdir = ensureSetSubdirectory(zoomedSetSubdir); } foreach (var card in set.Cards) { if (card.IsSingleSide() && card.Faces.Main != card) { continue; } if (card.IsToken != token) { continue; } Bitmap original = null; ImageModel modelSmall = null; if (small) { modelSmall = _imageRepo.GetSmallImage(card, _cardRepo.GetReleaseDateSimilarity); if (modelSmall != null && Str.Equals(card.SetCode, modelSmall.ImageFile.SetCode) == matchingSet && exportedSmall.Add(modelSmall.ImageFile.FullPath)) { FsPath smallPath = getTargetPath(modelSmall.ImageFile, smallSetSubdir); if (!smallPath.IsFile() || card.Faces.Count > 1) { original = ImageLoader.Open(modelSmall); addFile(original, modelSmall.ImageFile, smallPath, small: true, forceRemoveCorner); } } } if (zoomed) { var modelZoom = _imageRepo.GetImagePrint(card, _cardRepo.GetReleaseDateSimilarity); if (modelZoom != null && Str.Equals(card.SetCode, modelZoom.ImageFile.SetCode) == matchingSet && exportedZoomed.Add(modelZoom.ImageFile.FullPath)) { FsPath zoomedPath = getTargetPath(modelZoom.ImageFile, zoomedSetSubdir); if (!zoomedPath.IsFile() || card.Faces.Count > 1) { if (original == null || modelSmall.ImageFile.FullPath != modelZoom.ImageFile.FullPath) { original?.Dispose(); original = ImageLoader.Open(modelZoom); } addFile(original, modelZoom.ImageFile, zoomedPath, small: false, forceRemoveCorner); } } } original?.Dispose(); } smallSetSubdir.DeleteEmptyDirectory(); zoomedSetSubdir.DeleteEmptyDirectory(); } }
private void ResizeRadioButtons(int n) { if (radioButtons != null && radioButtons.Length == n) { return; } if (radioButtons != null) { foreach (var i in All.Int(radioButtons.Length)) { var r = radioButtons[i]; groupBox1.Controls.Remove(r); r.Dispose(); var p = pictureBoxes[i]; // PictureBoxは必ず持っているとは限らない。 if (p != null) { groupBox1.Controls.Remove(p); p.Dispose(); } var img = images[i]; if (img != null) { img.Dispose(); } } } radioButtons = new Control[n]; pictureBoxes = new Control[n]; images = new ImageLoader[n]; foreach (var i in All.Int(n)) { var texts = SelectionTexts[i].Split(','); if (texts.Length < 2) { continue; } var x = (pictureBox1.Width + pictureBox1.Margin.Left + pictureBox1.Margin.Right) * i; var radio = new RadioButton() { // 座標 Location = new Point(x + radioButton1.Location.X, radioButton1.Location.Y), // マージン値などは引き継ぐ Margin = radioButton1.Margin, // 文字フォントが変更された時に自動的に領域が大きくなってもらわないと困る。 AutoSize = radioButton1.AutoSize, // == true, Text = texts[0], }; var j = i; // copy for lambda's capture radio.CheckedChanged += (sender, args) => { if (radio.Checked) { // 再起動するように警告表示 if (ViewModel.WarningRestart && ViewModel.Selection != j) { TheApp.app.MessageShow("この変更が反映するのは次回起動時です。", MessageShowType.Confirmation); } ViewModel.Selection = j; } }; // 先にCheckを変更しないと、このあとのCheckedChangedのイベントハンドラが呼び出されてしまう。 // → 先に変更しても無駄だった。そうか…。上のハンドラのなかに // " && ViewModel.Selection = j "を追加する。 radio.Checked = i == ViewModel.Selection; radioButtons[i] = radio; groupBox1.Controls.Add(radio); var picture = new PictureBox() { // 引き伸ばしておく。 SizeMode = PictureBoxSizeMode.StretchImage, // 座標 Location = new Point(x + pictureBox1.Location.X, pictureBox1.Location.Y), // マージン値などは引き継ぐ Margin = pictureBox1.Margin, Size = pictureBox1.Size, // 境界線をつけておく BorderStyle = pictureBox1.BorderStyle // BorderStyle.FixedSingle, }; picture.Click += (sender, args) => { radio.Checked = true; /* RadioButtonがクリックされたのと同等の扱いをしてやる*/ }; pictureBoxes[i] = picture; groupBox1.Controls.Add(picture); var img = new ImageLoader(); var path = Path.Combine(ImageFolder, texts[1]); img.Load(path); images[i] = img; picture.Image = images[i].image; // ToolTipの追加。 if (texts.Length >= 3) { var tips = texts[2]; toolTip1.SetToolTip(radio, tips); toolTip1.SetToolTip(picture, tips); } } Invalidate(); }
private void UpdateLibraryStatistics_Headers() { TextLibraryCount.Text = ""; PanelForHyperlinks.Visibility = Visibility.Collapsed; PanelForget.Visibility = Visibility.Collapsed; PanelLocateSyncPoint.Visibility = Visibility.Collapsed; PanelViewOnline.Visibility = Visibility.Collapsed; PanelInviteAndShare.Visibility = Visibility.Collapsed; PanelEditDelete.Visibility = Visibility.Collapsed; PanelTopUp.Visibility = Visibility.Collapsed; PanelPurge.Visibility = Visibility.Collapsed; ButtonAutoSync.Visibility = Visibility.Collapsed; ButtonReadOnly.Visibility = Visibility.Collapsed; if (null != web_library_detail) { TextLibraryCount.Text = String.Format("{0} document(s) in this library", web_library_detail.library.PDFDocuments_IncludingDeleted_Count); //TextLibraryCount.Text = // String.Format( // " ({0} documents, last synced on {1})", // web_library_detail.library.PDFDocuments.Count, // web_library_detail.LastSynced.HasValue ? web_library_detail.LastSynced.Value.ToString() : "Never" // ); // The wizard stuff if (web_library_detail.IsLocalGuestLibrary) { WizardDPs.SetPointOfInterest(ButtonIcon, "GuestLibraryOpenButton"); WizardDPs.SetPointOfInterest(TxtTitle, "GuestLibraryTitle"); } // The icon stuff { RenderOptions.SetBitmapScalingMode(ButtonIcon, BitmapScalingMode.HighQuality); ButtonIcon.Width = 64; ButtonIcon.Height = 64; if (web_library_detail.IsWebLibrary) { ButtonIcon.Source = Icons.GetAppIcon(Icons.LibraryTypeWeb); ButtonIcon.ToolTip = "This is a Web Library.\nYou can sync it via the cloud to access it online or on your other devices."; } else if (web_library_detail.IsIntranetLibrary) { ButtonIcon.Source = Icons.GetAppIcon(Icons.LibraryTypeIntranet); ButtonIcon.ToolTip = "This is an Intranet Library.\nYou can sync it via your Intranet to share with colleagues and across your company computers."; } else if (web_library_detail.IsLocalGuestLibrary) { ButtonIcon.Source = Icons.GetAppIcon(Icons.LibraryTypeGuest); ButtonIcon.ToolTip = "This is a Guest Library.\nIts contents remain local to this computer and can not be synced."; } else if (web_library_detail.IsBundleLibrary) { ButtonIcon.Source = Icons.GetAppIcon(Icons.LibraryTypeBundle); ButtonIcon.ToolTip = "This is a Bundle Library.\nIt's contents will be updated automatically when the Bundle is updates by it's administrator."; } else { ButtonIcon.Source = null; ButtonIcon.ToolTip = null; } } // The customization images stuff { string image_filename = CustomBackgroundFilename; if (File.Exists(image_filename)) { try { ObjTitleImage.Source = BitmapImageTools.FromImage(ImageLoader.Load(image_filename)); } catch (Exception ex) { Logging.Warn(ex, "Problem with custom library background."); } } else { ObjTitleImage.Source = null; } } { string image_filename = CustomIconFilename; if (File.Exists(image_filename)) { try { ButtonIcon.Source = BitmapImageTools.FromImage(ImageLoader.Load(image_filename)); } catch (Exception ex) { Logging.Warn(ex, "Problem with custom library icon."); } } } // The autosync stuff if (web_library_detail.IsWebLibrary || web_library_detail.IsIntranetLibrary) { ButtonAutoSync.Visibility = Visibility.Visible; ButtonAutoSync.IsChecked = web_library_detail.AutoSync; } // The readonly stuff if (web_library_detail.IsReadOnly) { ButtonReadOnly.Visibility = Visibility.Visible; } // The hyperlinks panel if (web_library_detail.IsWebLibrary) { PanelForHyperlinks.Visibility = Visibility.Visible; PanelViewOnline.Visibility = Visibility.Visible; PanelTopUp.Visibility = Visibility.Visible; if (web_library_detail.IsAdministrator) { PanelInviteAndShare.Visibility = Visibility.Visible; PanelEditDelete.Visibility = Visibility.Visible; } if (web_library_detail.Deleted) { PanelPurge.Visibility = Visibility.Visible; } } if (web_library_detail.IsIntranetLibrary) { PanelForHyperlinks.Visibility = Visibility.Visible; PanelForget.Visibility = Visibility.Visible; PanelLocateSyncPoint.Visibility = Visibility.Visible; } if (web_library_detail.IsBundleLibrary) { PanelForHyperlinks.Visibility = Visibility.Visible; PanelForget.Visibility = Visibility.Visible; } } }
/// <summary> /// Action permettant d'ouvrir l'explorateur de fichiers. /// </summary> private void OpenFile() { this.Picture = ImageLoader.SearchImageWithExplorer(); }
// constructor for an enemy static Enemy NewEnemy(double[] location, int type) { BitmapImage startingImage = null; double[] accel; Enemy enemy = new Enemy(); enemy.setTeamNum(1); // #define DESIGN_HERE switch (type) { case 0: startingImage = ImageLoader.loadImage("archer.png"); enemy.setCenter(location); enemy.setShape(new GameRectangle(26, 41)); accel = new double[2]; accel[0] = 510; accel[1] = 0; enemy.setMaxAccel(accel); enemy.setDragCoefficient(3); enemy.enemyType = type; enemy.setGravity(1000); enemy.initializeHitpoints(15); enemy.setJumpSpeed(950); enemy.setContactDamagePerSecond(0); break; case 1: startingImage = ImageLoader.loadImage("eagle.png"); enemy.setCenter(location); enemy.setShape(new GameRectangle(56, 43)); accel = new double[2]; accel[0] = 480; accel[1] = 500; enemy.setMaxAccel(accel); enemy.setDragCoefficient(3); enemy.enemyType = type; enemy.setGravity(75); enemy.initializeHitpoints(9); enemy.setJumpSpeed(500); enemy.setContactDamagePerSecond(0); break; case 2: startingImage = ImageLoader.loadImage("horseman.png"); enemy.setCenter(location); enemy.setShape(new GameRectangle(80, 93)); accel = new double[2]; accel[0] = 360; accel[1] = 0; enemy.setMaxAccel(accel); enemy.setDragCoefficient(1); enemy.enemyType = type; enemy.setGravity(1000); enemy.initializeHitpoints(11); enemy.setJumpSpeed(800); enemy.setContactDamagePerSecond(0); break; case 3: startingImage = ImageLoader.loadImage("swarm.png"); enemy.setCenter(location); enemy.setShape(new GameRectangle(16, 9)); accel = new double[2]; accel[0] = 350; accel[1] = 0; enemy.setMaxAccel(accel); enemy.setDragCoefficient(3); enemy.enemyType = type; enemy.setGravity(1000); enemy.initializeHitpoints(5); enemy.setJumpSpeed(500); enemy.setContactDamagePerSecond(0); break; case 4: startingImage = ImageLoader.loadImage("armadillo.png"); enemy.setCenter(location); enemy.setShape(new GameRectangle(157, 79)); accel = new double[2]; accel[0] = 280; accel[1] = 0; enemy.setMaxAccel(accel); enemy.setDragCoefficient(4); enemy.enemyType = type; enemy.setGravity(1000); enemy.initializeHitpoints(30); enemy.setJumpSpeed(550); enemy.setArmor(1); enemy.setContactDamagePerSecond(0); break; case 5: startingImage = ImageLoader.loadImage("chariot.png"); enemy.setCenter(location); enemy.setShape(new GameRectangle(102, 61)); accel = new double[2]; accel[0] = 220; accel[1] = 0; enemy.setMaxAccel(accel); enemy.setDragCoefficient(.5); enemy.enemyType = type; enemy.setGravity(1000); enemy.initializeHitpoints(11); enemy.setJumpSpeed(500); enemy.setContactDamagePerSecond(0); break; case 6: startingImage = ImageLoader.loadImage("goblin2.png"); enemy.setCenter(location); enemy.setShape(new GameRectangle(18, 51)); accel = new double[2]; accel[0] = 540; accel[1] = 0; enemy.setMaxAccel(accel); enemy.setDragCoefficient(3); enemy.enemyType = type; enemy.setGravity(1000); enemy.initializeHitpoints(15); enemy.setJumpSpeed(950); enemy.setContactDamagePerSecond(2); break; default: break; } enemy.setBitmap(startingImage); enemy.setImageOffset(new double[2]); enemy.setBrain(new AI(1)); return(enemy); }
public void InitializeAssets() { if ( Orientations != null ) { foreach (var orientation in Orientations) orientation.InitializeAssets(Path.GetDirectoryName(FullPath)); } // Get the inventory icon string iconStr = InventoryIconStr ?? "/interface/inventory/x.png"; string inventoryPath = Editor.EditorHelpers.FindAsset(Path.GetDirectoryName(this.FullPath), iconStr); if ( inventoryPath == null ) inventoryPath = Editor.EditorHelpers.FindAsset(Path.GetDirectoryName(this.FullPath), "/interface/inventory/x.png"); InventoryIcon = new ImageLoader(inventoryPath); }
protected void Button6_Click(object sender, EventArgs e) { DataTable dv = db.selectquery("select * from voting where userid='" + id + "'"); if (dv.Rows.Count > 0) { // Label1.Visible = true; Label1.Text = "already voted !!!"; } else { try { string str1 = "figkk" + ".jpg"; Base64ToImage().Save(Server.MapPath("~/UploadTump/" + str1)); string Image1 = "~/UploadTump/" + str1.ToString(); string filePath1 = Server.MapPath(Image1); string filename1 = Path.GetFileName(filePath1); FileStream fs1 = new FileStream(filePath1, FileMode.Open, FileAccess.Read); BinaryReader br1 = new BinaryReader(fs1); bytes1 = br1.ReadBytes((Int32)fs1.Length); DataTable dt = db.selectquery("select * from candidates where lid='" + id + "'"); string mm = dt.Rows[0]["fingerprint"].ToString(); vid = dt.Rows[0]["cid"].ToString(); string filePath = Server.MapPath(mm); string filename = Path.GetFileName(filePath); FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); bytes = br.ReadBytes((Int32)fs.Length); var fingerprintImg1 = ImageLoader.LoadImage(filePath); var fingerprintImg2 = ImageLoader.LoadImage(filePath1); var featExtractor = new PNFeatureExtractor() { MtiaExtractor = new Ratha1995MinutiaeExtractor() }; var features1 = featExtractor.ExtractFeatures(fingerprintImg1); var features2 = featExtractor.ExtractFeatures(fingerprintImg2); // Building matcher and matching var matcher = new PN(); double similarity = matcher.Match(features1, features2); score = similarity.ToString("0.000"); Label1.Text = similarity.ToString("0.000"); if (similarity > 40) { Label1.Text = " "; DataList1.DataSource = db.selectquery("Select * from candidates where cid='" + vid + "'"); DataList1.DataBind(); Button2.Visible = true; pnl_otp.Visible = true; } else { Label1.Text = "Invalid User !!!"; DataList1.DataSource = null; DataList1.DataBind(); Button2.Visible = false; } } catch (Exception ex) { // Label1.Visible = true; Label1.Text = ex.Message.ToString(); } } }
/* * void AttachAssetObject(VuMarkIdentifier identifier, GameObject parent, string objectId, AssetInstance assetInstance, MediaElement fallbackImage, Action onOpen, Action onSelect) * { * if (fallbackImage != null) * { * AttachAssetObject(identifier, parent, objectId, assetInstance, fallbackImage.MediaUrl, fallbackImage.Layout, onOpen, onSelect); * } * else * { * AttachAssetObject(identifier, parent, objectId, assetInstance, null, null, onOpen); * } * }*/ void AttachMediaObject( MarkerMedia media, ARMarkerObject markerObj) { var activeObject = GetOrCreateActiveObject(media.ObjectId); VisualMarkerObject mediaObj = null; Action onReady = null; var worldObj = activeObject.HoldingMarkerObjects.GetFirstOrDefault(markerObj.MarkerIdentifier); if (worldObj != null) { activeObject.HoldingMarkerObjects.Remove(markerObj.MarkerIdentifier, worldObj); activeObject.TrackingMarkerObjects.Add(markerObj.GameObject, worldObj); mediaObj = worldObj.GameObject.GetComponent <VisualMarkerObject>(); switch (media.MediaType) { case Motive.Core.Media.MediaType.Audio: onReady = () => { var player = mediaObj.GetComponentInChildren <AudioSubpanel>(); player.Play(media.OnClose); }; break; case Motive.Core.Media.MediaType.Video: onReady = () => { var player = mediaObj.GetComponentInChildren <VideoSubpanel>(); player.Play(media.OnClose); }; break; } worldObj.GameObject.SetActive(true); } else { switch (media.MediaType) { case Motive.Core.Media.MediaType.Audio: { mediaObj = Instantiate(MarkerAudioObject); onReady = () => { var player = mediaObj.GetComponentInChildren <AudioSubpanel>(); player.Play(media.MediaUrl, media.OnClose); }; break; } case Motive.Core.Media.MediaType.Image: { mediaObj = Instantiate(MarkerImageObject); onReady = () => { ThreadHelper.Instance.StartCoroutine( ImageLoader.LoadImage(media.MediaUrl, mediaObj.RenderObject)); }; break; } case Motive.Core.Media.MediaType.Video: { mediaObj = Instantiate(MarkerVideoObject); var renderer = mediaObj.RenderObject.GetComponent <Renderer>(); renderer.enabled = false; onReady = () => { var player = mediaObj.GetComponentInChildren <VideoSubpanel>(); UnityAction setAspect = () => { renderer.enabled = true; if (media.MediaLayout == null) { var aspect = player.AspectRatio; if (aspect > 1) { // Wider than tall, reduce y scale player.transform.localScale = new Vector3(1, 1 / aspect, 1); } else { // Wider than tall, reduce x scale player.transform.localScale = new Vector3(aspect, 1, 1); } } }; player.ClipLoaded.AddListener(setAspect); player.Play(media.MediaUrl, media.OnClose); }; break; } } if (mediaObj) { if (media.MediaLayout != null) { LayoutHelper.Apply(mediaObj.LayoutObject.transform, media.MediaLayout); } if (media.Color != null) { var renderer = mediaObj.RenderObject.GetComponent <Renderer>(); if (renderer) { renderer.material.color = ColorHelper.ToUnityColor(media.Color); } } worldObj = CreateWorldObject(markerObj, mediaObj, mediaObj.RenderObject, media.ActivationContext); activeObject.TrackingMarkerObjects[markerObj.GameObject] = worldObj; worldObj.Clicked += (sender, args) => { if (media.OnSelect != null) { media.OnSelect(); } }; } } if (mediaObj) { mediaObj.transform.SetParent(markerObj.GameObject.transform, false); mediaObj.transform.localScale = ItemScale; mediaObj.transform.localPosition = Vector3.zero; mediaObj.transform.localRotation = Quaternion.identity; if (onReady != null) { onReady(); } if (media.OnOpen != null) { media.OnOpen(); } } }
public BindableImageView(Context context) : base(context) { _imageLoader = ImageLoader.Instance; _downloadCache = Mvx.Resolve<IMvxFileDownloadCache>(); }
LotThumbEntry GetLotEntryForFrame(uint shardID, uint location, bool facade) { LotThumbEntry result = null; var key = (((ulong)shardID) << 32) | location; var entries = facade ? FacadeEntries : Entries; if (!entries.TryGetValue(key, out result)) { result = new LotThumbEntry() { Location = location }; if (facade) { result.LotFacade = DefaultFSOF; Client.GetFacadeAsync(shardID, location, (data) => { if (data != null && !result.Dead && !result.Loaded) { using (var mem = new MemoryStream(data)) { result.Loaded = true; try { result.LotFacade = new FSOF(); result.LotFacade.Read(mem); result.LotFacade.LoadGPU(GameFacade.GraphicsDevice); } catch { result.LotFacade = null; } } } }); } else { result.LotTexture = DefaultThumb; Client.GetThumbnailAsync(shardID, location, (data) => { if (data != null && !result.Dead && !result.Loaded) { using (var mem = new MemoryStream(data)) { result.Loaded = true; try { result.LotTexture = ImageLoader.FromStream(GameFacade.GraphicsDevice, mem); } catch { result.LotTexture = new Texture2D(GameFacade.GraphicsDevice, 1, 1); } } } }); } entries[key] = result; } result.LastDrawSecond = Second; return(result); }
/// <summary> /// The main clustering execution logic, including the initialization (loading), cancellation, and progress handling. /// </summary> /// <param name="imageLoader">The initialized image loader object.</param> /// <returns></returns> protected abstract byte[] Execute(ImageLoader imageLoader);
internal static Control CreateRecursive( WndWindowDefinition wndWindow, ImageLoader imageLoader, ContentManager contentManager, AssetStore assetStore, WndCallbackResolver wndCallbackResolver, Point2D parentOffset) { var result = CreateControl(wndWindow, imageLoader); result.Name = wndWindow.Name; var wndRectangle = wndWindow.ScreenRect.ToRectangle(); result.Bounds = new Rectangle( wndRectangle.X - parentOffset.X, wndRectangle.Y - parentOffset.Y, wndRectangle.Width, wndRectangle.Height); var systemCallback = wndCallbackResolver.GetControlCallback(wndWindow.SystemCallback); if (systemCallback != null) { result.SystemCallback = systemCallback; } var inputCallback = wndCallbackResolver.GetControlCallback(wndWindow.InputCallback); if (inputCallback != null) { result.InputCallback = inputCallback; } var drawCallback = wndCallbackResolver.GetControlDrawCallback(wndWindow.DrawCallback); if (drawCallback != null) { result.DrawCallback = drawCallback; } // TODO: TooltipCallback result.Visible = !wndWindow.Status.HasFlag(WndWindowStatusFlags.Hidden); if (wndWindow.Status.HasFlag(WndWindowStatusFlags.SeeThru)) { result.BackgroundColor = ColorRgbaF.Transparent; result.BorderColor = ColorRgbaF.Transparent; } if (wndWindow.HasHeaderTemplate) { var headerTemplate = assetStore.HeaderTemplates.GetByName(wndWindow.HeaderTemplate); result.Font = contentManager.FontManager.GetOrCreateFont(headerTemplate.Font.Name, headerTemplate.Font.Size, headerTemplate.Font.Bold ? FontWeight.Bold : FontWeight.Normal); } else { result.Font = contentManager.FontManager.GetOrCreateFont(wndWindow.Font.Name, wndWindow.Font.Size, wndWindow.Font.Bold ? FontWeight.Bold : FontWeight.Normal); } result.TextColor = wndWindow.TextColor.Enabled.ToColorRgbaF(); result.Text = wndWindow.Text.Translate(); // TODO: TextBorderColor foreach (var childWindow in wndWindow.ChildWindows) { var child = CreateRecursive(childWindow, imageLoader, contentManager, assetStore, wndCallbackResolver, wndRectangle.Location); result.Controls.Add(child); } return(result); }
public static ImageLoader GetUserIcon(string email, int size) { string key = email + size; ImageLoader img; if (!userIcons.TryGetValue (key, out img)) { var md5 = System.Security.Cryptography.MD5.Create (); byte[] hash = md5.ComputeHash (Encoding.UTF8.GetBytes (email.Trim ().ToLower ())); StringBuilder sb = new StringBuilder (); foreach (byte b in hash) sb.Append (b.ToString ("x2")); string url = "http://www.gravatar.com/avatar/" + sb.ToString () + "?d=mm&s=" + size; userIcons [key] = img = new ImageLoader (url); } return img; }
private void OnStartup(object sender, StartupEventArgs e) { Log.Info("On Startup.", GetType()); var bootTime = new System.Diagnostics.Stopwatch(); bootTime.Start(); Stopwatch.Normal("App.OnStartup - Startup cost", () => { var textToLog = new StringBuilder(); textToLog.AppendLine("Begin PowerToys Run startup ----------------------------------------------------"); textToLog.AppendLine($"Runtime info:{ErrorReporting.RuntimeInfo()}"); RegisterAppDomainExceptions(); RegisterDispatcherUnhandledException(); _themeManager = new ThemeManager(this); ImageLoader.Initialize(_themeManager.GetCurrentTheme()); _settingsVM = new SettingWindowViewModel(); _settings = _settingsVM.Settings; _settings.UsePowerToysRunnerKeyboardHook = e.Args.Contains("--centralized-kb-hook"); _stringMatcher = new StringMatcher(); StringMatcher.Instance = _stringMatcher; _stringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision; _mainVM = new MainViewModel(_settings); _mainWindow = new MainWindow(_settings, _mainVM); API = new PublicAPIInstance(_settingsVM, _mainVM, _themeManager); _settingsReader = new SettingsReader(_settings, _themeManager); _settingsReader.ReadSettings(); PluginManager.InitializePlugins(API); Current.MainWindow = _mainWindow; Current.MainWindow.Title = Constant.ExeFileName; // main windows needs initialized before theme change because of blur settings HttpClient.Proxy = _settings.Proxy; RegisterExitEvents(); _settingsReader.ReadSettingsOnChange(); _mainVM.MainWindowVisibility = Visibility.Visible; _mainVM.ColdStartFix(); _themeManager.ThemeChanged += OnThemeChanged; textToLog.AppendLine("End PowerToys Run startup ---------------------------------------------------- "); bootTime.Stop(); Log.Info(textToLog.ToString(), GetType()); _mainVM.RegisterHotkey(); PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds }); // [Conditional("RELEASE")] // check update every 5 hours // check updates on startup }); }
private void OnStartup(object sender, StartupEventArgs e) { Log.Info("On Startup.", GetType()); // Fix for .net 3.1.19 making PowerToys Run not adapt to DPI changes. PowerLauncher.Helper.NativeMethods.SetProcessDPIAware(); var bootTime = new System.Diagnostics.Stopwatch(); bootTime.Start(); Stopwatch.Normal("App.OnStartup - Startup cost", () => { var textToLog = new StringBuilder(); textToLog.AppendLine("Begin PowerToys Run startup ----------------------------------------------------"); textToLog.AppendLine($"Runtime info:{ErrorReporting.RuntimeInfo()}"); RegisterAppDomainExceptions(); RegisterDispatcherUnhandledException(); _themeManager = new ThemeManager(this); ImageLoader.Initialize(_themeManager.GetCurrentTheme()); _settingsVM = new SettingWindowViewModel(); _settings = _settingsVM.Settings; _settings.StartedFromPowerToysRunner = e.Args.Contains("--started-from-runner"); _stringMatcher = new StringMatcher(); StringMatcher.Instance = _stringMatcher; _stringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision; _mainVM = new MainViewModel(_settings); _mainWindow = new MainWindow(_settings, _mainVM); API = new PublicAPIInstance(_settingsVM, _mainVM, _themeManager); _settingsReader = new SettingsReader(_settings, _themeManager); _settingsReader.ReadSettings(); PluginManager.InitializePlugins(API); Current.MainWindow = _mainWindow; Current.MainWindow.Title = Constant.ExeFileName; RegisterExitEvents(); _settingsReader.ReadSettingsOnChange(); _mainVM.MainWindowVisibility = Visibility.Visible; _mainVM.ColdStartFix(); _themeManager.ThemeChanged += OnThemeChanged; textToLog.AppendLine("End PowerToys Run startup ---------------------------------------------------- "); bootTime.Stop(); Log.Info(textToLog.ToString(), GetType()); PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds }); // [Conditional("RELEASE")] // check update every 5 hours // check updates on startup }); }
public void SetImage(string uri) { uriLoadedFrom = uri; ImageLoader.LoadImage(uri, this); }
public NewsBox() { this.InitializeComponent(); this.ImgLoader = new ImageLoader(this); }
private static void UpdatePreviewUrl(UIElement gridPreview, Image imagePreview, string url) { ImageLoader.SetUriSource(imagePreview, url); gridPreview.Visibility = (!string.IsNullOrEmpty(url) ? Visibility.Visible : Visibility.Collapsed); }
public BindableImageView(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer) { _imageLoader = ImageLoader.Instance; _downloadCache = Mvx.Resolve<IMvxFileDownloadCache>(); }
public BackgroundController(ProductJsonConverter productJsonConverter, IFileCache fileCache, IConfiguration configuration, ImageLoader imageLoader) { _productJsonConverter = productJsonConverter; _fileCache = fileCache; _configuration = configuration; _imageLoader = imageLoader; _itemHandlerFactory = new ItemHandlerFactory(_configuration, _fileCache, null, _imageLoader, null, null); }
void SlideshowView_Loaded(object sender, RoutedEventArgs e) { if (loader != null) return; ImageHost.Width = ActualWidth; ImageHost.Height = ActualHeight; loader = new ImageLoader(allFilenames); loader.ImageLoaded += loader_ImageLoaded; loader.BeginLoad((int)ActualWidth, (int)ActualHeight); DoNavigateTo(0); }
/// <summary> /// <see cref="LayerHelper.ConvertBitmapToPixelFormat_32bppArgb(Bitmap)"/> /// </summary> public static Bitmap ConvertToPixelFormat_32bppArgb(Bitmap image) { return(ImageLoader.ConvertBitmapToPixelFormat_32bppArgb(image)); }
public static void FinalizeTarget() { ImageLoader.RemoveImage("Cells"); }
public void UpdatedImage(Uri uri) { this.image.Image = ImageLoader.DefaultRequestImage(uri, this); }
private static void FacePresence() { var batchSize = 1000; int width = 32; int height = 32; BuilderInstance <float> .Volume = new VolumeBuilder(); // For GPU var imageLoader = new ImageLoader(); var randomImageLoader = new ImageLoader(true, 2); // Load Dataset - Faces var faces1 = LfwCropLoader.LoadDataset(@"..\..\..\Dataset\lfwcrop_grey", width, height); var faces2 = imageLoader.LoadDataset(@"..\..\..\Dataset\custom\faces", width, height); // dump you own face images here // Load Dataset - Non-faces var nonFaces1 = randomImageLoader.LoadDataset(@"..\..\..\Dataset\scene_categories", width, height); var nonFaces2 = randomImageLoader.LoadDataset(@"..\..\..\Dataset\TextureDatabase", width, height); var nonFaces3 = randomImageLoader.LoadDataset(@"..\..\..\Dataset\cars_brad_bg", width, height); var nonFaces4 = randomImageLoader.LoadDataset(@"..\..\..\Dataset\houses", width, height); var nonFaces5 = imageLoader.LoadDataset(@"..\..\..\Dataset\custom\non_faces", width, height); // dump you own non-face images here var facesDataset = new FaceDetectionDataset(width, height); facesDataset.TrainSet.AddRange(faces1); facesDataset.TrainSet.AddRange(faces2); facesDataset.TrainSet.AddRange(nonFaces1); facesDataset.TrainSet.AddRange(nonFaces2); facesDataset.TrainSet.AddRange(nonFaces3); facesDataset.TrainSet.AddRange(nonFaces4); facesDataset.TrainSet.AddRange(nonFaces5); Console.WriteLine(" Done."); ConvNetSharp <float> cns; // Model Op <float> softmax = null; if (File.Exists("FaceDetection.json")) { Console.WriteLine("Loading model from disk..."); softmax = SerializationExtensions.Load <float>("FaceDetection", false)[0]; // first element is the model (second element is the cost if it was saved along) cns = softmax.Graph; // Deserialization creates its own graph that we have to use. TODO: make it simplier in ConvNetSharp } else { cns = new ConvNetSharp <float>(); } var x = cns.PlaceHolder("x"); var dropProb = cns.PlaceHolder("dropProb"); if (softmax == null) { // Inspired by https://github.com/PCJohn/FaceDetect var layer1 = cns.Relu(cns.Conv(x, 5, 5, 4, 2) + cns.Variable(new Shape(1, 1, 4, 1), "bias1", true)); var layer2 = cns.Relu(cns.Conv(layer1, 3, 3, 16, 2) + cns.Variable(new Shape(1, 1, 16, 1), "bias2", true)); var layer3 = cns.Relu(cns.Conv(layer2, 3, 3, 32) + cns.Variable(new Shape(1, 1, 32, 1), "bias3", true)); var flatten = cns.Flatten(layer3); var dense1 = cns.Dropout(cns.Relu(cns.Dense(flatten, 600)) + cns.Variable(new Shape(1, 1, 600, 1), "bias4", true), dropProb); var dense2 = cns.Dense(dense1, 2) + cns.Variable(new Shape(1, 1, 2, 1), "bias5", true); softmax = cns.Softmax(dense2); } var y = cns.PlaceHolder("y"); // Cost var cost = new SoftmaxCrossEntropy <float>(cns, softmax, y); // Optimizer var optimizer = new AdamOptimizer <float>(cns, 1e-4f, 0.9f, 0.999f, 1e-16f); //if (File.Exists("loss.csv")) //{ // File.Delete("loss.csv"); //} Volume <float> trainingProb = 0.5f; Volume <float> testingProb = 0.0f; // Training using (var session = new Session <float>()) { session.Differentiate(cost); // computes dCost/dW at every node of the graph var iteration = 0; double currentCost; do { var batch = facesDataset.GetBatch(batchSize); var input = batch.Item1; var output = batch.Item2; var dico = new Dictionary <string, Volume <float> > { { "x", input }, { "y", output }, { "dropProb", trainingProb } }; var stopwatch = Stopwatch.StartNew(); // session.Run(softmax, dico); Debug.WriteLine(stopwatch.ElapsedMilliseconds); currentCost = session.Run(cost, dico); Console.WriteLine($"cost: {currentCost}"); File.AppendAllLines("loss.csv", new[] { currentCost.ToString(CultureInfo.InvariantCulture) }); session.Run(optimizer, dico); if (iteration++ % 100 == 0) { // Test on a on random picture var test = facesDataset.GetBatch(100); dico = new Dictionary <string, Volume <float> > { { "x", test.Item1 }, { "dropProb", testingProb } }; var result = session.Run(softmax, dico); int correct = 0; for (int i = 0; i < 100; i++) { var class0Prob = result.Get(0, 0, 0, i); var class1Prob = result.Get(0, 0, 1, i); if ((test.Item3[i].IsFace && class1Prob > class0Prob) || (!test.Item3[i].IsFace && class0Prob > class1Prob)) { correct++; } } Console.WriteLine($"Test: {correct}%"); File.AppendAllLines("accuracy.csv", new[] { correct.ToString() }); var filename = test.Item3[0].Filename; softmax.Save("FaceDetection"); } } while (currentCost > 1e-5 && !Console.KeyAvailable); softmax.Save("FaceDetection"); } }
private void AddManyViews() { Random rand = new Random(); for (int i = 0; i < AutoDisposedObjectCount; i++) { int viewSize = 150; var view = new Custom3DView() { Size = new Size(viewSize, viewSize, viewSize), Position = new Position( rand.Next(10, win.WindowSize.Width - 10), rand.Next(10, win.WindowSize.Height - 10), rand.Next(-3 * viewSize, 3 * viewSize) ), }; root.Add(view); PixelData pixelData = PixelBuffer.Convert(ImageLoader.LoadImageFromFile( resource + "/images/PopupTest/circle.jpg", new Size2D(), FittingModeType.ScaleToFill )); Texture texture = new Texture( TextureType.TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() ); texture.Upload(pixelData); TextureSet textureSet = new TextureSet(); textureSet.SetTexture(0u, texture); Renderer renderer = new Renderer(GenerateGeometry(), new Shader(VERTEX_SHADER, FRAGMENT_SHADER)); renderer.SetTextures(textureSet); view.AddRenderer(renderer); rotateAnimation.AnimateBy(view, "Orientation", new Rotation(new Radian(new Degree(360.0f)), Vector3.YAxis)); } for (int i = 0; i < ManualDisposedObjectCount; i++) { int viewSize = 150; var view = new Custom3DView() { Size = new Size(viewSize, viewSize, viewSize), Position = new Position( rand.Next(10, win.WindowSize.Width - 10), rand.Next(10, win.WindowSize.Height - 10), rand.Next(-3 * viewSize, 3 * viewSize) ), }; root.Add(view); views.Add(view); PixelData pixelData = PixelBuffer.Convert(ImageLoader.LoadImageFromFile( resource + "/images/PaletteTest/red2.jpg", new Size2D(), FittingModeType.ScaleToFill )); Texture texture = new Texture( TextureType.TEXTURE_2D, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight() ); texture.Upload(pixelData); TextureSet textureSet = new TextureSet(); textureSet.SetTexture(0u, texture); Renderer renderer = new Renderer(GenerateGeometry(), new Shader(VERTEX_SHADER, FRAGMENT_SHADER)); renderer.SetTextures(textureSet); view.AddRenderer(renderer); rotateAnimation.AnimateBy(view, "Orientation", new Rotation(new Radian(new Degree(-360.0f)), Vector3.YAxis)); } rotateAnimation.Looping = true; rotateAnimation.Play(); }
public IAsyncResult BeginLoadPortrait(Session session, ImageSize size, AsyncCallback userCallback, object state) { return(ImageLoader.Begin(LibSpotify.sp_artist_portrait_r, Handle, session, size, userCallback, state)); }
void PrepareCell(UITableViewCell cell) { if (cell == null) { return; } cell.Accessory = Accessory; var tl = cell.TextLabel; tl.Text = Caption; tl.TextAlignment = Alignment; tl.TextColor = TextColor ?? UIColor.Black; tl.Font = Font ?? UIFont.BoldSystemFontOfSize(17); tl.LineBreakMode = LineBreakMode; tl.Lines = Lines; // The check is needed because the cell might have been recycled. if (cell.DetailTextLabel != null) { cell.DetailTextLabel.Text = Value == null ? "" : Value; } if (_extraInfo == null) { ClearBackground(cell); } else { var imgView = cell.ImageView; UIImage img; if (imgView != null) { if (_extraInfo.Uri != null) { img = ImageLoader.DefaultRequestImage(_extraInfo.Uri, this); } else if (_extraInfo.Image != null) { img = _extraInfo.Image; } else { img = null; } imgView.Image = img; } if (cell.DetailTextLabel != null) { cell.DetailTextLabel.TextColor = _extraInfo.DetailColor ?? UIColor.Gray; } } if (cell.DetailTextLabel != null) { cell.DetailTextLabel.Lines = Lines; cell.DetailTextLabel.LineBreakMode = LineBreakMode; cell.DetailTextLabel.Font = SubtitleFont ?? UIFont.SystemFontOfSize(14); cell.DetailTextLabel.TextColor = (_extraInfo == null || _extraInfo.DetailColor == null) ? UIColor.Gray : _extraInfo.DetailColor; } }
public Image EndLoadPortrait(IAsyncResult result) { return(ImageLoader.End(result)); }
/// <summary> /// Callback when windows theme is changed. /// </summary> /// <param name="oldTheme">Previous Theme</param> /// <param name="newTheme">Current Theme</param> private void OnThemeChanged(Theme oldTheme, Theme newTheme) { ImageLoader.UpdateIconPath(newTheme); _mainVM.Query(); }
private void OnStartup(object sender, StartupEventArgs e) { RunnerHelper.WaitForPowerToysRunner(_powerToysPid, () => { try { Dispose(); } finally { Environment.Exit(0); } }); var bootTime = new System.Diagnostics.Stopwatch(); bootTime.Start(); Stopwatch.Normal("|App.OnStartup|Startup cost", () => { Log.Info("|App.OnStartup|Begin PowerToys Run startup ----------------------------------------------------"); Log.Info($"|App.OnStartup|Runtime info:{ErrorReporting.RuntimeInfo()}"); RegisterAppDomainExceptions(); RegisterDispatcherUnhandledException(); _themeManager = new ThemeManager(this); ImageLoader.Initialize(_themeManager.GetCurrentTheme()); _settingsVM = new SettingWindowViewModel(); _settings = _settingsVM.Settings; _alphabet.Initialize(_settings); _stringMatcher = new StringMatcher(_alphabet); StringMatcher.Instance = _stringMatcher; _stringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision; PluginManager.LoadPlugins(_settings.PluginSettings); _mainVM = new MainViewModel(_settings); _mainWindow = new MainWindow(_settings, _mainVM); API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet, _themeManager); PluginManager.InitializePlugins(API); Current.MainWindow = _mainWindow; Current.MainWindow.Title = Constant.ExeFileName; // main windows needs initialized before theme change because of blur settings Http.Proxy = _settings.Proxy; RegisterExitEvents(); _settingsWatcher = new SettingsWatcher(_settings); _mainVM.MainWindowVisibility = Visibility.Visible; _mainVM.ColdStartFix(); _themeManager.ThemeChanged += OnThemeChanged; Log.Info("|App.OnStartup|End PowerToys Run startup ---------------------------------------------------- "); bootTime.Stop(); PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds }); // [Conditional("RELEASE")] // check update every 5 hours // check updates on startup }); }
public ImageCourseObj(Id<Special> specialId, float scaleRatio, CourseAppearance appearance, PointF[] locations, string imageName, Bitmap imageBitmap) : base(Id<ControlPoint>.None, Id<CourseControl>.None, specialId, scaleRatio, appearance, Geometry.RectFromPoints(locations[0].X, locations[0].Y, locations[1].X, locations[1].Y)) { this.imageName = imageName; this.imageBitmap = imageBitmap; this.imageLoader = new ImageLoader(imageName, imageBitmap); }
private void Image_MouseLeave(object sender, MouseEventArgs e) { CloseImage.Source = ImageLoader.FromResource("Close.png"); }
private void OnStartup(object sender, StartupEventArgs e) { var bootTime = new System.Diagnostics.Stopwatch(); bootTime.Start(); Stopwatch.Normal("|App.OnStartup|Startup cost", () => { Log.Info("|App.OnStartup|Begin Wox startup ----------------------------------------------------"); Log.Info($"|App.OnStartup|Runtime info:{ErrorReporting.RuntimeInfo()}"); RegisterAppDomainExceptions(); RegisterDispatcherUnhandledException(); ImageLoader.Initialize(); _settingsVM = new SettingWindowViewModel(); _settings = _settingsVM.Settings; _alphabet.Initialize(_settings); _stringMatcher = new StringMatcher(_alphabet); StringMatcher.Instance = _stringMatcher; _stringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision; ThemeManager themeManager = new ThemeManager(this); PluginManager.LoadPlugins(_settings.PluginSettings); _mainVM = new MainViewModel(_settings); var window = new MainWindow(_settings, _mainVM); API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet); PluginManager.InitializePlugins(API); Current.MainWindow = window; Current.MainWindow.Title = Constant.ExeFileName; // happlebao todo temp fix for instance code logic // load plugin before change language, because plugin language also needs be changed InternationalizationManager.Instance.Settings = _settings; InternationalizationManager.Instance.ChangeLanguage(_settings.Language); // main windows needs initialized before theme change because of blur settings Http.Proxy = _settings.Proxy; RegisterExitEvents(); _settingsWatcher = new SettingsWatcher(_settings); _mainVM.MainWindowVisibility = Visibility.Visible; _mainVM.ColdStartFix(); Log.Info("|App.OnStartup|End Wox startup ---------------------------------------------------- "); bootTime.Stop(); PowerToysTelemetry.Log.WriteEvent(new LauncherBootEvent() { BootTimeMs = bootTime.ElapsedMilliseconds }); //[Conditional("RELEASE")] // check update every 5 hours // check updates on startup }); }
public BindableImageView(Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base(context, attrs, defStyleAttr, defStyleRes) { _imageLoader = ImageLoader.Instance; _downloadCache = Mvx.Resolve<IMvxFileDownloadCache>(); }
public MonkeyAdapter(Activity context, IEnumerable<Monkey> friends) { this.context = context; this.friends = friends; ImageLoader = ImageLoader.Instance; }
public void UpdateCell(Uri uri) { imageView.Image = ImageLoader.DefaultRequestImage(uri, this); }