예제 #1
0
파일: type.cs 프로젝트: 2276225819/prpaint
        public static WriteableBitmap Create(ISize s)
        {
            var wn = new WriteableBitmap(s.DrawWidth, s.DrawHeight);

            //new Graphics(Color.Transparent, wn).fillRect(0, 0, w, h);
            return(wn);
        }
 public GoogleProjectIcon(IIcon icon, IIconColor color, ISize size, string density)
 {
     this.Icon    = icon;
     this.Color   = color;
     this.Size    = size;
     this.Density = density;
 }
예제 #3
0
        public TextEditElement(IPosition position, ISize size, Func <string> readContent, Action <string> saveContent, StyleIndex styleIndex = StyleIndex.TextElement)
            : base(position, size, styleIndex, readContent)
        {
            this.saveContent = saveContent;

            Normalize();
        }
예제 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommonController" /> class.
 /// </summary>
 /// <param name="_iMaster">The i common.</param>
 /// <param name="_iProductCategoryType">Type of the i product category.</param>
 /// <param name="_iUser">The i user.</param>
 /// <param name="_iSize">Size of the i.</param>
 public MasterController(IMaster _iMaster, IProductCategoryType _iProductCategoryType, IUser _iUser, ISize _iSize)
 {
     iMaster = _iMaster;
     iProductCategoryType = _iProductCategoryType;
     iUser = _iUser;
     iSize = _iSize;
 }
 public ValueRenderRectangle(Double x,
                             Double y,
                             ISize size,
                             IPoint2D offset)
     : this(x, y, size.Width, size.Height, offset)
 {
 }
예제 #6
0
 public MapFrame(ISize size)
 {
     Start     = Coor.Empty;
     Size      = size;
     ConstSize = (ISize)Size.Clone();
     Scale     = 1;
 }
예제 #7
0
        static private void GetSizePrivate(XElement element, ISize isize, int[] size)
        {
            IEnumerable <XElement> nl = element.GetChildNodes();

            foreach (XElement n in nl)
            {
                if (!(n is XElement))
                {
                    continue;
                }
                XElement e   = n as XElement;
                bool     rec = false;
                Action <XElement, int[]> gs = isize.GetSize(e, out rec);
                int x = size[0];
                int y = size[1];
                gs(e, size);
                if (x > size[0])
                {
                    size[0] = x;
                }
                if (y > size[1])
                {
                    size[1] = y;
                }
                if (rec)
                {
                    GetSizePrivate(e, isize, size);
                }
            }
        }
예제 #8
0
        public static LandingArea Create(ISize landingAreaSize)
        {
            LandingArea landingArea = new LandingArea();

            landingArea.SetSize(landingAreaSize);
            return(landingArea);
        }
예제 #9
0
        ///// <summary>
        ///// Generate a new image from the bitmap with the specified format, width, and height, and at the specified location.
        ///// Returns the actual size of the generated image, which may differ from the requested values by a pixel or so.
        ///// </summary>
        ///// <param name="sourceBmp">The bitmap containing an image from which to generate a new image with the
        ///// specified settings. This bitmap is not modified.</param>
        ///// <param name="newFilePath">The location on disk to store the image that is generated.</param>
        ///// <param name="newImageFormat">The new image format.</param>
        ///// <param name="newWidth">The width to make the new image.</param>
        ///// <param name="newHeight">The height to make the new image.</param>
        ///// <param name="newJpegQuality">The JPEG quality setting (0 - 100) for the new image. Only used if the
        ///// image format parameter is JPEG; ignored for all other formats.</param>
        ///// <returns>An instance of <see cref="Size" /> that describes the actual width and height of the generated image.</returns>
        ///// <exception cref="System.ArgumentNullException">sourceBmp</exception>
        ///// <exception cref="UnsupportedImageTypeException">Thrown when <paramref name="sourceBmp" />
        ///// cannot be resized to the requested dimensions.</exception>
        ///// <exception cref="ArgumentNullException">Thrown when <paramref name="sourceBmp" /> is null.</exception>
        //public static Size SaveImageFile(System.Drawing.Image sourceBmp, string newFilePath, ImageFormat newImageFormat, double newWidth, double newHeight, int newJpegQuality)
        //{
        //    if (sourceBmp == null)
        //        throw new ArgumentNullException(nameof(sourceBmp));

        //    //Create new bitmap with the new dimensions and in the specified format.
        //    Bitmap destinationBmp = CreateResizedBitmap(sourceBmp, sourceBmp.Size.Width, sourceBmp.Size.Height, newWidth, newHeight);

        //    try
        //    {
        //        SaveImageToDisk(destinationBmp, newFilePath, newImageFormat, newJpegQuality);

        //        return new Size(destinationBmp.Width, destinationBmp.Height);
        //    }
        //    finally
        //    {
        //        destinationBmp.Dispose();
        //    }
        //}

        ///// <summary>
        ///// Overlay the text and/or image watermark over the image specified in the <paramref name="filePath" /> parameter and return.
        ///// </summary>
        ///// <param name="filePath">A string representing the full path to the image file
        ///// (e.g. "C:\mypics\myprettypony.jpg", "myprettypony.jpg").</param>
        ///// <param name="galleryId">The gallery ID. The watermark associated with this gallery is applied to the file.</param>
        ///// <returns>
        ///// Returns a System.Drawing.Image instance containing the image with the watermark applied.
        ///// </returns>
        //public static System.Drawing.Image AddWatermark(string filePath, int galleryId)
        //{
        //    Watermark wm = Factory.GetWatermarkInstance(galleryId);
        //    return wm.ApplyWatermark(filePath);
        //}

        ///// <summary>
        ///// Create a new Bitmap with the specified dimensions.
        ///// </summary>
        ///// <param name="inputBmp">The source bitmap to use.</param>
        ///// <param name="sourceBmpWidth">The width of the input bitmap. This should be equal to inputBmp.Size.Width, but it is added as
        ///// a parameter so that calling code can send a cached value rather than requiring this method to query the bitmap for the data.
        ///// If a value less than zero is specified, then inputBmp.Size.Width is used.
        ///// </param>
        ///// <param name="sourceBmpHeight">The height of the input bitmap. This should be equal to inputBmp.Size.Height, but it is added as
        ///// a parameter so that calling code can send a cached value rather than requiring this method to query the bitmap for the data.</param>
        ///// If a value less than zero is specified, then inputBmp.Size.Height is used.
        ///// <param name="newWidth">The width of the new bitmap.</param>
        ///// <param name="newHeight">The height of the new bitmap.</param>
        ///// <returns>Returns a new Bitmap with the specified dimensions.</returns>
        ///// <exception cref="UnsupportedImageTypeException">Thrown when <paramref name="inputBmp"/>
        ///// cannot be resized to the requested dimensions. Typically this will occur during
        ///// <see cref="Graphics.DrawImage(System.Drawing.Image, Rectangle, Rectangle, GraphicsUnit)"/> because there is not enough system memory.</exception>
        ///// <exception cref="ArgumentNullException">Thrown when <paramref name="inputBmp" /> is null.</exception>
        //public static Bitmap CreateResizedBitmap(System.Drawing.Image inputBmp, int sourceBmpWidth, int sourceBmpHeight, double newWidth, double newHeight)
        //{
        //    //Adapted (but mostly copied) from http://www.codeproject.com/cs/media/bitmapmanip.asp
        //    //Create a new bitmap object based on the input
        //    if (inputBmp == null)
        //        throw new ArgumentNullException("inputBmp");

        //    if (sourceBmpWidth <= 0)
        //        sourceBmpWidth = inputBmp.Size.Width;

        //    if (sourceBmpHeight <= 0)
        //        sourceBmpHeight = inputBmp.Size.Height;

        //    double xScaleFactor = newWidth / sourceBmpWidth;
        //    double yScaleFactor = newHeight / sourceBmpHeight;

        //    int calculatedNewWidth = (int)(sourceBmpWidth * xScaleFactor);
        //    int calculatedNewHeight = (int)(sourceBmpHeight * yScaleFactor);

        //    if (calculatedNewWidth <= 0)
        //    {
        //        calculatedNewWidth = 1; // Make sure the value is at least 1.
        //        xScaleFactor = (float)calculatedNewWidth / (float)sourceBmpWidth; // Update the scale factor to reflect the new width
        //    }

        //    if (calculatedNewHeight <= 0)
        //    {
        //        calculatedNewHeight = 1; // Make sure the value is at least 1.
        //        yScaleFactor = (float)calculatedNewHeight / (float)sourceBmpHeight; // Update the scale factor to reflect the new height
        //    }

        //    Bitmap newBmp = null;
        //    try
        //    {
        //        newBmp = new Bitmap(calculatedNewWidth, calculatedNewHeight, PixelFormat.Format24bppRgb); //Graphics.FromImage doesn't like Indexed pixel format

        //        //Create a graphics object attached to the new bitmap
        //        using (Graphics newBmpGraphics = Graphics.FromImage(newBmp))
        //        {
        //            newBmpGraphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

        //            // Make background white. Without this a thin grey line is rendered along the top and left.
        //            // See http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/2c9ac8d0-366c-4919-8f92-3a91c56f41e0/
        //            newBmpGraphics.Clear(Color.White);

        //            newBmpGraphics.ScaleTransform((float)xScaleFactor, (float)yScaleFactor);

        //            //Draw the bitmap in the graphics object, which will apply the scale transform.
        //            //Note that pixel units must be specified to ensure the framework doesn't attempt
        //            //to compensate for varying horizontal resolutions in images by resizing; in this case,
        //            //that's the opposite of what we want.
        //            Rectangle drawRect = new Rectangle(0, 0, sourceBmpWidth, sourceBmpHeight);

        //            lock (_sharedLock)
        //            {
        //                try
        //                {
        //                    try
        //                    {
        //                        newBmpGraphics.DrawImage(inputBmp, drawRect, drawRect, GraphicsUnit.Pixel);
        //                    }
        //                    catch (OutOfMemoryException)
        //                    {
        //                        // The garbage collector will automatically run to try to clean up memory, so let's wait for it to finish and
        //                        // try again. If it still doesn't work because the image is just too large and the system doesn't have enough
        //                        // memory, catch the OutOfMemoryException and throw one of our UnsupportedImageTypeException exceptions instead.
        //                        GC.WaitForPendingFinalizers();
        //                        newBmpGraphics.DrawImage(inputBmp, drawRect, drawRect, GraphicsUnit.Pixel);
        //                    }
        //                }
        //                catch (OutOfMemoryException)
        //                {
        //                    throw new Events.CustomExceptions.UnsupportedImageTypeException();
        //                }
        //            }
        //        }
        //    }
        //    catch
        //    {
        //        if (newBmp != null)
        //            newBmp.Dispose();

        //        throw;
        //    }

        //    return newBmp;
        //}

        ///// <overloads>Persist the specified image to disk at the specified path.</overloads>
        ///// <summary>
        ///// Persist the specified image to disk at the specified path. If the directory to contain the file does not exist, it
        ///// is automatically created.
        ///// </summary>
        ///// <param name="image">The image to persist to disk.</param>
        ///// <param name="newFilePath">The full physical path, including the file name to where the image is to be stored. Ex: C:\mypics\cache\2008\May\flower.jpg</param>
        ///// <param name="imageFormat">The file format for the image.</param>
        ///// <param name="jpegQuality">The quality value to save JPEG images at. This is a value between 1 and 100. This parameter
        ///// is ignored if the image format is not JPEG.</param>
        ///// <exception cref="ArgumentNullException">Thrown when <paramref name="imageFormat" /> is null.</exception>
        //public static void SaveImageToDisk(System.Drawing.Image image, string newFilePath, ImageFormat imageFormat, int jpegQuality)
        //{
        //    if (imageFormat == null)
        //        throw new ArgumentNullException("imageFormat");

        //    if (String.IsNullOrEmpty(newFilePath))
        //        throw new ArgumentNullException("newFilePath");

        //    VerifyDirectoryExistsForNewFile(newFilePath);

        //    if (imageFormat.Equals(ImageFormat.Jpeg))
        //        SaveJpgImageToDisk(image, newFilePath, jpegQuality);
        //    else
        //        SaveNonJpgImageToDisk(image, newFilePath, imageFormat);
        //}

        ///// <summary>
        ///// Persist the specified image to disk at the specified path. If the directory to contain the file does not exist, it
        ///// is automatically created.
        ///// </summary>
        ///// <param name="imageData">The image to persist to disk.</param>
        ///// <param name="newFilePath">The full physical path, including the file name to where the image is to be stored. Ex: C:\mypics\cache\2008\May\flower.jpg</param>
        ///// <exception cref="ArgumentNullException">Thrown when <paramref name="imageData" /> or <paramref name="newFilePath" /> is null.</exception>
        //public static void SaveImageToDisk(byte[] imageData, string newFilePath)
        //{
        //    if (imageData == null)
        //        throw new ArgumentNullException("imageData");

        //    if (String.IsNullOrEmpty(newFilePath))
        //        throw new ArgumentNullException("newFilePath");

        //    VerifyDirectoryExistsForNewFile(newFilePath);

        //    File.WriteAllBytes(newFilePath, imageData);
        //}

        #endregion

        #region Private Static Methods

        //private static void SaveJpgImageToDisk(System.Drawing.Image image, string newFilepath, long jpegQuality)
        //{
        //    //Save the image in the JPG format using the specified compression value.
        //    using (EncoderParameters eps = new EncoderParameters(1))
        //    {
        //        eps.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, jpegQuality);
        //        ImageCodecInfo ici = GetEncoderInfo("image/jpeg");
        //        image.Save(newFilepath, ici, eps);
        //    }
        //}

        ///// <summary>
        ///// Make sure the directory exists for the file at the specified path. It is created if it does not exist.
        ///// (For example, it might not exist when the user changes the thumbnail or optimized location and subsequently
        ///// synchronizes. This process creates a new directory structure to match the directory structure where the
        ///// originals are stored, and there may be cases where we need to save a file to a directory that doesn't yet exist.
        ///// </summary>
        ///// <param name="newFilepath">The full physical path for which to verify the directory exists. Ex: C:\mypics\cache\2008\May\flower.jpg</param>
        //private static void VerifyDirectoryExistsForNewFile(string newFilepath)
        //{
        //    if (!Directory.Exists(Path.GetDirectoryName(newFilepath)))
        //    {
        //        Directory.CreateDirectory(Path.GetDirectoryName(newFilepath));
        //    }
        //}

        //private static void SaveNonJpgImageToDisk(System.Drawing.Image image, string newFilepath, System.Drawing.Imaging.ImageFormat imgFormat)
        //{
        //    image.Save(newFilepath, imgFormat);
        //}

        //private static ImageCodecInfo GetEncoderInfo(String mimeType)
        //{
        //    //Get the image codec information for the specified mime type.
        //    ImageCodecInfo[] encoders = ImageCodecInfo.GetImageEncoders();
        //    for (int j = 0; j < encoders.Length; ++j)
        //    {
        //        if (encoders[j].MimeType == mimeType)
        //            return encoders[j];
        //    }
        //    return null;
        //}

        /// <summary>
        ///   Calculate new width and height values of an existing <paramref name="size" /> instance, making the length
        ///   of the longest side equal to <paramref name="maxLength" />. The aspect ratio if preserved. If
        ///   <paramref name="autoEnlarge" /> is <c>true</c>, then increase the size so that the longest side equals <paramref name="maxLength" />
        ///   (i.e. enlarge a small image if necessary).
        /// </summary>
        /// <param name="size">The current size of an object.</param>
        /// <param name="maxLength">The target length (in pixels) of the longest side.</param>
        /// <param name="autoEnlarge">
        ///   A value indicating whether to enlarge objects that are smaller than the
        ///   <paramref name="size" />. If true, the new width and height will be increased if necessary. If false, the original
        ///   width and height are returned when their dimensions are smaller than <paramref name="maxLength" />. This
        ///   parameter has no effect when <paramref name="maxLength" /> is greater than the width and height of
        ///   <paramref name="size" />.
        /// </param>
        /// <returns>
        ///   Returns a <see cref="Size" /> instance conforming to the requested parameters.
        /// </returns>
        private static ISize CalculateWidthAndHeight(ISize size, int maxLength, bool autoEnlarge)
        {
            int newWidth, newHeight;

            if (!autoEnlarge && (maxLength > size.Width) && (maxLength > size.Height))
            {
                // Bitmap is smaller than desired thumbnail dimensions but autoEnlarge = false. Don't enlarge thumbnail;
                // just use original size.
                newWidth  = (int)size.Width;
                newHeight = (int)size.Height;
            }
            else if (size.Width > size.Height)
            {
                // Bitmap is in landscape format (width > height). The width will be the longest dimension.
                newWidth  = maxLength;
                newHeight = (int)(size.Height * newWidth / size.Width);
            }
            else
            {
                // Bitmap is in portrait format (height > width). The height will be the longest dimension.
                newHeight = maxLength;
                newWidth  = (int)(size.Width * newHeight / size.Height);
            }

            return(new Size(newWidth, newHeight));
        }
 public RenderRectangle(IPoint2D location,
                        ISize size,
                        IPoint2D offset)
     : base(location, size)
 {
     _offset = offset;
 }
예제 #11
0
        public void GetClass_IsElement_Correctly()
        {
            // Arrange
            this.underTest = Size.IsElement(50);

            // Act
            var underTestClass = underTest.Class;
            var underTestCss   = underTest.Css;

            // Assert
            underTestClass.Should().NotBeNullOrWhiteSpace();

            underTestClass.Split(' ').Should()
            .HaveCount(5)
            .And
            .OnlyHaveUniqueItems();

            underTestCss.Should()
            .NotBeNull()
            .And
            .HaveCount(5);

            underTestCss.Keys.Should()
            .Match(keys => keys.All(key => !string.IsNullOrWhiteSpace(key)));


            underTestCss.Values.Should()
            .Match(values => values.All(value => Regex.Matches(value, "50em").Count == 2));
        }
예제 #12
0
        public IPosition Move(ISize withinBoundary)
        {
            IPosition newPosition = this;

            switch (this.Orientation)
            {
            case Oriented.NORTH:
                newPosition = this.YAxis < withinBoundary.Lenght - 1 ? StepNorth(): this;
                break;

            case Oriented.EAST:
                newPosition = this.XAxis < withinBoundary.Width - 1 ? StepEast() : this;
                break;

            case Oriented.SOUTH:
                newPosition = this.YAxis > 0 ? StepSouth() : this;
                break;

            case Oriented.WEST:
                newPosition = this.XAxis > 0 ? StepWest() : this;
                break;
            }
            ;

            return(newPosition);
        }
        public IconDetailsViewModel(IIcon icon, ISize size = null, IIconColor color = null)
            : this()
        {
            var sizes     = icon.Provider.GetSizes();
            var densities = icon.Provider.GetDensities();

            // fill selection controls
            this._icon      = icon;
            this._colors    = new ObservableCollection <IIconColor>(MaterialIconColor.Get());
            this._size      = size ?? sizes.First();
            this._sizes     = new ObservableCollection <ISize>(sizes);
            this._densities = new ObservableCollection <Selectable <string> >(
                densities.Select(density => new Selectable <string>(density, !density.Contains("drawable"),
                                                                    (x) => this.AddToProjectCommand.RaiseCanExecuteChanged())));

            // fill user selection
            this._color                 = color ?? MaterialIconColor.Black;
            this._colorCode             = this.ColorToCode(this._color.Color);
            this._materialColorSelected = this._color is MaterialIconColor
                ? this._color
                : MaterialIconColor.Black;
            this._projectIcon = icon.Provider.CreateProjectIcon(this.Icon,
                                                                this.Color, this.Size, densities.FirstOrDefault());

            this.GenerateName();
        }
예제 #14
0
        public void OnFullHD_SetsValue_Correctly()
        {
            // Arrange
            this.underTest = Size.Is.OnFullHD("75px");

            // Act
            var underTestClass = underTest.Class;
            var underTestCss   = underTest.Css;

            // Assert
            underTestClass.Should().NotBeNullOrWhiteSpace();
            underTestClass.Split(' ').Should()
            .HaveCount(1)
            .And
            .OnlyHaveUniqueItems();

            underTestCss.Should()
            .NotBeNull()
            .And
            .HaveCount(1);

            underTestCss.Keys.Should()
            .Match(keys => keys.All(key => !string.IsNullOrWhiteSpace(key)));


            var lines = underTestCss.Values.ToArray();

            lines.Should().HaveCount(1);

            lines[0].Should().Match(line => Regex.Matches(line, "75px").Count == 2);
        }
 public ValueCube(Double x,
                  Double y,
                  ISize size,
                  Double depth)
     : this(x, y, size.Width, size.Height, depth)
 {
 }
예제 #16
0
    public static Vector3 GetExtentPos(ISize obj, PosEnum pos)
    {
        float x, y;

        if ((int)pos < 3)
        {
            y = obj.Center.y + obj.Height / 2f;
        }
        else if ((int)pos < 6)
        {
            y = obj.Center.y;
        }
        else
        {
            y = obj.Center.y - obj.Height / 2f;
        }
        if ((int)pos % 3 == 0)
        {
            x = obj.Center.x - obj.Width / 2f;
        }
        else if ((int)pos % 3 == 1)
        {
            x = obj.Center.x;
        }
        else
        {
            x = obj.Center.x + obj.Width / 2f;
        }
        return(Round(new Vector3(x, y, 0)));
    }
예제 #17
0
 public PuzzleSaver(ISize size, string filename, Broadcast broadcast)
 {
     _size      = size;
     _filename  = filename;
     _broadcast = broadcast;
     _pixels    = new Color[size.Width, size.Height];
 }
 public ValueIntRectangle(IPoint2D pos,
                          ISize size)
     : this(Convert.ToInt32(pos.X),
            Convert.ToInt32(pos.Y),
            Convert.ToInt32(size.Width),
            Convert.ToInt32(size.Height))
 {
 }
 public BaseGdiDevice(Color?backgroundColor,
                      ISize size)
 {
     Invalidate(
         Convert.ToInt32(size.Width),
         Convert.ToInt32(size.Height),
         backgroundColor);
 }
예제 #20
0
        public TextViewElement(IPosition position, ISize size, StyleIndex styleIndex = StyleIndex.TextElement, Func <string> readContent = null)
            : base(position, size, styleIndex)
        {
            //this.text         = (readContent == null) ? null : readContent();
            this.readContent = readContent;

            Normalize();
        }
예제 #21
0
 public HomeController(ISize sizeService, IDepth depthService, ITopping toppingService, IPizza pizzaService, IPizzaTopping pizzaToppingService)
 {
     _sizeService         = sizeService;
     _depthService        = depthService;
     _toppingService      = toppingService;
     _pizzaService        = pizzaService;
     _pizzaToppingService = pizzaToppingService;
 }
예제 #22
0
        public void Create_landing_area_success()
        {
            ISize     landingAreaSize     = Size.Create(100, 100);
            ISize     platformSize        = Size.Create(10, 10);
            IPosition platformoutPosition = Position.Create(5, 5);

            Assert.NotNull(Landings.Create(landingAreaSize, platformSize, platformoutPosition));
        }
        public void Resize(ISize newSize)
        {
            var oldSizeVector = canvasItem.GetSize().ToVector();
            var newSizeVector = newSize.ToVector();

            var deltaSize = newSizeVector.Subtract(oldSizeVector);
            DeltaResize(deltaSize);
        }
예제 #24
0
        public void ShouldReturnSize()
        {
            //arrange
            ISize actualsSize = CharacterRace.WoodElf.Size();

            //assert
            actualsSize.Should().Be(new Medium());
        }
 public ProjectIconDesign(IIcon icon, IIconColor color, ISize size, string density)
 {
     this.Icon     = icon;
     this.FullName = icon.Name;
     this.Color    = color;
     this.Size     = size;
     this.Density  = density;
 }
예제 #26
0
 public Region(IPosition position, ISize size, StyleIndex styleIndex = StyleIndex.Default)
 {
     this.row        = position.row;
     this.col        = position.col;
     this.width      = size.width;
     this.height     = size.height;
     this.styleIndex = styleIndex;
 }
예제 #27
0
        private long GetDocumentSize(ISize doc)
        {
            if (doc == null)
            {
                return(1);
            }

            return(doc.Size);
        }
예제 #28
0
        public void SetSize(ISize size)
        {
            if (size == null)
            {
                throw new ArgumentNullException(nameof(size));
            }

            _size = Aggregates.Size.Create(size.X, size.Y);
        }
예제 #29
0
        public static LandingPlatform Create(ISize size, IPosition position, int platformRocketSeparation)
        {
            LandingPlatform landingPlatform = new LandingPlatform();

            landingPlatform.SetSize(size);
            landingPlatform.SetPlatformPosition(position);
            landingPlatform.SetPlatformRocketSeparation(platformRocketSeparation);
            return(landingPlatform);
        }
예제 #30
0
 public ProductCategoryAPIController(IProductCategoryService _categoryService, IAscending _ascending, ICount _count, IPageNumber _number, ISize _size, IItemSearch _itemSearch)
 {
     this.categoryService = _categoryService;
     this.ascending       = _ascending;
     this.count           = _count;
     this.number          = _number;
     this.size            = _size;
     this.itemSearch      = _itemSearch;
 }
예제 #31
0
파일: HubSaver.cs 프로젝트: calielc/Mosaic
        public HubSaver(ISize size, string filename, Broadcast broadcast, Queue queue)
        {
            _queue = queue;

            _puzzleSaver  = new PuzzleSaver(size, filename, broadcast);
            _heatmapSaver = new HeatmapSaver(size, filename, broadcast);
            _tileSaver    = new TileSaver(size, filename, broadcast);
            _creators     = new[] { _puzzleSaver, _heatmapSaver, _tileSaver, };
        }
예제 #32
0
 public static Size GetOrientatedSize(ISize media, MediaOrientation orientation)
 {
     switch (orientation)
     {
         case MediaOrientation.Transpose:
         case MediaOrientation.Rotate90:
         case MediaOrientation.Transverse:
         case MediaOrientation.Rotate270 : return new Size(media.Height, media.Width);
         default                         : return new Size(media.Width, media.Height);
     }
 }
예제 #33
0
        public static Rectangle CalculateCropRectangle(ISize sourceSize, ISize targetSize, Alignment anchor)
        {
            var x = 0d;
            var y = 0d;

            var nPercent = 0d;
            double nPercentW = (double)targetSize.Width / (double)sourceSize.Width;
            double nPercentH = (double)targetSize.Height / (double)sourceSize.Height;

            if (nPercentH < nPercentW)
            {
                nPercent = nPercentW;

                switch (anchor)
                {
                    case Alignment.Top:
                        y = 0;
                        break;
                    case Alignment.Bottom:
                        y = targetSize.Height - (sourceSize.Height * nPercent);
                        break;
                    default:
                        y = (targetSize.Height - (sourceSize.Height * nPercent)) / 2d;
                        break;
                }
            }
            else
            {
                nPercent = nPercentH;

                switch (anchor)
                {
                    case Alignment.Left:
                        y = 0;
                        break;
                    case Alignment.Right:
                        x = targetSize.Width - (sourceSize.Width * nPercent);
                        break;
                    default:
                        x = (targetSize.Width - (sourceSize.Width * nPercent)) / 2d;
                        break;
                }
            }

            return new Rectangle(
                x: (int)x,
                y: (int)y,
                width: (int)(sourceSize.Width * nPercent),
                height: (int)(sourceSize.Height * nPercent)
            );
        }
예제 #34
0
파일: Polygon.cs 프로젝트: carbon/Media
        public Polygon FromPercentages(ISize size)
        {
            var bounds = Vector2f.Create(size);

            var scaled = new Vector2f[Vertices.Length];

            var i = 0;

            foreach (var vector in Vertices)
            {
                scaled[i] = Vector2f.Create(vector.X * bounds.X, vector.Y * bounds.Y);

                i++;
            }

            return new Polygon(scaled);
        }
예제 #35
0
파일: Polygon.cs 프로젝트: carbon/Media
 public static Vector2f Create(ISize size)
     => new Vector2f { X = size.Width, Y = size.Height };
예제 #36
0
파일: Rectangle.cs 프로젝트: nrkn/NrknLib
 public Rectangle( ISize size )
     : this(0, size.Width - 1, size.Height - 1, 0)
 {
 }
예제 #37
0
 public static bool FitsIn(this ISize source, ISize target)
     => source.Width <= target.Width && source.Height <= target.Height;
예제 #38
0
 /// <summary>
 /// Draws the character when scaled to geographic sizes.
 /// </summary>
 /// <param name="character"></param>
 /// <param name="center"></param>
 /// <param name="size"></param>
 public virtual void DrawCharacter(ICharacterSymbol character, ICoordinate center, ISize size)
 {
     
     Envelope env = new Envelope(center.X - size.XSize / 2, center.X + size.XSize / 2, center.Y - size.YSize / 2, center.Y + size.YSize / 2);
     Rectangle r = ProjToBuffer(env);
     Font tempFont = new Font(character.FontFamilyName, r.Height, character.Style, GraphicsUnit.Pixel);
     Brush brush = new SolidBrush(character.Color);
     _device.TextContrast = 0;
     _device.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
     _device.DrawString(character.ToString(), tempFont, brush, r.Left, r.Top);
     brush.Dispose();
     tempFont.Dispose();
 }
 public GridSnappingEngine(ISize gridSize, double threshold)
     : base(threshold)
 {
     GridSize = gridSize;            
 }
예제 #40
0
파일: PrintLayout.cs 프로젝트: kanbang/Colt
        ILogo IPrintLayout.CreateLogo(string symbolLibraryId, string symbolName, ISize size, IPosition position)
        {
            var logo = new PrintLayoutLogo()
            {
                Name = symbolName,
                ResourceId = symbolLibraryId,
                Position = (PrintLayoutLogoPosition)position,
                Size = (PrintLayoutLogoSize)size
            };

            return logo;
        }
예제 #41
0
 public MediaRenditionInfo(ISize size, string path)
     : this(size.Width, size.Height, path)
 { }
예제 #42
0
        public static Size CalculateScaledSize(ISize source, Size maxSize)
        {
            #region Preconditions

            if (source == null)
                throw new ArgumentNullException("source");

            #endregion

            return CalculateScaledSize(new Size(source.Width, source.Height), maxSize);
        }
예제 #43
0
        public static Size CalculateScaledSize(ISize source, double scale)
        {
            #region Preconditions

            if (source == null) throw new ArgumentNullException("source");

            #endregion

            return new Size(
                width: (int)(source.Height * scale),
                height: (int)(source.Width * scale)
            );
        }