C# Class Smrf.GraphicsLib.GraphicsUtil

Set of static methods that perform graphics operations not available directly through GDI+.
Do not try to instantiate an object of this type. All methods are static.
Show file Open project: 2014-sed-team3/term-project

Public Methods

Method Description
AreaToRadius ( Double dArea ) : Double
Clear ( Graphics oGraphics, Color oColor ) : void
CreateRoundedRectangleGraphicsPath ( Rectangle oRectangle, Int32 iCornerRadius ) : GraphicsPath
DiamondFromCenterAndHalfWidth ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : System.Drawing.PointF[]
DisposeBitmap ( Bitmap &oBitmap ) : void
DisposeBrush ( Brush &oBrush ) : void
DisposeGraphics ( Graphics &oGraphics ) : void
DisposeGraphicsPath ( GraphicsPath &oGraphicsPath ) : void
DisposePen ( Pen &oPen ) : void
DisposeSolidBrush ( SolidBrush &oSolidBrush ) : void
DistanceBetweenTwoPointFs ( PointF point1, PointF point2 ) : System.Single
Draw3DHorizontalLine ( Graphics oGraphics, System.Single fLeft, System.Single fTop, System.Single fRight ) : System.Single
DrawCircle ( Graphics oGraphics, Pen oPen, System.Single fXCenter, System.Single fYCenter, System.Single fRadius ) : void
DrawDiamond ( Graphics oGraphics, Pen oPen, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
DrawErrorStringOnGraphics ( Graphics oGraphics, Rectangle oRectangle, String sString ) : void
DrawSquare ( Graphics oGraphics, Pen oPen, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
DrawTriangle ( Graphics oGraphics, Pen oPen, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
FillCircle ( Graphics oGraphics, Brush oBrush, System.Single fXCenter, System.Single fYCenter, System.Single fRadius ) : void
FillCircle3D ( Graphics oGraphics, Color oColor, System.Single fXCenter, System.Single fYCenter, System.Single fRadius ) : void
FillDiamond ( Graphics oGraphics, Brush oBrush, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
FillSquare ( Graphics oGraphics, Brush oBrush, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
FillSquare3D ( Graphics oGraphics, Color oColor, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
FillTextRectangle ( Graphics oGraphics, Rectangle oRectangle, System.Boolean bTextIsSelected ) : void
FillTriangle ( Graphics oGraphics, Brush oBrush, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
GetDiamondEdgeMidpoints ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : System.Drawing.PointF[]
GetImageCodecInfoForMimeType ( String sMimeType ) : System.Drawing.Imaging.ImageCodecInfo
GetTriangleEdgeMidpoints ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : System.Drawing.PointF[]
LineSegmentsIntersect ( PointF endpointA1, PointF endpointA2, PointF endpointB1, PointF endpointB2 ) : System.Boolean
MoveRectangleWithinBounds ( RectangleF rectangle, RectangleF boundingRectangle, System.Boolean resizeRectangleIfNecessary ) : RectangleF
PixelsToPoints ( Graphics oGraphics, System.Single fWidthPx, System.Single fHeightPx, System.Single &fWidthPt, System.Single &fHeightPt ) : void
PointsToPixels ( Graphics oGraphics, System.Single fWidthPt, System.Single fHeightPt, Int32 &iWidthPx, Int32 &iHeightPx ) : void
PointsToPixels ( Graphics oGraphics, System.Single fWidthPt, System.Single fHeightPt, System.Single &fWidthPx, System.Single &fHeightPx ) : void
RadiusToArea ( Double dRadius ) : Double
RectangleFToRectangle ( RectangleF oRectangle, Int32 iPenWidthPx ) : Rectangle
SaveHighQualityImage ( Image oImage, String sFileName, ImageFormat eImageFormat ) : void
SaveJpegImage ( Image oImage, String sFileName, Int32 iQuality ) : void
SquareFromCenterAndHalfWidth ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : RectangleF
TriangleFromCenterAndHalfWidth ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : System.Drawing.PointF[]

Protected Methods

Method Description
ConvertPixelsAndPoints ( System.Boolean bPixelsToPoints, Graphics oGraphics, System.Single fWidthIn, System.Single fHeightIn, System.Single &fWidthOut, System.Single &fHeightOut ) : void

Private Methods

Method Description
GraphicsUtil ( ) : System

Do not use this contructor.

All methods on this class are static, so there is no need to create a GraphicsUtil object.

Method Details

AreaToRadius() public static method

public static AreaToRadius ( Double dArea ) : Double
dArea Double
return Double

Clear() public static method

public static Clear ( Graphics oGraphics, Color oColor ) : void
oGraphics System.Drawing.Graphics
oColor Color
return void

ConvertPixelsAndPoints() protected static method

protected static ConvertPixelsAndPoints ( System.Boolean bPixelsToPoints, Graphics oGraphics, System.Single fWidthIn, System.Single fHeightIn, System.Single &fWidthOut, System.Single &fHeightOut ) : void
bPixelsToPoints System.Boolean
oGraphics System.Drawing.Graphics
fWidthIn System.Single
fHeightIn System.Single
fWidthOut System.Single
fHeightOut System.Single
return void

CreateRoundedRectangleGraphicsPath() public static method

public static CreateRoundedRectangleGraphicsPath ( Rectangle oRectangle, Int32 iCornerRadius ) : GraphicsPath
oRectangle System.Drawing.Rectangle
iCornerRadius System.Int32
return System.Drawing.Drawing2D.GraphicsPath

DiamondFromCenterAndHalfWidth() public static method

public static DiamondFromCenterAndHalfWidth ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : System.Drawing.PointF[]
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return System.Drawing.PointF[]

DisposeBitmap() public static method

public static DisposeBitmap ( Bitmap &oBitmap ) : void
oBitmap System.Drawing.Bitmap
return void

DisposeBrush() public static method

public static DisposeBrush ( Brush &oBrush ) : void
oBrush System.Drawing.Brush
return void

DisposeGraphics() public static method

public static DisposeGraphics ( Graphics &oGraphics ) : void
oGraphics System.Drawing.Graphics
return void

DisposeGraphicsPath() public static method

public static DisposeGraphicsPath ( GraphicsPath &oGraphicsPath ) : void
oGraphicsPath System.Drawing.Drawing2D.GraphicsPath
return void

DisposePen() public static method

public static DisposePen ( Pen &oPen ) : void
oPen System.Drawing.Pen
return void

DisposeSolidBrush() public static method

public static DisposeSolidBrush ( SolidBrush &oSolidBrush ) : void
oSolidBrush System.Drawing.SolidBrush
return void

DistanceBetweenTwoPointFs() public static method

public static DistanceBetweenTwoPointFs ( PointF point1, PointF point2 ) : System.Single
point1 System.Drawing.PointF
point2 System.Drawing.PointF
return System.Single

Draw3DHorizontalLine() public static method

public static Draw3DHorizontalLine ( Graphics oGraphics, System.Single fLeft, System.Single fTop, System.Single fRight ) : System.Single
oGraphics System.Drawing.Graphics
fLeft System.Single
fTop System.Single
fRight System.Single
return System.Single

DrawCircle() public static method

public static DrawCircle ( Graphics oGraphics, Pen oPen, System.Single fXCenter, System.Single fYCenter, System.Single fRadius ) : void
oGraphics System.Drawing.Graphics
oPen System.Drawing.Pen
fXCenter System.Single
fYCenter System.Single
fRadius System.Single
return void

DrawDiamond() public static method

public static DrawDiamond ( Graphics oGraphics, Pen oPen, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
oGraphics System.Drawing.Graphics
oPen System.Drawing.Pen
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return void

DrawErrorStringOnGraphics() public static method

public static DrawErrorStringOnGraphics ( Graphics oGraphics, Rectangle oRectangle, String sString ) : void
oGraphics System.Drawing.Graphics
oRectangle System.Drawing.Rectangle
sString String
return void

DrawSquare() public static method

public static DrawSquare ( Graphics oGraphics, Pen oPen, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
oGraphics System.Drawing.Graphics
oPen System.Drawing.Pen
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return void

DrawTriangle() public static method

public static DrawTriangle ( Graphics oGraphics, Pen oPen, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
oGraphics System.Drawing.Graphics
oPen System.Drawing.Pen
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return void

FillCircle() public static method

public static FillCircle ( Graphics oGraphics, Brush oBrush, System.Single fXCenter, System.Single fYCenter, System.Single fRadius ) : void
oGraphics System.Drawing.Graphics
oBrush System.Drawing.Brush
fXCenter System.Single
fYCenter System.Single
fRadius System.Single
return void

FillCircle3D() public static method

public static FillCircle3D ( Graphics oGraphics, Color oColor, System.Single fXCenter, System.Single fYCenter, System.Single fRadius ) : void
oGraphics System.Drawing.Graphics
oColor Color
fXCenter System.Single
fYCenter System.Single
fRadius System.Single
return void

FillDiamond() public static method

public static FillDiamond ( Graphics oGraphics, Brush oBrush, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
oGraphics System.Drawing.Graphics
oBrush System.Drawing.Brush
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return void

FillSquare() public static method

public static FillSquare ( Graphics oGraphics, Brush oBrush, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
oGraphics System.Drawing.Graphics
oBrush System.Drawing.Brush
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return void

FillSquare3D() public static method

public static FillSquare3D ( Graphics oGraphics, Color oColor, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
oGraphics System.Drawing.Graphics
oColor Color
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return void

FillTextRectangle() public static method

public static FillTextRectangle ( Graphics oGraphics, Rectangle oRectangle, System.Boolean bTextIsSelected ) : void
oGraphics System.Drawing.Graphics
oRectangle System.Drawing.Rectangle
bTextIsSelected System.Boolean
return void

FillTriangle() public static method

public static FillTriangle ( Graphics oGraphics, Brush oBrush, System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : void
oGraphics System.Drawing.Graphics
oBrush System.Drawing.Brush
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return void

GetDiamondEdgeMidpoints() public static method

public static GetDiamondEdgeMidpoints ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : System.Drawing.PointF[]
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return System.Drawing.PointF[]

GetImageCodecInfoForMimeType() public static method

public static GetImageCodecInfoForMimeType ( String sMimeType ) : System.Drawing.Imaging.ImageCodecInfo
sMimeType String
return System.Drawing.Imaging.ImageCodecInfo

GetTriangleEdgeMidpoints() public static method

public static GetTriangleEdgeMidpoints ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : System.Drawing.PointF[]
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return System.Drawing.PointF[]

LineSegmentsIntersect() public static method

public static LineSegmentsIntersect ( PointF endpointA1, PointF endpointA2, PointF endpointB1, PointF endpointB2 ) : System.Boolean
endpointA1 System.Drawing.PointF
endpointA2 System.Drawing.PointF
endpointB1 System.Drawing.PointF
endpointB2 System.Drawing.PointF
return System.Boolean

MoveRectangleWithinBounds() public static method

public static MoveRectangleWithinBounds ( RectangleF rectangle, RectangleF boundingRectangle, System.Boolean resizeRectangleIfNecessary ) : RectangleF
rectangle System.Drawing.RectangleF
boundingRectangle System.Drawing.RectangleF
resizeRectangleIfNecessary System.Boolean
return System.Drawing.RectangleF

PixelsToPoints() public static method

public static PixelsToPoints ( Graphics oGraphics, System.Single fWidthPx, System.Single fHeightPx, System.Single &fWidthPt, System.Single &fHeightPt ) : void
oGraphics System.Drawing.Graphics
fWidthPx System.Single
fHeightPx System.Single
fWidthPt System.Single
fHeightPt System.Single
return void

PointsToPixels() public static method

public static PointsToPixels ( Graphics oGraphics, System.Single fWidthPt, System.Single fHeightPt, Int32 &iWidthPx, Int32 &iHeightPx ) : void
oGraphics System.Drawing.Graphics
fWidthPt System.Single
fHeightPt System.Single
iWidthPx System.Int32
iHeightPx System.Int32
return void

PointsToPixels() public static method

public static PointsToPixels ( Graphics oGraphics, System.Single fWidthPt, System.Single fHeightPt, System.Single &fWidthPx, System.Single &fHeightPx ) : void
oGraphics System.Drawing.Graphics
fWidthPt System.Single
fHeightPt System.Single
fWidthPx System.Single
fHeightPx System.Single
return void

RadiusToArea() public static method

public static RadiusToArea ( Double dRadius ) : Double
dRadius Double
return Double

RectangleFToRectangle() public static method

public static RectangleFToRectangle ( RectangleF oRectangle, Int32 iPenWidthPx ) : Rectangle
oRectangle System.Drawing.RectangleF
iPenWidthPx System.Int32
return System.Drawing.Rectangle

SaveHighQualityImage() public static method

public static SaveHighQualityImage ( Image oImage, String sFileName, ImageFormat eImageFormat ) : void
oImage Image
sFileName String
eImageFormat System.Drawing.Imaging.ImageFormat
return void

SaveJpegImage() public static method

public static SaveJpegImage ( Image oImage, String sFileName, Int32 iQuality ) : void
oImage Image
sFileName String
iQuality System.Int32
return void

SquareFromCenterAndHalfWidth() public static method

public static SquareFromCenterAndHalfWidth ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : RectangleF
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return System.Drawing.RectangleF

TriangleFromCenterAndHalfWidth() public static method

public static TriangleFromCenterAndHalfWidth ( System.Single fXCenter, System.Single fYCenter, System.Single fHalfWidth ) : System.Drawing.PointF[]
fXCenter System.Single
fYCenter System.Single
fHalfWidth System.Single
return System.Drawing.PointF[]