예제 #1
0
        //public List<System.Drawing.Bitmap> GetAllFrames()
        //{
        //    return GetFramesInRange(0, FrameCount);
        //}

        public List <BitmapSource> GetFramesInRange(int startInclusive, int count)
        {
            List <BitmapSource> frames = new List <BitmapSource>();

            for (int i = startInclusive; i < startInclusive + count; i++)
            {
                if (i < FrameCount)
                {
                    System.Drawing.Bitmap bmp = GetBitmap(i);
                    BitmapSource          src = ViewablePrototypeItem.ToBitmapSource(Bitmap.FromSystemDrawingBitmap(bmp));
                    frames.Add(src);
                }
            }

            return(frames);
        }
예제 #2
0
            public Visual Visualize(Ptype ptype, object parameter = null)
            {
                if (!ptype.Model.Name.Equals("onepart"))
                {
                    throw new Exception("One Part Model cannot render prototypes created by other models.");
                }

                Feature part = ptype.Feature("part");

                Image img = new Image();

                img.Source = ViewablePrototypeItem.ToBitmapSource(part.Bitmap);
                img.SnapsToDevicePixels = true;
                img.Stretch             = System.Windows.Media.Stretch.Uniform;
                RenderOptions.SetBitmapScalingMode(img, BitmapScalingMode.NearestNeighbor);

                return(img);
            }
예제 #3
0
 private BitmapSource GetBitmapSource(int index)
 {
     return(ViewablePrototypeItem.ToBitmapSource(Bitmap.FromSystemDrawingBitmap(_frames.GetBitmap(index))));
 }