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

The mother of all Laxkit classes. More...

Classes

class  anObject
 Base class for all Laxkit objects. More...
class  WindowColors
 Holds basic color styling info. More...
class  aDrawable
 Class to facilitate various double buffer and in-memory pixmap rendering. More...
class  anXWindow
 This is the basic window unit for the Laxkit. More...
struct  TimerInfo
 The TimerInfo class is used with anXApp. More...
class  ScreenInformation
class  anXApp
 This class is the control unit for programs. More...
class  SquishyBox
 A box with x,y,w,h, prefered w/h, and allowable shrink and expand values for w/h. More...
class  ListBox
 A SquishyBox containing either a horizontal or vertical list of boxes. More...
class  RowColBox
 Divvies up the child boxes into multiple rows or columns. More...
class  TableData
 Class used internally for the data of tables, oddly enough. More...
class  TableBox
class  SelBox
 Adds id,info,state to SquishyBox. Used in BoxSelector. More...
class  BoxSelector
 Abstract base class for selectors based on boxed items. More...
class  Button
 Simple class for a button that is an icon with optional label. Sends message when pressed. More...
class  ButtonBase
 Abstract base class for single buttons. More...
class  ButtonDownInfo
 Class to simplify keeping track of what buttons have been pressed. More...
class  CheckBox
 Class for a single item checkbox. More...
class  ColorBase
 Defines various simple conversions between rgb, cmyk, gray, and hsv. More...
class  ColorBox
 A control to select an RGBA color, with each mouse button corresponding to r, g, and b. More...
class  SimpleColorEventData
 Class to pass simple rgb, gray, or cmyk colors. More...
class  ColorPrimary
 Defines a primary color of a ColorSystem. More...
class  ColorSystem
 Defines a color system, like RGB, CMYK, etc. More...
class  Color
 A base color, one value in range 0..1.0 for each channel of a ColorSystem. More...
class  ColorSet
 Holds a collection of colors. More...
class  ColorSelector
class  ColorBarInfo
class  ColorSliders
 Panel of sliders to control various color channels. More...
class  CurveInfo
class  CurveWindow
class  DateSelector
 Pick a date from a gregorian calendar. More...
class  LaxDate
 Small class to help slightly with date manipulation, based on the Gregorian calendar. More...
class  DisplayerCairo
 Displayer based on Cairo. More...
class  DisplayerXlib
 Somewhat of a graphics wrapper for Xlib graphics functions. More...
class  Displayer
 A graphics drawing wrapper. More...
class  DoubleBBox
 Class with double minx,maxx,miny,maxy. More...
class  DoublePanner
 A PanController that uses doubles as a base. More...
class  ErrorLogNode
 Stack node for ErrorLog class. More...
class  ErrorLog
 Class to simplify keeping track of offending objects. More...
class  EventData
 Class for sending data messages between windows. More...
class  RefCountedEventData
 Class to send a reference counted object. More...
class  StrEventData
 A EventData with a new'd char[] (copied from nstr in constructor), since they are so common. More...
class  StrsEventData
 A EventData with a new'd char[][] (first element copied from nstr in constructor), since they are so common. More...
class  InOutData
 Wrapper for info about a focus on/off, or Enter/Exit for a window or subwindow. More...
class  MouseEventData
 Hold info about mouse button and motion events. More...
class  KeyEventData
 Hold info about key press or release. More...
class  ScreenEventData
 Wrapper for areas of a screen that need redrawing. More...
class  DeviceEventData
 Event class for device events other than common mouse and keyboard events. More...
class  EventReceiver
 Base class for any object that can receive events. More...
class  FileDialog
 A dialog for selecting files. More...
class  FileMenuItem
 Sub class of MenuItem to read in directories only when needed. More...
class  FileOrStr
 Class that lets you output or input to a disk file or a string. More...
class  PreviewerFunction
 File previewer module to handle different kinds of files. More...
class  FilePreviewer
 Previews images if possible, otherwise shows a snippet of text. More...
class  FontDialogFont
 Describes a font as dealt with in a FontDialog. More...
class  FontDialog
 Dialog to allow selecting fonts. More...
class  LaxFontCairo
 A LaxFont using cairo. More...
class  FontManagerCairo
 The font manager used by anXApp to simplify keeping track of what fonts are loaded. More...
class  LaxFontXlib
 A LaxFont using Xft. More...
class  FontManagerXlib
 The font manager used by anXApp to simplify keeping track of what fonts are loaded. More...
class  LaxFont
 A wrapper for fonts that contains various metric information. More...
class  FontManager
 The font manager used by anXApp to simplify keeping track of what fonts are loaded. More...
class  FuncFrame
 A frame window that uses rpn (reverse polish notation) expressions to define the subwindow positions and dimensions. More...
class  IconNode
 Stacked in an IconManager. More...
class  IconManager
 Simplify maintenance of icons with this stack of IconNode objects. More...
class  IconBox
 Internal node type for IconSelector. More...
class  IconSelector
 A selector using boxes with a label and/or an icon. More...
class  IconSlider
 Flip through a number of icons, 1 shown at a time. More...
class  ImageDialog
 Class to allow viewing and changing info related to an image. More...
class  ImageInfo
 Kind of a shell to hold various information about an image. More...
class  InputDialog
 Dialog to enter a single line of text, with optional 3 buttons. More...
class  ItemSlider
 Abstract base class for a kind of button that increments and decrements itself based on where the mouse is clicked. More...
class  LaxDevice
 Class to hold info about various input devices. More...
class  LaxMouse
 LaxDevice subclass for pointers. More...
class  LaxKeyboard
 LaxDevice subclass for keyboards. More...
class  DeviceManager
 Class to translate various incoming device events into Lax events. More...
class  CoreXlibPointer
 Device that selects for core mouse events. More...
class  CoreXlibKeyboard
 Device that selects for core keyboard events. More...
class  LaxCairoImage
class  LaxImlibImage
 A LaxImage based on Imlib_Images. More...
class  VectorPart
class  VectorPartPath
class  MemCachedObject
class  ImageLoader
 Class to facilitate getting an image from the disk into memory suitable for the current graphics backend. More...
class  LaxBufferImage
class  LaxImage
 Abstraction around images. More...
class  LaxOption
 Used internally by LaxOptions. More...
class  LaxOptions
 Class to simplify parsing command line options, and outputing help text. More...
class  TouchObject
 Basically a LaxMouse for touch objects. More...
class  TUIOListener
 Class to listen to TUIO events on a specified port. More...
class  LayerPicker
 Pick layers by number. More...
class  LineEdit
 A generic single line text edit. More...
class  LineInput
 A LineEdit with a label. More...
class  LinkedList
 Independent node type for doubly linked lists. More...
class  PtrList
 A simple doubly linked list of pointers. More...
class  NumStack
 A generic stack for values (like int, double), not pointers. More...
class  PtrStack
 A generic stack for pointers (like anXWindow *, char *), not values. More...
class  MenuButton
 Simple class for a button pops up a menu instead of toggling itself in and out. More...
class  MenuItem
 Node type for MenuInfo. More...
class  MenuInfo
 General container for menu types of lists. More...
class  MenuSelector
 General list and menu controller. Base class for PopupMenu. More...
class  MessageBar
 A very basic text displayer window. Pass in a chunk of text and this window will display it. You can have multiple lines by putting '\n' characters in the text. More...
class  MessageBox
 Window that puts a message and buttons like OK or Cancel. More...
class  MultiLineEdit
 *** please note this class is currently seriously broken *** Multiline edit with optional word wrap. More...
class  NewWindowObject
class  NumInputSlider
 Like NumSlider, but on shift-LBDown lets you type in a value. More...
class  NumSlider
 A slider control specifically for selecting integer numbers within a range. More...
class  Overwrite
 Dialog to ask whether to overwrite something. More...
class  PaletteEntry
 Color instance type for Palette. More...
class  Palette
 A color palette. You can use a PaletteWindow to handle these. More...
class  PaletteWindow
 A window to handle Palette instances. More...
class  PanController
 A convenience for scroller types of things. More...
class  PanPopup
 Press this, and a little PanWindow pops up. More...
class  PanWindow
 Lets you drag a little rectangle around an image to select viewable area. More...
class  PanUser
 Brief class to provide useful stuff for elements that use a PanController. More...
class  PopupMenu
 Class for, of all things, popup menus. More...
class  PrintContext
class  PrintDialog
 (***rather hideous at the moment...) Dialog to get some sort of context for printing. More...
class  ProgressBar
 Where would we be without the ability to measure progress? More...
class  HistoryNode
 Node class for a stack of history for PromptEdit. More...
class  PromptEdit
 An editor for a command prompt. More...
class  QuickFileOpen
 A button with "..." on it that pops up a FileDialog sporting a menu with FileMenuItem entries. More...
class  IntRectangle
class  DoubleRectangle
class  RefCounted
 A minimal refcounted object. More...
class  RefPtrStack
 A RefPtrStack with refcounting elements. More...
class  RowFrame
 A frame that lays out in multiple rows or by columns, but only one control deep. More...
class  RulerWindow
 A ruler that tracks the mouse. More...
class  ScreenColor
class  ScrolledWindow
 Class to have a window associated with a vertical and horizontal scroller. More...
class  Scroller
 A vertical or horizontal scroll bar, with optional zooming handles, and togglable arrow positions. More...
class  KeyInfo
 Info about a key, which can be part of a list in ShortCutDef. More...
class  ShortcutDef
class  ShortcutDefs
class  WindowAction
class  WindowModeInfo
 Class to hold info about different modes a window can have. Used in WindowActions. More...
class  WindowActions
 RefCount derived stack for WindowAction objects. More...
class  ShortcutHandler
 A kind of event filter windows can use to help process keyboard shortcuts. More...
class  ShortcutManager
class  ShortcutTreeSelector
class  ShortcutWindow
class  SimplePrint
 Simple dialog with option to print to file or via command. More...
class  SliderPopup
 Basically an extended IconSlider to include a popup MenuSelector. More...
class  PlainWinBox
 Basically a rectangle with a anXWindow. More...
class  SplitWindow
 A window with resizable panes than can be split and joined. More...
class  StackFrame
 A frame for a stack of windows that can be sized in one dimension. More...
class  TabBox
 Holds the icon and a pointer to the window for elements of a TabFrame. More...
class  TabFrame
 A frame to hold tabbed windows via TabBox objects. More...
class  Tagged
 class to help implement simple tagging and tag querying system. More...
class  TagCloudInfo
 TagCloud node to keep track of which objects have a particular tag. More...
class  TagCloud
 A tagged object manager, to make searching for sets of objects with specified tags easier. More...
class  TextUndo
 Class to hold info for undos in text edit boxes. More...
class  TextEditBaseUtf8
 A base class for text edits using utf8 encoded character arrays. More...
class  TextXEditBaseUtf8
 The window base class for text edits using Latin-1 characters. More...
class  ToolTip
 The ToolTip class is used within anXApp. More...
class  Affine
class  TreeSelector
 Collapsible tree view. More...
class  Undoable
 Subclass from this if you want an object that can act as an agent of undoing. More...
class  UndoData
 Undo node for UndoManager. More...
class  UndoManager
 Simple class to keep track of undoes. More...
class  SimpleUnit
 Small class to help with the conversion of simple units. More...
class  WinFrameBox
 Extends SquishyBox to store anXWindow for use in RowFrame, for instance. More...
class  XYMesBar
 Designed to display 2 numbers: "32,45" or "32x45". More...

Typedefs

typedef int(* DeleteRefCountedFunc )(anObject *obj)
 The type of function in an object optionally called on count reaching 0.
typedef Displayer *(* NewDisplayerFunc )(aDrawable *w)
 Function type to create new Displayer objects.
typedef StrEventData SimpleMessage
typedef InOutData FocusChangeData
typedef InOutData EnterExitData
typedef FontManager *(* NewFontManagerFunc )()
 Function type to create new FontManager objects.
typedef int(* DefaultImageTypeFunc )()
 Returns what the default image format is.
typedef void(* ImageOutFunc )(LaxImage *image, aDrawable *win, int ulx, int uly)
 Simply oriented drawing of image to aDrawable.
typedef void(* ImageOutRotatedFunc )(LaxImage *image, aDrawable *win, int ulx, int uly, int urx, int ury)
 Drawing image to aDrawable with rotation and scaling.
typedef void(* ImageOutSkewedFunc )(LaxImage *image, aDrawable *win, int ulx, int uly, int urx, int ury, int llx, int lly)
 Drawing image to aDrawable with rotation, scaling, and skewing.
typedef void(* ImageOutMatrixFunc )(LaxImage *image, aDrawable *win, double *m)
 Drawing an image to aDrawable with an affine matrix.
typedef int(* GeneratePreviewFunc )(const char *original_file, const char *to_preview_file, const char *format, int width, int height, int fit)
typedef LaxImage *(* CreateNewImageFunc )(int w, int h)
 Type of function that creates a new image based on a certain width and height.
typedef LaxImage *(* ImageFromBufferFunc )(unsigned char *buffer, int w, int h, int stride)
 Create a LaxImage from ARGB 8 bit data.
typedef LaxImage *(* LoadImageFunc )(const char *filename)
 The type of function that loads a file to a LaxImage. Defines load_image().
typedef LaxImage *(* LoadImageWithPreviewFunc )(const char *filename, const char *previewfile, int maxx, int maxy, char delpreview)
 Loads an image, using a preview image.
typedef int(* CompareFunc )(const char *s1, const char *s2)
typedef anXWindow *(* NewWindowFunc )(anXWindow *parnt, const char *ntitle, unsigned long style, anXWindow *owner)
 Function that returns a new window. Used in SplitWindow.
typedef NewWindowObject WinFuncNode
typedef SimpleUnit UnitManager

Enumerations

enum  SimpleColorId {
  COLOR_Foreground, COLOR_Background, COLOR_Stroke, COLOR_Fill,
  COLOR_Controls, COLOR_MAX
}
enum  ColorSliderBlockType {
  COLORBLOCK_RGB, COLORBLOCK_CMYK, COLORBLOCK_HSV, COLORBLOCK_Alpha,
  COLORBLOCK_Gray, COLORBLOCK_Hue, COLORBLOCK_CieLAB, COLORBLOCK_XYZ,
  COLORBLACK_MAX
}
enum  ColorSliderType {
  COLORSLIDER_Red, COLORSLIDER_Green, COLORSLIDER_Blue, COLORSLIDER_Cyan,
  COLORSLIDER_Magenta, COLORSLIDER_Yellow, COLORSLIDER_Black, COLORSLIDER_Hue,
  COLORSLIDER_Saturation, COLORSLIDER_Value, COLORSLIDER_Transparency, COLORSLIDER_MAX
}
enum  ColorSlidersStyle {
  COLORSLIDERS_Vertical = (1<<16), COLORSLIDERS_HideOldNew = (1<<17), COLORSLIDERS_VerticalOldNew = (1<<18), COLORSLIDERS_HideHex = (1<<19),
  COLORSLIDERS_MAX
}
enum  CurveWindowStyles { CURVE_Show_Ranges = (1<<15) }
enum  LaxCompositeOp {
  LAXOP_None = 0, LAXOP_Clear, LAXOP_Source, LAXOP_Over,
  LAXOP_In, LAXOP_Out, LAXOP_Atop, LAXOP_Dest,
  LAXOP_Dest_over, LAXOP_Dest_in, LAXOP_Dest_out, LAXOP_Dest_atop,
  LAXOP_Xor, LAXOP_Add, LAXOP_Saturate, LAXOP_Multiply,
  LAXOP_Screen, LAXOP_Overlay, LAXOP_Darken, LAXOP_Lighten,
  LAXOP_Color_dodge, LAXOP_Color_burn, LAXOP_Hard_light, LAXOP_Soft_light,
  LAXOP_Difference, LAXOP_Exclusion, LAXOP_Hsl_hue, LAXOP_Hsl_saturation,
  LAXOP_Hsl_color, LAXOP_Hsl_luminosity, LAXOP_MAX
}
 Compositing operators for Displayer drawing functions. More...
enum  LaxCapStyle { LAXCAP_Butt = 1, LAXCAP_Round, LAXCAP_Projecting, LAXCAP_MAX }
enum  LaxJoinStyle {
  LAXJOIN_Miter = 1, LAXJOIN_Round, LAXJOIN_CurveMiter, LAXJOIN_Bevel,
  LAXJOIN_MAX
}
enum  DrawThingTypes {
  THING_None, THING_Circle, THING_Circle_X, THING_Circle_Plus,
  THING_Square, THING_Diamond, THING_Triangle_Up, THING_Triangle_Down,
  THING_Triangle_Left, THING_Triangle_Right, THING_Plus, THING_X,
  THING_Asterix, THING_Eject, THING_Double_Triangle_Up, THING_Double_Triangle_Down,
  THING_Double_Triangle_Left, THING_Double_Triangle_Right, THING_Arrow_Left, THING_Arrow_Right,
  THING_Arrow_Up, THING_Arrow_Down, THING_Double_Arrow_Horizontal, THING_Double_Arrow_Vertical,
  THING_Pan_Arrows, THING_Check, THING_Locked, THING_Unlocked,
  THING_Open_Eye, THING_Closed_Eye, THING_Octagon, THING_MAX
}
 Various common things that draw_thing() can draw simply. More...
enum  ErrorSeverity {
  ERROR_Unknown = -1, ERROR_Ok = 0, ERROR_Fail = 1, ERROR_Warning = 2,
  ERROR_MAX
}
enum  BBoxReferencePoint {
  LAX_TOP_LEFT = 1, LAX_TOP_MIDDLE, LAX_TOP_RIGHT, LAX_MIDDLE_LEFT,
  LAX_MIDDLE, LAX_MIDDLE_RIGHT, LAX_BOTTOM_LEFT, LAX_BOTTOM_MIDDLE,
  LAX_BOTTOM_RIGHT
}
enum  ListsDeleteType { LISTS_DELETE_None, LISTS_DELETE_Array, LISTS_DELETE_Refcount, LISTS_DELETE_MAX }
enum  MessageBarTypes {
  MB_LEFT = (1<<16), MB_RIGHT = (1<<17), MB_CENTERX = (1<<18), MB_CENTERY = (1<<19),
  MB_CENTER = (1<<18 | 1<<19), MB_TOP = (1<<20), MB_BOTTOM = (1<<21), MB_MOVE = (1<<22),
  MB_COPY = (1<<23), MB_WRAP = (1<<24), MB_LEAVE_DESTROYS = (1<<25), MB_BINARY = (1<<26),
  MB_MAX
}
enum  ShortcutWindowStyles { SHORTCUTW_Show_Search = (1<<16), SHORTCUTW_Load_Save = (1<<17), SHORTCUTW_MAX }
enum  TabFrameStyle {
  TabFrame_Top = (1<<16), TabFrame_Bottom = (1<<17), TabFrame_Right = (1<<18), TabFrame_Left = (1<<19),
  TabFrame_Stretch = (1<<20), TabFrame_Pile = (1<<21)
}
enum  TextUndoTypes { TEXTUNDO_Insert, TEXTUNDO_Delete, TEXTUNDO_MAX }
enum  UnitTypes {
  UNITS_None = 0, UNITS_Inches, UNITS_Feet, UNITS_Yards,
  UNITS_CM, UNITS_MM, UNITS_Meters, UNITS_Points,
  UNITS_Pixels, UNITS_MAX
}

Functions

int eventscreen (int e_type, unsigned long mask)
 Check to see if some kinds of event types are in mask, and so allow them through.
const charxlib_event_name (int e_type)
 Return name for an xlib core event.
int IsWindowChild (anXWindow *top, anXWindow *check)
 Check if a window (check) is the same as or is descended from another (top).
anXWindowTopWindow (anXWindow *win)
 Return the top level window that win is somewhere nested within.
void printxcrossing (anXWindow *win, XEvent *e)
 cerr an XCrossingEvent. This is used in debugging mode..
const charxlib_extension_event_name (int e_type)
unsigned int filterkeysym (KeySym keysym, unsigned int *state)
 Converts an Xlib keysym to a Laxkit key value.
unsigned int composekey (unsigned int k1, unsigned int k2)
 From 2 keys, typically an ascii key and a dead key, compose another.
int bez_bbox (flatpoint p, flatpoint c, flatpoint d, flatpoint q, DoubleBBox *bbox, double *extrema)
 Update a bounding box to include the given bezier segment.
double bez_closest_point (flatpoint p, flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2, int maxpoints, double *d_ret, double *dalong_ret, flatpoint *found)
 Return the t parament for the point closest to p in the bezier segment p1,c1,c2,p2.
double bez_segment_length (flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2, int npoints)
 Return the physical length of the segment, by approximating with npoints.
int bez_intersection (flatpoint p1, flatpoint p2, int isline, flatpoint bp1, flatpoint bc1, flatpoint bc2, flatpoint bp2, int resolution, flatpoint *point_ret, double *t_ret)
int bez_intersections (flatpoint P1, flatpoint P2, int isline, flatpoint *points, int n, int resolution, double startt, flatpoint *points_ret, int np, double *t_ret, int nt, double *endt)
double bez_distance_to_t (double dist, flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2, int resolution)
 From a physical distance, return the corresponding t parameter value.
double bez_t_to_distance (double T, flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2, int resolution)
 From a t parameter, return the corresponding distance value.
flatpoint bez_tangent (double t, flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2)
 Return the numerical tangent at t.
flatpoint bez_visual_tangent (double t, flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2)
 Return the visual tangent at t.
void bez_subdivide (double t, flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2, flatpoint *points_ret)
 Cut the bezier segment in two at t.
flatpoint bez_point (double t, flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2)
 Return the cubic bezier point at t. t==0 is p1, t==1 is p2.
flatpointbez_points (flatpoint *to_points, int numsegs, flatpoint *from_points, int resolution)
 Break down numsegs bezier segments to a polyline with resolution*numsegs points.
flatpointbez_points (flatpoint *to_points, int numsegs, flatpoint *from_points, int resolution, int isclosed, int atend)
 Break down numsegs bezier segments to a polyline with resolution*numsegs points.
flatpointbez_points (flatpoint *to_points, flatpoint *from_points, int resolution, int ignorefirst)
 Break down the bezier segment to a polyline with resolution points.
flatpointbez_points (flatpoint *to_points, flatpoint p1, flatpoint c1, flatpoint c2, flatpoint p2, int resolution, int ignorefirst)
 Break down the bezier segment to a polyline with resolution points.
double bez_near_point (flatpoint p, flatpoint *points, int n, int maxpoints, double *t_ret, int *i_ret)
 Return the distance p is from the bezier curve in points.
double bez_near_point_p (flatpoint p, flatpoint **points, int n, int maxpoints, double *t_ret, int *i_ret)
 Just like bez_near_point() but with a list of pointers to points, rather than directly at points.
int point_is_in_bez (flatpoint p, flatpoint *points, int n, int resolution)
 Return the winding number of p relative to the bezier curve in points. 0 means point is inside.
flatpointbez_to_points (flatpoint *to_points, flatpoint *from_points, int n, int resolution, int closed)
 Decompose the bezier curve to a polyline.
flatpointbez_circle (flatpoint *points, int numpoints, double x, double y, double r)
 Return an approximate circle, with numpoints control points, or 4 if numpoints<=1.
flatpointbez_ellipse (flatpoint *points, int numsegments, double x, double y, double xr, double yr, flatvector xaxis, flatvector yaxis, double start_angle, double end_angle)
 Create an ellipse composed of numsegments bezier segments, or 4 if numsegments<=1.
void mapname (char *buf, int m)
int is_leap_year (int year)
int days_in_month (int month, int year)
int days_in_year (int year)
 Returns 366 for leap years, or else 365.
const chardayofweek (int day, int lvl, int sunday)
 Return text for day of the week.
const charmonthname (int month, int lvl)
 Return the month name. Month is [1..12].
int operator- (LaxDate d2, LaxDate d1)
 Return the number of days between dates. Note this is negative when d1 is later than d2.
int operator< (LaxDate d1, LaxDate d2)
int operator> (LaxDate d1, LaxDate d2)
int operator<= (LaxDate d1, LaxDate d2)
int operator>= (LaxDate d1, LaxDate d2)
int operator== (LaxDate d1, LaxDate d2)
DBG void DANGER ()
int SetNewDisplayerFunc (const char *backend)
 Set the default "constructor" for Displayer objects.
int SetDefaultDisplayer (Displayer *displayer)
 Set the default Displayer, incrementing its count.
DisplayerGetDefaultDisplayer ()
void dumperrorlog (const char *mes, ErrorLog &log)
 Dump to cout.
const charlax_event_name (int e)
PreviewerFunctionFindPreviewer (const char *filename)
 Return a PreviewerFunction object that can display filename, or NULL.
int AddPreviewer (PreviewerFunction *previewer)
 Add previewer to list of file previewer objects.
int InitializeDefaultPreviewers ()
 If previewers.n>0, then nothing is done. Returns number added.
FontManagernewFontManager_cairo ()
FontManagernewFontManager_xlib ()
int SetNewFontManagerFunc (const char *backend)
 Set the default "constructor" for FontManager objects.
FontManagerGetDefaultFontManager ()
int SetDefaultFontManager (FontManager *manager)
static int lark_position (const char *str, int *c)
 Find the index in the lark_alpha_sorted stack that str would be found.
const charlark_str_from_id (int id)
 Return pointer to string associated with id, or NULL if none.
int lark_id_from_str (const char *str, char createifabsent)
 Return the id associated with str.
void InitLaxCairo ()
 Imlib2 support not compiled in, this just prints a warning and returns.
void InitCairoBackend ()
static clock_t gettime ()
DeviceManagernewCoreXlibDeviceManager (Display *dpy)
 Return a DeviceManager with 2 devices: a core Xlib keyboard and mouse.
int laxcairo_image_type ()
void laxcairo_image_out (LaxImage *image, anXWindow *win, int ulx, int uly)
void laxcairo_image_out_rotated (LaxImage *image, anXWindow *win, int ulx, int uly, int urx, int ury)
void laxcairo_image_out_skewed (LaxImage *image, anXWindow *win, int ulx, int uly, int urx, int ury, int llx, int lly)
void laxcairo_image_out_matrix (LaxImage *image, anXWindow *win, double *m)
LaxImageload_cairo_image (const char *filename)
LaxImageload_cairo_image_with_preview (const char *filename, const char *previewfile, int maxx, int maxy, char del)
int laxcairo_generate_preview (const char *original, const char *preview, const char *format, int maxw, int maxh, int fit)
LaxImagecreate_new_cairo_image (int w, int h)
LaxImageimage_from_buffer_cairo (unsigned char *buffer, int w, int h)
void laxcairo_image_out (LaxImage *image, aDrawable *win, int ulx, int uly)
void laxcairo_image_out_rotated (LaxImage *image, aDrawable *win, int ulx, int uly, int urx, int ury)
void laxcairo_image_out_skewed (LaxImage *image, aDrawable *win, int ulx, int uly, int urx, int ury, int llx, int lly)
void laxcairo_image_out_matrix (LaxImage *image, aDrawable *win, double *m)
LaxImageimage_from_buffer_cairo (unsigned char *buffer, int w, int h, int stride)
int laximlib_image_type ()
 Returns LAX_IMAGE_IMLIB.
void laximlib_alternate_drawable (Drawable drawable)
 Override the drawable used for drawing out images.
void laximlib_usealpha (int yes)
 Set the imlib color modifier to use transparency.
void laximlib_update_alpha (int alpha)
void laximlib_image_out (LaxImage *image, aDrawable *win, int ulx, int uly)
void laximlib_image_out_rotated (LaxImage *image, aDrawable *win, int ulx, int uly, int urx, int ury)
void laximlib_image_out_skewed (LaxImage *image, aDrawable *win, int ulx, int uly, int urx, int ury, int llx, int lly)
void laximlib_image_out_matrix (LaxImage *image, aDrawable *win, double *m)
LaxImagecreate_new_imlib_image (int w, int h)
 Simply return a new imlib image.
LaxImageimage_from_buffer_imlib (unsigned char *buffer, int w, int h, int stride)
 Basically create a nem Imlib_Image, and copy buffer to its data.
LaxImageload_imlib_image (const char *filename)
 Function that returns a new LaxImlibImage.
LaxImageload_imlib_image_with_preview (const char *filename, const char *previewfile, int maxx, int maxy, char del)
 Function that returns a new LaxImlibImage with preview.
int laximlib_generate_preview (const char *original_file, const char *to_preview_file, const char *format, int width, int height, int fit)
 Generate a preview image. Return 0 for success.
int add_image_loader (ImageLoader *loader, int where)
 Add loader to list of available loaders.
LaxImageload_image_with_loaders (const char *file, const char *previewfile, int maxx, int maxy, char delpreview, int required_state, int target_format, int must_be_that_format, int *actual_format)
void InitLaxImlib (int megabytes)
 Initialize Imlib2 using settings in anXApp::app.
void InitImlib2Backend ()
int SetupTUIOListener (const char *port)
 Define and install a new TUIOTouchPointer into your application.
void error_handler (int num, const char *msg, const char *where)
 Error handling for TUIOListener.
int tuio_handler (const char *path, const char *types, lo_arg **argv, int argc, void *, void *user_data)
unsigned long screen_color_at_mouse (int mouse_id)
 Return the screen pixel color underneath the mouse.
int translate_window_coordinates (anXWindow *from, int x, int y, anXWindow *to, int *xx, int *yy, anXWindow **kid)
int mouseisin (int mouse_id, anXWindow *win)
 Return whether the mouse is within the bounds of win.
int mouseposition (int mouse_id, anXWindow *win, int *x, int *y, unsigned int *state, anXWindow **child, int *screen)
 Find the mouse x,y in win coordinates, also return the pointer mask, and what child it is in if any.
LaxCompositeOp drawing_function (LaxCompositeOp mode)
void drawing_line_attributes (double width, int type, int cap, int join)
 Set characteristics of drawn lines.
unsigned long background_color (unsigned long newcolor)
 Set the new default background color, and return the old one.
void foreground_color (double r, double g, double b, double a)
void background_color (double r, double g, double b)
unsigned long foreground_color (unsigned long newcolor)
 Set the new default foreground color.
ScreenColorcoloravg (ScreenColor *result, ScreenColor *a, ScreenColor *b, float r)
 result=a*(1-r)+b*r. Returns result.
unsigned long pixelfromcolor (ScreenColor *col)
 Return conversion of col values to 8 bit color, as for Xlib's XSetForeground(). Ignores alpha.
void set_color_shift_info (unsigned int rm, unsigned int gm, unsigned int bm, unsigned int am)
 Set up how to pack colors within a 32 bit location.
unsigned long coloravg (unsigned long a, unsigned long b, float r)
 Return a scaled average of 2 colors. Returns equivalent of a*(1-r) + b*r.
void colorrgb (unsigned long col, int *r, int *g, int *b)
 Decompose a pixel color into separate red, green, and blue components.
unsigned long rgbcolor (int r, int g, int b)
 Get a pixel value suitable for X graphics functions from the r,g,b components.
unsigned long rgbcolorf (double r, double g, double b)
 Get pixel value from floating point channel values in range [0..1].
void draw_bevel (aDrawable *win, int bevel, unsigned long highlight, unsigned long shadow, int state, double x, double y, double w, double h)
 Draw a bevel with bevel thickness within x,y,w,h. Draws state== LAX_OFF=not pressed, LAX_ON=pressed.
flatpointdraw_thing_coordinates (DrawThingTypes thing, flatpoint *buffer, int buffer_size, int *n_ret, double scale, DoubleBBox *bounds)
 Get coordinates for various graphical things. Coordinates are in a square bound by x=[0..scale], y=[0..scale].
int draw_thing (aDrawable *win, double x, double y, double rx, double ry, int fill, DrawThingTypes thing)
 Draw a little graphic with current foreground and line width.
int draw_thing (aDrawable *win, double x, double y, double rx, double ry, DrawThingTypes thing, unsigned long fg, unsigned long bg, int lwidth)
 Draw a thing with outline color fg, and insides color bg.
void clear_window (anXWindow *win)
 Clear the window area.
void draw_rectangle (aDrawable *win, double x, double y, double w, double h)
 Draw a rectangle on win with the current foreground color.
void fill_rectangle (aDrawable *win, double x, double y, double w, double h)
 Fill a rectangle on win with the current foreground color.
void draw_line (aDrawable *win, double x1, double y1, double x2, double y2)
 Draw a line in screen coordinates.
void draw_arc (aDrawable *win, double x, double y, double xradius, double yradius, double start_radians, double end_radians)
 Draw an optionally filled arc. Angles are in radians.
void fill_arc (aDrawable *win, double x, double y, double xradius, double yradius, double start_radians, double end_radians)
void draw_arc_wh (aDrawable *win, double x, double y, double width, double height, double start_radians, double end_radians)
void fill_arc_wh (aDrawable *win, double x, double y, double width, double height, double start_radians, double end_radians)
void draw_lines (aDrawable *win, flatpoint *p, int n, int isclosed)
 Draw a line connecting the dots in p.
void fill_polygon (aDrawable *win, flatpoint *p, int n)
 Fill a polygon line connecting the dots in p with the current foreground color.
LaxFontget_default_font ()
double getextent (const char *str, int len, double *ex, double *ey, double *fasc, double *fdes, char r)
 Find the text extent with the default font for the given utf8 text.
double getextent (LaxFont *font, const char *str, int len, double *ex, double *ey, double *fasc, double *fdes, char r)
 Find the text extent with the given font for the given utf8 text.
double text_height ()
double textout (aDrawable *win, const char *thetext, int len, double x, double y, unsigned long align)
 Write one line of utf8 text out with the default LaxFont. Uses foreground color only.
double textout (aDrawable *win, LaxFont *font, const char *thetext, int len, double x, double y, unsigned long align)
double textout_matrix (aDrawable *win, double *m, const char *thetext, int len, double x, double y, unsigned long align)
double textout_rotated (aDrawable *win, double radians, const char *thetext, int len, double x, double y, unsigned long align)
double textout_rotated (aDrawable *win, LaxFont *font, double radians, const char *thetext, int len, double x, double y, unsigned long align)
double textout_multiline (aDrawable *win, const char *thetext, int len, double x, double y, unsigned long align)
 Write out possibly many lines of text. Each line delimited with a '
'.
void get_placement (LaxImage *image, const char *label, int gap, unsigned int how, int *w, int *h, int *tx, int *ty, int *ix, int *iy)
 Figure out the extent and placement of an image and a label.
void get_placement (int thingw, int thingh, const char *label, int gap, unsigned int how, int *w, int *h, int *tx, int *ty, int *ix, int *iy)
 Figure out how to place a box with dimensions thingw,thingh next to a text label.
int mouseisin (XID mouse_id, anXWindow *win)
template<class T >
T *LinkedList< T > disconnectNode ()
 If this is part of a list, then remove it.
void menuinfoDump (MenuInfo *menu, int indent)
int reversestrcmp (const char *s1, const char *s2)
int reversestrcasecmp (const char *s1, const char *s2)
int strcmp123 (const char *s1, const char *s2)
int strcmp321 (const char *s1, const char *s2)
unsigned long getUniqueNumber ()
 Return a unique unsigned long.
charmake_id (const char *base)
 Return a roughly unique id. Uniqueness is not guaranteed!
void simple_rgb_to_cmyk (double r, double g, double b, double *c, double *m, double *y, double *k)
 Convert an rgb color to cmyk.
void simple_rgb_to_cmyk (double *rgb, double *cmyk)
 Convert an rgb color to cmyk. Fields in range 0..1.
void simple_rgb_to_cmyk (int r, int g, int b, int *c, int *m, int *y, int *k, int max)
 Convert an rgb color to cmyk. Max is maximum value of the field, ie 255 for 8 bit, or 65535 for 16 bit.
void simple_rgb_to_cmyk (int *rgb, int *cmyk, int max)
 Convert an rgb color to cmyk. Max is maximum value of the field, ie 255 for 8 bit, or 65535 for 16 bit.
void simple_cmyk_to_rgb (double c, double m, double y, double k, double *r, double *g, double *b)
 Convert a cmyk color to rgb with components [0..1].
void simple_cmyk_to_rgb (int c, int m, int y, int k, int *r, int *g, int *b, int max)
 Convert a cmyk color to rgb. Max is maximum value of the field, ie 255 for 8 bit, or 65535 for 16 bit.
void simple_cmyk_to_rgb (int *cmyk, int *rgb, int max)
 Convert a cmyk color to rgb. Max is maximum value of the field, ie 255 for 8 bit, or 65535 for 16 bit.
void simple_cmyk_to_rgb (double *cmyk, double *rgb)
 Convert a cmyk color to rgb.
void simple_rgb_to_hsv (double r, double g, double b, double *h, double *s, double *v)
void simple_rgb_to_hsv (int r, int g, int b, int *h, int *s, int *v, int max)
void simple_rgb_to_hsv (int *rgb, int *hsv, int max)
void simple_rgb_to_hsv (double *rgb, double *hsv)
void simple_hsv_to_rgb (double h, double s, double v, double *r, double *g, double *b)
void simple_hsv_to_rgb (int h, int s, int v, int *r, int *g, int *b, int max)
void simple_hsv_to_rgb (int *hsv, int *rgb, int max)
void simple_hsv_to_rgb (double *hsv, double *rgb)
PaletterainbowPalette (int w, int h, int max, int include_gray_strip)
int key_value_from_name (const char *k)
const charkey_name_from_value (int ch, char *buf)
 Return a string name (printed into buf) for a non-modifier key.
void InstallShortcutManager (ShortcutManager *manager)
ShortcutManagerGetDefaultShortcutManager ()
 Return a default shortcut manager.
void FinalizeShortcutManager ()
 Dec count on the default shortcut manager, and set to null.
const charlax_nonprinting_key_name (int ch)
 Return a string identifier for non-printing keys known to the Laxkit.
static void AddAreaToMenu (MenuInfo *aream, ShortcutHandler *handler)
int hexify (char *str, int i)
 Put a hex string of i into str.
bool are_near (double a, double b, double eps=EPSILON)
void dumpctm (const double *d)
 Write out the transform d to cout, or to cerr if DBG is enabled.
double * transform_identity (double *result)
 Return identity matrix. If result==NULL, then return a new'd double[6].
double * transform_invert (double *result, const double *m)
 Invert m into result. If result==NULL, then return a new double[6].
int is_degenerate_transform (double *m)
double * transform_mult (double *result, const double *a, const double *b)
 Multiply 2 6 member transform arrays: result = a x b.
double * transform_rotate (double *m, double angle)
 Rotate m by angle. If m==NULL, then return a new'd double[6] with rotation angle.
double * transform_from_basis (double *result, flatpoint o, flatpoint x, flatpoint y)
 Find a transform from the given flat basis. Return new double[6] if result==NULL.
void transform_to_basis (double *m, flatpoint *o, flatpoint *x, flatpoint *y)
 Decompose a transform to an origin, x axis, and y axis.
double * transform_from_basics (double *result, double x, double y, double sx, double sy, double angle, double shear)
 ***imp me! Compose a transform from a position, x scale, y scale, rotation, and "shear".
void transform_to_basics (double *m, double *x, double *y, double *sx, double *sy, double *ang, double *shear)
 Decompose a transform to simple measures of position, x scale, y scale, rotation, and "shear".
double * transform_set (double *m, double a, double b, double c, double d, double x0, double y0)
 Simple set m[]={a,b,c,d,x0,y0}.
void transform_copy (double *dest, const double *src)
 Simple copy transform dest[0..5]=src[0..5]. dest and src must both exist.
flatpoint transform_point_inverse (const double *m, flatpoint p)
 Return point p transformed by the inverse of matrix m. newpoint=[x,y,1]*m^-1.
flatpoint transform_point (const double *m, double x, double y)
 Return point p transformed by matrix m. newpoint=[x,y,1]*m.
flatpoint transform_point (const double *m, flatpoint p)
 Return point p transformed by matrix m. newpoint=[p.x,p.y,1]*m.
flatpoint transform_vector (const double *m, flatpoint p)
 Return vector p transformed by matrix m. newpoint=[p.x,p.y,0]*m. Basically rotate+scale+shear, no translate.
double * transform_from_3x3_fixed (double *result, int M[3][3])
 Create as possible an affine transform from M, which has 16.16 fixed point elements.
void transform_to_3x3_fixed (int M[3][3], double *m)
 Fill result with the affine transform m.
double * svgtransform (const char *v, double *m)
 Based on an svg transform in v, return the equivalent 6 member affine transform.
UndoManagerGetUndoManager ()
UndoManagerSetUndoManager (UndoManager *newmanager)
SimpleUnitCreateDefaultUnits (SimpleUnit *units)
 Create a SimpleUnit collection of some common units.
UnitManagerGetUnitManager ()
 Return unit_manager, initializing it with CreateDefaultUnits() if it was NULL.
unsigned utf8decode (const char *p, const char *end, int *len)
const charutf8fwd (const char *p, const char *start, const char *end)
const charutf8back (const char *p, const char *start, const char *end)
int utf8bytes (unsigned ucs)
int utf8encode (unsigned ucs, char *buf)
unsigned utf8towc (const char *src, unsigned srclen, wchar_t *dst, unsigned dstlen)
unsigned utf8toa (const char *src, unsigned srclen, char *dst, unsigned dstlen)
unsigned utf8fromwc (char *dst, unsigned dstlen, const wchar_t *src, unsigned srclen)
unsigned utf8froma (char *dst, unsigned dstlen, const char *src, unsigned srclen)
int utf8locale ()
unsigned utf8tomb (const char *src, unsigned srclen, char *dst, unsigned dstlen)
unsigned utf8frommb (char *dst, unsigned dstlen, const char *src, unsigned srclen)
int utf8test (const char *src, unsigned srclen)

Variables

static DBG int numofanObject = 0
DeleteRefCountedFunc defaultDeleteRefCountedFunc = NULL
static struct tms tmsstruct
static const char compose_pairs []
static const char dead_keys []
NewDisplayerFunc newDisplayer = NULL
 The default Displayer "constructor".
static PtrStack
< PreviewerFunction
previewers
static FontManagerfontmanager = NULL
 There can be only one (default displayer).
NewFontManagerFunc newFontManager = NULL
 The default FontManager "constructor".
static PtrStack< charlax_larks (2)
static NumStack< intlark_alpha_sorted
Imlib_Color_Modifier alpha_modifier = NULL
DATA8 linearmap [256]
DATA8 alphamap [256]
Drawable alternate_drawable = 0
int lastalpha = -1
int usealpha = 0
DefaultImageTypeFunc default_image_type = NULL
ImageOutFunc image_out = NULL
 The default image to window drawing function.
ImageOutRotatedFunc image_out_rotated = NULL
 The default image to window drawing function with rotation and scaling.
ImageOutSkewedFunc image_out_skewed = NULL
 The default image to window drawing function with skewing.
ImageOutMatrixFunc image_out_matrix = NULL
 The default image to window drawing function with an affine matrix.
LoadImageFunc load_image = NULL
 The default image loading function.
LoadImageWithPreviewFunc load_image_with_preview = NULL
ImageFromBufferFunc image_from_buffer = NULL
CreateNewImageFunc create_new_image = NULL
static ImageLoaderimageloaders = NULL
GeneratePreviewFunc generate_preview_image = NULL
 The base preview creator.
static Displayerdp = NULL
 There can be only one (default displayer).
static unsigned long default_bg_color = 0
static unsigned long default_fg_color = 0
static unsigned int red_shift = 0
static unsigned int green_shift = 8
static unsigned int blue_shift = 16
static unsigned int alpha_shift = 24
static unsigned int red_mask = 0xff
static unsigned int green_mask = 0xff00
static unsigned int blue_mask = 0xff0000
static unsigned int alpha_mask = 0xff000000
static unsigned int red_size = 256
static unsigned int green_size = 256
static unsigned int blue_size = 256
static unsigned int alpha_size = 256
static unsigned int color_size = 256
const charBuiltinPaperSizes [60 *5]
static ShortcutManagerdefault_shortcutmanager = NULL
const char hexdigits [17] = "0123456789abcdef"
static UndoManagerdefault_undo_manager = NULL
SimpleUnitunit_manager = NULL
 A general repository for units.
static unsigned short cp1252 [32]

Detailed Description

The mother of all Laxkit classes.


Enumeration Type Documentation

ERROR_Ok, means everything checks out. ERROR_Fail is an extreme error which should interrupt whatever you are doing. ERROR_Warning is a generic error which does not halt anything, but users can attend to it. Other values above ERROR_MAX can be used for other warnings.

Compositing operators for Displayer drawing functions.

These are basically one to one with Cairo's operators.

Enumerator:
LAXOP_Clear 
  • Block out parts of dest that are in src
LAXOP_Source 
  • Lay on src totally
LAXOP_Over 
  • Lay on src with transparency
LAXOP_In 
  • Remove dest, but only put src where dest was
LAXOP_Out 
  • Use all src, but mix with parts that overlap dest
LAXOP_Atop 
  • Use all dest, but mix where src was
LAXOP_Dest 
  • Use only dest, ignore src, this is a no-op
LAXOP_Dest_over 
  • Use dest as src, and src as dest
LAXOP_Dest_in 
  • Like In, but swap dest and src
LAXOP_Dest_out 
  • Like Out, but swap dest and src
LAXOP_Dest_atop 
  • Like Atop, but swap dest and src
LAXOP_Xor 
  • Perform xor
LAXOP_Add 
  • Add color values, clamping to max
LAXOP_Saturate 
  • Pump it up
LAXOP_Multiply 
  • At least as dark as darkest
LAXOP_Screen 
  • At least as light as lightest
LAXOP_Overlay 
  • Darkens or lightens depending on color
LAXOP_Darken 
LAXOP_Lighten 
LAXOP_Color_dodge 
LAXOP_Color_burn 
LAXOP_Hard_light 
LAXOP_Soft_light 
LAXOP_Difference 
LAXOP_Exclusion 
LAXOP_Hsl_hue 
LAXOP_Hsl_saturation 
LAXOP_Hsl_color 
LAXOP_Hsl_luminosity 

Function Documentation

flatpoint * Laxkit::bez_circle ( flatpoint points,
int  numpoints,
double  x,
double  y,
double  r 
)

Return an approximate circle, with numpoints control points, or 4 if numpoints<=1.

Center at (x,y) with radius r.

To make 2 vertex points lie $\theta$ degrees apart on a circle of radius r, then the control rods will have length v:

\[ v=\frac{4\:r}{3}\:\frac{2\;sin(\theta/2)-sin(\theta)}{1-cos(\theta)}; \]

The first point in the returned array is a control point for the second point in the array. So points alternate handle-node-handle - handle-node-handle - ... So there will be numpoints*3 points in the returned array.

If points==NULL, then return a new flatpoint[3*numpoints], else it is assumed that pts has at least 3*numpoints allocated.

Referenced by draw_thing_coordinates().

double Laxkit::bez_distance_to_t ( double  dist,
flatpoint  p1,
flatpoint  c1,
flatpoint  c2,
flatpoint  p2,
int  resolution 
)

From a physical distance, return the corresponding t parameter value.

Note that this is probably not very reliable for long segments.

Referenced by LaxInterfaces::Path::distance_to_t(), and LaxInterfaces::Path::PointAlongPath().

flatpoint * Laxkit::bez_ellipse ( flatpoint points,
int  numsegments,
double  x,
double  y,
double  xr,
double  yr,
flatvector  xaxis,
flatvector  yaxis,
double  start_angle,
double  end_angle 
)

Create an ellipse composed of numsegments bezier segments, or 4 if numsegments<=1.

Start and end in radians. If start==end, then assume a full circle.

References transform_from_basis(), and transform_point().

Referenced by Laxkit::Displayer::drawfocusellipse().

int Laxkit::bez_intersection ( flatpoint  p1,
flatpoint  p2,
int  isline,
flatpoint  bp1,
flatpoint  bc1,
flatpoint  bc2,
flatpoint  bp2,
int  resolution,
flatpoint point_ret,
double *  t_ret 
)

For when you only need one intersection on one bezier segment. Return 1 for hit found, or 0.

This just calls the fuller bez_intersections() with appropriate settings.

References bez_intersections().

int Laxkit::bez_intersections ( flatpoint  P1,
flatpoint  P2,
int  isline,
flatpoint points,
int  n,
int  resolution,
double  startt,
flatpoint points_ret,
int  np,
double *  t_ret,
int  nt,
double *  endt 
)

Transform points to coordinate system where p1 is the origin, and p2 corresponds to point (1,0). Then it is easy to find intersections through the segment, or through the line going through p1 and p2, since that is wherever the new x axis is crossed.

Assumes points is an array structured as v-c-c-v-c-c...c-c-v. For closed paths, you must ensure the final vertex is the same as the initial. So there should be n/3+1 vertices in the list.

This is a kind of primitive approximation, based on sampling resolution number of points per v-c-c-v bezier segment.

Return value is number of hits actually parsed. If the whole path was not processed, then endt is assigned the ending t, else it gets 0.

Parameters:
pointsarray of v-c-c-v
nnumber of flatpoints in points
resolutionhow many linear segments to begin search for each segment
starttoffset this many segments before searching
points_retthis must be allocated already
npnumber of points allocated in points_ret, return up to this many hits
t_retthis must be allocated already (optional, can be NULL)
ntnumber of doubles allocated in t_ret
endtt at which searching stopped (hit max of np)

References transform_from_basis(), transform_invert(), transform_point(), and transpose().

Referenced by bez_intersection(), Laxkit::CurveInfo::f_autosmooth(), Laxkit::CurveInfo::f_bezier(), and LaxInterfaces::Path::Intersect().

flatpoint * Laxkit::bez_points ( flatpoint to_points,
int  numsegs,
flatpoint from_points,
int  resolution 
)

Break down numsegs bezier segments to a polyline with resolution*numsegs points.

If numsegs==1, then from_points is an array of points: v-c-c-v. Each additional segment means that two control points and another vertex follow (-c-c-v).

If to_points==NULL, then return a new flatpoint[numsegs*resolution];

Referenced by bez_points(), bez_to_points(), and Laxkit::DisplayerXlib::buildXPoints().

flatpoint* Laxkit::bez_points ( flatpoint to_points,
int  numsegs,
flatpoint from_points,
int  resolution,
int  isclosed,
int  atend 
)

Break down numsegs bezier segments to a polyline with resolution*numsegs points.

from_points is a list of bezier vertices and control points. If atend==0, then the array starts with a vertex, and that vertex's previous control point is at the end of from_points. Otherwise it starts with a control point, then a vertex. numsegs is the number of bezier segments in from_points. Each segment is defined by 4 points. If closed==1, then the final vertex connects to the first vertex (after 2 control points). Note that an array c-v-c is valid, provided that isclosed==1 and atend==0.

If to_points==NULL, then return a new flatpoint[numsegs*resolution];

void Laxkit::bez_subdivide ( double  t,
flatpoint  p1,
flatpoint  c1,
flatpoint  c2,
flatpoint  p2,
flatpoint points_ret 
)

Cut the bezier segment in two at t.

points_ret must be an already allocated array of 5 points. It is filled with the new found points as follows:

   points_ret[0] = new handle of p1
   points_ret[1] = new tonext of new vertex
   points_ret[2]= new vertex
   points_ret[3]= new toprev of new vertex
   points_ret[4]= new handle of p2
 

References bez_point(), and bez_tangent().

Referenced by LaxInterfaces::PathInterface::CutNear().

double Laxkit::bez_t_to_distance ( double  T,
flatpoint  p1,
flatpoint  c1,
flatpoint  c2,
flatpoint  p2,
int  resolution 
)

From a t parameter, return the corresponding distance value.

Note that this is probably not very reliable for long segments. It only checks against resolution number of straight line segments.

Referenced by LaxInterfaces::Path::t_to_distance().

flatpoint Laxkit::bez_tangent ( double  t,
flatpoint  p1,
flatpoint  c1,
flatpoint  c2,
flatpoint  p2 
)

Return the numerical tangent at t.

Note that this is NOT necessarily the visual tangent! If a control point is on the vertex, then the tangent there is the null vector.

Referenced by bez_subdivide(), and bez_visual_tangent().

flatpoint * Laxkit::bez_to_points ( flatpoint to_points,
flatpoint from_points,
int  n,
int  resolution,
int  closed 
)

Decompose the bezier curve to a polyline.

There are n vertices, and n*3 points in from_points. The first bezier segment is from_points[1]-from_points[2],from_points[3],from_points[4]. If closed is nonzero, then assume the final 2 points and the first 2 points of from_points make up the final segment of the curve.

to_points is a flatpoint[n*resolution] array. If to_points==NULL, then a new'd array is returned, else be sure that to_points has enough space for n*resolution flatpoints.

If n<2, NULL is returned.

References bez_points().

Referenced by point_is_in_bez().

flatpoint Laxkit::bez_visual_tangent ( double  t,
flatpoint  p1,
flatpoint  c1,
flatpoint  c2,
flatpoint  p2 
)

Return the visual tangent at t.

If t>0 and t<1, then just return bez_tangent(). Otherwise, approximate a vector with a point just off the path. If t<0 or t>1, then a null vector is returned.

Todo:
this could use L'Hopital's rule, which says if two functions in this case x(t) and y(t) approach 0, then x'(t) and y'(t) are such that x/y=x'/y' when limit x'/y' exists...

References bez_point(), and bez_tangent().

unsigned int Laxkit::composekey ( unsigned int  k1,
unsigned int  k2 
)

From 2 keys, typically an ascii key and a dead key, compose another.

If k1 and k2 are not deadkeys and k1 and k2 are greater than 127, then 0 is returned.

If k2==0, then try to find a compose code for k1 on its own. In this case, if none is found, 0 is returned.

If both k1 and k2 are valid keys, and if the combination is not recognized, then k2 is returned.

This is used by anXApp to decipher key input for characters with accents and such.

References composekey().

Referenced by composekey().

LaxImage * Laxkit::create_new_imlib_image ( int  w,
int  h 
)

Simply return a new imlib image.

Note that this image will not be cached, since it is not associated with a file.

Referenced by InitImlib2Backend().

SimpleUnit * Laxkit::CreateDefaultUnits ( SimpleUnit *  units)

Create a SimpleUnit collection of some common units.

This will add "pixel" units with a scaling of 1. If you want it to be meaningful, you will have to manually adjust this value. All other units assume that meters is 1.

Defined are inches, feet, centimeters, millimeters, meters, points, and pixels

If units==NULL, return a new SimpleUnit. Else add to units.

References Laxkit::SimpleUnit::AddUnits(), and CreateDefaultUnits().

Referenced by CreateDefaultUnits(), and GetUnitManager().

const char * Laxkit::dayofweek ( int  day,
int  lvl,
int  sunday 
)

Return text for day of the week.

Return S,M,T,W... for lvl==0. Sun,Mon,Tue,... for lvl==1, or Sunday,Monday,...

sunday is which position "sunday" occupies. 0 means the first position. Say sunday==6, then day==0 will return "Monday".

References dayofweek().

Referenced by dayofweek(), and Laxkit::LaxDate::LaxDate().

int Laxkit::days_in_month ( int  month,
int  year 
)

If leap, then return 29 for February, else 28 for February. Otherwise, April, June, September, November have 30, and the others have 31.

References days_in_month(), and is_leap_year().

Referenced by days_in_month(), Laxkit::DateSelector::MouseMove(), Laxkit::LaxDate::Set(), and Laxkit::DateSelector::SetDate().

template<class T >
T* LinkedList<T> Laxkit::disconnectNode ( )

If this is part of a list, then remove it.

Connects prev_node to next_node if possible. Returns prev_node if it exists, or next_node otherwise. prev_node and next_node get set to NULL.

Referenced by Laxkit::LinkedList< T >::~LinkedList().

int Laxkit::eventscreen ( int  e_type,
unsigned long  mask 
)

Check to see if some kinds of event types are in mask, and so allow them through.

Note that only KeyPress/KeyRelease/ButtonPress/ButtonRelease/MotionNotify/Enter/Leave/FocusIn/Out GraphicsExpose/Expose events are screened. All others pass right through.

Returns nonzero for do NOT allow event (matched in mask), 0 for allow event

References eventscreen(), and xlib_event_name().

Referenced by eventscreen().

unsigned int Laxkit::filterkeysym ( KeySym  keysym,
unsigned int state 
)

Converts an Xlib keysym to a Laxkit key value.

This is called when deciphering key input from X via Xutf8LookupString(), when it returns a keysym but no buffer data. It is then assumed that the keysym corresponds to some control or function key.

If the keysym corresponds directly to a UCS value, then that value is returned. This happens when the keysym>0x01000000 and less than 0x02000000. The UCS value is then keysym&0x00ffffff.

If a keypad key is detected, then state is modified to have KeypadMask set.

Look in laxdefs.h for a number of key codes corresponding to various "extra" keys found on some keyboards.

Todo:
If the keysym corresponds to any of the keys in laxdefs.h, then it is mapped to those values. Otherwise...? CharInput() says if the returned value is > 0x1000000, then it is either a Laxkit value, or the X keysym plus 0x1000000, which is not quite how it is coded right now. need to check if the keysym can still be converted to a unicode value. keysyms correspond pretty well to it, and should have been converted to the buffer in event() if so, but not sure of that.

References filterkeysym().

Referenced by Laxkit::CoreXlibKeyboard::eventFilter(), and filterkeysym().

ShortcutManager * Laxkit::GetDefaultShortcutManager ( )

Return a default shortcut manager.

Defines a default manager if none exists.

References default_shortcutmanager.

LaxImage * Laxkit::image_from_buffer_imlib ( unsigned char buffer,
int  w,
int  h,
int  stride 
)

Basically create a nem Imlib_Image, and copy buffer to its data.

buffer is assumed to be ARGB 8 bit data.

Note that this image will not be cached, since it is not associated with a file.

Referenced by InitImlib2Backend().

void Laxkit::InitImlib2Backend ( )
void Laxkit::InstallShortcutManager ( ShortcutManager *  manager)

If manager==NULL, then remove the old default. This will result in NO manager being defined. To reallocate one, simply call GetDefaultShortcutManager(), and a new one will be generated. You might want to pass in NULL at the end of a program, when memory is all being freed.

Takes posession of the manager count, meaning if it had a count of 1, it will still have a count of 1, and it will be dec_count()'d when removed.

References Laxkit::anObject::dec_count(), default_shortcutmanager, and Laxkit::anObject::inc_count().

int Laxkit::is_leap_year ( int  year)

A leap year is divisible by 4, but NOT divisible by 100 EXCEPT when divisible by 400.

References is_leap_year().

Referenced by days_in_month(), days_in_year(), and is_leap_year().

const char * Laxkit::key_name_from_value ( int  ch,
char buf 
)

Return a string name (printed into buf) for a non-modifier key.

If the value is not translatable, return NULL, and nothing is written to buf. Buf should be 10 bytes or longer.

References lax_nonprinting_key_name().

Referenced by Laxkit::ShortcutManager::ShortcutString().

int Laxkit::lark_id_from_str ( const char str,
char  createifabsent 
)

Return the id associated with str.

If createifabsent!=0 and str is not known, then a new association is added, and the new id is returned.

If createifabsent==0 and the string is not known, then 0 is returned. No string can have 0 associated with it.

Todo:
*** make threadsafe

References Laxkit::NumStack< T >::e, lark_alpha_sorted, lark_position(), Laxkit::PtrStack< T >::n, newstr(), Laxkit::NumStack< T >::push(), and Laxkit::PtrStack< T >::push().

static int Laxkit::lark_position ( const char str,
int c 
)
static

Find the index in the lark_alpha_sorted stack that str would be found.

If str is not there, then c is filled with that position in lark_alpha_sorted that the id of the lark must be pushed into.

Todo:
make this faster via binary search

References Laxkit::NumStack< T >::e, Laxkit::PtrStack< T >::e, lark_alpha_sorted, and Laxkit::NumStack< T >::n.

Referenced by lark_id_from_str().

const char * Laxkit::lark_str_from_id ( int  id)

Return pointer to string associated with id, or NULL if none.

Yes, lark is a take off on Glib's quarks: Laxkit+quARK.

Laxkit maintains a hash of strings and associated ids, that can be used as a shortcut for checking string equality for commonly used strings, namely event names. These are a replacement for X Atoms, so that Laxkit events do not clutter up the X server.

Todo:
*** make threadsafe

References Laxkit::PtrStack< T >::e, and Laxkit::PtrStack< T >::n.

const char* Laxkit::lax_nonprinting_key_name ( int  ch)

Return a string identifier for non-printing keys known to the Laxkit.

Returns a string like "Esc", "Bksp", or "F1".

Referenced by key_name_from_value().

void Laxkit::laximlib_alternate_drawable ( Drawable  drawable)

Override the drawable used for drawing out images.

Pass 0 to go back to default behavior.

int Laxkit::laximlib_generate_preview ( const char original_file,
const char to_preview_file,
const char format,
int  width,
int  height,
int  fit 
)

Generate a preview image. Return 0 for success.

WARNING: this does no sanity checking on file names, and will force an overwrite. It is the responsibility of the calling code to do those things, and to ensure that preview is in fact a writable path.

Todo:

*** afterwards, make sure preview was actually written

if making a freedesktop preview, must add proper tags to the resulting png

Referenced by InitImlib2Backend().

char * Laxkit::make_id ( const char base)

Return a roughly unique id. Uniqueness is not guaranteed!

Say base=="blah" then something like "blah12" will be returned.

This currently uses Laxkit::getUniqueNumber(), and simply appends it to base. Please note that if you load in something, either a laidout document or a resource, it is possible to have name collision.

References getUniqueNumber(), and make_id().

Referenced by LaxInterfaces::SomeData::Id(), and make_id().

void Laxkit::mapname ( char buf,
int  m 
)
Todo:
be ablte use control, meta, and alt?

Referenced by Laxkit::ColorBox::tooltip().

const char * Laxkit::monthname ( int  month,
int  lvl 
)

Return the month name. Month is [1..12].

If lvl==0, return Jan, Feb, ... If lvl==1, return January, February, ...

References monthname().

Referenced by monthname().

int Laxkit::SetNewFontManagerFunc ( const char backend)

Set the default "constructor" for FontManager objects.

If func==NULL, then use the default, checks for cairo, then for xlib. Return 0 for success, or 1 for unable to set to non-null.

References newFontManager, and SetNewFontManagerFunc().

Referenced by SetNewFontManagerFunc().

UndoManager * Laxkit::SetUndoManager ( UndoManager *  newmanager)

Any old manager will be deleted, and the newmanager pointer taken.

References SetUndoManager().

Referenced by SetUndoManager().

double * Laxkit::svgtransform ( const char v,
double *  m 
)

Based on an svg transform in v, return the equivalent 6 member affine transform.

If m==NULL, then return a new double[6]. Else assume m has room for 6 doubles, and return m.

On error, return NULL. If m!=NULL, it gets set to identity on error.

Todo:

this needs thorough testing

should make the reverse too, breaking down to only scale, or only translate, if possible

References svgtransform(), transform_copy(), transform_identity(), and transform_mult().

Referenced by svgtransform().

double * Laxkit::transform_from_3x3_fixed ( double *  result,
int  M[3][3] 
)

Create as possible an affine transform from M, which has 16.16 fixed point elements.

If result is NULL, then create and return a new double[6].

This is mainly to assist in using XTransform in the XRender extension, which allows full 3x3 transformations. This might not be so useful, and in the future, this function might be removed.

      [ a  b  0 ]
    M=[ c  d  0 ]  –> [a b c d tx ty]
      [ tx ty 1 ]
 

References transform_from_3x3_fixed().

Referenced by transform_from_3x3_fixed().


Variable Documentation

const char Laxkit::dead_keys[]
static
Initial value:
{
'`',
'\'',
'^',
'~',
'-',
'u',
'.',
':',
'*',
'"',
'v',
',',
','
}
ShortcutManager* Laxkit::default_shortcutmanager = NULL
static

Retrieve with GetDefaultShortcutManager() and set with InstallShortCutManager().

Referenced by FinalizeShortcutManager(), GetDefaultShortcutManager(), and InstallShortcutManager().

DeleteRefCountedFunc Laxkit::defaultDeleteRefCountedFunc = NULL

If this function pointer is not NULL, then every time a anObject::dec_count() results in a count less than or equal to 0, that function gets called with the object address as the argument, unless the corresponding anObject::deleteMe is not NULL, in which case that deleteMe is called instead of this function.

This could be used, for instance to remove the object from some stack, when the object is no longer referenced.

Should return 1 if the object is no longer needed, and the destructor should delete it, and 0 if it might still exist, like if it gets thrown onto a hidden cache, and should not yet be deleted.

NOTE, currently, this is not used in Laxkit.

Referenced by Laxkit::anObject::dec_count().

NumStack<int> Laxkit::lark_alpha_sorted
static

lark_alpha_sorted[0] is index in lax_larks of lowest string. lark_alpha_sorted[lark_alpha_sorted.n-1] is index in lax_larks of highest string.

Referenced by lark_id_from_str(), and lark_position().

SimpleUnit* Laxkit::unit_manager = NULL

A general repository for units.

This starts out as NULL. You would initialize it and retrieve it with GetUnitManager().

Referenced by GetUnitManager().


Mon Feb 17 2014 11:52:58, Laxkit