private void SetupWorld(World world) { _imageFactory.Create("background"); CreateGameOver(world); CreateScoreText(); CreateOkButton(); }
public override Image Clone() { ImageGray <T> clone = (ImageGray <T>)ImageFactory.Create(Width, Height, ColorModel.GRAY, GetDataType()); clone.Gray = (GenericChannel <T>)Gray.Clone(); return(clone); }
public IImage Create <T>(string path) where T : SystemImage <T> { var image = _imageFactory.Create <T>(path); return(image); }
public Round StartRoundOrGetExisting(int userId) { GameEntity gameEntity = StartNewGameOrGetExisting(userId); RoundEntity roundEntity = _roundRepository.GetCurrentOpenRound(gameEntity.Id); if (null != roundEntity) { // Unfinished round return(RoundEntityFactory.Create(roundEntity, ROUNDS_PER_GAME, RoundsPlayedInGame(gameEntity.Id))); } roundEntity = RoundEntityFactory.Create(gameEntity.Id); // Determine the correct one var randomImages = _imageRepository.GetRandomImages(IMAGES_PER_ROUND, _userRepository.Get(userId).FullName); int indexOfCorrectImageInList = (new Random()).Next(IMAGES_PER_ROUND); var correctImage = randomImages.ElementAt(indexOfCorrectImageInList); Round round = RoundFactory.Create(new List <Image>(), RoundsPlayedInGame(gameEntity.Id), ROUNDS_PER_GAME, correctImage.Name); roundEntity.CorrectImageId = correctImage.Id; _roundRepository.Create(roundEntity); foreach (ImageEntity imageEntity in randomImages) { ImageInRoundEntity imageInRoundEntity = ImageInRoundEntityFactory.Create(imageEntity.Id, roundEntity.Id); _imageInRoundRepository.Create(imageInRoundEntity); round.Images.Add(ImageFactory.Create(imageEntity.Url, imageEntity.Id)); } return(round); }
static void Main(string[] args) { try { string path = args[0]; string output = args[1]; var imageFactory = new ImageFactory(); Debugging.Debugger.Print("Reading: " + path); IImage image = imageFactory.Create <PNGImage>(path); _fill = new bool[image.Height * image.Width]; Debugging.Debugger.Print("Calculating outline..."); OutlineImage(image); Debugging.Debugger.Print("Applying outline..."); ColorOutline(image); Debugging.Debugger.Print("Saving image to: " + output); image.Save(output); } catch (Exception e) { Debugging.Debugger.PrintError(e); } }
public override bool Open(string file_name) { _paginal_image_file = ImageFactory.Create(file_name); Bitmap = _paginal_image_file.CurrentPage; return(true); }
internal override GenericImage <T> Add(GenericImage <T> other) { ImageGray <T> outcome = (ImageGray <T>)ImageFactory.Create(Width, Height, GetColorModel(), GetDataType()); ImageGray <T> otherGray = (ImageGray <T>)other.ToGray(); outcome.Gray = Gray.Add(otherGray.Gray); return(outcome); }
public override Image Clone() { ImageHSV <T> clone = (ImageHSV <T>)ImageFactory.Create(Width, Height, ColorModel.HSV, GetDataType()); clone.H = (GenericChannel <T>)H.Clone(); clone.S = (GenericChannel <T>)S.Clone(); clone.V = (GenericChannel <T>)V.Clone(); return(clone); }
public void Create() { IImageFactory fac = new ImageFactory(); fac.AddProvider(new GeneralImageProvider(new GeneralImageOptions())); fac.Create(110, 40, "abcde").Save("abcde.jpg", ImageFormat.Jpeg); Assert.True(true); }
internal override GenericImage <T> Add(GenericImage <T> other) { ImageHSV <T> outcome = (ImageHSV <T>)ImageFactory.Create(Width, Height, GetColorModel(), GetDataType()); ImageHSV <T> otherHSV = (ImageHSV <T>)other.ToHSV(); outcome.H = H.Add(otherHSV.H); outcome.S = S.Add(otherHSV.S); outcome.V = V.Add(otherHSV.V); return(outcome); }
public override Image Clone() { ImageCMYK <T> clone = (ImageCMYK <T>)ImageFactory.Create(Width, Height, ColorModel.CMYK, GetDataType()); clone.C = (GenericChannel <T>)C.Clone(); clone.M = (GenericChannel <T>)M.Clone(); clone.Y = (GenericChannel <T>)Y.Clone(); clone.K = (GenericChannel <T>)K.Clone(); return(clone); }
internal override GenericImage <T> Add(GenericImage <T> other) { ImageCMYK <T> outcome = (ImageCMYK <T>)ImageFactory.Create(Width, Height, GetColorModel(), GetDataType()); ImageCMYK <T> otherCMYK = (ImageCMYK <T>)other.ToCMYK(); outcome.C = C.Add(otherCMYK.C); outcome.M = M.Add(otherCMYK.M); outcome.Y = Y.Add(otherCMYK.Y); outcome.K = K.Add(otherCMYK.K); return(outcome); }
public override Image ToRGB() { ImageRGB <T> result = (ImageRGB <T>)ImageFactory.Create(Width, Height, ColorModel.RGB, GetDataType()); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { result.R[x, y] = Gray[x, y]; result.G[x, y] = Gray[x, y]; result.B[x, y] = Gray[x, y]; } } return(result); }
public override Image ToCMYK() { ImageCMYK <T> result = (ImageCMYK <T>)ImageFactory.Create(Width, Height, ColorModel.CMYK, GetDataType()); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { result.C[x, y] = Gray[x, y]; result.M[x, y] = Gray[x, y]; result.Y[x, y] = Gray[x, y]; result.K[x, y] = Gray[x, y]; } } return(result); }
private void CreateImage() { int width = _hdu.Axes[0].NumPoints; int height = _hdu.Axes[1].NumPoints; // see if our values make little sense if (width <= 0 || height <= 0 || (_modelState.PixelMinimum == 0 && _modelState.PixelMaximum == 0)) { // TODO: create a special exception class throw new System.Exception("Can't create Image - Invalid image data!"); } // create image object CurrentImage = ImageFactory.Create(_modelState.ImagePixelFormat); // make sure we have a color table if (_colorTable == null) { ResetColorTable(); } // initialize it passing the color table CurrentImage.Initialize(_hdu.DataMngr.Data, width, height, _colorTable, null); }
private void SetupWorld() { _imageFactory.Create("background", Color.White); _buttonFactory.CreateAtCenter("playButton", Play); }
public Task <Image> Save(Stream stream, string currentFileName, string contentType) => _imageFactory.Create(stream, currentFileName, contentType);
private void CreateBorders() { var entity = _imageFactory.Create("borders"); entity.Set <Borders>(); }