afpdev / alpheusafpparser

Library & parser for IBM Advanced Function Presentation (AFP) document/print stream format
GNU General Public License v3.0
16 stars 11 forks source link

Incorrect 0xFF08 AFP Color value translation #4

Closed RaphC closed 8 years ago

RaphC commented 8 years ago

Hi,

I noticed there's an incorrect translation of 0xFF08 STC value. If your code it is mapped to BlackColor whereas in the spec it's mentionned as a 'Reset Color'


public enum AFPColorValue{

    Black_ColorOfMedium_0xFF08(0xFF08,0,0,0),
}

Here is the PTOCA spec extract (p. 90)

Table 8. Color-Value Table
| Value Color
| X'0000' or X'FF00' Device default
| X'0001' or X'FF01' Blue
| X'0002' or X'FF02' Red
| X'0003' or X'FF03' Pink/magenta
| X'0004' or X'FF04' Green
| X'0005' or X'FF05' Turquoise/cyan
| X'0006' or X'FF06' Yellow
| X'0008' Black
| X'0010' Brown
| X'FF07' Device default
| X'FF08' Reset color, also called color
| of medium
| X'FFFF' Default indicator
| All others Reserved
A color attribute value of X'FF08' means that the receiver's default background
color should be used for the foreground color. This provides an erase function.

Regards,

afpdev commented 8 years ago

Hi RaphC, again, thank you for your valuable contribution.

PTOCA, GOCA, IOCA, LineData, and MODCA have slightly different implementations/interpretations of color codes. I tried to culminated them into one single enum AFPColorValue with the expense that some of them (e.g. white and black) appear ambiguous without knowing their exact meaning in the context in which they are used. e.g. "Black_ColorOfMedium_0xFF08" in PTOCA it means "ColorOfMedium", while in an other context it is interpreted as "Black".

I'm not particular happy with this solution but prefer it over having different color value enums for every context. I'm open to any suggestions.

BR afpdev