version 1.169, 2003/01/09 09:49:56
|
version 1.170, 2003/01/13 09:50:43
|
Line 392 char *ParseNumber (char *cssRule, Presen
|
Line 392 char *ParseNumber (char *cssRule, Presen
|
char *ParseClampedUnit (char *text, |
char *ParseClampedUnit (char *text, |
PresentationValue *pval) |
PresentationValue *pval) |
{ |
{ |
float opacity; |
float clamped_value; |
int intopacity; |
int int_clamped_value; |
|
|
if (*(text + strlen (text) -1) == '%') |
if (*(text + strlen (text) -1) == '%') |
{ |
{ |
intopacity = atoi (text); |
int_clamped_value = atoi (text); |
if (intopacity < 0 || |
if (int_clamped_value < 0 || |
intopacity > 100) |
int_clamped_value > 100) |
intopacity = 1000; |
int_clamped_value = 1000; |
else |
else |
intopacity = intopacity * 10; |
int_clamped_value = int_clamped_value * 10; |
} |
} |
else |
else |
{ |
{ |
opacity = (float) atof (text); |
clamped_value = (float) atof (text); |
if (opacity < 0.0 |
if (clamped_value < 0.0 |
|| opacity > 1.0) |
|| clamped_value > 1.0) |
intopacity = 1000; |
int_clamped_value = 1000; |
else |
else |
intopacity = (int) (opacity * 1000); |
int_clamped_value = (int) (clamped_value * 1000); |
} |
} |
pval->typed_data.unit = STYLE_UNIT_REL; |
pval->typed_data.unit = STYLE_UNIT_REL; |
pval->typed_data.value = intopacity; |
pval->typed_data.value = int_clamped_value; |
pval->typed_data.real = FALSE; |
pval->typed_data.real = 0; |
pval->data = intopacity; |
pval->data = int_clamped_value; |
return (SkipWord (text)); |
return (SkipWord (text)); |
} |
} |
|
|
Line 2870 static char *ParseSVGOpacity (Element el
|
Line 2870 static char *ParseSVGOpacity (Element el
|
} |
} |
return (cssRule); |
return (cssRule); |
} |
} |
|
/*---------------------------------------------------------------------- |
|
ParseSVGOpacity: parse a SVG fill property |
|
----------------------------------------------------------------------*/ |
|
static char *ParseSVGStrokeOpacity (Element element, PSchema tsch, |
|
PresentationContext context, char *cssRule, |
|
CSSInfoPtr css, ThotBool isHTML) |
|
{ |
|
PresentationValue best; |
|
|
|
best.typed_data.unit = STYLE_UNIT_INVALID; |
|
best.typed_data.real = FALSE; |
|
cssRule = ParseClampedUnit (cssRule, &best); |
|
if (DoApply) |
|
{ |
|
if (tsch) |
|
cssRule = CheckImportantRule (cssRule, context); |
|
/* install the new presentation. */ |
|
TtaSetStylePresentation (PRStrokeOpacity, element, |
|
tsch, context, best); |
|
} |
|
return (cssRule); |
|
} |
|
/*---------------------------------------------------------------------- |
|
ParseSVGOpacity: parse a SVG fill property |
|
----------------------------------------------------------------------*/ |
|
static char *ParseSVGFillOpacity (Element element, PSchema tsch, |
|
PresentationContext context, char *cssRule, |
|
CSSInfoPtr css, ThotBool isHTML) |
|
{ |
|
PresentationValue best; |
|
|
|
best.typed_data.unit = STYLE_UNIT_INVALID; |
|
best.typed_data.real = FALSE; |
|
cssRule = ParseClampedUnit (cssRule, &best); |
|
if (DoApply) |
|
{ |
|
if (tsch) |
|
cssRule = CheckImportantRule (cssRule, context); |
|
/* install the new presentation. */ |
|
TtaSetStylePresentation (PRFillOpacity, element, |
|
tsch, context, best); |
|
} |
|
return (cssRule); |
|
} |
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
ParseCSSBackgroundImageCallback: Callback called asynchronously by |
ParseCSSBackgroundImageCallback: Callback called asynchronously by |
FetchImage when a background image has been fetched. |
FetchImage when a background image has been fetched. |
Line 3524 static CSSProperty CSSProperties[] =
|
Line 3567 static CSSProperty CSSProperties[] =
|
{"page-break-inside", ParseCSSPageBreakInside}, |
{"page-break-inside", ParseCSSPageBreakInside}, |
|
|
/* SVG extensions */ |
/* SVG extensions */ |
|
{"stroke-opacity", ParseSVGStrokeOpacity}, |
{"stroke-width", ParseSVGStrokeWidth}, |
{"stroke-width", ParseSVGStrokeWidth}, |
{"stroke", ParseSVGStroke}, |
{"stroke", ParseSVGStroke}, |
|
|
|
{"fill-opacity", ParseSVGFillOpacity}, |
{"fill", ParseSVGFill}, |
{"fill", ParseSVGFill}, |
|
|
{"opacity", ParseSVGOpacity} |
{"opacity", ParseSVGOpacity} |
}; |
}; |
|
|