コード例 #1
0
ファイル: ImageBuilder.cs プロジェクト: stoennies/raumwiese
        protected void buildRandomImageCoverThread(int _imageRowCount = 3, int _width = 40, delegate_OnImageReady _delegate = null)
        {
            int imageCount = _imageRowCount * _imageRowCount;
            int subImageWidth = _width / _imageRowCount;
            int imageWidth = _width, imageHeight = _width;
            int x=1,y=1;
            List<Image> imageList = this.loadRandomImagesFromDB(imageCount+1);

            Image image = null;

            if (imageList == null)
                return;

            if (imageList.Count >= imageCount)
            {
                Bitmap outputImage = new Bitmap(imageWidth, imageHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                Graphics graphics = Graphics.FromImage(outputImage);

                foreach(Image img in imageList)
                {
                    graphics.DrawImage(img, x, y, subImageWidth, subImageWidth);
                    x += subImageWidth;
                    if (x >= imageWidth)
                    {
                        x = 0;
                        y += subImageWidth;
                        if (y >= imageHeight)
                            break;
                    }
                }

                image = (Image)outputImage;

            }

            if (_delegate != null) _delegate(image);
        }
コード例 #2
0
        protected void buildRandomImageCoverThread(int _imageRowCount = 3, int _width = 40, delegate_OnImageReady _delegate = null)
        {
            int          imageCount = _imageRowCount * _imageRowCount;
            int          subImageWidth = _width / _imageRowCount;
            int          imageWidth = _width, imageHeight = _width;
            int          x = 1, y = 1;
            List <Image> imageList = this.loadRandomImagesFromDB(imageCount + 1);

            Image image = null;

            if (imageList == null)
            {
                return;
            }

            if (imageList.Count >= imageCount)
            {
                Bitmap   outputImage = new Bitmap(imageWidth, imageHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
                Graphics graphics    = Graphics.FromImage(outputImage);

                foreach (Image img in imageList)
                {
                    graphics.DrawImage(img, x, y, subImageWidth, subImageWidth);
                    x += subImageWidth;
                    if (x >= imageWidth)
                    {
                        x  = 0;
                        y += subImageWidth;
                        if (y >= imageHeight)
                        {
                            break;
                        }
                    }
                }

                image = (Image)outputImage;
            }

            if (_delegate != null)
            {
                _delegate(image);
            }
        }
コード例 #3
0
ファイル: ImageBuilder.cs プロジェクト: stoennies/raumwiese
 public void buildRandomImageCover(int _imageRowCount = 3, int _width = 40, delegate_OnImageReady _delegate = null)
 {
     Thread thread = new Thread(() => buildRandomImageCoverThread(_imageRowCount, _width, _delegate));
     thread.Start();
 }
コード例 #4
0
        public void buildRandomImageCover(int _imageRowCount = 3, int _width = 40, delegate_OnImageReady _delegate = null)
        {
            Thread thread = new Thread(() => buildRandomImageCoverThread(_imageRowCount, _width, _delegate));

            thread.Start();
        }