本文整理汇总了C#中BaseColor类的典型用法代码示例。如果您正苦于以下问题:C# BaseColor类的具体用法?C# BaseColor怎么用?C# BaseColor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseColor类属于命名空间,在下文中一共展示了BaseColor类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: LineSeparator
/**
* Creates a new instance of the LineSeparator class.
* @param lineWidth the thickness of the line
* @param percentage the width of the line as a percentage of the available page width
* @param color the color of the line
* @param align the alignment
* @param offset the offset of the line relative to the current baseline (negative = under the baseline)
*/
public LineSeparator(float lineWidth, float percentage, BaseColor lineColor, int align, float offset) {
this.lineWidth = lineWidth;
this.percentage = percentage;
this.lineColor = lineColor;
this.alignment = align;
this.offset = offset;
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:15,代码来源:LineSeparator.cs
示例2: PlaceBarcode
/** Places the barcode in a <CODE>PdfContentByte</CODE>. The
* barcode is always placed at coodinates (0, 0). Use the
* translation matrix to move it elsewhere.<p>
* The bars and text are written in the following colors:<p>
* <P><TABLE BORDER=1>
* <TR>
* <TH><P><CODE>barColor</CODE></TH>
* <TH><P><CODE>textColor</CODE></TH>
* <TH><P>Result</TH>
* </TR>
* <TR>
* <TD><P><CODE>null</CODE></TD>
* <TD><P><CODE>null</CODE></TD>
* <TD><P>bars and text painted with current fill color</TD>
* </TR>
* <TR>
* <TD><P><CODE>barColor</CODE></TD>
* <TD><P><CODE>null</CODE></TD>
* <TD><P>bars and text painted with <CODE>barColor</CODE></TD>
* </TR>
* <TR>
* <TD><P><CODE>null</CODE></TD>
* <TD><P><CODE>textColor</CODE></TD>
* <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD>
* </TR>
* <TR>
* <TD><P><CODE>barColor</CODE></TD>
* <TD><P><CODE>textColor</CODE></TD>
* <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD>
* </TR>
* </TABLE>
* @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed
* @param barColor the color of the bars. It can be <CODE>null</CODE>
* @param textColor the color of the text. It can be <CODE>null</CODE>
* @return the dimensions the barcode occupies
*/
public override Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor) {
if (supp.Font != null)
supp.BarHeight = ean.BarHeight + supp.Baseline - supp.Font.GetFontDescriptor(BaseFont.CAPHEIGHT, supp.Size);
else
supp.BarHeight = ean.BarHeight;
Rectangle eanR = ean.BarcodeSize;
cb.SaveState();
ean.PlaceBarcode(cb, barColor, textColor);
cb.RestoreState();
cb.SaveState();
cb.ConcatCTM(1, 0, 0, 1, eanR.Width + n, eanR.Height - ean.BarHeight);
supp.PlaceBarcode(cb, barColor, textColor);
cb.RestoreState();
return this.BarcodeSize;
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:51,代码来源:BarcodeEANSUPP.cs
示例3: UncoloredPattern
protected internal UncoloredPattern(PdfPatternPainter p, BaseColor color, float tint) : base(p) {
this.color = color;
this.tint = tint;
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:4,代码来源:PdfContentByte.cs
示例4: SaveColor
private void SaveColor(BaseColor color, bool fill) {
if (IsTagged()) {
if (inText) {
if (fill) {
state.textColorFill = color;
} else {
state.textColorStroke = color;
}
} else {
if (fill) {
state.colorFill = color;
} else {
state.colorStroke = color;
}
}
}
else {
if (fill) {
state.colorFill = color;
}
else {
state.colorStroke = color;
}
}
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:25,代码来源:PdfContentByte.cs
示例5: SetPatternStroke
/** Sets the stroke color to an uncolored pattern.
* @param p the pattern
* @param color the color of the pattern
*/
public virtual void SetPatternStroke(PdfPatternPainter p, BaseColor color) {
if (ExtendedColor.GetType(color) == ExtendedColor.TYPE_SEPARATION)
SetPatternStroke(p, color, ((SpotColor)color).Tint);
else
SetPatternStroke(p, color, 0);
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:10,代码来源:PdfContentByte.cs
示例6: SetColorStroke
/** Sets the stroke color. <CODE>color</CODE> can be an
* <CODE>ExtendedColor</CODE>.
* @param color the color
*/
public virtual void SetColorStroke(BaseColor value) {
int type = ExtendedColor.GetType(value);
switch (type) {
case ExtendedColor.TYPE_GRAY: {
SetGrayStroke(((GrayColor)value).Gray);
break;
}
case ExtendedColor.TYPE_CMYK: {
CMYKColor cmyk = (CMYKColor)value;
SetCMYKColorStrokeF(cmyk.Cyan, cmyk.Magenta, cmyk.Yellow, cmyk.Black);
break;
}
case ExtendedColor.TYPE_SEPARATION: {
SpotColor spot = (SpotColor)value;
SetColorStroke(spot.PdfSpotColor, spot.Tint);
break;
}
case ExtendedColor.TYPE_PATTERN: {
PatternColor pat = (PatternColor)value;
SetPatternStroke(pat.Painter);
break;
}
case ExtendedColor.TYPE_SHADING: {
ShadingColor shading = (ShadingColor)value;
SetShadingStroke(shading.PdfShadingPattern);
break;
}
case ExtendedColor.TYPE_DEVICEN: {
DeviceNColor devicen = (DeviceNColor) value;
SetColorStroke(devicen.PdfDeviceNColor, devicen.Tints);
break;
}
case ExtendedColor.TYPE_LAB: {
LabColor lab = (LabColor) value;
SetColorStroke(lab.LabColorSpace, lab.L, lab.A, lab.B);
break;
}
default:
SetRGBColorStroke(value.R, value.G, value.B);
break;
}
}
开发者ID:jagruti23,项目名称:itextsharp,代码行数:46,代码来源:PdfContentByte.cs
示例7: PlaceBarcode
/** Places the barcode in a <CODE>PdfContentByte</CODE>. The
* barcode is always placed at coodinates (0, 0). Use the
* translation matrix to move it elsewhere.<p>
* The bars and text are written in the following colors:<p>
* <P><TABLE BORDER=1>
* <TR>
* <TH><P><CODE>barColor</CODE></TH>
* <TH><P><CODE>textColor</CODE></TH>
* <TH><P>Result</TH>
* </TR>
* <TR>
* <TD><P><CODE>null</CODE></TD>
* <TD><P><CODE>null</CODE></TD>
* <TD><P>bars and text painted with current fill color</TD>
* </TR>
* <TR>
* <TD><P><CODE>barColor</CODE></TD>
* <TD><P><CODE>null</CODE></TD>
* <TD><P>bars and text painted with <CODE>barColor</CODE></TD>
* </TR>
* <TR>
* <TD><P><CODE>null</CODE></TD>
* <TD><P><CODE>textColor</CODE></TD>
* <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD>
* </TR>
* <TR>
* <TD><P><CODE>barColor</CODE></TD>
* <TD><P><CODE>textColor</CODE></TD>
* <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD>
* </TR>
* </TABLE>
* @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed
* @param barColor the color of the bars. It can be <CODE>null</CODE>
* @param textColor the color of the text. It can be <CODE>null</CODE>
* @return the dimensions the barcode occupies
*/
public override Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor) {
if (barColor != null)
cb.SetColorFill(barColor);
byte[] bars = GetBarsPostnet(code);
byte flip = 1;
if (codeType == PLANET) {
flip = 0;
bars[0] = 0;
bars[bars.Length - 1] = 0;
}
float startX = 0;
for (int k = 0; k < bars.Length; ++k) {
cb.Rectangle(startX, 0, x - inkSpreading, bars[k] == flip ? barHeight : size);
startX += n;
}
cb.Fill();
return this.BarcodeSize;
}
开发者ID:smartleos,项目名称:itextsharp,代码行数:54,代码来源:BarcodePostnet.cs
示例8: PlaceBarcode
public virtual void PlaceBarcode(PdfContentByte cb, BaseColor foreground, float moduleHeight, float moduleWidth) {
PaintCode();
int stride = (bitColumns + 7)/8;
cb.SetColorFill(foreground);
for (int k = 0; k < codeRows; ++k) {
int p = k*stride;
for (int j = 0; j < bitColumns; ++j) {
int b = outBits[p + j/8] & 0xff;
b <<= j%8;
if ((b & 0x80) != 0) {
cb.Rectangle(j*moduleWidth, (codeRows - k - 1)*moduleHeight, moduleWidth, moduleHeight);
}
}
}
cb.Fill();
}
开发者ID:joshaxey,项目名称:Simple-PDFMerge,代码行数:16,代码来源:BarcodePDF417.cs
示例9: SetColorFill
/** Sets the fill color. <CODE>color</CODE> can be an
* <CODE>ExtendedColor</CODE>.
* @param color the color
*/
public virtual void SetColorFill(BaseColor value) {
int type = ExtendedColor.GetType(value);
switch (type) {
case ExtendedColor.TYPE_GRAY: {
SetGrayFill(((GrayColor)value).Gray);
break;
}
case ExtendedColor.TYPE_CMYK: {
CMYKColor cmyk = (CMYKColor)value;
SetCMYKColorFillF(cmyk.Cyan, cmyk.Magenta, cmyk.Yellow, cmyk.Black);
break;
}
case ExtendedColor.TYPE_SEPARATION: {
SpotColor spot = (SpotColor)value;
SetColorFill(spot.PdfSpotColor, spot.Tint);
break;
}
case ExtendedColor.TYPE_PATTERN: {
PatternColor pat = (PatternColor)value;
SetPatternFill(pat.Painter);
break;
}
case ExtendedColor.TYPE_SHADING: {
ShadingColor shading = (ShadingColor)value;
SetShadingFill(shading.PdfShadingPattern);
break;
}
default:
SetRGBColorFill(value.R, value.G, value.B);
break;
}
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:36,代码来源:PdfContentByte.cs
示例10: OutputColorNumbers
/** Outputs the color values to the content.
* @param color The color
* @param tint the tint if it is a spot color, ignored otherwise
*/
internal void OutputColorNumbers(BaseColor color, float tint) {
PdfWriter.CheckPdfIsoConformance(writer, PdfIsoKeys.PDFISOKEY_COLOR, color);
int type = ExtendedColor.GetType(color);
switch (type) {
case ExtendedColor.TYPE_RGB:
content.Append((float)(color.R) / 0xFF);
content.Append(' ');
content.Append((float)(color.G) / 0xFF);
content.Append(' ');
content.Append((float)(color.B) / 0xFF);
break;
case ExtendedColor.TYPE_GRAY:
content.Append(((GrayColor)color).Gray);
break;
case ExtendedColor.TYPE_CMYK: {
CMYKColor cmyk = (CMYKColor)color;
content.Append(cmyk.Cyan).Append(' ').Append(cmyk.Magenta);
content.Append(' ').Append(cmyk.Yellow).Append(' ').Append(cmyk.Black);
break;
}
case ExtendedColor.TYPE_SEPARATION:
content.Append(tint);
break;
default:
throw new Exception(MessageLocalization.GetComposedMessage("invalid.color.type"));
}
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:31,代码来源:PdfContentByte.cs
示例11: PlaceBarcode
virtual public void PlaceBarcode(PdfContentByte cb, BaseColor foreground, float moduleHeight, float moduleWidth) {
int w = width + 2*ws;
int h = height + 2*ws;
int stride = (w + 7)/8;
int ptr = 0;
cb.SetColorFill(foreground);
for (int k = 0; k < h; ++k) {
int p = k*stride;
for (int j = 0; j < w; ++j) {
int b = image[p + j/8] & 0xff;
b <<= j%8;
if ((b & 0x80) != 0) {
cb.Rectangle(j*moduleWidth, (h - k - 1)*moduleHeight, moduleWidth, moduleHeight);
}
}
}
cb.Fill();
}
开发者ID:joshaxey,项目名称:Simple-PDFMerge,代码行数:18,代码来源:BarcodeDatamatrix.cs
示例12: RestoreColor
private void RestoreColor(BaseColor color, bool fill) {
if (IsTagged()) {
if (color is UncoloredPattern) {
UncoloredPattern c = (UncoloredPattern)color;
if (fill)
SetPatternFill(c.Painter, c.color, c.tint);
else
SetPatternStroke(c.Painter, c.color, c.tint);
} else {
if (fill)
SetColorFill(color);
else
SetColorStroke(color);
}
}
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:16,代码来源:PdfContentByte.cs
示例13: CompareColors
private bool CompareColors(BaseColor c1, BaseColor c2) {
if (c1 == null && c2 == null)
return true;
if (c1 == null || c2 == null)
return false;
if (c1 is ExtendedColor)
return c1.Equals(c2);
return c2.Equals(c1);
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:9,代码来源:PdfContentByte.cs
示例14: PlaceBarcode
/** Places the barcode in a <CODE>PdfContentByte</CODE>. The
* barcode is always placed at coodinates (0, 0). Use the
* translation matrix to move it elsewhere.<p>
* The bars and text are written in the following colors:<p>
* <P><TABLE BORDER=1>
* <TR>
* <TH><P><CODE>barColor</CODE></TH>
* <TH><P><CODE>textColor</CODE></TH>
* <TH><P>Result</TH>
* </TR>
* <TR>
* <TD><P><CODE>null</CODE></TD>
* <TD><P><CODE>null</CODE></TD>
* <TD><P>bars and text painted with current fill color</TD>
* </TR>
* <TR>
* <TD><P><CODE>barColor</CODE></TD>
* <TD><P><CODE>null</CODE></TD>
* <TD><P>bars and text painted with <CODE>barColor</CODE></TD>
* </TR>
* <TR>
* <TD><P><CODE>null</CODE></TD>
* <TD><P><CODE>textColor</CODE></TD>
* <TD><P>bars painted with current color<br>text painted with <CODE>textColor</CODE></TD>
* </TR>
* <TR>
* <TD><P><CODE>barColor</CODE></TD>
* <TD><P><CODE>textColor</CODE></TD>
* <TD><P>bars painted with <CODE>barColor</CODE><br>text painted with <CODE>textColor</CODE></TD>
* </TR>
* </TABLE>
* @param cb the <CODE>PdfContentByte</CODE> where the barcode will be placed
* @param barColor the color of the bars. It can be <CODE>null</CODE>
* @param textColor the color of the text. It can be <CODE>null</CODE>
* @return the dimensions the barcode occupies
*/
public override Rectangle PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor) {
string fullCode;
if (codeType == CODE128_RAW) {
int idx = code.IndexOf('\uffff');
if (idx < 0)
fullCode = "";
else
fullCode = code.Substring(idx + 1);
}
else if (codeType == CODE128_UCC)
fullCode = GetHumanReadableUCCEAN(code);
else
fullCode = RemoveFNC1(code);
float fontX = 0;
if (font != null) {
fontX = font.GetWidthPoint(fullCode = altText != null ? altText : fullCode, size);
}
string bCode;
if (codeType == CODE128_RAW) {
int idx = code.IndexOf('\uffff');
if (idx >= 0)
bCode = code.Substring(0, idx);
else
bCode = code;
}
else {
bCode = GetRawText(code, codeType == CODE128_UCC);
}
int len = bCode.Length;
float fullWidth = (len + 2) * 11 * x + 2 * x;
float barStartX = 0;
float textStartX = 0;
switch (textAlignment) {
case Element.ALIGN_LEFT:
break;
case Element.ALIGN_RIGHT:
if (fontX > fullWidth)
barStartX = fontX - fullWidth;
else
textStartX = fullWidth - fontX;
break;
default:
if (fontX > fullWidth)
barStartX = (fontX - fullWidth) / 2;
else
textStartX = (fullWidth - fontX) / 2;
break;
}
float barStartY = 0;
float textStartY = 0;
if (font != null) {
if (baseline <= 0)
textStartY = barHeight - baseline;
else {
textStartY = -font.GetFontDescriptor(BaseFont.DESCENT, size);
barStartY = textStartY + baseline;
}
}
byte[] bars = GetBarsCode128Raw(bCode);
bool print = true;
if (barColor != null)
cb.SetColorFill(barColor);
for (int k = 0; k < bars.Length; ++k) {
float w = bars[k] * x;
//.........这里部分代码省略.........
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:101,代码来源:Barcode128.cs
示例15: Encode
/**
* Converts a <CODE>BaseColor</CODE> into a HTML representation of this <CODE>BaseColor</CODE>.
*
* @param color the <CODE>BaseColor</CODE> that has to be converted.
* @return the HTML representation of this <COLOR>BaseColor</COLOR>
*/
public static String Encode(BaseColor color) {
StringBuilder buffer = new StringBuilder("#");
if (color.R < 16) {
buffer.Append('0');
}
buffer.Append(System.Convert.ToString(color.R, 16));
if (color.G < 16) {
buffer.Append('0');
}
buffer.Append(System.Convert.ToString(color.G, 16));
if (color.B < 16) {
buffer.Append('0');
}
buffer.Append(System.Convert.ToString(color.B, 16));
return buffer.ToString();
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:23,代码来源:HtmlEncoder.cs
示例16: CreatePattern
/**
* Create a new uncolored tiling pattern.
*
* @param width the width of the pattern
* @param height the height of the pattern
* @param xstep the desired horizontal spacing between pattern cells.
* May be either positive or negative, but not zero.
* @param ystep the desired vertical spacing between pattern cells.
* May be either positive or negative, but not zero.
* @param color the default color. Can be <CODE>null</CODE>
* @return the <CODE>PdfPatternPainter</CODE> where the pattern will be created
*/
public PdfPatternPainter CreatePattern(float width, float height, float xstep, float ystep, BaseColor color) {
CheckWriter();
if ( xstep == 0.0f || ystep == 0.0f )
throw new Exception(MessageLocalization.GetComposedMessage("xstep.or.ystep.can.not.be.zero"));
PdfPatternPainter painter = new PdfPatternPainter(writer, color);
painter.Width = width;
painter.Height = height;
painter.XStep = xstep;
painter.YStep = ystep;
writer.AddSimplePattern(painter);
return painter;
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:24,代码来源:PdfContentByte.cs
示例17: Init
virtual public void Init(InputMeta meta) {
style = meta.ReadWord();
penWidth = meta.ReadShort();
meta.ReadWord();
color = meta.ReadColor();
}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:6,代码来源:MetaPen.cs
示例18: CopyParameters
internal void CopyParameters(GraphicState cp) {
fontDetails = cp.fontDetails;
colorDetails = cp.colorDetails;
size = cp.size;
xTLM = cp.xTLM;
yTLM = cp.yTLM;
aTLM = cp.aTLM;
bTLM = cp.bTLM;
cTLM = cp.cTLM;
dTLM = cp.dTLM;
tx = cp.tx;
leading = cp.leading;
scale = cp.scale;
charSpace = cp.charSpace;
wordSpace = cp.wordSpace;
textColorFill = cp.textColorFill;
colorFill = cp.colorFill;
textColorStroke = cp.textColorStroke;
colorStroke = cp.colorStroke;
CTM = (AffineTransform)cp.CTM.Clone();
textRenderMode = cp.textRenderMode;
extGState = cp.extGState;
}
开发者ID:NelsonSantos,项目名称:fyiReporting-Android,代码行数:23,代码来源:PdfContentByte.cs
注:本文中的BaseColor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论