예제 #1
0
        ///<summary>
        /// Creates a new instance of the OutlineTextProcessor class.
        ///</summary>
        public OutlineTextProcessor(ModelItem modelItemParam, TemplateBase templateParam, string fontPathParam)
        {
            modelItem = modelItemParam;
            template = templateParam;

            PrivateFontCollection fontcollection = new PrivateFontCollection();
            fontcollection.AddFontFile(fontPathParam + template.Font.FileName);
            fontFamily = fontcollection.Families[0];
        }
예제 #2
0
        public void Delete(ModelItem modelItem)
        {
            //ToDo JavaScript does not know if modelItem deletes from the database
            if (!ModelState.IsValid)
                return;

            var mi = _modelItemRepository.Get(modelItem.Id);

            if (mi != null)
            {
                _modelItemRepository.Delete(mi);

                _modelItemRepository.Save();
            }
        }
예제 #3
0
        public int AddModelItem(ModelItem modelItem)
        {
            if (!ModelState.IsValid)
                return 0;

            var model = _modelRepository.Get(modelItem.ModelId);

            if (model == null)
                return 0;

            model.Items.Add(modelItem);
            _modelRepository.Save();

            return modelItem.Id;
        }
예제 #4
0
        public Model CreateFromSample(int id)
        {
            if (!ModelState.IsValid)
                return null;

            Sample sample = _sampleRepository.Get(id);

            if (sample != null)
            {
                Model model = new Model();

                model.Image = sample.Image;
                model.ContentType = sample.ContentType;
                model.ImageHeight = sample.ImageHeight;
                model.ImageWidth = sample.ImageWidth;
                model.Items = new List<ModelItem>();

                foreach (SampleItem sampleItem in sample.Items)
                {
                    ModelItem modelItem = new ModelItem();
                    modelItem.ItemType = sampleItem.ItemType;
                    modelItem.FontColor = sampleItem.FontColor;
                    modelItem.TemplateId = sampleItem.TemplateId;
                    modelItem.PositionLeft = sampleItem.PositionLeft;
                    modelItem.PositionTop = sampleItem.PositionTop;
                    modelItem.Rotation = sampleItem.Rotation;
                    modelItem.FontSize = sampleItem.FontSize;
                    modelItem.Text = sampleItem.Text;
                    modelItem.Model = model;

                    model.Items.Add(modelItem);
                }

                _modelRepository.Add(model);
                _modelRepository.Save();

                return model;
            }

            return null;
        }
예제 #5
0
        public void Update(ModelItem modelItem)
        {
            //ToDo JavaScript does not know if modelItem saves in the database
            if (!ModelState.IsValid)
                return;

            var mi = _modelItemRepository.Get(modelItem.Id);

            if (mi != null)
            {
                mi.PositionLeft = modelItem.PositionLeft;
                mi.PositionTop = modelItem.PositionTop;
                mi.Rotation = modelItem.Rotation;
                mi.Text = modelItem.Text;
                mi.TemplateId = modelItem.TemplateId;
                mi.FontColor = modelItem.FontColor;
                mi.FontSize = modelItem.FontSize;

                _modelItemRepository.Save();
            }
        }
예제 #6
0
        public TemplateForm()
        {
            InitializeComponent();

            colorDialog = new ColorDialog();

            fakeModelItem = new ModelItem()
            {
                Id = 1,
                ModelId = 1,
                PositionTop = 0,
                PositionLeft = 0,
                Text = String.Empty,
                TemplateId = 1,
                FontSize = 64,
                FontColor = "#FF00FF",
                Rotation = 0,
            };

            resultImage = new Bitmap(1, 1);

            fontPath = Utils.GetFontPath();
        }