Laxkit  0.0.7.1
Classes | Typedefs | Enumerations | Functions | Variables
LaxInterfaces Namespace Reference

Namespace for the Laxkit interfaces, surprisingly enough. More...

Classes

class  anInterface
 A class for key and mouse interfaces acting on particular windows. More...
class  CaptionData
 Holds a little bit of text. More...
class  CaptionInterface
 Interface for manipulating CaptionData objects. More...
class  ColorPatchData
 Cubic tensor product patch with colors defined at each vertex. More...
class  ColorPatchInterface
 Interface for dealing with ColorPatchData objects. More...
class  SegmentControls
 Class to hold info about how to generate associated Coordinate points. More...
class  Coordinate
 The basic coordinate class for points. More...
class  DumpContext
 Class to pass to interface object dump out methods for particular behavior. More...
class  EllipseData
 Data class for EllipseInterface. More...
class  EllipseInterface
 *** fix me!Interface for EllipseData objects. More...
class  LinePoint
class  EngraverFillData
class  EngraverFillInterface
 Interface for dealing with EngraverFillData objects. More...
class  FillStyle
 Store various characteristics of a fill. More...
class  RawPoint
class  FreehandInterface
 Interface to create bezier or straight lines from freehand motion. More...
class  GradientDataSpot
 GradientData keeps a stack of these. More...
class  GradientData
 Handled by GradientInterface. More...
class  GradientInterface
 Manipulates GradientData objects. More...
class  ImageData
 Holds an image and a transform. More...
class  ImageInterface
 Interface for manipulating ImageData objects. More...
class  ImagePatchData
 Cubic tensor product patch with an image as the color source. More...
class  ImagePatchInterface
 Interface for dealing with ImagePatchData objects. More...
class  LinesData
 Data class for LinesInterface. More...
class  LinesInterface
 Interface for LinesData, just straight point to point lines. More...
class  LineStyle
 Store various characteristics of a line. More...
class  MeasureInterface
 Measure length, angle and area in various ways. More...
class  ObjectInterface
 Allows selecting and moving around several objects all at once. More...
class  showmat
class  PatchRenderContext
 Holds threadsafe data concerning computations with PatchData like objects. More...
class  PatchData
 Plain old ordinary cubic tensor product patches, the base for mesh gradients and some image warping. More...
class  PatchInterface
 Class to deal with PatchData objects. More...
class  PathInfo
class  Path
 Path contains only one path. More...
class  PathsData
 Basically a stack of Path objects with extra fill rules. More...
class  PathOperator
 Abstract base class of path operators. More...
class  PathInterface
 The maintainer of all PathOperator classes. More...
struct  PointWarpLink
struct  PointWarpPoint
class  PointWarpData
class  PointWarpInterface
 Class to deal with PointWarpData objects. More...
class  RectData
 Basic rectangular selection, data type for RectInterface. More...
class  RectInterface
 Handles RectData or works directly on the matrix of any SomeData. More...
class  SomeData
 Basic data type for interfaces. More...
class  SomeFacNode
 Internal node for SomeDataFactory. More...
class  SomeDataFactory
 Class to get instances of interface data. More...
class  SomeDataRef
 A reference to a SomeData. More...
class  ViewerWindow
 Class for providing a ViewportWindow together with rulers, scrollers, etc. More...
class  ObjectContext
 Class to make searching for objects convenient and expandable in a ViewportWindow. More...
class  ViewportWindow
 Class specifically to use anInterface classes. More...
class  ViewportWithStack
 ViewportWindow with an internal stack of objects. More...

Typedefs

typedef Laxkit::PtrStack
< RawPoint
RawPointLine
typedef enum
LaxInterfaces::_PatchControls 
PatchControls
typedef SomeData *(* NewSomeDataFunc )(SomeData *refobj)
typedef int(* DelSomeDataFunc )(SomeData *obj)

Enumerations

enum  anInterFaceStyles {
  INTERFACE_Unknown = 0, INTERFACE_Overlay, INTERFACE_Tool, INTERFACE_Child,
  INTERFACE_MAX
}
enum  OverlayOptions { OVERLAYOPT_RESIZABLE = (1<<0), OVERLAYOPT_FIXEDPOS = (1<<1), OVERLAYOPT_MAX }
enum  EngraverModes { EMODE_Mesh, EMODE_Thickness, EMODE_Orientation, EMODE_Freehand }
enum  EngraveShortcuts {
  ENGRAVE_SwitchMode = PATCHA_MAX, ENGRAVE_ExportSvg, ENGRAVE_RotateDir, ENGRAVE_RotateDirR,
  ENGRAVE_SpacingInc, ENGRAVE_SpacingDec, ENGRAVE_MAX
}
enum  FreehandEditorStyles {
  FREEHAND_Till_Closed = (1<<0), FREEHAND_Coordinates = (1<<1), FREEHAND_Flatpoints = (1<<2), FREEHAND_Path = (1<<3),
  FREEHAND_ScrollWindow = (1<<4), FREEHAND_MAX
}
enum  GradientInterfaceActions {
  GRAD_SelectLeft, GRAD_SelectRight, GRAD_Decorations, GRAD_Flip,
  GRAD_MakeLinear, GRAD_MakeRadial, GRAD_Select, GRAD_Delete,
  GRAD_MAX
}
enum  ImageInterfaceActions {
  II_Normalize, II_Rectify, II_Decorations, II_ToggleLabels,
  II_MAX
}
enum  LineStyleMask {
  LINESTYLE_Width = (1<<0), LINESTYLE_Color = (1<<1), LINESTYLE_Dash = (1<<2), LINESTYLE_Joinstyle = (1<<3),
  LINESTYLE_Capstyle = (1<<4), LINESTYLE_MAX
}
enum  ObjectInterfaceActions { OIA_Group = RIA_MAX, OIA_MAX }
enum  _PatchControls {
  Patch_Full_Bezier = 0, Patch_Coons, Patch_Border_Only, Patch_Linear,
  Patch_MAX
}
enum  PatchInterfaceActions {
  PATCHA_RenderMode, PATCHA_RecurseInc, PATCHA_RecurseDec, PATCHA_SmoothEdit,
  PATCHA_MeshType, PATCHA_MeshTypeR, PATCHA_Select, PATCHA_ConstrainY,
  PATCHA_ConstrainX, PATCHA_RowDivInc, PATCHA_RowDivDec, PATCHA_ColDivInc,
  PATCHA_ColDivDec, PATCHA_Subdivide, PATCHA_SubdivideRows, PATCHA_SubdivideCols,
  PATCHA_Rectify, PATCHA_Decorations, PATCHA_CircleWarp, PATCHA_SelectCorners,
  PATCHA_SelectMids, PATCHA_SelectEdgeMids, PATCHA_SelectVerticalEdgeMids, PATCHA_SelectHorizontalEdgeMids,
  PATCHA_SelectAllVertically, PATCHA_SelectMoreVertically, PATCHA_SelectAllHorizontally, PATCHA_SelectMoreHorizontally,
  PATCHA_SelectAround, PATCHA_MAX
}
enum  PathUndoTypes {
  PATHUNDO_Move_Point, PATHUNDO_Add_Point, PATHUNDO_Delete_Point, PATHUNDO_Point_Type_Change,
  PATHUNDO_Width_Change, PATHUNDO_Width1_Change, PATHUNDO_Width2_Change, PATHUNDO_Add_Path,
  PATHUNDO_Delete_Path, PATHUNDO_LineStyle_Change, PATHUNDO_FillStyle_Change, PATHUNDO_MAX
}
enum  PathFillType {
  FILL_NONE, FILL_NONZERO, FILL_ZERO, FILL_EVEN_ODD,
  FILL_ODD_EVEN
}
enum  PathInterfaceSettings {
  PATHI_One_Path_Only = (1<<0), PATHI_Two_Point_Minimum = (1<<1), PATHI_Path_Is_Screen = (1<<2), PATHI_Path_Is_M_Screen = (1<<3),
  PATHI_Path_Is_Real = (1<<4), PATHI_Path_Is_M_Real = (1<<5), PATHI_Esc_Off_Sub = (1<<6), PATHI_Plain_Click_Add = (1<<7)
}
enum  PathInterfaceActions {
  PATHIA_CurpointOnHandle, PATHIA_CurpointOnHandleR, PATHIA_Pathop, PATHIA_ToggleFillRule,
  PATHIA_ToggleFill, PATHIA_ToggleStroke, PATHIA_ColorFillOrStroke, PATHIA_RollNext,
  PATHIA_RollPrev, PATHIA_ToggleAddAfter, PATHIA_TogglePointType, PATHIA_Select,
  PATHIA_SelectInPath, PATHIA_Close, PATHIA_Decorations, PATHIA_StartNewPath,
  PATHIA_StartNewSubpath, PATHIA_Wider, PATHIA_Thinner, PATHIA_WidthStep,
  PATHIA_WidthStepR, PATHIA_MakeCircle, PATHIA_MakeRect, PATHIA_Reverse,
  PATHIA_Delete, PATHIA_Combine, PATHIA_ExtractPath, PATHIA_ExtractAll,
  PATHIA_Copy, PATHIA_Cut, PATHIA_Paste, PATHIA_MAX
}
enum  PointWarpInterfaceActions {
  POINTWARPA_RenderMode, POINTWARPA_RecurseInc, POINTWARPA_RecurseDec, POINTWARPA_Decorations,
  POINTWARPA_MAX
}
enum  RectInterfaceActions {
  RIA_Decorations, RIA_Normalize, RIA_Rectify, RIA_Constrain,
  RIA_MoveCenter, RIA_ExpandHandle, RIA_ContractHandle, RIA_FlipHorizontal,
  RIA_FlipVertical, RIA_ToggleFlipControls, RIA_RotateCW, RIA_RotateCCW,
  RIA_MAX
}
enum  ViewerWindowActions { VIEWER_NextTool, VIEWER_PreviousTool, VIEWER_MAX }
enum  ViewportWindowActions {
  VIEWPORT_ZoomIn = 1, VIEWPORT_ZoomOut, VIEWPORT_CenterReal, VIEWPORT_ResetView,
  VIEWPORT_NextObject, VIEWPORT_PreviousObject, VIEWPORT_DeleteObj, VIEWPORT_ShiftLeft,
  VIEWPORT_ShiftRight, VIEWPORT_ShiftUp, VIEWPORT_ShiftDown, VIEWPORT_IncShift,
  VIEWPORT_DecShift, VIEWPORT_MAX
}

Functions

 anOverlay ()
virtual int X ()
virtual int Y ()
virtual int Width ()
virtual int Height ()
CoordinateCoordinatePolygon (flatpoint center, double radius, bool point_on_x_axis, int num_sides, int num_winding)
void getT (double *v, double t)
 v=[ t^3, t^2, t, 1 ]
double dot (double *a, double *b)
 Returns a*b, a and b are double[4]..
void m_times_v (double *m, double *b, double *v)
 v = m b (b is the vector), m is 4x4 matrix, b and v are double[4]
void m_times_m (double *a, double *b, double *m)
 m = a x b, a and b are 4x4 matrices
void getI (double *I)
 Fill I with 4x4 Identity matrix.
void getScaledI (double *I, double a, double b, double c, double d)
 Fill 4x4 I with x,y,z,w scaled by a,b,c,d.
void printG (const char *ch, double *G)
 For debugging: cout a 4x4 matrix G[16].
void m_transpose (double *M)
 Transpose the 4x4 matrix.
void getPolyT (double *N, double n, double t0)
 This makes a polynomial column vector T:
void renderTriangleToBuffer (unsigned char *buf, int bw, int bh, flatpoint p1, flatpoint p2, flatpoint p3, ScreenColor *col)
PathsDataSvgToPathsData (PathsData *existingpath, const char *d, char **end_ptr)
 Turn an svg 'd' attribute to a PathsData.
CoordinateSvgToCoordinate (const char *d, int how, char **endptr, int *totalpoints)
 Convert an SVG path data snippet to a Coordinate list.
charCoordinateToSvg (Coordinate *points)
 Convert a coordinate list to an svg styled string.

Variables

enum LaxInterfaces::OverlayOptions bounds
double B [16]
 The bezier matrix.
double Binv [16]
 The inverse of the bezier matrix.
SomeDataFactorysomedatafactory = NULL

Detailed Description

Namespace for the Laxkit interfaces, surprisingly enough.


Function Documentation

Coordinate * LaxInterfaces::CoordinatePolygon ( flatpoint  center,
double  radius,
bool  point_on_x_axis,
int  num_sides,
int  num_winding 
)

Returns polygon arranged in counterclockwise direction as viewed in right handed coordinate system.

References angle(), and CoordinatePolygon().

Referenced by CoordinatePolygon().

char * LaxInterfaces::CoordinateToSvg ( Coordinate *  points)

Convert a coordinate list to an svg styled string.

This only handles coordinates that are marked POINT_VERTEX, POINT_TONEXT, and POINT_TOPREV. All others are assumed to be vertex points.

Todo:
if the list is malformed, such as by having other than 2 control points between vertices, then this currently ignores extras...

References appendstr(), and newstr().

Referenced by SvgToCoordinate().

void LaxInterfaces::renderTriangleToBuffer ( unsigned char buf,
int  bw,
int  bh,
flatpoint  p1,
flatpoint  p2,
flatpoint  p3,
ScreenColor col 
)
Todo:
implement me!

Referenced by LaxInterfaces::PatchData::patchpoint().

Coordinate * LaxInterfaces::SvgToCoordinate ( const char d,
int  how,
char **  endptr,
int totalpoints 
)

Convert an SVG path data snippet to a Coordinate list.

The d attribute of Svg paths allows definition of lines composed of a mixture of straight lines, cubic bezier lines, quartic bezier lines, circle arcs, and ellipses.

Unless how&4==4, if d contains multiple paths, the paths are all parsed into a single coordinate list, delimited by a Coordinate where Coordinate::flags contains either POINT_TERMINATOR, or POINT_LOOP_TERMINATOR. and should not be considered an actual point. POINT_LOOP_TERMINATOR means that the preceding path is closed. POINT_TERMINATOR means an open path. This terminator stuff is necessary because of how the svg spec defines path continuation after a 'z'/'Z' command, which is that sometimes it requires knowledge of the previous subpath.

If everything in d is parsed, then endptr will be pointing to the terminating null character of the string.

Any path in d that corresponds to path with a single coordinate will be ignored.

If how&3==0, then allow mixed poly lines and bezier segments. If how&3==1, then the returned path must be only a poly line. If how&3==2, then the returned path must be all bezier segments. if how&4==4 then return a normal closed Coordinate upon parsing a 'z'. Otherwise use the clunky LOOP_TERMINATOR points.

Ellipsoidal arcs are converted into cubic bezier segments.

Svg path data follows the following format. The letter is a command. If more than the given numbers are present, then assume they are parameters for another of the same command, except for moveto, which switches to lineto for subsequent x,y.

   M x y    move to absolute coordinate (x,y)
   m x y    move to coordinate (x,y) relative to previous coordinate
       Any further x y are implied lineto commands
   L x y    draw a line to absolute coordinate (x,y)
   l x y    draw a line to coordinate (x,y) relative to previous coordinate
   H x      draw a horizontal line to absolute coordinate (x,current y)
   h x      draw a horizontal line to coordinate ((current x)+x,(current y))
   V x      draw a vertical line to absolute coordinate ((current x), y)
   v x      draw a vertical line to coordinate ((current x),(current y)+y)
   C x1 y1 x2 y2 x y   draw a cubic bezier segment. 1 and 2 are controls, (x,y) is vertex
   c x1 y1 x2 y2 x y   like C, but using relative coordinates
   S x2 y2 x y   draw a cubic bezier segment.  2 is the second controls, (x,y) is vertex,
   s x2 y2 x y     the first control is reflection of control from previous bezier segment,
                   or the current point, if there was no previous segment. 's' is for
                   relative coordinates
   Q x1 y1 x y   draw a quartic bezier segment. 1 is control point, (x,y) is vertex
   q x1 y1 x y   like q, but using relative coordinates
   T x y         draw a quartic bezier segment. (x,y) is vertex,
   t x y           the control point is reflection of control from previous bezier segment,
                   or the current point, if there was no previous segment. 't' is for
                   relative coordinates
   A/a rx ry x-axis-rotation large-arc-flag sweep-flag x y
               draw an arc from the current point to the point (x,y)
               rx and ry are the x and y radii.
               the ellipse is rotated by x-axis-rotation (in degrees).
               if large-arc-flag==1, then the swept out arc is large. 0 means small.
               if sweep-flag==1, then the arc is traced in a positive angle direction,
               otherwise 0 means in a negative direction (hard to describe without pictures).
   Z or z   close the current path by with a straight line. If a move does not follow it,
            then use the initial point of the path just closed as the starting point for
            the new path
 
Todo:

*** right now how&3 bits are ignored..

*** if d doesn't start with a move, what is the spec'd default starting point?? right now, failure results if not starting with a move

References CoordinateToSvg(), and LaxFiles::DoubleListAttribute().

Referenced by SvgToPathsData().

PathsData * LaxInterfaces::SvgToPathsData ( PathsData *  existingpath,
const char d,
char **  end_ptr 
)

Turn an svg 'd' attribute to a PathsData.

This parses via SvgToCoordinate(), then converts the Coordinate list to a PathsData format.

Return the PathsData object on success, or NULL for failure.

If existingpath==NULL, then return a new PathsData, else append new Path objects to existingpath. existingpath is also returned on success.

References LaxInterfaces::PathsData::append(), LaxInterfaces::PathsData::close(), LaxInterfaces::PathsData::FindBBox(), LaxInterfaces::SomeDataFactory::newObject(), LaxInterfaces::PathsData::pushEmpty(), somedatafactory, and SvgToCoordinate().

Referenced by LaxInterfaces::PathsData::dump_in_atts().


Variable Documentation

LaxInterfaces::SomeDataFactory * LaxInterfaces::somedatafactory = NULL

Mon Feb 17 2014 11:52:58, Laxkit