Common Lisp Package: CLOT

README:

FUNCTION

Public

PLOT-BAR-CHART (DATA &KEY X-AXIS-LABELS (BAR-WIDTH 1) VGRID HGRID (IMAGE *DEFAULT-IMAGE*))

Plot a histogram chart on *DEFAULT-IMAGE* of DATA. DATA is expected to be an alist where each sublist is: (name colour value ...) Name is the name of the series of values, colour is the colour to be used to render the bar of that series. The rest is a list of values of the series. BAR-WIDTH is the horizontal magnification factor of the bar size, where the normal value of 1 means they are drawn side by side next to each other. Values x > 1 makes the bars overlap, and values x < 1 draws them scattered.

PLOT-GANTT-CHART (DATA &KEY (PERIOD 86400) SPAN-BORDER (BAR-WIDTH 0.8) HGRID VGRID TIME-FORMATTER VRULERS (IMAGE *DEFAULT-IMAGE*) DO-NOT-DRAW)

Plot a Gantt chart on *DEFAULT-IMAGE* of DATA. DATA is expected to be an alist where each sublist is: (name (start colour duration [label]) ...) Name is the name a resource, start the beginning of the allocation of resource to a job, colour is the colour of the job, duration is the length of the job allocated on that resource. If DO-NOT-DRAW is true don't draw but just do the calculations of the bounding boxes of the spans.

PLOT-LINE-CHART (DATA &KEY X-AXIS-LABELS FILL BULLETS HGRID VGRID LINE-WIDTH (IMAGE *DEFAULT-IMAGE*))

Plot a line chart on *DEFAULT-IMAGE* of DATA. If FILL is true the space below the lines is filled with the same colour as the line, therefore it's important in which order the data appears in DATA as to avoid hiding parts of the chart. If BULLETS is true, draw small bullet point in the line segment edges. DATA is expected to be an alist where each sublist is: (name colour value ...) Name is the name of the series of values, colour is the colour to be used to render the line of that series. The rest is a list of values of the series.

PLOT-PIE-CHART (DATA &KEY SHADED SIMPLIFIED (OTHERS-LABEL others) (IMAGE *DEFAULT-IMAGE*))

Plot a pie chart of DATA on IMAGE. DATA is expected to be an alist where each sublist is: (name colour value) Name is a label for that value, colour is the colour to be used to render the slice of that series. If SHADED is true the pie will be draw atop of its own shadow giving a cheap 3D effect. The colour of the shadow can be chosen passing a colour as SHADE. If SIMPLIFIED is true, don't show slices that would be too small to be seen on the chart and clump them together under the name OTHERS-LABEL.

Undocumented

FILL-IMAGE (X Y &KEY BORDER (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

FIND-RGB-COLOUR (NAME)

VIEW-CHART (TYPE WIDTH HEIGHT DATA &REST ARGS)

Private

BBOX->DIMENSIONS (BBOX)

Given a bounding box BBOX as returned by DRAW-FREETYPE-STRING, return a list of two values: the width and the height.

CHANGE-COLOUR-BRIGHTNESS (COLOUR DELTA &KEY (IMAGE *DEFAULT-IMAGE*))

Return a colour which is a brightened/darkened version of COLOUR. DELTA should be in the range -1 < x < 1.

CHART-METADATA (DATA)

Return the metadata of DATA in several values. These informations are necessary to plot a chart of any kind.

CLOT-IMAGE-ANGLE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

CLOT-IMAGE-CARTESIAN-MODE (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

CLOT-IMAGE-CTM (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

CLOT-IMAGE-IMG (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

CLOT-IMAGE-X-SCALING (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

CLOT-IMAGE-Y-SCALING (INSTANCE)

@arg[extid]{A @class{extid}} @return[sytemid]{puri:uri or nil} Returns the System ID part of this External ID.

COLUMNS-TO-FIT-ASPECT-RATIO (CELL-WIDTH CELL-HEIGHT N-CELLS ASPECT-RATIO)

Return how many columns of N-CELLS rectangular cells of size CELL-WIDTHxCELL-HEIGHT we need to respect ASPECT-RATIO.

COMPUTE-AXIS-BEST-POINT-SIZE (LABELS FONT MAX-POINT-SIZE AVAILABLE-SPACE &KEY (IMAGE *DEFAULT-IMAGE*))

Calculate the point size to be used to draw the largest string of LABELS with FONT within the AVAILABLE-SPACE using at most MAX-POINT-SIZE. Return three values the point size and the width and height of the largest string drawn at that point size.

CTM-DETERMINANT (CTM)

Return the determinant of the matrix CTM.

CTM-MULTIPLY (M1 M2)

Multiply two Coordinates Transformation Matrices.

DRAW-BULLET (CENTER-X CENTER-Y RADIUS &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

Like draw filled-circle but RADIUS is expressed in raw IMAGE pixels (they are not transformed by any CTM).

DRAW-FREETYPE-STRING (X Y STRING &KEY (ANTI-ALIASED T) (POINT-SIZE 12.0d0) (ANGLE 0.0d0) (CONVERT-CHARS T) LINE-SPACING (FONT-NAME *DEFAULT-FONT*) DO-NOT-DRAW (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*) (JUSTIFICATION BOTTOM-LEFT))

Just like CL-GD:DRAW-FREETYPE-STRING but make use of the CTM.

DRAW-XY-FRAME (X-LABELS Y-LABELS &KEY HGRID VGRID (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*) BACKGROUND (X-LABEL-POSITION ON-NOTCH) (Y-LABEL-POSITION ON-NOTCH) (MAX-POINT-SIZE 10.0d0))

Draw just the frame for a chart marking the axis accordingly. The frame is drawn in COLOR. The X axis will be marked with X-LABELS, whereas the Y axis will be marked with Y-LABELS. If HGRID is provided, draw horizontal lines in the correspondence of the Y markings across the chart. If VGRID is provided, draw vertical lines in the correspondence of the X markings across the chart. Both HGRID and VGRID can be just T, in which case a light gray colour is used. If BACKGROUND is specified the chart area is filled with that colour. If BACKGROUND is T a white colour is used. IMAGE is the working image, or the default image if it's not provided. The CHART-TYPE can be :LINE or :HISTOGRAM; this affects the type and position of markings on the X axis.

IMAGE-Y (IMAGE Y)

Just height - Y if IMAGE is in cartesian mode otherwise Y itself.

ITRANSFORM (X Y CTM)

Inverse of TRANSFORM.

MAKE-CTM-MATRIX (&OPTIONAL ELEMENTS)

Make two dimensional array for a Coordinates Transformation Matrix.

MAX-TEXT-DIMENSIONS (STRINGS FONT POINT-SIZE &KEY (IMAGE *DEFAULT-IMAGE*))

Return the maximum dimensions (width and height) of the graphical output if we had to draw LINES of text (a list) with FONT and POINT-SIZE.

PLOT-HISTOGRAM-CHART (DATA &KEY X-AXIS-LABELS SHADED VGRID HGRID (IMAGE *DEFAULT-IMAGE*))

Plot a histogram chart on *DEFAULT-IMAGE* of DATA. DATA is expected to be an alist where each sublist is: (name colour value ...) Name is the name of the series of values, colour is the colour to be used to render the bar of that series. The rest is a list of values of the series.

SPLIT-LIST (LIST CHUNKS-SIZE)

Split LIST into chunks of length CHUNKS-SIZE.

STRING-GRAPHICAL-DIMENSIONS (STRING FONT POINT-SIZE &OPTIONAL (IMAGE *DEFAULT-IMAGE*))

Return the dimensions in pixels of the draw area if we had to render STRING with FONT and POINT-SIZE.

SUBMATRIX (CTM EXCLUDE-I EXCLUDE-J)

Return the list of elements of CTM excluding those on column EXCLUDE-I and row EXCLUDE-J.

SUBMATRIX-DETERMINANT (CTM EXCLUDE-I EXCLUDE-J)

Return the determinant of the submatrix of CTM obtained removing all the elements lying on column EXCLUDE-I and row EXCLUDE-J.

TRANSFORM (X Y CTM)

Apply CTM transformation to X and Y coordinates.

TRANSPOSE-CTM (CTM)

Transpose the matrix CTM.

VALUES-METADATA (VALUES)

Return the metadata of DATA in several values. These informations are necessary to plot a chart of any kind.

Y-AXIS-LABEL-POSITIONS (MIN MAX TARGET-STEPS)

Return two values, a list of numbers to be used as both Y axis labels and positions, and the number of decimals to render the labels with. The length of the list depends on TARGET-STEPS but it could be rounded to some other value to make the labels look better.

Undocumented

AS32BIT (X)

SETFCLOT-IMAGE-ANGLE (NEW-VALUE INSTANCE)

SETFCLOT-IMAGE-CARTESIAN-MODE (NEW-VALUE INSTANCE)

SETFCLOT-IMAGE-CTM (NEW-VALUE INSTANCE)

SETFCLOT-IMAGE-IMG (NEW-VALUE INSTANCE)

CLOT-IMAGE-P (OBJECT)

SETFCLOT-IMAGE-X-SCALING (NEW-VALUE INSTANCE)

SETFCLOT-IMAGE-Y-SCALING (NEW-VALUE INSTANCE)

COPY-CLOT-IMAGE (INSTANCE)

DRAW-ARC (CENTER-X CENTER-Y WIDTH HEIGHT START END &KEY STRAIGHT-LINE CENTER-CONNECT FILLED (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

DRAW-BARS-ON-CHART (VALUES &KEY (OFFSET 0) (WIDTH 1) BORDER (IMAGE *DEFAULT-IMAGE*))

DRAW-CHART-FRAME (X-LABELS MIN MAX &KEY HGRID VGRID (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*) BACKGROUND (CHART-TYPE LINE))

DRAW-FILLED-CIRCLE (CENTER-X CENTER-Y RADIUS &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*) (PRESERVE-ASPECT T))

DRAW-FILLED-ELLIPSE (CENTER-X CENTER-Y WIDTH HEIGHT &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

DRAW-HISTOGRAM-ON-CHART (VALUES &KEY FILL (IMAGE *DEFAULT-IMAGE*))

DRAW-LINE (FROM-X FROM-Y TO-X TO-Y &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*) THICKNESS)

DRAW-LINE-ON-CHART (VALUES &KEY FILL BULLETS THICKNESS (IMAGE *DEFAULT-IMAGE*))

DRAW-POLYGON (VERTICES &KEY (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*) FILLED)

DRAW-RECTANGLE (POINTS &KEY FILLED COLOR THICKNESS (IMAGE *DEFAULT-IMAGE*))

DRAW-RECTANGLE* (POINT1-X POINT1-Y POINT2-X POINT2-Y &KEY FILLED THICKNESS (COLOR *DEFAULT-COLOR*) (IMAGE *DEFAULT-IMAGE*))

DRAW-X-AXIS (X-LABELS LABEL-POSITION LABEL-ANGLE VGRID FONT-SIZE VERTICAL-OFFSET)

FIND-FONT (NAME)

FIT-TEXT-IN-BOX (WIDTH HEIGHT TEXT-LIST &KEY (FONT *AXIS-FONT*) (MAX-POINT-SIZE 12.0d0) (IMAGE *DEFAULT-IMAGE*))

FONT-PATH (FONT)

GANTT-METADATA (DATA)

INVERT-COLOUR (COLOUR &KEY (IMAGE *DEFAULT-IMAGE*))

INVERT-CTM (CTM)

MAKE-CAPTION (LABELS COLOURS &KEY (FONT *AXIS-FONT*) (POINT-SIZE 10.0d0) (ASPECT 2) (IMAGE *DEFAULT-IMAGE*))

MAKE-CLOT-IMAGE (&KEY ((IMG DUM455) NIL) ((CTM DUM456) *DEFAULT-CTM*) ((ANGLE DUM457) 0) ((X-SCALING DUM458) 1) ((Y-SCALING DUM459) 1) ((CARTESIAN-MODE DUM460) NIL))

MAKE-CTM (A B C D TX TY)

PHYSICAL-BBOX-TO-VIRTUAL (BBOX IMAGE)

PIE-METADATA (DATA)

POINT (X Y)

POINT-X (POINT)

POINT-Y (POINT)

POINTS-DISTANCE (P1 P2)

POLAR->CARTESIAN (ANGLE RADIUS)

RADIANS->DEGREES (RADIANS)

READ-RGB-TABLE (PATHNAME)

ROTATION-CTM (RADIANS)

SCALING-CTM (X Y)

SIMPLIFY-PIE-CHART-DATA (DATA OTHERS-LABEL)

TRANSFORM-IMAGE-ANGLE (ANGLE IMAGE)

TRANSFORM-IMAGE-COORDINATES (X Y IMAGE)

TRANSLATION-CTM (X Y)

VIEW-IMAGE (&OPTIONAL (IMAGE *DEFAULT-IMAGE*))

MACRO

Public

WITH-ROTATION ((ANGLE &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Execute BODY with ANGLE transformation to IMAGE coordinates.

WITH-SCALING ((X-SCALE Y-SCALE &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Execute BODY with X-SCALE and Y-SCALE scaling transformation to IMAGE coordinates.

WITH-SUBIMAGE ((V1-X V1-Y V2-X V2-Y &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Execut body working on a part of IMAGE. The coordinate system is scaled accordingly.

WITH-TRANSLATION ((X-OFFSET Y-OFFSET &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Execute BODY with translating the x and y coordinates of IMAGE of respectively X-OFFSET and Y-OFFSET.

Private

WITH-ADDITIONAL-CTM ((CTM &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Execute BODY applying the Coordinates Transformation Matrix CTM to IMAGE in addition to the one already applied to it.

WITH-CTM ((CTM &KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Execute BODY applying the Coordinates Transformation Matrix CTM to IMAGE. Any existing ctm is disregarded but replaced on exit of BODY.

WITHOUT-TRANSFORMATIONS ((&OPTIONAL (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

Execute BODY without any transformation to IMAGE coordinates.

Undocumented

WITH-CARTESIAN-COORDINATES ((&KEY (IMAGE '*DEFAULT-IMAGE*)) &BODY BODY)

WITH-DEFAULT-COLOUR ((COLOUR &KEY (IMAGE *DEFAULT-IMAGE*)) &BODY BODY)

GENERIC-FUNCTION

Public

COLOUR (CODE &KEY IMAGE ALPHA (IMAGE *DEFAULT-IMAGE*))

Return a possibily new allocated colour indicated by CODE. ALPHA is in the range 0 to 1. IMAGE defaults to *DEFAULT-IMAGE*.

VARIABLE

Public

Undocumented

*DEFAULT-BACKGROUND-COLOUR*

Private

Undocumented

*AXIS-FONT*

*DEFAULT-CTM*

*FONT-CACHE*

*FONT-SEARCH-PATH*

*RGB-TABLE*

CLASS

Private

Undocumented

CLOT-IMAGE

CONSTANT

Private

Undocumented

+IDENTITY-CTM+