Beispiel #1
0
        public virtual string GetExpr(ImageItem item)
        {
            var opts = "comp:" + item.FinalDimensions.Width + ',' + item.FinalDimensions.Height;

            /////////////////////////////////////////////////////////
            // Background

            var origBgSize = GetOriginalBGSize(item.SizeType);

            var aspectRatio = origBgSize.Width / (float)origBgSize.Height;
            var newBgHeight = (int)(item.FinalDimensions.Width / aspectRatio);

            var bgPath = GetBGPath(item.SizeType);

            if (bgPath != null)
            {
                var dimensions = new Size(item.FinalDimensions.Width, newBgHeight);
                opts += ";" + CompositedLayer.MakeString(bgPath, 0, 0, null, dimensions);
            }

            /////////////////////////////////////////////////////////
            // Foreground

            opts += ";" + CompositedLayer.MakeString(
                item.ForegroundImagePath,
                item.ForegroundCoords.X,
                item.ForegroundCoords.Y,
                null,
                Size.Empty
                );

            return(opts);
        }
Beispiel #2
0
		public virtual String GetExpr(ImageItem item) {
			
			String opts = "comp:" + item.FinalDimensions.Width + ',' + item.FinalDimensions.Height;
			
			/////////////////////////////////////////////////////////
			// Background
			
			Size origBgSize = GetOriginalBGSize( item.SizeType );
			
			Single aspectRatio = (Single)origBgSize.Width / (Single)origBgSize.Height;
			Int32  newBgHeight  = (Int32)( (Single)item.FinalDimensions.Width / aspectRatio );
			
			String bgPath = GetBGPath( item.SizeType );
			if( bgPath != null ) {
				Size dimensions = new Size( item.FinalDimensions.Width, newBgHeight );
				opts += ";" + CompositedLayer.MakeString( bgPath, 0, 0, null, dimensions );
			}
			
			/////////////////////////////////////////////////////////
			// Foreground
			
			opts += ";" + CompositedLayer.MakeString( item.ForegroundImagePath, item.ForegroundCoords.X, item.ForegroundCoords.Y, null, Size.Empty );
			
			return opts;
		}
Beispiel #3
0
 private void LoadLayer(CompositedLayer layer)
 {
     if (layer == null)
     {
         __compPreview.Image = null;
     }
     else
     {
         __compPreview.Image = layer.Image;
     }
 }
Beispiel #4
0
		public override String GetExpr(ImageItem item) {
			
			String opts = base.GetExpr(item);
			
			//////////////////////////////////
			// Background Stripe (goes at the very front because sometimes the foreground spreads on to it)
			if( item.SizeType != SizeType.Small ) {
				
				opts += ";" + CompositedLayer.MakeString( pathToStripe, item.FinalDimensions.Width - 3, 0, null, Size.Empty );
			}
			
			return opts;
		}
Beispiel #5
0
        private void __compLayers_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (__compLayers.SelectedIndex == -1)
            {
                LoadImage(null);
            }
            else
            {
                Object obj = __compLayers.Items[__compLayers.SelectedIndex];
                if (obj is String)
                {
                    LoadFinalImage(_currentImage);
                }
                else
                {
                    CompositedLayer layer = (CompositedLayer)obj;

                    LoadLayer(layer);
                }
            }
        }