- CssSpriteGenerator.zip
- Code
- CssSpriteGenerator.sln
- CssSpriteGenerator.suo
- CssSpriteGenerator.vssscc
- CssSpriteGenerator
- DemoSite_AutoResized
- DemoSite_CombineAndMinify
- ___generated
- Bin
- CombineAndMinify.dll
- CombineAndMinify.pdb
- CssSpriteGenerator.dll
- CssSpriteGenerator.pdb
- EcmaScript.NET.modified.dll
- Yahoo.Yui.Compressor.dll
- DemoSite_CompressedJpeg
- DemoSite_CompressedPng
- DemoSite_CssBackgroundImages
- App_Browsers
- PageAdapter.browser
- Bin
- CssSpriteGenerator.dll
- CssSpriteGenerator.pdb
- css
- images
- button-green-left.png
- button-green-right.png
- button-green-w100.png
- button-orange-left.png
- button-orange-right.png
- button-orange-w100.png
- gradient-hor-blue-w20h1.png
- gradient-hor-green-w20h1.png
- gradient-vert-blue-w1h20.png
- gradient-vert-green-w1h20.png
- gradient-vert-lightblue-w1h10.png
- gradient-vert-orange-w1h10.png
- site.css
- Default.aspx
- Default.aspx.cs
- web.config
- DemoSite_Database
- DemoSite_DefaultConfig
- App_Browsers
- PageAdapter.browser
- Bin
- CssSpriteGenerator.dll
- CssSpriteGenerator.pdb
- Default.aspx
- Default.aspx.cs
- images
- band-4bits.png
- cart.png
- circles-8bits.gif
- contactus.png
- dragonboats-thumbnail1.jpg
- dragonboats-thumbnail2.jpg
- dragonboats-thumbnail3.jpg
- print.png
- rectangles-4bits.png
- smallrectangles-4bits.png
- web.config
- DemoSite_FolderImages
- DemoSite_Gallery
- DemoSite_QuickStart
- App_Browsers
- PageAdapter.browser
- Bin
- CssSpriteGenerator.dll
- CssSpriteGenerator.pdb
- Default.aspx
- Default.aspx.cs
- images
- 200x200.png
- 90x90.gif
- 90x90.jpg
- 90x90.png
- photos
- vanuatu2.JPG
- web.config
- CssSpriteGenerator.zip
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace CssSpriteGenerator
{
public class Css_ImageReference : IImageReferenceWithCombineTypeRestriction
{
private CssImage _cssImage = null;
private string _originalImageFilePath = null;
private ConfigSection _cs = null;
public Css_ImageReference(CssImage cssImage, ConfigSection cs)
{
_cssImage = cssImage;
_cs = cs;
_originalImageFilePath = UrlUtils.MapPath(_cssImage.ImageUrl, ConfigSection.OptionIsActive(cs.ExceptionOnMissingFile));
}
#region IImageReferenceWithCombineTypeRestriction Members
public string OriginalImageFilePath
{
get { return _originalImageFilePath; }
}
public Size SizeFromProperties { get { return new Size(-1,-1); } }
public void ReplaceWithSprite(
string spriteUrl, int xOffset, int yOffset, int imageWidth, int imageHeight, bool overrideImgTagDimensionProperties,
Stylesheet additionalCss, int nbrImagesInSprite)
{
string cssDeclaration = HtmlUtils.CssSpriteCss(spriteUrl, xOffset, yOffset, _cssImage.BackgroundAlignment);
additionalCss.AddDefinition(_cssImage.CssSelector, cssDeclaration);
}
public CombineRestriction CombineRestriction
{
get
{
if (_cssImage == null)
{
return CombineRestriction.Null;
}
else
{
return _cssImage.CombineRestriction;
}
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Twitter: @MattPerdeck
LinkedIn: au.linkedin.com/in/mattperdeck
Current project:
JSNLog JavaScript Logging Package
Matt has over 9 years .NET and SQL Server development experience. Before getting into .Net, he worked on a number of systems, ranging from the largest ATM network in The Netherlands to embedded software in advanced Wide Area Networks and the largest ticketing web site in Australia. He has lived and worked in Australia, The Netherlands, Slovakia and Thailand.
He is the author of the book ASP.NET Performance Secrets (www.amazon.com/ASP-NET-Site-Performance-Secrets-Perdeck/dp/1849690685) in which he shows in clear and practical terms how to quickly find the biggest bottlenecks holding back the performance of your web site, and how to then remove those bottlenecks. The book deals with all environments affecting a web site - the web server, the database server and the browser.
Matt currently lives in Sydney, Australia. He recently worked at Readify and the global professional services company PwC. He now works at SP Health, a global provider of weight loss web sites such at CSIRO's TotalWellBeingDiet.com and BiggestLoserClub.com.