hOLOlu LCD
C# Kayan Yazı Denemesi
550
TextDesignerCSLibrary/BmpOutlineText.cs
Normal file
@@ -0,0 +1,550 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class BmpOutlineText
|
||||
{
|
||||
public BmpOutlineText()
|
||||
{
|
||||
m_pbmpResult = null;
|
||||
m_pbmpMask = null;
|
||||
m_pbmpShadow = null;
|
||||
m_clrBkgd = Color.FromArgb(0, 255, 0);
|
||||
m_clrOutline = Color.FromArgb(255,0,0);
|
||||
m_clrText = Color.FromArgb(0,0,255);
|
||||
|
||||
m_PngOutlineText = new PngOutlineText();
|
||||
m_PngShadow = new PngOutlineText();
|
||||
}
|
||||
|
||||
public Bitmap Render(
|
||||
uint nTextX,
|
||||
uint nTextY,
|
||||
Bitmap pbmpText,
|
||||
uint nOutlineX,
|
||||
uint nOutlineY,
|
||||
Bitmap pbmpOutline)
|
||||
{
|
||||
if(pbmpText==null)
|
||||
return null;
|
||||
if(pbmpOutline==null)
|
||||
return null;
|
||||
|
||||
m_pbmpResult = new Bitmap((int)(pbmpOutline.Width+nOutlineX), (int)(pbmpOutline.Height+nOutlineY), PixelFormat.Format32bppArgb);
|
||||
|
||||
|
||||
|
||||
Bitmap png = m_PngOutlineText.GetPngImage();
|
||||
BitmapData bitmapDataResult = new BitmapData();
|
||||
BitmapData bitmapDataText = new BitmapData();
|
||||
BitmapData bitmapDataOutline = new BitmapData();
|
||||
BitmapData bitmapDataPng = new BitmapData();
|
||||
Rectangle rectResult = new Rectangle(0, 0, m_pbmpResult.Width, m_pbmpResult.Height );
|
||||
Rectangle rectText = new Rectangle(0, 0, pbmpText.Width, pbmpText.Height );
|
||||
Rectangle rectOutline = new Rectangle(0, 0, pbmpOutline.Width, pbmpOutline.Height );
|
||||
Rectangle rectPng = new Rectangle(0, 0, m_pbmpMask.Width, m_pbmpMask.Height );
|
||||
|
||||
m_pbmpResult.LockBits(
|
||||
rectResult,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataResult );
|
||||
pbmpText.LockBits(
|
||||
rectText,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataText );
|
||||
pbmpOutline.LockBits(
|
||||
rectOutline,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataOutline );
|
||||
png.LockBits(
|
||||
rectPng,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataPng );
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixelsResult = (uint*)bitmapDataResult.Scan0;
|
||||
uint* pixelsText = (uint*)bitmapDataText.Scan0;
|
||||
uint* pixelsOutline = (uint*)bitmapDataOutline.Scan0;
|
||||
uint* pixelsPng = (uint*)bitmapDataPng.Scan0;
|
||||
|
||||
if( pixelsResult==null || pixelsText==null || pixelsOutline==null || pixelsPng==null )
|
||||
return null;
|
||||
|
||||
uint col = 0;
|
||||
int strideResult = bitmapDataResult.Stride >> 2;
|
||||
int strideOutline = bitmapDataOutline.Stride >> 2;
|
||||
int strideText = bitmapDataText.Stride >> 2;
|
||||
int stridePng = bitmapDataPng.Stride >> 2;
|
||||
|
||||
for(uint row = 0; row < bitmapDataResult.Height; ++row)
|
||||
{
|
||||
for(col = 0; col < bitmapDataResult.Width; ++col)
|
||||
{
|
||||
uint indexResult = (uint)(row * strideResult + col);
|
||||
uint indexText = (uint)((row-nTextY)* strideText + (col-nTextX));
|
||||
uint indexOutline = (uint)((row-nOutlineY) * strideOutline + (col-nOutlineX));
|
||||
uint indexPng = (uint)(row * stridePng + col);
|
||||
byte red = (byte)((pixelsPng[indexPng] & 0xff0000) >> 16);
|
||||
byte blue = (byte)(pixelsPng[indexPng] & 0xff);
|
||||
|
||||
if(red>0&&blue>0)
|
||||
{
|
||||
uint nOutlineColor = pixelsOutline[indexOutline];
|
||||
byte aOutline = (byte)((nOutlineColor & 0xff000000) >> 24);
|
||||
byte rOutline = (byte)((nOutlineColor & 0xff0000) >> 16);
|
||||
byte gOutline = (byte)((nOutlineColor & 0xff00) >> 8);
|
||||
byte bOutline = (byte)(nOutlineColor & 0xff);
|
||||
|
||||
if (aOutline > 0)
|
||||
{
|
||||
aOutline = (byte)((red * aOutline) >> 8);
|
||||
rOutline = (byte)((red * rOutline) >> 8);
|
||||
gOutline = (byte)((red * gOutline) >> 8);
|
||||
bOutline = (byte)((red * bOutline) >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
rOutline = 0;
|
||||
gOutline = 0;
|
||||
bOutline = 0;
|
||||
}
|
||||
|
||||
uint nTextColor = pixelsText[indexText];
|
||||
byte aText = (byte)((nTextColor & 0xff000000) >> 24);
|
||||
byte rText = (byte)((nTextColor & 0xff0000) >> 16);
|
||||
byte gText = (byte)((nTextColor & 0xff00) >> 8);
|
||||
byte bText = (byte)(nTextColor & 0xff);
|
||||
|
||||
if (aText > 0)
|
||||
{
|
||||
aText = (byte)((blue * aText) >> 8);
|
||||
rText = (byte)((blue * rText) >> 8);
|
||||
gText = (byte)((blue * gText) >> 8);
|
||||
bText = (byte)((blue * bText) >> 8);
|
||||
}
|
||||
else
|
||||
{
|
||||
rText = 0;
|
||||
gText = 0;
|
||||
bText = 0;
|
||||
}
|
||||
|
||||
if (aText > 0 && aOutline > 0)
|
||||
{
|
||||
pixelsResult[indexResult] = (uint)((0xff << 24) | (Clamp((uint)(rOutline + rText)) << 16) | (Clamp((uint)(gOutline + gText)) << 8) | Clamp((uint)(bOutline + bText)));
|
||||
}
|
||||
else if (aOutline > 0)
|
||||
pixelsResult[indexResult] = (uint)((aOutline << 24) | (Clamp((uint)(rOutline + rText)) << 16) | (Clamp((uint)(gOutline + gText)) << 8) | Clamp((uint)(bOutline + bText)));
|
||||
else if (aText > 0)
|
||||
pixelsResult[indexResult] = (uint)((aText << 24) | (Clamp((uint)(rOutline + rText)) << 16) | (Clamp((uint)(gOutline + gText)) << 8) | Clamp((uint)(bOutline + bText)));
|
||||
else
|
||||
pixelsResult[indexResult] = 0;
|
||||
}
|
||||
else if(red>0)
|
||||
{
|
||||
uint nOutlineColor = pixelsOutline[indexOutline];
|
||||
byte a = (byte)((nOutlineColor & 0xff000000) >> 24);
|
||||
byte r = (byte)((nOutlineColor & 0xff0000) >> 16);
|
||||
byte g = (byte)((nOutlineColor & 0xff00) >> 8);
|
||||
byte b = (byte)(nOutlineColor & 0xff);
|
||||
|
||||
if (a > 0)
|
||||
pixelsResult[indexResult] = (uint)((red << 24) | (r << 16) | (g << 8) | b);
|
||||
else
|
||||
pixelsResult[indexResult] = 0;
|
||||
}
|
||||
else if(blue>0)
|
||||
{
|
||||
uint nTextColor = pixelsText[indexText];
|
||||
byte a = (byte)((nTextColor & 0xff000000) >> 24);
|
||||
byte r = (byte)((nTextColor & 0xff0000) >> 16);
|
||||
byte g = (byte)((nTextColor & 0xff00) >> 8);
|
||||
byte b = (byte)(nTextColor & 0xff);
|
||||
|
||||
if (a > 0)
|
||||
pixelsResult[indexResult] = (uint)((blue << 24) | (r << 16) | (g << 8) | b);
|
||||
else
|
||||
pixelsResult[indexResult] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pixelsResult[indexResult] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
png.UnlockBits(
|
||||
bitmapDataPng );
|
||||
pbmpOutline.UnlockBits(
|
||||
bitmapDataOutline );
|
||||
pbmpText.UnlockBits(
|
||||
bitmapDataText );
|
||||
m_pbmpResult.UnlockBits(
|
||||
bitmapDataResult );
|
||||
|
||||
return m_pbmpResult;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
Graphics pGraphics,
|
||||
FontFamily pFontFamily,
|
||||
FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string pszText,
|
||||
Point ptDraw,
|
||||
StringFormat pStrFormat,
|
||||
int nThickness,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
bool bGlow,
|
||||
byte nGlowAlpha)
|
||||
{
|
||||
if (bGlow)
|
||||
m_PngOutlineText.TextGlow(m_clrText, Color.FromArgb(nGlowAlpha, m_clrOutline.R, m_clrOutline.G, m_clrOutline.B), nThickness);
|
||||
else
|
||||
m_PngOutlineText.TextOutline(m_clrText, m_clrOutline, nThickness);
|
||||
m_PngOutlineText.EnableReflection(false);
|
||||
m_PngOutlineText.EnableShadow(false);
|
||||
|
||||
m_pbmpMask = new Bitmap(nWidth, nHeight, PixelFormat.Format32bppArgb);
|
||||
|
||||
|
||||
Graphics graph = Graphics.FromImage(m_pbmpMask);
|
||||
SolidBrush brush = new SolidBrush(m_clrBkgd);
|
||||
graph.FillRectangle(brush, 0, 0, m_pbmpMask.Width, m_pbmpMask.Height);
|
||||
|
||||
m_PngOutlineText.SetPngImage(m_pbmpMask);
|
||||
|
||||
m_PngOutlineText.DrawString(
|
||||
pGraphics,
|
||||
pFontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
pszText,
|
||||
ptDraw,
|
||||
pStrFormat);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
Graphics pGraphics,
|
||||
FontFamily pFontFamily,
|
||||
FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string pszText,
|
||||
Rectangle rtDraw,
|
||||
StringFormat pStrFormat,
|
||||
int nThickness,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
bool bGlow,
|
||||
byte nGlowAlpha)
|
||||
{
|
||||
if (bGlow)
|
||||
m_PngOutlineText.TextGlow(m_clrText, Color.FromArgb(nGlowAlpha, m_clrOutline.R, m_clrOutline.G, m_clrOutline.B), nThickness);
|
||||
else
|
||||
m_PngOutlineText.TextOutline(m_clrText, m_clrOutline, nThickness);
|
||||
m_PngOutlineText.EnableReflection(false);
|
||||
m_PngOutlineText.EnableShadow(false);
|
||||
|
||||
m_pbmpMask = new Bitmap(nWidth, nHeight, PixelFormat.Format32bppArgb);
|
||||
|
||||
|
||||
Graphics graph = Graphics.FromImage(m_pbmpMask);
|
||||
SolidBrush brush = new SolidBrush(m_clrBkgd);
|
||||
graph.FillRectangle(brush, 0, 0, m_pbmpMask.Width, m_pbmpMask.Height);
|
||||
|
||||
m_PngOutlineText.SetPngImage(m_pbmpMask);
|
||||
|
||||
m_PngOutlineText.DrawString(
|
||||
pGraphics,
|
||||
pFontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
pszText,
|
||||
rtDraw,
|
||||
pStrFormat);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
Graphics pGraphics,
|
||||
FontFamily pFontFamily,
|
||||
FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string pszText,
|
||||
Point ptDraw,
|
||||
StringFormat pStrFormat,
|
||||
int nThickness,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
bool bGlow,
|
||||
byte nGlowAlpha,
|
||||
bool bShadow,
|
||||
Color clrShadow,
|
||||
int nShadowOffsetX,
|
||||
int nShadowOffsetY)
|
||||
{
|
||||
if (bGlow)
|
||||
m_PngOutlineText.TextGlow(m_clrText, Color.FromArgb(nGlowAlpha, m_clrOutline.R, m_clrOutline.G, m_clrOutline.B), nThickness);
|
||||
else
|
||||
m_PngOutlineText.TextOutline(m_clrText, m_clrOutline, nThickness);
|
||||
m_PngOutlineText.EnableReflection(false);
|
||||
m_PngOutlineText.EnableShadow(false);
|
||||
|
||||
if(bShadow)
|
||||
{
|
||||
m_PngShadow.SetNullTextEffect();
|
||||
m_PngShadow.EnableShadow(true);
|
||||
m_PngShadow.Shadow(clrShadow, nThickness, new Point(nShadowOffsetX, nShadowOffsetY));
|
||||
m_PngShadow.SetShadowBkgd(Color.FromArgb(0,0,0), nWidth, nHeight);
|
||||
}
|
||||
else
|
||||
m_PngShadow.EnableShadow(false);
|
||||
|
||||
m_pbmpMask = new Bitmap(nWidth, nHeight, PixelFormat.Format32bppArgb);
|
||||
|
||||
|
||||
using (Graphics graph = Graphics.FromImage(m_pbmpMask))
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrBkgd))
|
||||
{
|
||||
graph.FillRectangle(brush, 0, 0, m_pbmpMask.Width, m_pbmpMask.Height);
|
||||
}
|
||||
}
|
||||
m_PngOutlineText.SetPngImage(m_pbmpMask);
|
||||
|
||||
m_PngOutlineText.DrawString(
|
||||
pGraphics,
|
||||
pFontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
pszText,
|
||||
ptDraw,
|
||||
pStrFormat);
|
||||
|
||||
if (bShadow)
|
||||
{
|
||||
m_pbmpShadow = new Bitmap(nWidth, nHeight, PixelFormat.Format32bppArgb);
|
||||
|
||||
m_PngShadow.SetPngImage(m_pbmpShadow);
|
||||
|
||||
m_PngShadow.DrawString(
|
||||
pGraphics,
|
||||
pFontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
pszText,
|
||||
ptDraw,
|
||||
pStrFormat);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
Graphics pGraphics,
|
||||
FontFamily pFontFamily,
|
||||
FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string pszText,
|
||||
Rectangle rtDraw,
|
||||
StringFormat pStrFormat,
|
||||
int nThickness,
|
||||
int nWidth,
|
||||
int nHeight,
|
||||
bool bGlow,
|
||||
byte nGlowAlpha,
|
||||
bool bShadow,
|
||||
Color clrShadow,
|
||||
int nShadowOffsetX,
|
||||
int nShadowOffsetY)
|
||||
{
|
||||
if (bGlow)
|
||||
m_PngOutlineText.TextGlow(m_clrText, Color.FromArgb(nGlowAlpha, m_clrOutline.R, m_clrOutline.G, m_clrOutline.B), nThickness);
|
||||
else
|
||||
m_PngOutlineText.TextOutline(m_clrText, m_clrOutline, nThickness);
|
||||
m_PngOutlineText.EnableReflection(false);
|
||||
m_PngOutlineText.EnableShadow(false);
|
||||
|
||||
if (bShadow)
|
||||
{
|
||||
m_PngShadow.SetNullTextEffect();
|
||||
m_PngShadow.EnableShadow(true);
|
||||
m_PngShadow.Shadow(clrShadow, nThickness, new Point(nShadowOffsetX, nShadowOffsetY));
|
||||
m_PngShadow.SetShadowBkgd(Color.FromArgb(0, 0, 0), nWidth, nHeight);
|
||||
}
|
||||
else
|
||||
m_PngShadow.EnableShadow(false);
|
||||
|
||||
m_pbmpMask = new Bitmap(nWidth, nHeight, PixelFormat.Format32bppArgb);
|
||||
|
||||
using (Graphics graph = Graphics.FromImage(m_pbmpMask))
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrBkgd))
|
||||
{
|
||||
graph.FillRectangle(brush, 0, 0, m_pbmpMask.Width, m_pbmpMask.Height);
|
||||
}
|
||||
}
|
||||
m_PngOutlineText.SetPngImage(m_pbmpMask);
|
||||
|
||||
m_PngOutlineText.DrawString(
|
||||
pGraphics,
|
||||
pFontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
pszText,
|
||||
rtDraw,
|
||||
pStrFormat);
|
||||
|
||||
if(bShadow)
|
||||
{
|
||||
m_pbmpShadow = new Bitmap(nWidth, nHeight, PixelFormat.Format32bppArgb);
|
||||
|
||||
m_PngShadow.SetPngImage(m_pbmpShadow);
|
||||
|
||||
m_PngShadow.DrawString(
|
||||
pGraphics,
|
||||
pFontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
pszText,
|
||||
rtDraw,
|
||||
pStrFormat);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool Measure(
|
||||
Bitmap png,
|
||||
out uint nTextX, out uint nTextY, out uint nTextWidth, out uint nTextHeight,
|
||||
out uint nOutlineX, out uint nOutlineY, out uint nOutlineWidth, out uint nOutlineHeight)
|
||||
{
|
||||
nTextX = nTextY = nTextWidth = nTextHeight = 0;
|
||||
nOutlineX = nOutlineY = nOutlineWidth = nOutlineHeight = 0;
|
||||
|
||||
BitmapData bitmapData = new BitmapData();
|
||||
Rectangle rect = new Rectangle(0, 0, png.Width, png.Height );
|
||||
|
||||
png.LockBits(
|
||||
rect,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapData );
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixels = (uint*)bitmapData.Scan0;
|
||||
|
||||
if( pixels==null )
|
||||
return false;
|
||||
|
||||
uint col = 0;
|
||||
int stride = bitmapData.Stride >> 2;
|
||||
nTextX = 50000;
|
||||
nTextY = 50000;
|
||||
nTextWidth = 0;
|
||||
nTextHeight = 0;
|
||||
|
||||
nOutlineX = 50000;
|
||||
nOutlineY = 50000;
|
||||
nOutlineWidth = 0;
|
||||
nOutlineHeight = 0;
|
||||
for(uint row = 0; row < bitmapData.Height; ++row)
|
||||
{
|
||||
for(col = 0; col < bitmapData.Width; ++col)
|
||||
{
|
||||
uint index = (uint)(row * stride + col);
|
||||
byte red = (byte)((pixels[index] & 0xff0000) >> 16);
|
||||
byte blue = (byte)(pixels[index] & 0xff);
|
||||
|
||||
if(red>0)
|
||||
{
|
||||
if(col<nOutlineX)
|
||||
nOutlineX = col;
|
||||
if(row<nOutlineY)
|
||||
nOutlineY = row;
|
||||
if(col>nOutlineWidth)
|
||||
nOutlineWidth = col;
|
||||
if(row>nOutlineHeight)
|
||||
nOutlineHeight = row;
|
||||
}
|
||||
if(blue>0)
|
||||
{
|
||||
if(col<nTextX)
|
||||
nTextX = col;
|
||||
if(row<nTextY)
|
||||
nTextY = row;
|
||||
if(col>nTextWidth)
|
||||
nTextWidth = col;
|
||||
if(row>nTextHeight)
|
||||
nTextHeight = row;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
png.UnlockBits(bitmapData);
|
||||
|
||||
nTextWidth -= nTextX;
|
||||
nTextHeight -= nTextY;
|
||||
|
||||
nOutlineWidth -= nOutlineX;
|
||||
nOutlineHeight -= nOutlineY;
|
||||
|
||||
++nTextWidth;
|
||||
++nTextHeight;
|
||||
|
||||
++nOutlineWidth;
|
||||
++nOutlineHeight;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Bitmap GetInternalMaskImage()
|
||||
{
|
||||
return m_pbmpMask;
|
||||
}
|
||||
|
||||
public Bitmap GetResultImage()
|
||||
{
|
||||
return m_pbmpResult;
|
||||
}
|
||||
|
||||
public Bitmap GetShadowImage()
|
||||
{
|
||||
return m_pbmpShadow;
|
||||
}
|
||||
|
||||
private byte Clamp(uint val)
|
||||
{
|
||||
if(val>255)
|
||||
return 255;
|
||||
else
|
||||
return (byte)(val);
|
||||
}
|
||||
|
||||
private Bitmap m_pbmpResult;
|
||||
private Bitmap m_pbmpMask;
|
||||
private Bitmap m_pbmpShadow;
|
||||
private Color m_clrBkgd;
|
||||
private Color m_clrOutline;
|
||||
private Color m_clrText;
|
||||
private TextDesignerCSLibrary.PngOutlineText m_PngOutlineText;
|
||||
private TextDesignerCSLibrary.PngOutlineText m_PngShadow;
|
||||
|
||||
}
|
||||
}
|
||||
812
TextDesignerCSLibrary/Canvas.cs
Normal file
@@ -0,0 +1,812 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
/// <summary>
|
||||
/// Class to store the font info to pass as parameter to the drawing methods.
|
||||
/// </summary>
|
||||
public class TextContext
|
||||
{
|
||||
public TextContext()
|
||||
{
|
||||
fontFamily = new System.Drawing.FontFamily("Arial");
|
||||
fontStyle = System.Drawing.FontStyle.Regular;
|
||||
nfontSize = 20;
|
||||
pszText = null;
|
||||
ptDraw = new System.Drawing.Point(0, 0);
|
||||
strFormat = new System.Drawing.StringFormat();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// fontFamily is the font family
|
||||
/// </summary>
|
||||
public System.Drawing.FontFamily fontFamily;
|
||||
/// <summary>
|
||||
/// fontStyle is the font style, eg, bold, italic or bold
|
||||
/// </summary>
|
||||
public System.Drawing.FontStyle fontStyle;
|
||||
/// <summary>
|
||||
/// nfontSize is font size
|
||||
/// </summary>
|
||||
public int nfontSize;
|
||||
/// <summary>
|
||||
/// pszText is the text to be displayed
|
||||
/// </summary>
|
||||
public string pszText;
|
||||
/// <summary>
|
||||
/// ptDraw is the point to draw
|
||||
/// </summary>
|
||||
public System.Drawing.Point ptDraw;
|
||||
/// <summary>
|
||||
/// strFormat is the string format
|
||||
/// </summary>
|
||||
public System.Drawing.StringFormat strFormat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class to draw text outlines
|
||||
/// </summary>
|
||||
public class Canvas
|
||||
{
|
||||
/// <summary>
|
||||
/// Generate Text Glow strategy
|
||||
/// </summary>
|
||||
/// <param name="clrText">is the color of the text</param>
|
||||
/// <param name="clrOutline">is the color of the glow outline</param>
|
||||
/// <param name="nThickness">is the thickness of the outline in pixels</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextGlow(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
TextGlowStrategy strat = new TextGlowStrategy();
|
||||
strat.Init(clrText, clrOutline, nThickness);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate Text Glow strategy
|
||||
/// </summary>
|
||||
/// <param name="brushText">is the brush of the text</param>
|
||||
/// <param name="clrOutline">is the color of the glow outline</param>
|
||||
/// <param name="nThickness">is the thickness of the outline in pixels</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextGlow(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
TextGlowStrategy strat = new TextGlowStrategy();
|
||||
strat.Init(brushText, clrOutline, nThickness);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate Text Outline strategy
|
||||
/// </summary>
|
||||
/// <param name="clrText">is the color of the text</param>
|
||||
/// <param name="clrOutline">is the color of the outline</param>
|
||||
/// <param name="nThickness">is the thickness of the outline in pixels</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextOutline(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
TextOutlineStrategy strat = new TextOutlineStrategy();
|
||||
strat.Init(clrText, clrOutline, nThickness);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate Text Outline strategy
|
||||
/// </summary>
|
||||
/// <param name="brushText">is the brush of the text</param>
|
||||
/// <param name="clrOutline">is the color of the outline</param>
|
||||
/// <param name="nThickness">is the thickness of the outline in pixels</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextOutline(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
TextOutlineStrategy strat = new TextOutlineStrategy();
|
||||
strat.Init(brushText, clrOutline, nThickness);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setting Gradient Outlined Text effect
|
||||
/// </summary>
|
||||
/// <param name="clrText">is the text color</param>
|
||||
/// <param name="clrOutline1">is the inner outline color</param>
|
||||
/// <param name="clrOutline2">is the outer outline color</param>
|
||||
/// <param name="nThickness">is the outline thickness</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextGradOutline(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness)
|
||||
{
|
||||
TextGradOutlineStrategy strat = new TextGradOutlineStrategy();
|
||||
strat.Init(clrText, clrOutline1, clrOutline2, nThickness);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setting Gradient Outlined Text effect
|
||||
/// </summary>
|
||||
/// <param name="brushText">is the text brush</param>
|
||||
/// <param name="clrOutline1">is the inner outline color</param>
|
||||
/// <param name="clrOutline2">is the outer outline color</param>
|
||||
/// <param name="nThickness">is the outline thickness</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextGradOutline(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness)
|
||||
{
|
||||
TextGradOutlineStrategy strat = new TextGradOutlineStrategy();
|
||||
strat.Init(brushText, clrOutline1, clrOutline2, nThickness);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setting just Text effect with no outline
|
||||
/// </summary>
|
||||
/// <param name="clrText">is the text color</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextNoOutline(
|
||||
System.Drawing.Color clrText)
|
||||
{
|
||||
TextNoOutlineStrategy strat = new TextNoOutlineStrategy();
|
||||
strat.Init(clrText);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setting just Text effect with no outline
|
||||
/// </summary>
|
||||
/// <param name="brushText">is the text brush</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextNoOutline(
|
||||
System.Drawing.Brush brushText)
|
||||
{
|
||||
TextNoOutlineStrategy strat = new TextNoOutlineStrategy();
|
||||
strat.Init(brushText);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setting Outlined Text effect with no text fill
|
||||
/// </summary>
|
||||
/// <param name="clrOutline">is the outline color</param>
|
||||
/// <param name="nThickness">is the outline thickness</param>
|
||||
/// <param name="bRoundedEdge">specifies rounded or sharp edges</param>
|
||||
/// <returns>valid ITextStrategy pointer if successful</returns>
|
||||
public static ITextStrategy TextOnlyOutline(
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness,
|
||||
bool bRoundedEdge)
|
||||
{
|
||||
TextOnlyOutlineStrategy strat = new TextOnlyOutlineStrategy();
|
||||
strat.Init(clrOutline, nThickness, bRoundedEdge);
|
||||
|
||||
return strat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a canvas image based on width and height
|
||||
/// </summary>
|
||||
/// <param name="width">is the image width</param>
|
||||
/// <param name="height">is the image height</param>
|
||||
/// <returns>a valid canvas image if successful</returns>
|
||||
public static System.Drawing.Bitmap GenImage(int width, int height)
|
||||
{
|
||||
return new System.Drawing.Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a canvas image based on width and height
|
||||
/// </summary>
|
||||
/// <param name="width">is the image width</param>
|
||||
/// <param name="height">is the image height</param>
|
||||
/// <param name="colors">is the list of colors for the gradient</param>
|
||||
/// <param name="horizontal">specifies whether the gradient is horizontal</param>
|
||||
/// <returns>a valid canvas image if successful</returns>
|
||||
public static System.Drawing.Bitmap GenImage(int width, int height, List<System.Drawing.Color> colors, bool horizontal)
|
||||
{
|
||||
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
|
||||
DrawGradient.Draw(bmp, colors, horizontal);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a canvas image based on width and height
|
||||
/// </summary>
|
||||
/// <param name="width">is the image width</param>
|
||||
/// <param name="height">is the image height</param>
|
||||
/// <param name="clr">is the color to paint the image</param>
|
||||
/// <returns>a valid canvas image if successful</returns>
|
||||
public static System.Drawing.Bitmap GenImage(int width, int height, System.Drawing.Color clr)
|
||||
{
|
||||
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
|
||||
BitmapData bitmapData = new BitmapData();
|
||||
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
|
||||
|
||||
bmp.LockBits(
|
||||
rect,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapData);
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixels = (uint*)bitmapData.Scan0;
|
||||
|
||||
if (pixels == null)
|
||||
return null;
|
||||
|
||||
uint col = 0;
|
||||
int stride = bitmapData.Stride >> 2;
|
||||
uint color = (uint)(clr.A << 24 | clr.R << 16 | clr.G << 8 | clr.G);
|
||||
for (uint row = 0; row < bitmapData.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapData.Width; ++col)
|
||||
{
|
||||
uint index = (uint)(row * stride + col);
|
||||
|
||||
pixels[index] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
bmp.UnlockBits(bitmapData);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate a canvas image based on width and height
|
||||
/// </summary>
|
||||
/// <param name="width">is the image width</param>
|
||||
/// <param name="height">is the image height</param>
|
||||
/// <param name="clr">is the color to paint the image</param>
|
||||
/// <param name="alpha">is alpha of the color</param>
|
||||
/// <returns>a valid canvas image if successful</returns>
|
||||
public static System.Drawing.Bitmap GenImage(int width, int height, System.Drawing.Color clr, byte alpha)
|
||||
{
|
||||
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
|
||||
BitmapData bitmapData = new BitmapData();
|
||||
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
|
||||
|
||||
bmp.LockBits(
|
||||
rect,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapData);
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixels = (uint*)bitmapData.Scan0;
|
||||
|
||||
if (pixels == null)
|
||||
return null;
|
||||
|
||||
uint col = 0;
|
||||
int stride = bitmapData.Stride >> 2;
|
||||
uint color = (uint)(alpha << 24 | clr.R << 16 | clr.G << 8 | clr.G);
|
||||
for (uint row = 0; row < bitmapData.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapData.Width; ++col)
|
||||
{
|
||||
uint index = (uint)(row * stride + col);
|
||||
|
||||
pixels[index] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
bmp.UnlockBits(bitmapData);
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate mask image of the text strategy.
|
||||
/// </summary>
|
||||
/// <param name="strategy">is text strategy</param>
|
||||
/// <param name="width">is the mask image width</param>
|
||||
/// <param name="height">is the mask image height</param>
|
||||
/// <param name="offset">offsets the text (typically used for shadows)</param>
|
||||
/// <param name="textContext">is text context</param>
|
||||
/// <returns>a valid mask image if successful</returns>
|
||||
public static System.Drawing.Bitmap GenMask(
|
||||
ITextStrategy strategy,
|
||||
int width,
|
||||
int height,
|
||||
System.Drawing.Point offset,
|
||||
TextContext textContext)
|
||||
{
|
||||
if (strategy == null || textContext == null)
|
||||
return null;
|
||||
|
||||
System.Drawing.Bitmap pBmp = new System.Drawing.Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
|
||||
using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(pBmp))
|
||||
{
|
||||
graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
|
||||
strategy.DrawString(graphics,
|
||||
textContext.fontFamily,
|
||||
textContext.fontStyle,
|
||||
textContext.nfontSize,
|
||||
textContext.pszText,
|
||||
new System.Drawing.Point(textContext.ptDraw.X + offset.X, textContext.ptDraw.Y + offset.Y),
|
||||
textContext.strFormat);
|
||||
}
|
||||
|
||||
return pBmp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Measure the mask image based on the mask color.
|
||||
/// </summary>
|
||||
/// <param name="mask">is the mask image to be measured</param>
|
||||
/// <param name="maskColor">is mask color used in mask image</param>
|
||||
/// <param name="top">returns the topmost Y </param>
|
||||
/// <param name="left">returns the leftmost X</param>
|
||||
/// <param name="bottom">returns the bottommost Y</param>
|
||||
/// <param name="right">returns the rightmost X</param>
|
||||
/// <returns>true if successful</returns>
|
||||
public static bool MeasureMaskLength(
|
||||
System.Drawing.Bitmap mask,
|
||||
System.Drawing.Color maskColor,
|
||||
ref uint top,
|
||||
ref uint left,
|
||||
ref uint bottom,
|
||||
ref uint right)
|
||||
{
|
||||
top = 30000;
|
||||
left = 30000;
|
||||
bottom = 0;
|
||||
right = 0;
|
||||
|
||||
if (mask == null)
|
||||
return false;
|
||||
|
||||
BitmapData bitmapDataMask = new BitmapData();
|
||||
Rectangle rect = new Rectangle(0, 0, mask.Width, mask.Height);
|
||||
|
||||
mask.LockBits(
|
||||
rect,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataMask);
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixelsMask = (uint*)bitmapDataMask.Scan0;
|
||||
|
||||
if (pixelsMask == null)
|
||||
return false;
|
||||
|
||||
uint col = 0;
|
||||
int stride = bitmapDataMask.Stride >> 2;
|
||||
for (uint row = 0; row < bitmapDataMask.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapDataMask.Width; ++col)
|
||||
{
|
||||
uint index = (uint)(row * stride + col);
|
||||
byte nAlpha = 0;
|
||||
|
||||
if (MaskColor.IsEqual(maskColor, MaskColor.Red))
|
||||
nAlpha = (Byte)((pixelsMask[index] & 0xff0000) >> 16);
|
||||
else if (MaskColor.IsEqual(maskColor, MaskColor.Green))
|
||||
nAlpha = (Byte)((pixelsMask[index] & 0xff00) >> 8);
|
||||
else if (MaskColor.IsEqual(maskColor, MaskColor.Blue))
|
||||
nAlpha = (Byte)(pixelsMask[index] & 0xff);
|
||||
|
||||
if (nAlpha > 0)
|
||||
{
|
||||
if (col < left)
|
||||
left = col;
|
||||
if (row < top)
|
||||
top = row;
|
||||
if (col > right)
|
||||
right = col;
|
||||
if (row > bottom)
|
||||
bottom = row;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mask.UnlockBits(bitmapDataMask);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Apply image to mask onto the canvas
|
||||
/// </summary>
|
||||
/// <param name="image">is the image to be used</param>
|
||||
/// <param name="mask">is the mask image to be read</param>
|
||||
/// <param name="canvas">is the destination image to be draw upon</param>
|
||||
/// <param name="maskColor">is mask color used in mask image</param>
|
||||
/// <returns>true if successful</returns>
|
||||
public static bool ApplyImageToMask(
|
||||
System.Drawing.Bitmap image,
|
||||
System.Drawing.Bitmap mask,
|
||||
System.Drawing.Bitmap canvas,
|
||||
System.Drawing.Color maskColor)
|
||||
{
|
||||
if (image == null || mask == null || canvas == null)
|
||||
return false;
|
||||
|
||||
BitmapData bitmapDataImage = new BitmapData();
|
||||
BitmapData bitmapDataMask = new BitmapData();
|
||||
BitmapData bitmapDataCanvas = new BitmapData();
|
||||
Rectangle rectCanvas = new Rectangle(0, 0, canvas.Width, canvas.Height);
|
||||
Rectangle rectMask = new Rectangle(0, 0, mask.Width, mask.Height);
|
||||
Rectangle rectImage = new Rectangle(0, 0, image.Width, image.Height);
|
||||
|
||||
image.LockBits(
|
||||
rectImage,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataImage);
|
||||
|
||||
mask.LockBits(
|
||||
rectMask,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataMask);
|
||||
|
||||
canvas.LockBits(
|
||||
rectCanvas,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataCanvas);
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixelsImage = (uint*)bitmapDataImage.Scan0;
|
||||
uint* pixelsMask = (uint*)bitmapDataMask.Scan0;
|
||||
uint* pixelsCanvas = (uint*)bitmapDataCanvas.Scan0;
|
||||
|
||||
if (pixelsImage == null || pixelsMask == null || pixelsCanvas == null)
|
||||
return false;
|
||||
|
||||
uint col = 0;
|
||||
int stride = bitmapDataCanvas.Stride >> 2;
|
||||
for (uint row = 0; row < bitmapDataCanvas.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapDataCanvas.Width; ++col)
|
||||
{
|
||||
if (row >= bitmapDataImage.Height || col >= bitmapDataImage.Width)
|
||||
continue;
|
||||
if (row >= bitmapDataMask.Height || col >= bitmapDataMask.Width)
|
||||
continue;
|
||||
|
||||
uint index = (uint)(row * stride + col);
|
||||
uint indexMask = (uint)(row * (bitmapDataMask.Stride >> 2) + col);
|
||||
uint indexImage = (uint)(row * (bitmapDataImage.Stride >> 2) + col);
|
||||
|
||||
byte maskByte = 0;
|
||||
|
||||
if (MaskColor.IsEqual(maskColor, MaskColor.Red))
|
||||
maskByte = (Byte)((pixelsMask[indexMask] & 0xff0000) >> 16);
|
||||
else if (MaskColor.IsEqual(maskColor, MaskColor.Green))
|
||||
maskByte = (Byte)((pixelsMask[indexMask] & 0xff00) >> 8);
|
||||
else if (MaskColor.IsEqual(maskColor, MaskColor.Blue))
|
||||
maskByte = (Byte)(pixelsMask[indexMask] & 0xff);
|
||||
|
||||
if (maskByte > 0)
|
||||
pixelsCanvas[index] = Alphablend(pixelsCanvas[index], pixelsImage[indexImage], (Byte)(pixelsMask[indexMask] >> 24), (Byte)(pixelsMask[indexMask] >> 24));
|
||||
}
|
||||
}
|
||||
}
|
||||
canvas.UnlockBits(bitmapDataCanvas);
|
||||
mask.UnlockBits(bitmapDataMask);
|
||||
image.UnlockBits(bitmapDataImage);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply color to mask onto the canvas
|
||||
/// </summary>
|
||||
/// <param name="clr">is the color to be used</param>
|
||||
/// <param name="mask">is the mask image to be read</param>
|
||||
/// <param name="canvas">is the destination image to be draw upon</param>
|
||||
/// <param name="maskColor">is mask color used in mask image</param>
|
||||
/// <returns>true if successful</returns>
|
||||
public static bool ApplyColorToMask(
|
||||
System.Drawing.Color clr,
|
||||
System.Drawing.Bitmap mask,
|
||||
System.Drawing.Bitmap canvas,
|
||||
System.Drawing.Color maskColor)
|
||||
{
|
||||
if (mask == null || canvas == null)
|
||||
return false;
|
||||
|
||||
BitmapData bitmapDataMask = new BitmapData();
|
||||
BitmapData bitmapDataCanvas = new BitmapData();
|
||||
Rectangle rectCanvas = new Rectangle(0, 0, canvas.Width, canvas.Height);
|
||||
Rectangle rectMask = new Rectangle(0, 0, mask.Width, mask.Height);
|
||||
|
||||
mask.LockBits(
|
||||
rectMask,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataMask);
|
||||
|
||||
canvas.LockBits(
|
||||
rectCanvas,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataCanvas);
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixelsMask = (uint*)bitmapDataMask.Scan0;
|
||||
uint* pixelsCanvas = (uint*)bitmapDataCanvas.Scan0;
|
||||
|
||||
if (pixelsMask == null || pixelsCanvas == null)
|
||||
return false;
|
||||
|
||||
uint col = 0;
|
||||
int stride = bitmapDataCanvas.Stride >> 2;
|
||||
for (uint row = 0; row < bitmapDataCanvas.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapDataCanvas.Width; ++col)
|
||||
{
|
||||
if (row >= bitmapDataMask.Height || col >= bitmapDataMask.Width)
|
||||
continue;
|
||||
|
||||
uint index = (uint)(row * stride + col);
|
||||
uint indexMask = (uint)(row * (bitmapDataMask.Stride >> 2) + col);
|
||||
|
||||
byte maskByte = 0;
|
||||
|
||||
if (MaskColor.IsEqual(maskColor, MaskColor.Red))
|
||||
maskByte = (Byte)((pixelsMask[indexMask] & 0xff0000) >> 16);
|
||||
else if (MaskColor.IsEqual(maskColor, MaskColor.Green))
|
||||
maskByte = (Byte)((pixelsMask[indexMask] & 0xff00) >> 8);
|
||||
else if (MaskColor.IsEqual(maskColor, MaskColor.Blue))
|
||||
maskByte = (Byte)(pixelsMask[indexMask] & 0xff);
|
||||
|
||||
uint color = (uint)(0xff << 24 | clr.R << 16 | clr.G << 8 | clr.B);
|
||||
|
||||
if (maskByte > 0)
|
||||
pixelsCanvas[index] = Alphablend(pixelsCanvas[index], color, (Byte)(pixelsMask[indexMask] >> 24), (Byte)(pixelsMask[indexMask] >> 24));
|
||||
}
|
||||
}
|
||||
}
|
||||
canvas.UnlockBits(bitmapDataCanvas);
|
||||
mask.UnlockBits(bitmapDataMask);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply color to mask onto the canvas
|
||||
/// </summary>
|
||||
/// <param name="clr">is the color to be used</param>
|
||||
/// <param name="mask">is the mask image to be read</param>
|
||||
/// <param name="canvas">is the destination image to be draw upon</param>
|
||||
/// <param name="maskColor">is mask color used in mask image</param>
|
||||
/// <param name="offset">determine how much to offset the mask</param>
|
||||
/// <returns>true if successful</returns>
|
||||
public static bool ApplyColorToMask(
|
||||
System.Drawing.Color clr,
|
||||
System.Drawing.Bitmap mask,
|
||||
System.Drawing.Bitmap canvas,
|
||||
System.Drawing.Color maskColor,
|
||||
System.Drawing.Point offset)
|
||||
{
|
||||
if (mask == null || canvas == null)
|
||||
return false;
|
||||
|
||||
BitmapData bitmapDataMask = new BitmapData();
|
||||
BitmapData bitmapDataCanvas = new BitmapData();
|
||||
Rectangle rectCanvas = new Rectangle(0, 0, canvas.Width, canvas.Height);
|
||||
Rectangle rectMask = new Rectangle(0, 0, mask.Width, mask.Height);
|
||||
|
||||
mask.LockBits(
|
||||
rectMask,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataMask);
|
||||
|
||||
canvas.LockBits(
|
||||
rectCanvas,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataCanvas);
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixelsMask = (uint*)bitmapDataMask.Scan0;
|
||||
uint* pixelsCanvas = (uint*)bitmapDataCanvas.Scan0;
|
||||
|
||||
if (pixelsMask == null || pixelsCanvas == null)
|
||||
return false;
|
||||
|
||||
uint col = 0;
|
||||
int stride = bitmapDataCanvas.Stride >> 2;
|
||||
for (uint row = 0; row < bitmapDataCanvas.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapDataCanvas.Width; ++col)
|
||||
{
|
||||
if ((row - offset.Y) >= bitmapDataMask.Height || (col - offset.X) >= bitmapDataMask.Width ||
|
||||
(row - offset.Y) < 0 || (col - offset.X) < 0)
|
||||
continue;
|
||||
|
||||
uint index = (uint)(row * stride + col);
|
||||
uint indexMask = (uint)((row - offset.Y) * (bitmapDataMask.Stride >> 2) + (col - offset.X));
|
||||
|
||||
byte maskByte = 0;
|
||||
|
||||
if (MaskColor.IsEqual(maskColor, MaskColor.Red))
|
||||
maskByte = (Byte)((pixelsMask[indexMask] & 0xff0000) >> 16);
|
||||
else if (MaskColor.IsEqual(maskColor, MaskColor.Green))
|
||||
maskByte = (Byte)((pixelsMask[indexMask] & 0xff00) >> 8);
|
||||
else if (MaskColor.IsEqual(maskColor, MaskColor.Blue))
|
||||
maskByte = (Byte)(pixelsMask[indexMask] & 0xff);
|
||||
|
||||
uint color = (uint)(0xff << 24 | clr.R << 16 | clr.G << 8 | clr.B);
|
||||
|
||||
if (maskByte > 0)
|
||||
pixelsCanvas[index] = Alphablend(pixelsCanvas[index], color, (Byte)(pixelsMask[indexMask] >> 24), (Byte)(pixelsMask[indexMask] >> 24));
|
||||
}
|
||||
}
|
||||
}
|
||||
canvas.UnlockBits(bitmapDataCanvas);
|
||||
mask.UnlockBits(bitmapDataMask);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draw outline on image
|
||||
/// </summary>
|
||||
/// <param name="strategy">is text strategy</param>
|
||||
/// <param name="image">is the image to be draw upon</param>
|
||||
/// <param name="offset">offsets the text (typically used for shadows)</param>
|
||||
/// <param name="textContext">is text context</param>
|
||||
/// <returns>true if successful</returns>
|
||||
public static bool DrawTextImage(
|
||||
ITextStrategy strategy,
|
||||
System.Drawing.Bitmap image,
|
||||
System.Drawing.Point offset,
|
||||
TextContext textContext)
|
||||
{
|
||||
if (strategy == null || image == null || textContext == null)
|
||||
return false;
|
||||
|
||||
bool bRet = false;
|
||||
using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(image))
|
||||
{
|
||||
graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
|
||||
bRet = strategy.DrawString(graphics,
|
||||
textContext.fontFamily,
|
||||
textContext.fontStyle,
|
||||
textContext.nfontSize,
|
||||
textContext.pszText,
|
||||
new System.Drawing.Point(textContext.ptDraw.X + offset.X, textContext.ptDraw.Y + offset.Y),
|
||||
textContext.strFormat);
|
||||
}
|
||||
|
||||
return bRet;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set alpha to color
|
||||
/// </summary>
|
||||
/// <param name="dest">is destination color in ARGB</param>
|
||||
/// <param name="source">is source color in ARGB</param>
|
||||
/// <param name="nAlpha">is nAlpha is alpha channel</param>
|
||||
/// <returns></returns>
|
||||
private static UInt32 AddAlpha(UInt32 dest, UInt32 source, Byte nAlpha)
|
||||
{
|
||||
if (0 == nAlpha)
|
||||
return dest;
|
||||
|
||||
if (255 == nAlpha)
|
||||
return source;
|
||||
|
||||
Byte nSrcRed = (Byte)((source & 0xff0000) >> 16);
|
||||
Byte nSrcGreen = (Byte)((source & 0xff00) >> 8);
|
||||
Byte nSrcBlue = (Byte)((source & 0xff));
|
||||
|
||||
Byte nRed = (Byte)(nSrcRed);
|
||||
Byte nGreen = (Byte)(nSrcGreen);
|
||||
Byte nBlue = (Byte)(nSrcBlue);
|
||||
|
||||
return (UInt32)(nAlpha << 24 | nRed << 16 | nGreen << 8 | nBlue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs Alphablend
|
||||
/// </summary>
|
||||
/// <param name="dest">is destination color in ARGB</param>
|
||||
/// <param name="source">is source color in ARGB</param>
|
||||
/// <param name="nAlpha">is nAlpha is alpha channel</param>
|
||||
/// <param name="nAlphaFinal">sets alpha channel of the returned UInt32</param>
|
||||
/// <returns>destination color</returns>
|
||||
private static UInt32 Alphablend(UInt32 dest, UInt32 source, Byte nAlpha, Byte nAlphaFinal)
|
||||
{
|
||||
if (0 == nAlpha)
|
||||
return dest;
|
||||
|
||||
if (255 == nAlpha)
|
||||
return source;
|
||||
|
||||
Byte nInvAlpha = (Byte)(~nAlpha);
|
||||
|
||||
Byte nSrcRed = (Byte)((source & 0xff0000) >> 16);
|
||||
Byte nSrcGreen = (Byte)((source & 0xff00) >> 8);
|
||||
Byte nSrcBlue = (Byte)((source & 0xff));
|
||||
|
||||
Byte nDestRed = (Byte)((dest & 0xff0000) >> 16);
|
||||
Byte nDestGreen = (Byte)((dest & 0xff00) >> 8);
|
||||
Byte nDestBlue = (Byte)(dest & 0xff);
|
||||
|
||||
Byte nRed = (Byte)((nSrcRed * nAlpha + nDestRed * nInvAlpha) >> 8);
|
||||
Byte nGreen = (Byte)((nSrcGreen * nAlpha + nDestGreen * nInvAlpha) >> 8);
|
||||
Byte nBlue = (Byte)((nSrcBlue * nAlpha + nDestBlue * nInvAlpha) >> 8);
|
||||
|
||||
return (UInt32)(nAlphaFinal << 24 | nRed << 16 | nGreen << 8 | nBlue);
|
||||
}
|
||||
/// <summary>
|
||||
/// Performs Alphablend
|
||||
/// </summary>
|
||||
/// <param name="dest">is destination color in ARGB</param>
|
||||
/// <param name="source">is source color in ARGB</param>
|
||||
/// <returns>destination color</returns>
|
||||
private static UInt32 PreMultipliedAlphablend(UInt32 dest, UInt32 source)
|
||||
{
|
||||
Byte Alpha = (Byte)((source & 0xff000000) >> 24);
|
||||
Byte nInvAlpha = (Byte)(255 - Alpha);
|
||||
|
||||
Byte nSrcRed = (Byte)((source & 0xff0000) >> 16);
|
||||
Byte nSrcGreen = (Byte)((source & 0xff00) >> 8);
|
||||
Byte nSrcBlue = (Byte)((source & 0xff));
|
||||
|
||||
Byte nDestRed = (Byte)((dest & 0xff0000) >> 16);
|
||||
Byte nDestGreen = (Byte)((dest & 0xff00) >> 8);
|
||||
Byte nDestBlue = (Byte)(dest & 0xff);
|
||||
|
||||
Byte nRed = (Byte)(nSrcRed + ((nDestRed * nInvAlpha) >> 8));
|
||||
Byte nGreen = (Byte)(nSrcGreen + ((nDestGreen * nInvAlpha) >> 8));
|
||||
Byte nBlue = (Byte)(nSrcBlue + ((nDestBlue * nInvAlpha) >> 8));
|
||||
|
||||
return (UInt32)(0xff << 24 | nRed << 16 | nGreen << 8 | nBlue);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
272
TextDesignerCSLibrary/DiffusedShadowStrategy.cs
Normal file
@@ -0,0 +1,272 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
class DiffusedShadowStrategy : ITextStrategy
|
||||
{
|
||||
public DiffusedShadowStrategy()
|
||||
{
|
||||
m_nThickness=8;
|
||||
m_bOutlinetext = false;
|
||||
m_brushText = null;
|
||||
m_bClrText = true;
|
||||
disposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
~DiffusedShadowStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
DiffusedShadowStrategy p = new DiffusedShadowStrategy();
|
||||
if (m_bClrText)
|
||||
p.Init(m_clrText, m_clrOutline, m_nThickness, m_bOutlinetext);
|
||||
else
|
||||
p.Init(m_brushText, m_clrOutline, m_nThickness, m_bOutlinetext);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness,
|
||||
bool bOutlinetext)
|
||||
{
|
||||
m_clrText = clrText;
|
||||
m_bClrText = true;
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
m_bOutlinetext = bOutlinetext;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness,
|
||||
bool bOutlinetext)
|
||||
{
|
||||
m_brushText = brushText;
|
||||
m_bClrText = false;
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
m_bOutlinetext = bOutlinetext;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
for (int i = 1; i <= m_nThickness; ++i)
|
||||
{
|
||||
using (Pen pen = new Pen(m_clrOutline, i))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bOutlinetext == false)
|
||||
{
|
||||
for (int i = 1; i <= m_nThickness; ++i)
|
||||
{
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
for (int i = 1; i <= m_nThickness; ++i)
|
||||
{
|
||||
using (Pen pen = new Pen(m_clrOutline, i))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bOutlinetext == false)
|
||||
{
|
||||
for (int i = 1; i <= m_nThickness; ++i)
|
||||
{
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected System.Drawing.Color m_clrText;
|
||||
protected System.Drawing.Color m_clrOutline;
|
||||
protected int m_nThickness;
|
||||
protected bool m_bOutlinetext;
|
||||
protected System.Drawing.Brush m_brushText;
|
||||
protected bool m_bClrText;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
87
TextDesignerCSLibrary/DrawGradient.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class DrawGradient
|
||||
{
|
||||
public static bool Draw(Bitmap bmp, List<Color> colors, bool bHorizontal)
|
||||
{
|
||||
if(colors.Count==0)
|
||||
return false;
|
||||
|
||||
if(colors.Count==1)
|
||||
{
|
||||
using (Graphics graph = Graphics.FromImage(bmp))
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(colors[0]))
|
||||
{
|
||||
graph.FillRectangle(brush, 0, 0, bmp.Width, bmp.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (bHorizontal)
|
||||
{
|
||||
using (Graphics graph = Graphics.FromImage(bmp))
|
||||
{
|
||||
|
||||
int gradRectNum = colors.Count - 1;
|
||||
int gradWidth = bmp.Width / gradRectNum;
|
||||
int remainder = bmp.Width % gradRectNum;
|
||||
|
||||
int TotalWidthRendered = 0;
|
||||
int WidthToBeRendered = 0;
|
||||
|
||||
for (int i = 0; i < gradRectNum; ++i)
|
||||
{
|
||||
int addRemainder = 0;
|
||||
if (i < remainder)
|
||||
addRemainder = 1;
|
||||
WidthToBeRendered = gradWidth + addRemainder;
|
||||
Rectangle rect = new Rectangle(TotalWidthRendered - 1, 0, WidthToBeRendered + 1, bmp.Height);
|
||||
using (LinearGradientBrush brush = new LinearGradientBrush(rect, colors[i], colors[i + 1], LinearGradientMode.Horizontal))
|
||||
{
|
||||
graph.FillRectangle(brush, TotalWidthRendered, 0, WidthToBeRendered, bmp.Height);
|
||||
}
|
||||
TotalWidthRendered += WidthToBeRendered;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Graphics graph = Graphics.FromImage(bmp))
|
||||
{
|
||||
|
||||
int gradRectNum = colors.Count - 1;
|
||||
int gradHeight = bmp.Height / gradRectNum;
|
||||
int remainder = bmp.Height % gradRectNum;
|
||||
|
||||
int TotalHeightRendered = 0;
|
||||
int HeightToBeRendered = 0;
|
||||
for (int i = 0; i < gradRectNum; ++i)
|
||||
{
|
||||
int addRemainder = 0;
|
||||
if (i < remainder)
|
||||
addRemainder = 1;
|
||||
HeightToBeRendered = gradHeight + addRemainder;
|
||||
Rectangle rect = new Rectangle(0, TotalHeightRendered - 1, bmp.Width, HeightToBeRendered + 1);
|
||||
using (LinearGradientBrush brush = new LinearGradientBrush(rect, colors[i], colors[i + 1], LinearGradientMode.Vertical))
|
||||
{
|
||||
graph.FillRectangle(brush, 0, TotalHeightRendered, bmp.Width, HeightToBeRendered);
|
||||
}
|
||||
TotalHeightRendered += HeightToBeRendered;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
273
TextDesignerCSLibrary/ExtrudeStrategy.cs
Normal file
@@ -0,0 +1,273 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class ExtrudeStrategy : ITextStrategy
|
||||
{
|
||||
public ExtrudeStrategy()
|
||||
{
|
||||
m_nThickness=2;
|
||||
m_brushText = null;
|
||||
m_bClrText = true;
|
||||
disposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
~ExtrudeStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
ExtrudeStrategy p = new ExtrudeStrategy();
|
||||
if (m_bClrText)
|
||||
p.Init(m_clrText, m_clrOutline, m_nThickness, m_nOffsetX, m_nOffsetY);
|
||||
else
|
||||
p.Init(m_brushText, m_clrOutline, m_nThickness, m_nOffsetX, m_nOffsetY);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness,
|
||||
int nOffsetX,
|
||||
int nOffsetY )
|
||||
{
|
||||
m_clrText = clrText;
|
||||
m_bClrText = true;
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
m_nOffsetX = nOffsetX;
|
||||
m_nOffsetY = nOffsetY;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness,
|
||||
int nOffsetX,
|
||||
int nOffsetY)
|
||||
{
|
||||
m_brushText = brushText;
|
||||
m_bClrText = false;
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
m_nOffsetX = nOffsetX;
|
||||
m_nOffsetY = nOffsetY;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
int nOffset = Math.Abs(m_nOffsetX);
|
||||
if (Math.Abs(m_nOffsetX) == Math.Abs(m_nOffsetY))
|
||||
{
|
||||
nOffset = Math.Abs(m_nOffsetX);
|
||||
}
|
||||
else if (Math.Abs(m_nOffsetX) > Math.Abs(m_nOffsetY))
|
||||
{
|
||||
nOffset = Math.Abs(m_nOffsetY);
|
||||
}
|
||||
else if (Math.Abs(m_nOffsetX) < Math.Abs(m_nOffsetY))
|
||||
{
|
||||
nOffset = Math.Abs(m_nOffsetX);
|
||||
}
|
||||
|
||||
for(int i=0; i<nOffset; ++i)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize,
|
||||
new Point(ptDraw.X + ((i * (-m_nOffsetX)) / nOffset), ptDraw.Y + ((i * (-m_nOffsetY)) / nOffset)),
|
||||
strFormat);
|
||||
|
||||
using (Pen pen = new Pen(m_clrOutline, m_nThickness))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
int nOffset = Math.Abs(m_nOffsetX);
|
||||
if (Math.Abs(m_nOffsetX) == Math.Abs(m_nOffsetY))
|
||||
{
|
||||
nOffset = Math.Abs(m_nOffsetX);
|
||||
}
|
||||
else if (Math.Abs(m_nOffsetX) > Math.Abs(m_nOffsetY))
|
||||
{
|
||||
nOffset = Math.Abs(m_nOffsetY);
|
||||
}
|
||||
else if (Math.Abs(m_nOffsetX) < Math.Abs(m_nOffsetY))
|
||||
{
|
||||
nOffset = Math.Abs(m_nOffsetX);
|
||||
}
|
||||
|
||||
for (int i = 0; i < nOffset; ++i)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize,
|
||||
new Rectangle(rtDraw.X + ((i * (-m_nOffsetX)) / nOffset), rtDraw.Y + ((i * (-m_nOffsetY)) / nOffset),
|
||||
rtDraw.Width, rtDraw.Height),
|
||||
strFormat);
|
||||
|
||||
using (Pen pen = new Pen(m_clrOutline, m_nThickness))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected System.Drawing.Color m_clrText;
|
||||
protected System.Drawing.Color m_clrOutline;
|
||||
protected int m_nThickness;
|
||||
protected int m_nOffsetX;
|
||||
protected int m_nOffsetY;
|
||||
protected System.Drawing.Brush m_brushText;
|
||||
protected bool m_bClrText;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
181
TextDesignerCSLibrary/GDIPath.cs
Normal file
@@ -0,0 +1,181 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class GDIPath
|
||||
{
|
||||
static public bool MeasureGraphicsPath(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.Drawing2D.GraphicsPath graphicsPath,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fPixelsWidth,
|
||||
ref float fPixelsHeight)
|
||||
{
|
||||
if(graphicsPath.PathData.Points.Length<=0)
|
||||
return false;
|
||||
|
||||
float fHighestX = graphicsPath.PathData.Points[0].X;
|
||||
float fHighestY = graphicsPath.PathData.Points[0].Y;
|
||||
float fLowestX = graphicsPath.PathData.Points[0].X;
|
||||
float fLowestY = graphicsPath.PathData.Points[0].Y;
|
||||
int length = graphicsPath.PathData.Points.Length;
|
||||
PointF[] points = graphicsPath.PathData.Points;
|
||||
for(int i=1; i<length; ++i)
|
||||
{
|
||||
if (points[i].X < fLowestX)
|
||||
fLowestX = points[i].X;
|
||||
if (points[i].Y < fLowestY)
|
||||
fLowestY = points[i].Y;
|
||||
if (points[i].X > fHighestX)
|
||||
fHighestX = points[i].X;
|
||||
if (points[i].Y > fHighestY)
|
||||
fHighestY = points[i].Y;
|
||||
}
|
||||
|
||||
// Hack!
|
||||
if (fLowestX < 0.0f)
|
||||
{
|
||||
fStartX = fLowestX;
|
||||
fLowestX = -fLowestX;
|
||||
}
|
||||
else
|
||||
{
|
||||
fStartX = fLowestX;
|
||||
fLowestX = 0.0f;
|
||||
}
|
||||
|
||||
if (fLowestY < 0.0f)
|
||||
{
|
||||
fStartY = fLowestY;
|
||||
fLowestY = -fLowestY;
|
||||
}
|
||||
else
|
||||
{
|
||||
fStartY = fLowestY;
|
||||
fLowestY = 0.0f;
|
||||
}
|
||||
|
||||
bool b = ConvertToPixels(
|
||||
graphics,
|
||||
fLowestX + fHighestX - fPixelsWidth,
|
||||
fLowestY + fHighestY - fPixelsHeight,
|
||||
ref fStartX,
|
||||
ref fStartY,
|
||||
ref fPixelsWidth,
|
||||
ref fPixelsHeight );
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static public bool MeasureGraphicsPathRealHeight(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.Drawing2D.GraphicsPath graphicsPath,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fPixelsWidth,
|
||||
ref float fPixelsHeight)
|
||||
{
|
||||
if (graphicsPath.PathData.Points.Length <= 0)
|
||||
return false;
|
||||
|
||||
float fHighestX = graphicsPath.PathData.Points[0].X;
|
||||
float fHighestY = graphicsPath.PathData.Points[0].Y;
|
||||
float fLowestX = graphicsPath.PathData.Points[0].X;
|
||||
float fLowestY = graphicsPath.PathData.Points[0].Y;
|
||||
int length = graphicsPath.PathData.Points.Length;
|
||||
PointF[] points = graphicsPath.PathData.Points;
|
||||
for (int i = 1; i < length; ++i)
|
||||
{
|
||||
if (points[i].X < fLowestX)
|
||||
fLowestX = points[i].X;
|
||||
if (points[i].Y < fLowestY)
|
||||
fLowestY = points[i].Y;
|
||||
if (points[i].X > fHighestX)
|
||||
fHighestX = points[i].X;
|
||||
if (points[i].Y > fHighestY)
|
||||
fHighestY = points[i].Y;
|
||||
}
|
||||
|
||||
fStartX = fLowestX;
|
||||
fStartY = fLowestY;
|
||||
|
||||
bool b = ConvertToPixels(
|
||||
graphics,
|
||||
fLowestX + fHighestX - fPixelsWidth,
|
||||
fLowestY + fHighestY - fPixelsHeight,
|
||||
ref fStartX,
|
||||
ref fStartY,
|
||||
ref fPixelsWidth,
|
||||
ref fPixelsHeight);
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
static public bool ConvertToPixels(
|
||||
System.Drawing.Graphics graphics,
|
||||
float fSrcWidth,
|
||||
float fSrcHeight,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
GraphicsUnit unit = graphics.PageUnit;
|
||||
float fDpiX = graphics.DpiX;
|
||||
float fDpiY = graphics.DpiY;
|
||||
|
||||
if(unit==GraphicsUnit.World)
|
||||
return false; // dunno how to convert
|
||||
|
||||
if(unit==GraphicsUnit.Display||unit==GraphicsUnit.Pixel)
|
||||
{
|
||||
fDestWidth = fSrcWidth;
|
||||
fDestHeight = fSrcHeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(unit==GraphicsUnit.Point)
|
||||
{
|
||||
fStartX = 1.0f / 72.0f * fDpiX * fStartX;
|
||||
fStartY = 1.0f / 72.0f * fDpiY * fStartY;
|
||||
fDestWidth = 1.0f / 72.0f * fDpiX * fSrcWidth;
|
||||
fDestHeight = 1.0f / 72.0f * fDpiY * fSrcHeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(unit==GraphicsUnit.Inch)
|
||||
{
|
||||
fStartX = fDpiX * fStartX;
|
||||
fStartY = fDpiY * fStartY;
|
||||
fDestWidth = fDpiX * fSrcWidth;
|
||||
fDestHeight = fDpiY * fSrcHeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(unit==GraphicsUnit.Document)
|
||||
{
|
||||
fStartX = 1.0f / 300.0f * fDpiX * fStartX;
|
||||
fStartY = 1.0f / 300.0f * fDpiY * fStartY;
|
||||
fDestWidth = 1.0f / 300.0f * fDpiX * fSrcWidth;
|
||||
fDestHeight = 1.0f / 300.0f * fDpiY * fSrcHeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(unit==GraphicsUnit.Millimeter)
|
||||
{
|
||||
fStartX = 1.0f / 25.4f * fDpiX * fStartX;
|
||||
fStartY = 1.0f / 25.4f * fDpiY * fStartY;
|
||||
fDestWidth = 1.0f / 25.4f * fDpiX * fSrcWidth;
|
||||
fDestHeight = 1.0f / 25.4f * fDpiY * fSrcHeight;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
126
TextDesignerCSLibrary/IOutlineText.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public interface IOutlineText : IDisposable
|
||||
{
|
||||
void TextGlow(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness);
|
||||
|
||||
void TextGlow(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness);
|
||||
|
||||
void TextOutline(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness);
|
||||
|
||||
void TextOutline(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness);
|
||||
|
||||
void TextDblOutline(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2);
|
||||
|
||||
void TextDblOutline(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2);
|
||||
|
||||
void TextDblGlow(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2);
|
||||
|
||||
void TextDblGlow(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2);
|
||||
|
||||
void TextNoOutline(System.Drawing.Color clrText);
|
||||
|
||||
void TextNoOutline(System.Drawing.Brush brushText);
|
||||
|
||||
void TextOnlyOutline(
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness,
|
||||
bool bRoundedEdge);
|
||||
|
||||
void SetShadowBkgd(System.Drawing.Bitmap pBitmap);
|
||||
|
||||
void SetShadowBkgd(System.Drawing.Color clrBkgd, int nWidth, int nHeight);
|
||||
|
||||
void SetNullTextEffect();
|
||||
|
||||
void SetNullShadow();
|
||||
|
||||
void EnableShadow(bool bEnable);
|
||||
|
||||
void Shadow(
|
||||
System.Drawing.Color color,
|
||||
int nThickness,
|
||||
System.Drawing.Point ptOffset);
|
||||
|
||||
bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat);
|
||||
|
||||
bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat pStrFormat);
|
||||
|
||||
bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight );
|
||||
|
||||
bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight );
|
||||
|
||||
}
|
||||
}
|
||||
57
TextDesignerCSLibrary/ITextStrategy.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public interface ITextStrategy : IDisposable
|
||||
{
|
||||
ITextStrategy Clone();
|
||||
|
||||
bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat);
|
||||
|
||||
bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat);
|
||||
|
||||
bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string pszText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight);
|
||||
|
||||
bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string pszText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight);
|
||||
}
|
||||
}
|
||||
57
TextDesignerCSLibrary/MaskColor.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
/// <summary>
|
||||
/// Simple helper class to use mask color
|
||||
/// </summary>
|
||||
public class MaskColor
|
||||
{
|
||||
/// <summary>
|
||||
/// Method to return a primary red color to be used as mask
|
||||
/// </summary>
|
||||
public static System.Drawing.Color Red
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.Drawing.Color.FromArgb(0xFF, 0, 0);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Method to return a primary green color to be used as mask
|
||||
/// </summary>
|
||||
public static System.Drawing.Color Green
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.Drawing.Color.FromArgb(0, 0xFF, 0);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Method to return a primary blue color to be used as mask
|
||||
/// </summary>
|
||||
public static System.Drawing.Color Blue
|
||||
{
|
||||
get
|
||||
{
|
||||
return System.Drawing.Color.FromArgb(0, 0, 0xFF);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Method to compare 2 GDI+ color
|
||||
/// </summary>
|
||||
/// <param name="clr1">is 1st color</param>
|
||||
/// <param name="clr2">is 2nd color</param>
|
||||
/// <returns>true if equal</returns>
|
||||
public static bool IsEqual(System.Drawing.Color clr1, System.Drawing.Color clr2)
|
||||
{
|
||||
if (clr1.R == clr2.R && clr1.G == clr2.G && clr1.B == clr2.B)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
935
TextDesignerCSLibrary/OutlineText.cs
Normal file
@@ -0,0 +1,935 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class OutlineText : IOutlineText
|
||||
{
|
||||
public OutlineText()
|
||||
{
|
||||
m_pTextStrategy = null;
|
||||
m_pShadowStrategy = null;
|
||||
m_pFontBodyShadow = null;
|
||||
m_pBkgdBitmap = null;
|
||||
m_clrShadow = System.Drawing.Color.FromArgb(0,0,0);
|
||||
m_bEnableShadow = false;
|
||||
m_bDiffuseShadow = false;
|
||||
m_nShadowThickness = 2;
|
||||
disposed = false;
|
||||
}
|
||||
public OutlineText(OutlineText rhs)
|
||||
{
|
||||
if (rhs.m_pTextStrategy != null) m_pTextStrategy = rhs.m_pTextStrategy.Clone(); else m_pTextStrategy = null;
|
||||
if (rhs.m_pShadowStrategy != null) m_pShadowStrategy = rhs.m_pShadowStrategy.Clone(); else m_pShadowStrategy = null;
|
||||
if (rhs.m_pFontBodyShadow != null) m_pFontBodyShadow = rhs.m_pFontBodyShadow.Clone(); else m_pFontBodyShadow = null;
|
||||
m_pBkgdBitmap = rhs.m_pBkgdBitmap;
|
||||
m_clrShadow = rhs.m_clrShadow;
|
||||
m_bEnableShadow = rhs.m_bEnableShadow;
|
||||
m_bDiffuseShadow = rhs.m_bDiffuseShadow;
|
||||
m_nShadowThickness = rhs.m_nShadowThickness;
|
||||
disposed = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
if (m_pTextStrategy != null)
|
||||
m_pTextStrategy.Dispose();
|
||||
if (m_pShadowStrategy != null)
|
||||
m_pShadowStrategy.Dispose();
|
||||
if (m_pFontBodyShadow != null)
|
||||
m_pFontBodyShadow.Dispose();
|
||||
if (m_pBkgdBitmap != null)
|
||||
m_pBkgdBitmap.Dispose();
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
~OutlineText()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
|
||||
public void TextGlow(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
TextGlowStrategy pStrat = new TextGlowStrategy();
|
||||
pStrat.Init(clrText,clrOutline,nThickness);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextGlow(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
TextGlowStrategy pStrat = new TextGlowStrategy();
|
||||
pStrat.Init(brushText, clrOutline, nThickness);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextOutline(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
TextOutlineStrategy pStrat = new TextOutlineStrategy();
|
||||
pStrat.Init(clrText,clrOutline,nThickness);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextOutline(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
TextOutlineStrategy pStrat = new TextOutlineStrategy();
|
||||
pStrat.Init(brushText, clrOutline, nThickness);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextDblOutline(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2)
|
||||
{
|
||||
TextDblOutlineStrategy pStrat = new TextDblOutlineStrategy();
|
||||
pStrat.Init(clrText,clrOutline1,clrOutline2,nThickness1,nThickness2);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextDblOutline(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2)
|
||||
{
|
||||
TextDblOutlineStrategy pStrat = new TextDblOutlineStrategy();
|
||||
pStrat.Init(brushText, clrOutline1, clrOutline2, nThickness1, nThickness2);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextDblGlow(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2)
|
||||
{
|
||||
TextDblGlowStrategy pStrat = new TextDblGlowStrategy();
|
||||
pStrat.Init(clrText, clrOutline1, clrOutline2, nThickness1, nThickness2);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextDblGlow(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2)
|
||||
{
|
||||
TextDblGlowStrategy pStrat = new TextDblGlowStrategy();
|
||||
pStrat.Init(brushText, clrOutline1, clrOutline2, nThickness1, nThickness2);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextGradOutline(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness)
|
||||
{
|
||||
TextGradOutlineStrategy pStrat = new TextGradOutlineStrategy();
|
||||
pStrat.Init(clrText, clrOutline1, clrOutline2, nThickness);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextGradOutline(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness)
|
||||
{
|
||||
TextGradOutlineStrategy pStrat = new TextGradOutlineStrategy();
|
||||
pStrat.Init(brushText, clrOutline1, clrOutline2, nThickness);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextNoOutline(System.Drawing.Color clrText)
|
||||
{
|
||||
TextNoOutlineStrategy pStrat = new TextNoOutlineStrategy();
|
||||
pStrat.Init(clrText);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextNoOutline(System.Drawing.Brush brushText)
|
||||
{
|
||||
TextNoOutlineStrategy pStrat = new TextNoOutlineStrategy();
|
||||
pStrat.Init(brushText);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
public void TextOnlyOutline(
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness,
|
||||
bool bRoundedEdge)
|
||||
{
|
||||
TextOnlyOutlineStrategy pStrat = new TextOnlyOutlineStrategy();
|
||||
pStrat.Init(clrOutline, nThickness, bRoundedEdge);
|
||||
|
||||
m_pTextStrategy = pStrat;
|
||||
}
|
||||
|
||||
|
||||
public void SetShadowBkgd(System.Drawing.Bitmap pBitmap)
|
||||
{
|
||||
m_pBkgdBitmap = pBitmap;
|
||||
}
|
||||
|
||||
public void SetShadowBkgd(System.Drawing.Color clrBkgd, int nWidth, int nHeight)
|
||||
{
|
||||
m_pBkgdBitmap = new System.Drawing.Bitmap(nWidth, nHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
||||
|
||||
using (System.Drawing.Graphics graphics = System.Drawing.Graphics.FromImage(m_pBkgdBitmap))
|
||||
{
|
||||
using (System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(clrBkgd))
|
||||
{
|
||||
graphics.FillRectangle(brush, 0, 0, m_pBkgdBitmap.Width, m_pBkgdBitmap.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetNullTextEffect()
|
||||
{
|
||||
m_pTextStrategy = null;
|
||||
}
|
||||
|
||||
public void SetNullShadow()
|
||||
{
|
||||
m_pFontBodyShadow = null;
|
||||
m_pShadowStrategy = null;
|
||||
}
|
||||
|
||||
|
||||
public void EnableShadow(bool bEnable)
|
||||
{
|
||||
m_bEnableShadow = bEnable;
|
||||
}
|
||||
|
||||
public bool IsShadowEnabled()
|
||||
{
|
||||
return m_bEnableShadow;
|
||||
}
|
||||
|
||||
public void Shadow(
|
||||
System.Drawing.Color color,
|
||||
int nThickness,
|
||||
System.Drawing.Point ptOffset)
|
||||
{
|
||||
TextOutlineStrategy pStrat = new TextOutlineStrategy();
|
||||
pStrat.Init(System.Drawing.Color.FromArgb(0,0,0,0),color,nThickness);
|
||||
|
||||
m_clrShadow = color;
|
||||
|
||||
TextOutlineStrategy pFontBodyShadow = new TextOutlineStrategy();
|
||||
pFontBodyShadow.Init(System.Drawing.Color.FromArgb(255, 255, 255), System.Drawing.Color.FromArgb(0, 0, 0, 0), 0);
|
||||
m_pFontBodyShadow = pFontBodyShadow;
|
||||
|
||||
m_ptShadowOffset = ptOffset;
|
||||
m_pShadowStrategy = pStrat;
|
||||
m_bDiffuseShadow = false;
|
||||
}
|
||||
|
||||
public void DiffusedShadow(
|
||||
System.Drawing.Color color,
|
||||
int nThickness,
|
||||
System.Drawing.Point ptOffset)
|
||||
{
|
||||
DiffusedShadowStrategy pStrat = new DiffusedShadowStrategy();
|
||||
pStrat.Init(System.Drawing.Color.FromArgb(0,0,0,0),color,nThickness,true);
|
||||
|
||||
m_clrShadow = color;
|
||||
|
||||
DiffusedShadowStrategy pFontBodyShadow = new DiffusedShadowStrategy();
|
||||
pFontBodyShadow.Init(System.Drawing.Color.FromArgb(color.A, 255, 255), System.Drawing.Color.FromArgb(0, 0, 0, 0), 0, true);
|
||||
m_pFontBodyShadow = pFontBodyShadow;
|
||||
|
||||
m_ptShadowOffset = ptOffset;
|
||||
m_pShadowStrategy = pStrat;
|
||||
m_bDiffuseShadow = true;
|
||||
m_bExtrudeShadow = false;
|
||||
m_nShadowThickness = nThickness;
|
||||
}
|
||||
|
||||
public void Extrude(
|
||||
System.Drawing.Color color,
|
||||
int nThickness,
|
||||
System.Drawing.Point ptOffset)
|
||||
{
|
||||
ExtrudeStrategy pStrat = new ExtrudeStrategy();
|
||||
pStrat.Init(System.Drawing.Color.FromArgb(0, 0, 0, 0), color, nThickness, ptOffset.X, ptOffset.Y);
|
||||
|
||||
m_clrShadow = color;
|
||||
|
||||
ExtrudeStrategy pFontBodyShadow = new ExtrudeStrategy();
|
||||
pFontBodyShadow.Init(System.Drawing.Color.FromArgb(color.A, 255, 255), System.Drawing.Color.FromArgb(0, 0, 0, 0), 0, ptOffset.X, ptOffset.Y);
|
||||
m_pFontBodyShadow = pFontBodyShadow;
|
||||
|
||||
m_ptShadowOffset = ptOffset;
|
||||
m_pShadowStrategy = pStrat;
|
||||
m_bExtrudeShadow = true;
|
||||
m_bDiffuseShadow = false;
|
||||
m_nShadowThickness = nThickness;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
if (m_bEnableShadow && m_pShadowStrategy != null)
|
||||
{
|
||||
m_pShadowStrategy.DrawString(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
new System.Drawing.Point(ptDraw.X+m_ptShadowOffset.X, ptDraw.Y+m_ptShadowOffset.Y),
|
||||
strFormat);
|
||||
}
|
||||
|
||||
if (m_bEnableShadow && m_pBkgdBitmap != null && m_pFontBodyShadow != null)
|
||||
{
|
||||
RenderFontShadow(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
new System.Drawing.Point(ptDraw.X + m_ptShadowOffset.X, ptDraw.Y + m_ptShadowOffset.Y),
|
||||
strFormat);
|
||||
}
|
||||
|
||||
if (m_pTextStrategy != null)
|
||||
{
|
||||
return m_pTextStrategy.DrawString(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
ptDraw,
|
||||
strFormat);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
if(m_bEnableShadow &&m_pShadowStrategy!=null)
|
||||
{
|
||||
m_pShadowStrategy.DrawString(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
new System.Drawing.Rectangle(rtDraw.X+m_ptShadowOffset.X, rtDraw.Y+m_ptShadowOffset.Y,rtDraw.Width,rtDraw.Height),
|
||||
strFormat);
|
||||
}
|
||||
|
||||
if (m_bEnableShadow && m_pBkgdBitmap != null && m_pFontBodyShadow != null)
|
||||
{
|
||||
RenderFontShadow(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
new System.Drawing.Rectangle(rtDraw.X + m_ptShadowOffset.X, rtDraw.Y + m_ptShadowOffset.Y, rtDraw.Width, rtDraw.Height),
|
||||
strFormat);
|
||||
}
|
||||
|
||||
if (m_pTextStrategy != null)
|
||||
{
|
||||
return m_pTextStrategy.DrawString(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
rtDraw,
|
||||
strFormat);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
float fDestWidth1 = 0.0f;
|
||||
float fDestHeight1 = 0.0f;
|
||||
bool b = false;
|
||||
if(m_pTextStrategy!=null)
|
||||
{
|
||||
b = m_pTextStrategy.MeasureString(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
ptDraw,
|
||||
strFormat,
|
||||
ref fStartX,
|
||||
ref fStartY,
|
||||
ref fDestWidth1,
|
||||
ref fDestHeight1 );
|
||||
if(!b)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
float fDestWidth2 = 0.0f;
|
||||
float fDestHeight2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
if(m_bEnableShadow)
|
||||
{
|
||||
b = m_pShadowStrategy.MeasureString(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
ptDraw,
|
||||
strFormat,
|
||||
ref fStartX2,
|
||||
ref fStartY2,
|
||||
ref fDestWidth2,
|
||||
ref fDestHeight2 );
|
||||
|
||||
if(b)
|
||||
{
|
||||
float fDestWidth3 = 0.0f;
|
||||
float fDestHeight3 = 0.0f;
|
||||
float fStartX3 = 0.0f;
|
||||
float fStartY3 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_ptShadowOffset.X, m_ptShadowOffset.Y,
|
||||
ref fStartX3, ref fStartY3, ref fDestWidth3, ref fDestHeight3);
|
||||
if(b)
|
||||
{
|
||||
fDestWidth2 += fDestWidth3;
|
||||
fDestHeight2 += fDestHeight3;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fDestWidth1>fDestWidth2 || fDestHeight1>fDestHeight2)
|
||||
{
|
||||
fDestWidth = fDestWidth1;
|
||||
fDestHeight = fDestHeight1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fDestWidth = fDestWidth2;
|
||||
fDestHeight = fDestHeight2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
float fDestWidth1 = 0.0f;
|
||||
float fDestHeight1 = 0.0f;
|
||||
bool b = false;
|
||||
if (m_pTextStrategy != null)
|
||||
{
|
||||
b = m_pTextStrategy.MeasureString(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
rtDraw,
|
||||
strFormat,
|
||||
ref fStartX,
|
||||
ref fStartY,
|
||||
ref fDestWidth1,
|
||||
ref fDestHeight1);
|
||||
|
||||
if (!b)
|
||||
return false;
|
||||
}
|
||||
|
||||
float fDestWidth2 = 0.0f;
|
||||
float fDestHeight2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
if(m_bEnableShadow)
|
||||
{
|
||||
b = m_pShadowStrategy.MeasureString(
|
||||
graphics,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
rtDraw,
|
||||
strFormat,
|
||||
ref fStartX2,
|
||||
ref fStartY2,
|
||||
ref fDestWidth2,
|
||||
ref fDestHeight2 );
|
||||
|
||||
if(b)
|
||||
{
|
||||
float fDestWidth3 = 0.0f;
|
||||
float fDestHeight3 = 0.0f;
|
||||
float fStartX3 = 0.0f;
|
||||
float fStartY3 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics,m_ptShadowOffset.X,m_ptShadowOffset.Y,
|
||||
ref fStartX3, ref fStartY3, ref fDestWidth3, ref fDestHeight3);
|
||||
if(b)
|
||||
{
|
||||
fDestWidth2 += fDestWidth3;
|
||||
fDestHeight2 += fDestHeight3;
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
if(fDestWidth1>fDestWidth2 || fDestHeight1>fDestHeight2)
|
||||
{
|
||||
fDestWidth = fDestWidth1;
|
||||
fDestHeight = fDestHeight1;
|
||||
}
|
||||
else
|
||||
{
|
||||
fDestWidth = fDestWidth2;
|
||||
fDestHeight = fDestHeight2;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenderFontShadow(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
Rectangle rectbmp = new Rectangle(0, 0, m_pBkgdBitmap.Width, m_pBkgdBitmap.Height);
|
||||
using (System.Drawing.Bitmap pBmpMask =
|
||||
m_pBkgdBitmap.Clone(rectbmp, PixelFormat.Format32bppArgb))
|
||||
{
|
||||
|
||||
using (System.Drawing.Bitmap pBmpFontBodyBackup =
|
||||
m_pBkgdBitmap.Clone(rectbmp, PixelFormat.Format32bppArgb))
|
||||
{
|
||||
|
||||
using (System.Drawing.Graphics graphicsMask = System.Drawing.Graphics.FromImage(pBmpMask))
|
||||
{
|
||||
using (System.Drawing.SolidBrush brushBlack = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(0, 0, 0)))
|
||||
{
|
||||
graphicsMask.FillRectangle(brushBlack, 0, 0, m_pBkgdBitmap.Width, m_pBkgdBitmap.Height);
|
||||
|
||||
|
||||
using (System.Drawing.Bitmap pBmpDisplay =
|
||||
m_pBkgdBitmap.Clone(rectbmp, PixelFormat.Format32bppArgb))
|
||||
{
|
||||
using (System.Drawing.Graphics graphicsBkgd = System.Drawing.Graphics.FromImage(pBmpDisplay))
|
||||
{
|
||||
|
||||
graphicsMask.CompositingMode = graphics.CompositingMode;
|
||||
graphicsMask.CompositingQuality = graphics.CompositingQuality;
|
||||
graphicsMask.InterpolationMode = graphics.InterpolationMode;
|
||||
graphicsMask.SmoothingMode = graphics.SmoothingMode;
|
||||
graphicsMask.TextRenderingHint = graphics.TextRenderingHint;
|
||||
graphicsMask.PageUnit = graphics.PageUnit;
|
||||
graphicsMask.PageScale = graphics.PageScale;
|
||||
|
||||
graphicsBkgd.CompositingMode = graphics.CompositingMode;
|
||||
graphicsBkgd.CompositingQuality = graphics.CompositingQuality;
|
||||
graphicsBkgd.InterpolationMode = graphics.InterpolationMode;
|
||||
graphicsBkgd.SmoothingMode = graphics.SmoothingMode;
|
||||
graphicsBkgd.TextRenderingHint = graphics.TextRenderingHint;
|
||||
graphicsBkgd.PageUnit = graphics.PageUnit;
|
||||
graphicsBkgd.PageScale = graphics.PageScale;
|
||||
|
||||
m_pFontBodyShadow.DrawString(
|
||||
graphicsMask,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
ptDraw,
|
||||
strFormat);
|
||||
|
||||
m_pShadowStrategy.DrawString(
|
||||
graphicsBkgd,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
strText,
|
||||
ptDraw,
|
||||
strFormat);
|
||||
|
||||
unsafe
|
||||
{
|
||||
UInt32* pixelsSrc = null;
|
||||
UInt32* pixelsDest = null;
|
||||
UInt32* pixelsMask = null;
|
||||
|
||||
BitmapData bitmapDataSrc = new BitmapData();
|
||||
BitmapData bitmapDataDest = new BitmapData();
|
||||
BitmapData bitmapDataMask = new BitmapData();
|
||||
Rectangle rect = new Rectangle(0, 0, m_pBkgdBitmap.Width, m_pBkgdBitmap.Height);
|
||||
|
||||
pBmpFontBodyBackup.LockBits(
|
||||
rect,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataSrc);
|
||||
|
||||
pBmpDisplay.LockBits(
|
||||
rect,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataDest);
|
||||
|
||||
pBmpMask.LockBits(
|
||||
rect,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataMask);
|
||||
|
||||
|
||||
// Write to the temporary buffer provided by LockBits.
|
||||
pixelsSrc = (UInt32*)(bitmapDataSrc.Scan0);
|
||||
pixelsDest = (UInt32*)(bitmapDataDest.Scan0);
|
||||
pixelsMask = (UInt32*)(bitmapDataMask.Scan0);
|
||||
|
||||
if (pixelsSrc == null || pixelsDest == null || pixelsMask == null)
|
||||
return;
|
||||
|
||||
UInt32 col = 0;
|
||||
int stride = bitmapDataDest.Stride >> 2;
|
||||
if (m_bDiffuseShadow && m_bExtrudeShadow == false)
|
||||
{
|
||||
for (UInt32 row = 0; row < bitmapDataDest.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapDataDest.Width; ++col)
|
||||
{
|
||||
UInt32 index = (UInt32)(row * stride + col);
|
||||
Byte nAlpha = (Byte)(pixelsMask[index] & 0xff);
|
||||
UInt32 clrShadow = (UInt32)(0xff000000 | m_clrShadow.R << 16 | m_clrShadow.G << 8 | m_clrShadow.B);
|
||||
if (nAlpha > 0)
|
||||
{
|
||||
UInt32 clrtotal = clrShadow;
|
||||
for (int i = 2; i <= m_nShadowThickness; ++i)
|
||||
pixelsSrc[index] = Alphablend(pixelsSrc[index], clrtotal, m_clrShadow.A);
|
||||
|
||||
pixelsDest[index] = pixelsSrc[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (UInt32 row = 0; row < bitmapDataDest.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapDataDest.Width; ++col)
|
||||
{
|
||||
UInt32 index = (UInt32)(row * stride + col);
|
||||
Byte nAlpha = (Byte)(pixelsMask[index] & 0xff);
|
||||
UInt32 clrShadow = (UInt32)(0xff000000 | m_clrShadow.R << 16 | m_clrShadow.G << 8 | m_clrShadow.B);
|
||||
if (nAlpha > 0)
|
||||
pixelsDest[index] = Alphablend(pixelsSrc[index], clrShadow, m_clrShadow.A);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pBmpMask.UnlockBits(bitmapDataMask);
|
||||
pBmpDisplay.UnlockBits(bitmapDataDest);
|
||||
pBmpFontBodyBackup.UnlockBits(bitmapDataSrc);
|
||||
|
||||
graphics.DrawImage(pBmpDisplay, 0, 0, pBmpDisplay.Width, pBmpDisplay.Height);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RenderFontShadow(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int nfontSize,
|
||||
string pszText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
Rectangle rectbmp = new Rectangle(0, 0, m_pBkgdBitmap.Width, m_pBkgdBitmap.Height);
|
||||
using (System.Drawing.Bitmap pBmpMask =
|
||||
m_pBkgdBitmap.Clone(rectbmp, PixelFormat.Format32bppArgb))
|
||||
{
|
||||
|
||||
using (System.Drawing.Bitmap pBmpFontBodyBackup =
|
||||
m_pBkgdBitmap.Clone(rectbmp, PixelFormat.Format32bppArgb))
|
||||
{
|
||||
|
||||
using (System.Drawing.Graphics graphicsMask = System.Drawing.Graphics.FromImage(pBmpMask))
|
||||
{
|
||||
using (System.Drawing.SolidBrush brushBlack = new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(0, 0, 0)))
|
||||
{
|
||||
graphicsMask.FillRectangle(brushBlack, 0, 0, m_pBkgdBitmap.Width, m_pBkgdBitmap.Height);
|
||||
|
||||
using (System.Drawing.Bitmap pBmpDisplay =
|
||||
m_pBkgdBitmap.Clone(rectbmp, PixelFormat.Format32bppArgb))
|
||||
{
|
||||
using (System.Drawing.Graphics graphicsBkgd = System.Drawing.Graphics.FromImage(pBmpDisplay))
|
||||
{
|
||||
|
||||
graphicsMask.CompositingMode = graphics.CompositingMode;
|
||||
graphicsMask.CompositingQuality = graphics.CompositingQuality;
|
||||
graphicsMask.InterpolationMode = graphics.InterpolationMode;
|
||||
graphicsMask.SmoothingMode = graphics.SmoothingMode;
|
||||
graphicsMask.TextRenderingHint = graphics.TextRenderingHint;
|
||||
graphicsMask.PageUnit = graphics.PageUnit;
|
||||
graphicsMask.PageScale = graphics.PageScale;
|
||||
|
||||
graphicsBkgd.CompositingMode = graphics.CompositingMode;
|
||||
graphicsBkgd.CompositingQuality = graphics.CompositingQuality;
|
||||
graphicsBkgd.InterpolationMode = graphics.InterpolationMode;
|
||||
graphicsBkgd.SmoothingMode = graphics.SmoothingMode;
|
||||
graphicsBkgd.TextRenderingHint = graphics.TextRenderingHint;
|
||||
graphicsBkgd.PageUnit = graphics.PageUnit;
|
||||
graphicsBkgd.PageScale = graphics.PageScale;
|
||||
|
||||
m_pFontBodyShadow.DrawString(
|
||||
graphicsMask,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
pszText,
|
||||
rtDraw,
|
||||
strFormat);
|
||||
|
||||
m_pShadowStrategy.DrawString(
|
||||
graphicsBkgd,
|
||||
fontFamily,
|
||||
fontStyle,
|
||||
nfontSize,
|
||||
pszText,
|
||||
rtDraw,
|
||||
strFormat);
|
||||
|
||||
unsafe
|
||||
{
|
||||
UInt32* pixelsSrc = null;
|
||||
UInt32* pixelsDest = null;
|
||||
UInt32* pixelsMask = null;
|
||||
|
||||
BitmapData bitmapDataSrc = new BitmapData();
|
||||
BitmapData bitmapDataDest = new BitmapData();
|
||||
BitmapData bitmapDataMask = new BitmapData();
|
||||
Rectangle rect = new Rectangle(0, 0, m_pBkgdBitmap.Width, m_pBkgdBitmap.Height);
|
||||
|
||||
pBmpFontBodyBackup.LockBits(
|
||||
rect,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataSrc);
|
||||
|
||||
pBmpDisplay.LockBits(
|
||||
rect,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataDest);
|
||||
|
||||
pBmpMask.LockBits(
|
||||
rect,
|
||||
ImageLockMode.WriteOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapDataMask);
|
||||
|
||||
|
||||
// Write to the temporary buffer provided by LockBits.
|
||||
pixelsSrc = (UInt32*)(bitmapDataSrc.Scan0);
|
||||
pixelsDest = (UInt32*)(bitmapDataDest.Scan0);
|
||||
pixelsMask = (UInt32*)(bitmapDataMask.Scan0);
|
||||
|
||||
if (pixelsSrc == null || pixelsDest == null || pixelsMask == null)
|
||||
return;
|
||||
|
||||
UInt32 col = 0;
|
||||
int stride = bitmapDataDest.Stride >> 2;
|
||||
if (m_bDiffuseShadow && m_bExtrudeShadow == false)
|
||||
{
|
||||
for (UInt32 row = 0; row < bitmapDataDest.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapDataDest.Width; ++col)
|
||||
{
|
||||
UInt32 index = (UInt32)(row * stride + col);
|
||||
Byte nAlpha = (Byte)(pixelsMask[index] & 0xff);
|
||||
UInt32 clrShadow = (UInt32)(0xff000000 | m_clrShadow.R << 16 | m_clrShadow.G << 8 | m_clrShadow.B);
|
||||
if (nAlpha > 0)
|
||||
{
|
||||
UInt32 clrtotal = clrShadow;
|
||||
for (int i = 2; i <= m_nShadowThickness; ++i)
|
||||
pixelsSrc[index] = Alphablend(pixelsSrc[index], clrtotal, m_clrShadow.A);
|
||||
|
||||
pixelsDest[index] = pixelsSrc[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (UInt32 row = 0; row < bitmapDataDest.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapDataDest.Width; ++col)
|
||||
{
|
||||
UInt32 index = (UInt32)(row * stride + col);
|
||||
Byte nAlpha = (Byte)(pixelsMask[index] & 0xff);
|
||||
UInt32 clrShadow = (UInt32)(0xff000000 | m_clrShadow.R << 16 | m_clrShadow.G << 8 | m_clrShadow.B);
|
||||
if (nAlpha > 0)
|
||||
pixelsDest[index] = Alphablend(pixelsSrc[index], clrShadow, m_clrShadow.A);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pBmpMask.UnlockBits(bitmapDataMask);
|
||||
pBmpDisplay.UnlockBits(bitmapDataDest);
|
||||
pBmpFontBodyBackup.UnlockBits(bitmapDataSrc);
|
||||
|
||||
graphics.DrawImage(pBmpDisplay, 0, 0, pBmpDisplay.Width, pBmpDisplay.Height);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UInt32 Alphablend(UInt32 dest, UInt32 source, Byte nAlpha)
|
||||
{
|
||||
if( 0 == nAlpha )
|
||||
return dest;
|
||||
|
||||
if( 255 == nAlpha )
|
||||
return source;
|
||||
|
||||
Byte nInvAlpha = (Byte)(~nAlpha);
|
||||
|
||||
Byte nSrcRed = (Byte)((source & 0xff0000) >> 16);
|
||||
Byte nSrcGreen = (Byte)((source & 0xff00) >> 8);
|
||||
Byte nSrcBlue = (Byte)((source & 0xff));
|
||||
|
||||
Byte nDestRed = (Byte)((dest & 0xff0000) >> 16);
|
||||
Byte nDestGreen = (Byte)((dest & 0xff00) >> 8);
|
||||
Byte nDestBlue = (Byte)(dest & 0xff);
|
||||
|
||||
Byte nRed = (Byte)((nSrcRed * nAlpha + nDestRed * nInvAlpha) >> 8);
|
||||
Byte nGreen = (Byte)((nSrcGreen * nAlpha + nDestGreen * nInvAlpha) >> 8);
|
||||
Byte nBlue = (Byte)((nSrcBlue * nAlpha + nDestBlue * nInvAlpha) >> 8);
|
||||
|
||||
return (UInt32)(0xff000000 | nRed << 16 | nGreen << 8 | nBlue);
|
||||
}
|
||||
|
||||
|
||||
protected ITextStrategy m_pTextStrategy;
|
||||
protected ITextStrategy m_pShadowStrategy;
|
||||
protected ITextStrategy m_pFontBodyShadow;
|
||||
protected System.Drawing.Point m_ptShadowOffset;
|
||||
protected System.Drawing.Color m_clrShadow;
|
||||
protected System.Drawing.Bitmap m_pBkgdBitmap;
|
||||
protected bool m_bEnableShadow;
|
||||
protected bool m_bDiffuseShadow;
|
||||
protected int m_nShadowThickness;
|
||||
protected bool m_bExtrudeShadow;
|
||||
protected bool disposed;
|
||||
|
||||
}
|
||||
}
|
||||
1293
TextDesignerCSLibrary/PngOutlineText.cs
Normal file
35
TextDesignerCSLibrary/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TextDesignerCSLibrary")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TextDesignerCSLibrary")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("69651077-2a6f-4c44-83f0-28518170f660")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
250
TextDesignerCSLibrary/TextDblGlowStrategy.cs
Normal file
@@ -0,0 +1,250 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class TextDblGlowStrategy : ITextStrategy
|
||||
{
|
||||
public TextDblGlowStrategy()
|
||||
{
|
||||
m_nThickness1=2;
|
||||
m_nThickness2=2;
|
||||
m_brushText = null;
|
||||
m_bClrText = true;
|
||||
disposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
~TextDblGlowStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
TextDblGlowStrategy p = new TextDblGlowStrategy();
|
||||
if (m_bClrText)
|
||||
p.Init(m_clrText, m_clrOutline1, m_clrOutline2, m_nThickness1, m_nThickness2);
|
||||
else
|
||||
p.Init(m_brushText, m_clrOutline1, m_clrOutline2, m_nThickness1, m_nThickness2);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2 )
|
||||
{
|
||||
m_clrText = clrText;
|
||||
m_bClrText = true;
|
||||
m_clrOutline1 = clrOutline1;
|
||||
m_clrOutline2 = clrOutline2;
|
||||
m_nThickness1 = nThickness1;
|
||||
m_nThickness2 = nThickness2;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2)
|
||||
{
|
||||
m_brushText = brushText;
|
||||
m_bClrText = false;
|
||||
m_clrOutline1 = clrOutline1;
|
||||
m_clrOutline2 = clrOutline2;
|
||||
m_nThickness1 = nThickness1;
|
||||
m_nThickness2 = nThickness2;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
for (int i = m_nThickness1; i <= m_nThickness1 + m_nThickness2; ++i)
|
||||
{
|
||||
using (Pen pen = new Pen(m_clrOutline2, i))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
using (Pen pen1 = new Pen(m_clrOutline1, m_nThickness1))
|
||||
{
|
||||
pen1.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen1, path);
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
for (int i = m_nThickness1; i <= m_nThickness1 + m_nThickness2; ++i)
|
||||
{
|
||||
using (Pen pen = new Pen(m_clrOutline2, i))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
using (Pen pen1 = new Pen(m_clrOutline1, m_nThickness1))
|
||||
{
|
||||
pen1.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen1, path);
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness1 + m_nThickness2, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness1 + m_nThickness2, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected System.Drawing.Color m_clrText;
|
||||
protected System.Drawing.Color m_clrOutline1;
|
||||
protected System.Drawing.Color m_clrOutline2;
|
||||
protected int m_nThickness1;
|
||||
protected int m_nThickness2;
|
||||
protected System.Drawing.Brush m_brushText;
|
||||
protected bool m_bClrText;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
244
TextDesignerCSLibrary/TextDblOutlineStrategy.cs
Normal file
@@ -0,0 +1,244 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class TextDblOutlineStrategy : ITextStrategy
|
||||
{
|
||||
public TextDblOutlineStrategy()
|
||||
{
|
||||
m_nThickness1=2;
|
||||
m_nThickness2=2;
|
||||
m_brushText = null;
|
||||
m_bClrText = true;
|
||||
disposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
~TextDblOutlineStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
TextDblOutlineStrategy p = new TextDblOutlineStrategy();
|
||||
if (m_bClrText)
|
||||
p.Init(m_clrText, m_clrOutline1, m_clrOutline2, m_nThickness1, m_nThickness2);
|
||||
else
|
||||
p.Init(m_brushText, m_clrOutline1, m_clrOutline2, m_nThickness1, m_nThickness2);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2 )
|
||||
{
|
||||
m_clrText = clrText;
|
||||
m_bClrText = true;
|
||||
m_clrOutline1 = clrOutline1;
|
||||
m_clrOutline2 = clrOutline2;
|
||||
m_nThickness1 = nThickness1;
|
||||
m_nThickness2 = nThickness2;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness1,
|
||||
int nThickness2)
|
||||
{
|
||||
m_brushText = brushText;
|
||||
m_bClrText = false;
|
||||
m_clrOutline1 = clrOutline1;
|
||||
m_clrOutline2 = clrOutline2;
|
||||
m_nThickness1 = nThickness1;
|
||||
m_nThickness2 = nThickness2;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
using (Pen pen2 = new Pen(m_clrOutline2, m_nThickness1 + m_nThickness2))
|
||||
{
|
||||
pen2.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen2, path);
|
||||
}
|
||||
using (Pen pen1 = new Pen(m_clrOutline1, m_nThickness1))
|
||||
{
|
||||
pen1.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen1, path);
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
using (Pen pen2 = new Pen(m_clrOutline2, m_nThickness1 + m_nThickness2))
|
||||
{
|
||||
pen2.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen2, path);
|
||||
}
|
||||
using (Pen pen1 = new Pen(m_clrOutline1, m_nThickness1))
|
||||
{
|
||||
pen1.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen1, path);
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness1 + m_nThickness2, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness1 + m_nThickness2, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected System.Drawing.Color m_clrText;
|
||||
protected System.Drawing.Color m_clrOutline1;
|
||||
protected System.Drawing.Color m_clrOutline2;
|
||||
protected int m_nThickness1;
|
||||
protected int m_nThickness2;
|
||||
protected System.Drawing.Brush m_brushText;
|
||||
protected bool m_bClrText;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
72
TextDesignerCSLibrary/TextDesignerCSLibrary.csproj
Normal file
@@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{43967937-3D38-4DD8-9C63-A486A0BB6DD5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TextDesignerCSLibrary</RootNamespace>
|
||||
<AssemblyName>TextDesignerCSLibrary</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BmpOutlineText.cs" />
|
||||
<Compile Include="DiffusedShadowStrategy.cs" />
|
||||
<Compile Include="DrawGradient.cs" />
|
||||
<Compile Include="ExtrudeStrategy.cs" />
|
||||
<Compile Include="GDIPath.cs" />
|
||||
<Compile Include="IOutlineText.cs" />
|
||||
<Compile Include="ITextStrategy.cs" />
|
||||
<Compile Include="OutlineText.cs" />
|
||||
<Compile Include="PngOutlineText.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TextDblGlowStrategy.cs" />
|
||||
<Compile Include="TextDblOutlineStrategy.cs" />
|
||||
<Compile Include="TextGlowStrategy.cs" />
|
||||
<Compile Include="TextGradOutlineStrategy.cs" />
|
||||
<Compile Include="TextNoOutlineStrategy.cs" />
|
||||
<Compile Include="TextOnlyOutlineStrategy.cs" />
|
||||
<Compile Include="TextOutlineStrategy.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
106
TextDesignerCSLibrary/TextDesignerCSLibrary_vs2010.csproj
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{43967937-3D38-4DD8-9C63-A486A0BB6DD5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TextDesignerCSLibrary</RootNamespace>
|
||||
<AssemblyName>TextDesignerCSLibrary</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BmpOutlineText.cs" />
|
||||
<Compile Include="Canvas.cs" />
|
||||
<Compile Include="DiffusedShadowStrategy.cs" />
|
||||
<Compile Include="DrawGradient.cs" />
|
||||
<Compile Include="ExtrudeStrategy.cs" />
|
||||
<Compile Include="GDIPath.cs" />
|
||||
<Compile Include="IOutlineText.cs" />
|
||||
<Compile Include="ITextStrategy.cs" />
|
||||
<Compile Include="MaskColor.cs" />
|
||||
<Compile Include="OutlineText.cs" />
|
||||
<Compile Include="PngOutlineText.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TextDblGlowStrategy.cs" />
|
||||
<Compile Include="TextDblOutlineStrategy.cs" />
|
||||
<Compile Include="TextGlowStrategy.cs" />
|
||||
<Compile Include="TextGradOutlineStrategy.cs" />
|
||||
<Compile Include="TextNoOutlineStrategy.cs" />
|
||||
<Compile Include="TextOnlyOutlineStrategy.cs" />
|
||||
<Compile Include="TextOutlineStrategy.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
230
TextDesignerCSLibrary/TextGlowStrategy.cs
Normal file
@@ -0,0 +1,230 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
class TextGlowStrategy : ITextStrategy
|
||||
{
|
||||
public TextGlowStrategy()
|
||||
{
|
||||
m_nThickness=2;
|
||||
m_brushText = null;
|
||||
m_bClrText = true;
|
||||
disposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
~TextGlowStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
TextGlowStrategy p = new TextGlowStrategy();
|
||||
if (m_bClrText)
|
||||
p.Init(m_clrText, m_clrOutline, m_nThickness);
|
||||
else
|
||||
p.Init(m_brushText, m_clrOutline, m_nThickness);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness )
|
||||
{
|
||||
m_clrText = clrText;
|
||||
m_bClrText = true;
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
m_brushText = brushText;
|
||||
m_bClrText = false;
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
for (int i = 1; i <= m_nThickness; ++i)
|
||||
{
|
||||
using (Pen pen = new Pen(m_clrOutline, i))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
for (int i = 1; i <= m_nThickness; ++i)
|
||||
{
|
||||
using (Pen pen = new Pen(m_clrOutline, i))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected System.Drawing.Color m_clrText;
|
||||
protected System.Drawing.Color m_clrOutline;
|
||||
protected int m_nThickness;
|
||||
protected System.Drawing.Brush m_brushText;
|
||||
protected bool m_bClrText;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
304
TextDesignerCSLibrary/TextGradOutlineStrategy.cs
Normal file
@@ -0,0 +1,304 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class TextGradOutlineStrategy : ITextStrategy
|
||||
{
|
||||
public TextGradOutlineStrategy()
|
||||
{
|
||||
m_nThickness=2;
|
||||
m_brushText = null;
|
||||
m_bClrText = true;
|
||||
disposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
~TextGradOutlineStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
TextGradOutlineStrategy p = new TextGradOutlineStrategy();
|
||||
if (m_bClrText)
|
||||
p.Init(m_clrText, m_clrOutline1, m_clrOutline2, m_nThickness);
|
||||
else
|
||||
p.Init(m_brushText, m_clrOutline1, m_clrOutline2, m_nThickness);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness )
|
||||
{
|
||||
m_clrText = clrText;
|
||||
m_bClrText = true;
|
||||
m_clrOutline1 = clrOutline1;
|
||||
m_clrOutline2 = clrOutline2;
|
||||
m_nThickness = nThickness;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline1,
|
||||
System.Drawing.Color clrOutline2,
|
||||
int nThickness)
|
||||
{
|
||||
m_brushText = brushText;
|
||||
m_bClrText = false;
|
||||
m_clrOutline1 = clrOutline1;
|
||||
m_clrOutline2 = clrOutline2;
|
||||
m_nThickness = nThickness;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
List<Color> list = new List<Color>();
|
||||
CalculateGradient(
|
||||
m_clrOutline1,
|
||||
m_clrOutline2,
|
||||
m_nThickness,
|
||||
list);
|
||||
|
||||
for (int i = m_nThickness; i >= 1; --i)
|
||||
{
|
||||
using (Pen pen1 = new Pen(list[i - 1], i))
|
||||
{
|
||||
pen1.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen1, path);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
List<Color> list = new List<Color>();
|
||||
CalculateGradient(
|
||||
m_clrOutline1,
|
||||
m_clrOutline2,
|
||||
m_nThickness,
|
||||
list);
|
||||
|
||||
for (int i = m_nThickness; i >= 1; --i)
|
||||
{
|
||||
using (Pen pen1 = new Pen(list[i - 1], i))
|
||||
{
|
||||
pen1.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen1, path);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CalculateGradient(
|
||||
Color clr1,
|
||||
Color clr2,
|
||||
int nThickness,
|
||||
List<Color> list)
|
||||
{
|
||||
list.Clear();
|
||||
int nWidth = nThickness;
|
||||
int nHeight = 1;
|
||||
Rectangle rect = new Rectangle(0, 0, nWidth, nHeight);
|
||||
LinearGradientBrush brush = new LinearGradientBrush(rect,
|
||||
clr1, clr2, LinearGradientMode.Horizontal);
|
||||
|
||||
using (Bitmap pImage = new Bitmap(nWidth, nHeight, PixelFormat.Format32bppArgb))
|
||||
{
|
||||
using (Graphics graphics = System.Drawing.Graphics.FromImage(pImage))
|
||||
{
|
||||
graphics.FillRectangle(brush, 0, 0, pImage.Width, pImage.Height);
|
||||
|
||||
BitmapData bitmapData = new BitmapData();
|
||||
|
||||
|
||||
pImage.LockBits(
|
||||
rect,
|
||||
ImageLockMode.ReadOnly,
|
||||
PixelFormat.Format32bppArgb,
|
||||
bitmapData);
|
||||
|
||||
unsafe
|
||||
{
|
||||
uint* pixels = (uint*)bitmapData.Scan0;
|
||||
|
||||
if (pixels == null)
|
||||
{
|
||||
pImage.UnlockBits(bitmapData);
|
||||
return;
|
||||
}
|
||||
|
||||
uint col = 0;
|
||||
int stride = bitmapData.Stride >> 2;
|
||||
for (uint row = 0; row < bitmapData.Height; ++row)
|
||||
{
|
||||
for (col = 0; col < bitmapData.Width; ++col)
|
||||
{
|
||||
uint index = (uint)(row * stride + col);
|
||||
uint color = pixels[index];
|
||||
Color gdiColor = Color.FromArgb((int)((color & 0xff0000) >> 16), (int)((color & 0xff00) >> 8), (int)(color & 0xff));
|
||||
list.Add(gdiColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
pImage.UnlockBits(bitmapData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected System.Drawing.Color m_clrText;
|
||||
protected System.Drawing.Color m_clrOutline1;
|
||||
protected System.Drawing.Color m_clrOutline2;
|
||||
protected int m_nThickness;
|
||||
protected System.Drawing.Brush m_brushText;
|
||||
protected bool m_bClrText;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
170
TextDesignerCSLibrary/TextNoOutlineStrategy.cs
Normal file
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class TextNoOutlineStrategy : ITextStrategy
|
||||
{
|
||||
public TextNoOutlineStrategy()
|
||||
{
|
||||
m_brushText = null;
|
||||
m_bClrText = true;
|
||||
disposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
~TextNoOutlineStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
TextNoOutlineStrategy p = new TextNoOutlineStrategy();
|
||||
if (m_bClrText)
|
||||
p.Init(m_clrText);
|
||||
else
|
||||
p.Init(m_brushText);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrText)
|
||||
{
|
||||
m_clrText = clrText;
|
||||
m_bClrText = true;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Brush brushText)
|
||||
{
|
||||
m_brushText = brushText;
|
||||
m_bClrText = false;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
return b;
|
||||
}
|
||||
}
|
||||
|
||||
protected System.Drawing.Color m_clrText;
|
||||
protected System.Drawing.Brush m_brushText;
|
||||
protected bool m_bClrText;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
188
TextDesignerCSLibrary/TextOnlyOutlineStrategy.cs
Normal file
@@ -0,0 +1,188 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class TextOnlyOutlineStrategy : ITextStrategy
|
||||
{
|
||||
public TextOnlyOutlineStrategy()
|
||||
{
|
||||
m_nThickness=2;
|
||||
m_bRoundedEdge = false;
|
||||
disposed = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
~TextOnlyOutlineStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
TextOnlyOutlineStrategy p = new TextOnlyOutlineStrategy();
|
||||
p.Init(m_clrOutline, m_nThickness, m_bRoundedEdge);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness,
|
||||
bool bRoundedEdge)
|
||||
{
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
m_bRoundedEdge = bRoundedEdge;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
using (Pen pen = new Pen(m_clrOutline, m_nThickness))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
using (Pen pen = new Pen(m_clrOutline, m_nThickness))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected System.Drawing.Color m_clrOutline;
|
||||
protected int m_nThickness;
|
||||
protected bool m_bClrText;
|
||||
protected bool m_bRoundedEdge;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
225
TextDesignerCSLibrary/TextOutlineStrategy.cs
Normal file
@@ -0,0 +1,225 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace TextDesignerCSLibrary
|
||||
{
|
||||
public class TextOutlineStrategy : ITextStrategy
|
||||
{
|
||||
public TextOutlineStrategy()
|
||||
{
|
||||
m_nThickness=2;
|
||||
m_brushText = null;
|
||||
m_bClrText = true;
|
||||
disposed = false;
|
||||
}
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!this.disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
~TextOutlineStrategy()
|
||||
{
|
||||
Dispose(false);
|
||||
}
|
||||
public ITextStrategy Clone()
|
||||
{
|
||||
TextOutlineStrategy p = new TextOutlineStrategy();
|
||||
if (m_bClrText)
|
||||
p.Init(m_clrText, m_clrOutline, m_nThickness);
|
||||
else
|
||||
p.Init(m_brushText, m_clrOutline, m_nThickness);
|
||||
|
||||
return (ITextStrategy)(p);
|
||||
}
|
||||
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Color clrText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness )
|
||||
{
|
||||
m_clrText = clrText;
|
||||
m_bClrText = true;
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
}
|
||||
|
||||
public void Init(
|
||||
System.Drawing.Brush brushText,
|
||||
System.Drawing.Color clrOutline,
|
||||
int nThickness)
|
||||
{
|
||||
m_brushText = brushText;
|
||||
m_bClrText = false;
|
||||
m_clrOutline = clrOutline;
|
||||
m_nThickness = nThickness;
|
||||
}
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
using (Pen pen = new Pen(m_clrOutline, m_nThickness))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool DrawString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
using (Pen pen = new Pen(m_clrOutline, m_nThickness))
|
||||
{
|
||||
pen.LineJoin = LineJoin.Round;
|
||||
graphics.DrawPath(pen, path);
|
||||
}
|
||||
|
||||
if (m_bClrText)
|
||||
{
|
||||
using (SolidBrush brush = new SolidBrush(m_clrText))
|
||||
{
|
||||
graphics.FillPath(brush, path);
|
||||
}
|
||||
}
|
||||
else
|
||||
graphics.FillPath(m_brushText, path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Point ptDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, ptDraw, strFormat);
|
||||
|
||||
fDestWidth = ptDraw.X;
|
||||
fDestHeight = ptDraw.Y;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool MeasureString(
|
||||
System.Drawing.Graphics graphics,
|
||||
System.Drawing.FontFamily fontFamily,
|
||||
System.Drawing.FontStyle fontStyle,
|
||||
int fontSize,
|
||||
string strText,
|
||||
System.Drawing.Rectangle rtDraw,
|
||||
System.Drawing.StringFormat strFormat,
|
||||
ref float fStartX,
|
||||
ref float fStartY,
|
||||
ref float fDestWidth,
|
||||
ref float fDestHeight)
|
||||
{
|
||||
using (GraphicsPath path = new GraphicsPath())
|
||||
{
|
||||
path.AddString(strText, fontFamily, (int)fontStyle, fontSize, rtDraw, strFormat);
|
||||
|
||||
fDestWidth = rtDraw.Width;
|
||||
fDestHeight = rtDraw.Height;
|
||||
bool b = GDIPath.MeasureGraphicsPath(graphics, path, ref fStartX, ref fStartY, ref fDestWidth, ref fDestHeight);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
float pixelThick = 0.0f;
|
||||
float pixelThick2 = 0.0f;
|
||||
float fStartX2 = 0.0f;
|
||||
float fStartY2 = 0.0f;
|
||||
b = GDIPath.ConvertToPixels(graphics, m_nThickness, 0.0f, ref fStartX2, ref fStartY2, ref pixelThick, ref pixelThick2);
|
||||
|
||||
if (false == b)
|
||||
return false;
|
||||
|
||||
fDestWidth += pixelThick;
|
||||
fDestHeight += pixelThick;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected System.Drawing.Color m_clrText;
|
||||
protected System.Drawing.Color m_clrOutline;
|
||||
protected int m_nThickness;
|
||||
protected System.Drawing.Brush m_brushText;
|
||||
protected bool m_bClrText;
|
||||
protected bool disposed;
|
||||
}
|
||||
}
|
||||
BIN
TextDesignerCSLibrary/bin/Debug/TextDesignerCSLibrary.dll
Normal file
BIN
TextDesignerCSLibrary/bin/Debug/TextDesignerCSLibrary.pdb
Normal file
BIN
TextDesignerCSLibrary/controlbar/back.png
Normal file
|
After Width: | Height: | Size: 81 B |
BIN
TextDesignerCSLibrary/controlbar/buffer.png
Normal file
|
After Width: | Height: | Size: 126 B |
BIN
TextDesignerCSLibrary/controlbar/cap.png
Normal file
|
After Width: | Height: | Size: 77 B |
BIN
TextDesignerCSLibrary/controlbar/divider.png
Normal file
|
After Width: | Height: | Size: 73 B |
BIN
TextDesignerCSLibrary/controlbar/fullscreen.png
Normal file
|
After Width: | Height: | Size: 120 B |
BIN
TextDesignerCSLibrary/controlbar/left.png
Normal file
|
After Width: | Height: | Size: 96 B |
BIN
TextDesignerCSLibrary/controlbar/mute.png
Normal file
|
After Width: | Height: | Size: 195 B |
BIN
TextDesignerCSLibrary/controlbar/normalscreen.png
Normal file
|
After Width: | Height: | Size: 127 B |
BIN
TextDesignerCSLibrary/controlbar/pause.png
Normal file
|
After Width: | Height: | Size: 88 B |
BIN
TextDesignerCSLibrary/controlbar/play.png
Normal file
|
After Width: | Height: | Size: 134 B |
BIN
TextDesignerCSLibrary/controlbar/progress.png
Normal file
|
After Width: | Height: | Size: 126 B |
BIN
TextDesignerCSLibrary/controlbar/rail.png
Normal file
|
After Width: | Height: | Size: 85 B |
BIN
TextDesignerCSLibrary/controlbar/right.png
Normal file
|
After Width: | Height: | Size: 98 B |
BIN
TextDesignerCSLibrary/controlbar/thumb.png
Normal file
|
After Width: | Height: | Size: 128 B |
BIN
TextDesignerCSLibrary/controlbar/unmute.png
Normal file
|
After Width: | Height: | Size: 129 B |
BIN
TextDesignerCSLibrary/display/back.png
Normal file
|
After Width: | Height: | Size: 142 B |
BIN
TextDesignerCSLibrary/display/buffer.png
Normal file
|
After Width: | Height: | Size: 575 B |
BIN
TextDesignerCSLibrary/display/error.png
Normal file
|
After Width: | Height: | Size: 312 B |
BIN
TextDesignerCSLibrary/display/mute.png
Normal file
|
After Width: | Height: | Size: 142 B |
BIN
TextDesignerCSLibrary/display/play.png
Normal file
|
After Width: | Height: | Size: 194 B |
BIN
TextDesignerCSLibrary/dock/button.png
Normal file
|
After Width: | Height: | Size: 142 B |
@@ -0,0 +1,4 @@
|
||||
D:\Calismalar\C#\TestOutlineText\TextDesignerCSLibrary\bin\Debug\TextDesignerCSLibrary.dll
|
||||
D:\Calismalar\C#\TestOutlineText\TextDesignerCSLibrary\bin\Debug\TextDesignerCSLibrary.pdb
|
||||
D:\Calismalar\C#\TestOutlineText\TextDesignerCSLibrary\obj\Debug\TextDesignerCSLibrary.dll
|
||||
D:\Calismalar\C#\TestOutlineText\TextDesignerCSLibrary\obj\Debug\TextDesignerCSLibrary.pdb
|
||||
BIN
TextDesignerCSLibrary/obj/Debug/TextDesignerCSLibrary.dll
Normal file
BIN
TextDesignerCSLibrary/obj/Debug/TextDesignerCSLibrary.pdb
Normal file
@@ -0,0 +1,4 @@
|
||||
D:\Calismalar\C#\TestOutlineText\TextDesignerCSLibrary\bin\Debug\TextDesignerCSLibrary.dll
|
||||
D:\Calismalar\C#\TestOutlineText\TextDesignerCSLibrary\bin\Debug\TextDesignerCSLibrary.pdb
|
||||
D:\Calismalar\C#\TestOutlineText\TextDesignerCSLibrary\obj\Debug\TextDesignerCSLibrary.dll
|
||||
D:\Calismalar\C#\TestOutlineText\TextDesignerCSLibrary\obj\Debug\TextDesignerCSLibrary.pdb
|
||||
85
hLCD/Form1.Designer.cs
generated
Normal file
@@ -0,0 +1,85 @@
|
||||
namespace hLCD
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
|
||||
this.tmrZaman = new System.Windows.Forms.Timer(this.components);
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tmrZaman
|
||||
//
|
||||
this.tmrZaman.Interval = 50;
|
||||
this.tmrZaman.Tick += new System.EventHandler(this.tmrZaman_Tick);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Trebuchet MS", 48F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
|
||||
this.label1.Location = new System.Drawing.Point(122, 127);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(59, 81);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "-";
|
||||
this.label1.Visible = false;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.BackgroundImage = global::hLCD.Properties.Resources.SunuBack;
|
||||
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.ClientSize = new System.Drawing.Size(1033, 651);
|
||||
this.Controls.Add(this.label1);
|
||||
this.DoubleBuffered = true;
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "Form1";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "hOLOlu Clinart International Hospital LCD";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Timer tmrZaman;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
|
||||
135
hLCD/Form1.cs
Normal file
@@ -0,0 +1,135 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.Drawing.Drawing2D;
|
||||
using Ini;
|
||||
|
||||
namespace hLCD
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
//string marqueeText = "Çok Uzun bir metin dir bu metin çün ki deneme amaçlı olarak yapılmış bir metindir.. 0 545 Ayrıca içerisinde birden çok rakam mevcuttur.";
|
||||
String Satir1, Satir2, Satir3, Satir4, Fontu;
|
||||
private int xpos = 0, ypos = 200, boyut=0,fonb=82,hiz=100,adim=5;
|
||||
public string mode = "<";
|
||||
StringFormat strf = new StringFormat();
|
||||
int sw = Screen.PrimaryScreen.WorkingArea.Width;
|
||||
//int sx = Screen.PrimaryScreen.GetType;
|
||||
|
||||
public Form1()
|
||||
{
|
||||
this.Left = sw;
|
||||
strf.Alignment = StringAlignment.Center;
|
||||
strf.LineAlignment = StringAlignment.Center;
|
||||
|
||||
IniFile ini = new IniFile( Application.StartupPath + "\\ayar.ini");
|
||||
|
||||
Satir1 = ini.IniReadValue("bilgiler","doktor");
|
||||
Satir2 = ini.IniReadValue("bilgiler", "hemsire");
|
||||
Satir3 = ini.IniReadValue("bilgiler", "memur");
|
||||
Satir4 = ini.IniReadValue("bilgiler", "eczane");
|
||||
|
||||
Fontu = ini.IniReadValue("ayarlar", "font");
|
||||
fonb = Convert.ToInt32(ini.IniReadValue("ayarlar", "boyut"));
|
||||
hiz = Convert.ToInt32(ini.IniReadValue("ayarlar", "hiz"));
|
||||
adim = Convert.ToInt32(ini.IniReadValue("ayarlar", "adim"));
|
||||
mode = ini.IniReadValue("ayarlar", "yon");
|
||||
InitializeComponent();
|
||||
tmrZaman.Enabled = false;
|
||||
tmrZaman.Interval = hiz;
|
||||
label1.Text = Satir4;
|
||||
boyut = label1.Width; //marqueeText.Length * fonb;
|
||||
xpos = this.Width;
|
||||
this.DoubleBuffered = true;
|
||||
if (Screen.AllScreens.Length <= 1)
|
||||
{
|
||||
MessageBox.Show("2. Ekran Saptanamadı Lütfen Ayarlarınız Kontrol Ediniz..!");
|
||||
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
tmrZaman.Enabled = true;
|
||||
}
|
||||
|
||||
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == 27)
|
||||
{
|
||||
Application.Exit();
|
||||
}
|
||||
|
||||
if (e.KeyChar == 32)
|
||||
{
|
||||
if (tmrZaman.Enabled) { tmrZaman.Enabled = false; } else { tmrZaman.Enabled = true; };
|
||||
}
|
||||
}
|
||||
|
||||
private void tmrZaman_Tick(object sender, EventArgs e)
|
||||
{
|
||||
//this.Refresh();
|
||||
|
||||
SolidBrush renk = new SolidBrush(Color.FromArgb(227, 19, 28));
|
||||
Graphics gra = this.CreateGraphics();
|
||||
//gra.Clear(Color.Transparent);
|
||||
//gra.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
|
||||
gra.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
|
||||
Rectangle kutu = new Rectangle(0, 150, this.Width, label1.Height+12);
|
||||
gra.DrawString("Nöbetçi Doktor : " + Satir1, new Font(Fontu, fonb, FontStyle.Bold), renk, kutu,strf);
|
||||
|
||||
kutu = new Rectangle(0, 360, this.Width, label1.Height + 12);
|
||||
gra.DrawString("Nöbetçi Hemşire : " + Satir2, new Font(Fontu, fonb, FontStyle.Bold), renk, kutu, strf);
|
||||
|
||||
kutu = new Rectangle(0, 560, this.Width, label1.Height + 12);
|
||||
gra.DrawString("Nöbetçi Memur : " + Satir3, new Font(Fontu, fonb, FontStyle.Bold), renk, kutu, strf);
|
||||
|
||||
//gra.DrawString("Nöbetçi Eczaneler : " + Satir4, new Font(Fontu, fonb, FontStyle.Bold), Brushes.White , xpos+5, ypos + 550);
|
||||
|
||||
gra.FillRectangle(Brushes.White , 0, ypos +550, this.Width, 140);
|
||||
//gra.DrawString("Nöbetçi Eczaneler : " + Satir4, new Font(Fontu, fonb, FontStyle.Bold), Brushes.White, xpos+adim, ypos + 550);
|
||||
gra.DrawString("Nöbetçi Eczaneler : " + Satir4, new Font(Fontu, fonb, FontStyle.Bold), renk, xpos, ypos + 550);
|
||||
|
||||
|
||||
if (mode == ">")
|
||||
{
|
||||
if (this.Width == xpos)
|
||||
{
|
||||
//this.label1.Location = new System.Drawing.Point(0, ypos);
|
||||
xpos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//this.label1.Location = new System.Drawing.Point(xpos, ypos);
|
||||
xpos += adim;
|
||||
}
|
||||
}
|
||||
|
||||
else if (mode == "<")
|
||||
{
|
||||
if (xpos <= boyut*-1)
|
||||
{
|
||||
//this.label1.Location = new System.Drawing.Point(this.Width, ypos);
|
||||
this.Refresh();
|
||||
xpos = this.Width;
|
||||
}
|
||||
else
|
||||
{
|
||||
//this.label1.Location = new System.Drawing.Point(xpos, ypos);
|
||||
xpos -= adim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Form1_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
2099
hLCD/Form1.resx
Normal file
21
hLCD/Program.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace hLCD
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
hLCD/Properties/AssemblyInfo.cs
Normal file
73
hLCD/Properties/Resources.Designer.cs
generated
Normal file
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace hLCD.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("hLCD.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap SunuBack {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("SunuBack", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
124
hLCD/Properties/Resources.resx
Normal file
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="SunuBack" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SunuBack.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
30
hLCD/Properties/Settings.Designer.cs
generated
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace hLCD.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
7
hLCD/Properties/Settings.settings
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
BIN
hLCD/Resources/SunuBack.jpg
Normal file
|
After Width: | Height: | Size: 219 KiB |
10
hLCD/ayar.ini
Normal file
@@ -0,0 +1,10 @@
|
||||
[ayarlar]
|
||||
hiz=10
|
||||
font=Trebuchet MS
|
||||
boyut=48
|
||||
|
||||
[bilgiler]
|
||||
doktor=OSMAN BULUT
|
||||
hemsire=SELMA KIDIK
|
||||
memur=CELAL MISIR
|
||||
eczane=GÜL ECZANESİ 228 89 89 İNÖNÜ CAD. NO:93/C , SERA ECZANESİ-YILDIZLI BELDESİ 248 84 80 MERKEZ MAH. SAHİL YOLU CAD.NO:52/1 YILDIZLI BELDESİ
|
||||
BIN
hLCD/bin/Debug/SunuBack.jpg
Normal file
|
After Width: | Height: | Size: 219 KiB |
12
hLCD/bin/Debug/ayar.ini
Normal file
@@ -0,0 +1,12 @@
|
||||
[ayarlar]
|
||||
hiz=100
|
||||
font=Trebuchet MS
|
||||
boyut=82
|
||||
adim=7
|
||||
yon=<
|
||||
|
||||
[bilgiler]
|
||||
doktor=OSMAN BULUT
|
||||
hemsire=SELMA KIDIK
|
||||
memur=CELAL MISIR
|
||||
eczane=TUĞBA ECZANESİ-YILDIZLI BELDESİ 4622482025 DEĞİRMEN SOK. NO:4 YILDIZLI BELDESİ, MERKEZ ECZANESİ 4622283419 İNÖNÜ CAD. KASAP SOKAK NO:5/A
|
||||
BIN
hLCD/bin/Debug/hLCD.exe
Normal file
BIN
hLCD/bin/Debug/hLCD.pdb
Normal file
BIN
hLCD/bin/Debug/hLCD.vshost.exe
Normal file
11
hLCD/bin/Debug/hLCD.vshost.exe.manifest
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
BIN
hLCD/bin/Debug/logo_180.ico
Normal file
12
hLCD/bin/Release/ayar.ini
Normal file
@@ -0,0 +1,12 @@
|
||||
[ayarlar]
|
||||
hiz=80
|
||||
font=Trebuchet MS
|
||||
boyut=84
|
||||
adim=8
|
||||
yon=<
|
||||
|
||||
[bilgiler]
|
||||
doktor=OSMAN BULUT
|
||||
hemsire=SELMA KIDIK
|
||||
memur=CELAL MISIR
|
||||
eczane=TUĞBA ECZANESİ-YILDIZLI BELDESİ 4622482025 DEĞİRMEN SOK. NO:4 YILDIZLI BELDESİ, MERKEZ ECZANESİ 4622283419 İNÖNÜ CAD. KASAP SOKAK NO:5/A
|
||||
BIN
hLCD/bin/Release/hLCD.exe
Normal file
BIN
hLCD/bin/Release/hLCD.pdb
Normal file
138
hLCD/hLCD.csproj
Normal file
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{21F747ED-D056-4C77-A4AE-89A81762A850}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>hLCD</RootNamespace>
|
||||
<AssemblyName>hLCD</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>hLCD.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ini.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\SunuBack.jpg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="logo.ico" />
|
||||
<Content Include="logo_180.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
13
hLCD/hLCD.csproj.user
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory>publish\</PublishUrlHistory>
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
BIN
hLCD/hLCD.suo
Normal file
BIN
hLCD/hLCD.v12.suo
Normal file
57
hLCD/ini.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Ini
|
||||
{
|
||||
public class IniFile
|
||||
{
|
||||
public string path;
|
||||
|
||||
[DllImport("kernel32")]
|
||||
private static extern long WritePrivateProfileString(string section,
|
||||
string key, string val, string filePath);
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileString(string section,
|
||||
string key, string def, StringBuilder retVal,
|
||||
int size, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// INIFile Constructor.
|
||||
/// </summary>
|
||||
/// <PARAM name="INIPath"></PARAM>
|
||||
public IniFile(string INIPath)
|
||||
{
|
||||
path = INIPath;
|
||||
}
|
||||
/// <summary>
|
||||
/// Write Data to the INI File
|
||||
/// </summary>
|
||||
/// <PARAM name="Section"></PARAM>
|
||||
/// Section name
|
||||
/// <PARAM name="Key"></PARAM>
|
||||
/// Key Name
|
||||
/// <PARAM name="Value"></PARAM>
|
||||
/// Value Name
|
||||
public void IniWriteValue(string Section, string Key, string Value)
|
||||
{
|
||||
WritePrivateProfileString(Section, Key, Value, this.path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read Data Value From the Ini File
|
||||
/// </summary>
|
||||
/// <PARAM name="Section"></PARAM>
|
||||
/// <PARAM name="Key"></PARAM>
|
||||
/// <PARAM name="Path"></PARAM>
|
||||
/// <returns></returns>
|
||||
public string IniReadValue(string Section, string Key)
|
||||
{
|
||||
StringBuilder temp = new StringBuilder(255);
|
||||
int i = GetPrivateProfileString(Section, Key, "", temp,
|
||||
255, this.path);
|
||||
return temp.ToString();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
hLCD/logo.ico
Normal file
|
After Width: | Height: | Size: 115 KiB |
BIN
hLCD/logo_180.ico
Normal file
|
After Width: | Height: | Size: 97 KiB |
BIN
hLCD/obj/x86/Debug/DesignTimeResolveAssemblyReferences.cache
Normal file
BIN
hLCD/obj/x86/Debug/TempPE/Properties.Resources.Designer.cs.dll
Normal file
BIN
hLCD/obj/x86/Debug/hLCD.Form1.resources
Normal file
BIN
hLCD/obj/x86/Debug/hLCD.Properties.Resources.resources
Normal file
23
hLCD/obj/x86/Debug/hLCD.csproj.FileListAbsolute.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
C:\Users\hOLOlu\AppData\Local\Temporary Projects\hLCD\bin\Debug\hLCD.exe
|
||||
C:\Users\hOLOlu\AppData\Local\Temporary Projects\hLCD\bin\Debug\hLCD.pdb
|
||||
C:\Users\hOLOlu\AppData\Local\Temporary Projects\hLCD\obj\x86\Debug\hLCD.Form1.resources
|
||||
C:\Users\hOLOlu\AppData\Local\Temporary Projects\hLCD\obj\x86\Debug\hLCD.Properties.Resources.resources
|
||||
C:\Users\hOLOlu\AppData\Local\Temporary Projects\hLCD\obj\x86\Debug\hLCD.csproj.GenerateResource.Cache
|
||||
C:\Users\hOLOlu\AppData\Local\Temporary Projects\hLCD\obj\x86\Debug\hLCD.exe
|
||||
C:\Users\hOLOlu\AppData\Local\Temporary Projects\hLCD\obj\x86\Debug\hLCD.pdb
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.exe
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.pdb
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\bin\Debug\hLCD.exe
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\bin\Debug\hLCD.pdb
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.Form1.resources
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.Properties.Resources.resources
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.csproj.GenerateResource.Cache
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.csprojResolveAssemblyReference.cache
|
||||
D:\Belgelerim\Visual Studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.exe
|
||||
D:\Belgelerim\Visual Studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.pdb
|
||||
D:\Belgelerim\Visual Studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.csprojResolveAssemblyReference.cache
|
||||
D:\Belgelerim\Visual Studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.Form1.resources
|
||||
D:\Belgelerim\Visual Studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.Properties.Resources.resources
|
||||
D:\Belgelerim\Visual Studio 2010\Projects\hLCD\hLCD\obj\x86\Debug\hLCD.csproj.GenerateResource.Cache
|
||||
D:\Belgelerim\Visual Studio 2010\Projects\hLCD\hLCD\bin\Debug\hLCD.exe
|
||||
D:\Belgelerim\Visual Studio 2010\Projects\hLCD\hLCD\bin\Debug\hLCD.pdb
|
||||
BIN
hLCD/obj/x86/Debug/hLCD.csproj.GenerateResource.Cache
Normal file
BIN
hLCD/obj/x86/Debug/hLCD.csprojResolveAssemblyReference.cache
Normal file
BIN
hLCD/obj/x86/Debug/hLCD.exe
Normal file
BIN
hLCD/obj/x86/Debug/hLCD.pdb
Normal file
BIN
hLCD/obj/x86/Release/DesignTimeResolveAssemblyReferences.cache
Normal file
118
hLCD/obj/x86/Release/TempPE/Properties.Resources.Designer.cs.dll
Normal file
@@ -0,0 +1,118 @@
|
||||
# Copyright (C) 2011-2014 Canonical Ltd.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it under
|
||||
# the terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; version 3.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
# details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
# py3 compat
|
||||
try:
|
||||
from configparser import SafeConfigParser
|
||||
SafeConfigParser # pyflakes
|
||||
except ImportError:
|
||||
from ConfigParser import SafeConfigParser
|
||||
import os
|
||||
import logging
|
||||
|
||||
from paths import SOFTWARE_CENTER_CONFIG_FILE
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SoftwareCenterConfig(SafeConfigParser, object):
|
||||
|
||||
SECTIONS = ("general", "reviews")
|
||||
|
||||
def __init__(self, config):
|
||||
super(SoftwareCenterConfig, self).__init__()
|
||||
# imported here to avoid cycle
|
||||
from utils import safe_makedirs
|
||||
safe_makedirs(os.path.dirname(config))
|
||||
# we always want this sections, even on fresh installs
|
||||
for section in self.SECTIONS:
|
||||
self.add_section(section)
|
||||
|
||||
# read the config
|
||||
self.configfile = config
|
||||
try:
|
||||
self.read(self.configfile)
|
||||
except Exception as e:
|
||||
# don't crash on a corrupted config file
|
||||
LOG.warn("Could not read the config file '%s': %s",
|
||||
self.configfile, e)
|
||||
pass
|
||||
|
||||
def write(self):
|
||||
tmpname = self.configfile + ".new"
|
||||
# see LP: #996333, its ok to remove the old configfile as
|
||||
# its rewritten anyway
|
||||
from utils import ensure_file_writable_and_delete_if_not
|
||||
ensure_file_writable_and_delete_if_not(tmpname)
|
||||
ensure_file_writable_and_delete_if_not(self.configfile)
|
||||
try:
|
||||
f = open(tmpname, "w")
|
||||
SafeConfigParser.write(self, f)
|
||||
f.close()
|
||||
os.rename(tmpname, self.configfile)
|
||||
except Exception as e:
|
||||
# don't crash if there's an error when writing to the config file
|
||||
# (LP: #996333)
|
||||
LOG.warn("Could not write the config file '%s': %s",
|
||||
self.configfile, e)
|
||||
pass
|
||||
|
||||
# generic property helpers
|
||||
def _generic_get(self, option, section="general", default=""):
|
||||
if not self.has_option(section, option):
|
||||
self.set(section, option, default)
|
||||
return self.get(section, option)
|
||||
|
||||
def _generic_set(self, option, value, section="general"):
|
||||
self.set(section, option, value)
|
||||
|
||||
def _generic_getbool(self, option, section="general", default=False):
|
||||
if not self.has_option(section, option):
|
||||
self.set(section, option, str(default))
|
||||
return self.getboolean(section, option)
|
||||
|
||||
def _generic_setbool(self, option, value, section="general"):
|
||||
if value:
|
||||
self.set(section, option, "True")
|
||||
else:
|
||||
self.set(section, option, "False")
|
||||
|
||||
# our properties that will automatically sync with the configfile
|
||||
add_to_unity_launcher = property(
|
||||
lambda self: self._generic_getbool("add_to_launcher", default=True),
|
||||
lambda self, value: self._generic_setbool("add_to_launcher", value),
|
||||
None,
|
||||
"Defines if apps should get added to the unity launcher")
|
||||
app_window_maximized = property(
|
||||
lambda self: self._generic_getbool("maximized", default=False),
|
||||
lambda self, value: self._generic_setbool("maximized", value),
|
||||
None,
|
||||
"Defines if apps should be started maximized")
|
||||
recommender_uuid = property(
|
||||
# remove any dashes for the case where a user has opted in before
|
||||
# we required UUIDs without dashes
|
||||
lambda self: self._generic_get("recommender_uuid").replace("-", ""),
|
||||
lambda self, value: self._generic_set("recommender_uuid",
|
||||
value),
|
||||
None,
|
||||
"The UUID generated for the recommendations")
|
||||
recommender_profile_id = property(
|
||||
lambda self: self._generic_get("recommender_profile_id"),
|
||||
lambda self, value: self._generic_set("recommender_profile_id", value),
|
||||
None,
|
||||
"The recommendation profile id of the user")
|
||||
recommender_opt_in_requested = property(
|
||||
lambda self: self._generic_getbool(
|
||||
"reco
|
||||
BIN
hLCD/obj/x86/Release/hLCD.Form1.resources
Normal file
BIN
hLCD/obj/x86/Release/hLCD.Properties.Resources.resources
Normal file
7
hLCD/obj/x86/Release/hLCD.csproj.FileListAbsolute.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\bin\Release\hLCD.exe
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\bin\Release\hLCD.pdb
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Release\hLCD.Form1.resources
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Release\hLCD.Properties.Resources.resources
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Release\hLCD.csproj.GenerateResource.Cache
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Release\hLCD.exe
|
||||
C:\Users\hOLOlu\documents\visual studio 2010\Projects\hLCD\hLCD\obj\x86\Release\hLCD.pdb
|
||||