C# Class LayoutFarm.HtmlBoxes.BackgroundImagePaintHelper

Contains all the paint code to paint different background images.
显示文件 Open project: prepare/HTML-Renderer Class Usage Examples

Public Methods

Method Description
DrawBackgroundImage ( Canvas g, CssBox box, ImageBinder imageBinder, RectangleF rectangle ) : void

Draw the background image of the given box in the given rectangle.
Handle background-repeat and background-position values.

Private Methods

Method Description
DrawRepeat ( Canvas g, Image img, RectangleF rectangle, Rectangle srcRect, Rectangle destRect, Size imgSize ) : void

Draw the background image at the required location repeating it over the X and Y axis.
Adjust location to left-top if starting location doesn't include all the range (adjusted to center or bottom/right).

DrawRepeatX ( Canvas g, Image img, RectangleF rectangle, Rectangle srcRect, Rectangle destRect, Size imgSize ) : void

Draw the background image at the required location repeating it over the X axis.
Adjust location to left if starting location doesn't include all the range (adjusted to center or right).

DrawRepeatY ( Canvas g, Image img, RectangleF rectangle, Rectangle srcRect, Rectangle destRect, Size imgSize ) : void

Draw the background image at the required location repeating it over the Y axis.
Adjust location to top if starting location doesn't include all the range (adjusted to center or bottom).

GetLocation ( CssLength posX, CssLength posY, RectangleF rectangle, Size imgSize ) : Point

Get top-left location to start drawing the image at depending on background-position value.

Method Details

DrawBackgroundImage() public static method

Draw the background image of the given box in the given rectangle.
Handle background-repeat and background-position values.
public static DrawBackgroundImage ( Canvas g, CssBox box, ImageBinder imageBinder, RectangleF rectangle ) : void
g PixelFarm.Drawing.Canvas the device to draw into
box CssBox the box to draw its background image
imageBinder ImageBinder
rectangle PixelFarm.Drawing.RectangleF the rectangle to draw image in
return void