Beispiel #1
0
        public Bitmap GetFrame(int position, int width, int height)
        {
            if (!is_prepared_picture_)
            {
                PreparePicture();
                is_prepared_picture_ = true;
            }

            CacheItem cache_item = new CacheItem();
            int       prev       = frame_position_list_[position];
            int       current    = frame_position_list_[position + 1];

            for (int i = prev; i < current; ++i)
            {
                if ((int)tag_list_[i].tag == (int)ObjectType.PlaceObject2)
                {
                    PlaceObject place = new PlaceObject(tag_list_[i], data_reader_, (int)tag_list_[i].size);
                    cache_item.AddCommand(FindPicture(place.ObjectId), place.ObjectId, place.X / 20, place.Y / 20, place.Alpha);
                }
            }

            int src_width  = (frame_size_.x_max - frame_size_.x_min) / 20;
            int src_height = (frame_size_.y_max - frame_size_.y_min) / 20;

            Bitmap bitmap = cache_.GetBitmap(cache_item, (width > 0 ? width : src_width),
                                             (height > 0 ? height : src_height), src_width, src_height);

            return((Bitmap)bitmap.Clone());
        }