Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
Rotated.cxx File Reference
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include "TMath.h"
Include dependency graph for Rotated.cxx:

Classes

struct  RotatedTextItemTemplate_t
 
struct  StyleTemplate_t
 

Macros

#define _XVERTEXT_INCLUDED_
 
#define BCENTRE   8
 
#define BLEFT   7
 
#define BRIGHT   9
 
#define CACHE_BITMAPS
 
#define CACHE_SIZE_LIMIT   0
 
#define DEBUG_PRINT1(a)   if (gRotatedDebug) printf (a)
 
#define DEBUG_PRINT2(a, b)   if (gRotatedDebug) printf (a, b)
 
#define DEBUG_PRINT3(a, b, c)   if (gRotatedDebug) printf (a, b, c)
 
#define DEBUG_PRINT4(a, b, c, d)   if (gRotatedDebug) printf (a, b, c, d)
 
#define DEBUG_PRINT5(a, b, c, d, e)   if (gRotatedDebug) printf (a, b, c, d, e)
 
#define M_PI   3.14159265358979323846
 
#define MCENTRE   5
 
#define MLEFT   4
 
#define MRIGHT   6
 
#define NONE   0
 
#define TCENTRE   2
 
#define TLEFT   1
 
#define TRIGHT   3
 
#define XV_COPYRIGHT    "xvertext routines Copyright (c) 1993 Alan Richardson"
 
#define XV_VERSION   5.0
 

Typedefs

typedef struct RotatedTextItemTemplate_t RotatedTextItem_t
 

Functions

static XImageMakeXImage (Display *dpy, int w, int h)
 Create an XImage structure and allocate memory for it.
 
char * my_strdup (const char *str)
 Routine to mimic ‘strdup()’ (some machines don't have it)
 
char * my_strtok (char *str1, const char *str2)
 Routine to replace ‘strtok’ : this one returns a zero length string if it encounters two consecutive delimiters.
 
static void XRotAddToLinkedList (Display *dpy, RotatedTextItem_t *item)
 Adds a text item to the end of the cache, removing as many items from the front as required to keep cache size below limit.
 
static RotatedTextItem_tXRotCreateTextItem (Display *dpy, XFontStruct *font, float angle, char *text, int align)
 Create a rotated text item.
 
int XRotDrawAlignedImageString (Display *dpy, XFontStruct *font, float angle, Drawable drawable, GC gc, int x, int y, char *text, int align)
 A front end to XRotPaintAlignedString: -does alignment, paints background.
 
int XRotDrawAlignedString (Display *dpy, XFontStruct *font, float angle, Drawable drawable, GC gc, int x, int y, char *text, int align)
 A front end to XRotPaintAlignedString: -does alignment, no background.
 
static int XRotDrawHorizontalString (Display *dpy, XFontStruct *font, Drawable drawable, GC gc, int x, int y, char *text, int align, int bg)
 Draw a horizontal string in a quick fashion.
 
int XRotDrawImageString (Display *dpy, XFontStruct *font, float angle, Drawable drawable, GC gc, int x, int y, char *str)
 A front end to XRotPaintAlignedString: -no alignment, paints background.
 
int XRotDrawString (Display *dpy, XFontStruct *font, float angle, Drawable drawable, GC gc, int x, int y, char *str)
 A front end to XRotPaintAlignedString: -no alignment, no background.
 
static void XRotFreeTextItem (Display *dpy, RotatedTextItem_t *item)
 Free the resources used by a text item.
 
static XImageXRotMagnifyImage (Display *dpy, XImage *ximage)
 Magnify an XImage using bilinear interpolation.
 
static int XRotPaintAlignedString (Display *dpy, XFontStruct *font, float angle, Drawable drawable, GC gc, int x, int y, char *text, int align, int bg)
 Aligns and paints a rotated string.
 
static RotatedTextItem_tXRotRetrieveFromCache (Display *dpy, XFontStruct *font, float angle, char *text, int align)
 Query cache for a match with this font/text/angle/alignment request, otherwise arrange for its creation.
 
void XRotSetBoundingBoxPad (int p)
 Set the padding used when calculating bounding boxes.
 
void XRotSetMagnification (float m)
 Set the font magnification factor for all subsequent operations.
 
XPoint * XRotTextExtents (Display *, XFontStruct *font, float angle, int x, int y, char *text, int align)
 Calculate the bounding box some text will have when painted.
 
float XRotVersion (char *str, int n)
 Return version/copyright information.
 

Variables

static RotatedTextItem_tgFirstTextItem = nullptr
 
static int gRotatedDebug =0
 
static struct StyleTemplate_t gRotStyle
 

Macro Definition Documentation

◆ _XVERTEXT_INCLUDED_

#define _XVERTEXT_INCLUDED_

Definition at line 5 of file Rotated.cxx.

◆ BCENTRE

#define BCENTRE   8

Definition at line 60 of file Rotated.cxx.

◆ BLEFT

#define BLEFT   7

Definition at line 59 of file Rotated.cxx.

◆ BRIGHT

#define BRIGHT   9

Definition at line 61 of file Rotated.cxx.

◆ CACHE_BITMAPS

#define CACHE_BITMAPS

Definition at line 82 of file Rotated.cxx.

◆ CACHE_SIZE_LIMIT

#define CACHE_SIZE_LIMIT   0

Definition at line 75 of file Rotated.cxx.

◆ DEBUG_PRINT1

#define DEBUG_PRINT1 (   a)    if (gRotatedDebug) printf (a)

Definition at line 96 of file Rotated.cxx.

◆ DEBUG_PRINT2

#define DEBUG_PRINT2 (   a,
  b 
)    if (gRotatedDebug) printf (a, b)

Definition at line 97 of file Rotated.cxx.

◆ DEBUG_PRINT3

#define DEBUG_PRINT3 (   a,
  b,
  c 
)    if (gRotatedDebug) printf (a, b, c)

Definition at line 98 of file Rotated.cxx.

◆ DEBUG_PRINT4

#define DEBUG_PRINT4 (   a,
  b,
  c,
  d 
)    if (gRotatedDebug) printf (a, b, c, d)

Definition at line 99 of file Rotated.cxx.

◆ DEBUG_PRINT5

#define DEBUG_PRINT5 (   a,
  b,
  c,
  d,
  e 
)    if (gRotatedDebug) printf (a, b, c, d, e)

Definition at line 100 of file Rotated.cxx.

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 105 of file Rotated.cxx.

◆ MCENTRE

#define MCENTRE   5

Definition at line 57 of file Rotated.cxx.

◆ MLEFT

#define MLEFT   4

Definition at line 56 of file Rotated.cxx.

◆ MRIGHT

#define MRIGHT   6

Definition at line 58 of file Rotated.cxx.

◆ NONE

#define NONE   0

Definition at line 52 of file Rotated.cxx.

◆ TCENTRE

#define TCENTRE   2

Definition at line 54 of file Rotated.cxx.

◆ TLEFT

#define TLEFT   1

Definition at line 53 of file Rotated.cxx.

◆ TRIGHT

#define TRIGHT   3

Definition at line 55 of file Rotated.cxx.

◆ XV_COPYRIGHT

#define XV_COPYRIGHT    "xvertext routines Copyright (c) 1993 Alan Richardson"

Definition at line 45 of file Rotated.cxx.

◆ XV_VERSION

#define XV_VERSION   5.0

Definition at line 44 of file Rotated.cxx.

Typedef Documentation

◆ RotatedTextItem_t

Function Documentation

◆ MakeXImage()

static XImage * MakeXImage ( Display *  dpy,
int  w,
int  h 
)
static

Create an XImage structure and allocate memory for it.

Definition at line 260 of file Rotated.cxx.

◆ my_strdup()

char * my_strdup ( const char *  str)

Routine to mimic ‘strdup()’ (some machines don't have it)

Definition at line 176 of file Rotated.cxx.

◆ my_strtok()

char * my_strtok ( char *  str1,
const char *  str2 
)

Routine to replace ‘strtok’ : this one returns a zero length string if it encounters two consecutive delimiters.

Definition at line 190 of file Rotated.cxx.

◆ XRotAddToLinkedList()

static void XRotAddToLinkedList ( Display *  dpy,
RotatedTextItem_t item 
)
static

Adds a text item to the end of the cache, removing as many items from the front as required to keep cache size below limit.

Definition at line 1104 of file Rotated.cxx.

◆ XRotCreateTextItem()

static RotatedTextItem_t * XRotCreateTextItem ( Display *  dpy,
XFontStruct *  font,
float  angle,
char *  text,
int  align 
)
static

Create a rotated text item.

Definition at line 791 of file Rotated.cxx.

◆ XRotDrawAlignedImageString()

int XRotDrawAlignedImageString ( Display *  dpy,
XFontStruct *  font,
float  angle,
Drawable  drawable,
GC  gc,
int  x,
int  y,
char *  text,
int  align 
)

A front end to XRotPaintAlignedString: -does alignment, paints background.

Definition at line 316 of file Rotated.cxx.

◆ XRotDrawAlignedString()

int XRotDrawAlignedString ( Display *  dpy,
XFontStruct *  font,
float  angle,
Drawable  drawable,
GC  gc,
int  x,
int  y,
char *  text,
int  align 
)

A front end to XRotPaintAlignedString: -does alignment, no background.

Definition at line 305 of file Rotated.cxx.

◆ XRotDrawHorizontalString()

static int XRotDrawHorizontalString ( Display *  dpy,
XFontStruct *  font,
Drawable  drawable,
GC  gc,
int  x,
int  y,
char *  text,
int  align,
int  bg 
)
static

Draw a horizontal string in a quick fashion.

Definition at line 553 of file Rotated.cxx.

◆ XRotDrawImageString()

int XRotDrawImageString ( Display *  dpy,
XFontStruct *  font,
float  angle,
Drawable  drawable,
GC  gc,
int  x,
int  y,
char *  str 
)

A front end to XRotPaintAlignedString: -no alignment, paints background.

Definition at line 294 of file Rotated.cxx.

◆ XRotDrawString()

int XRotDrawString ( Display *  dpy,
XFontStruct *  font,
float  angle,
Drawable  drawable,
GC  gc,
int  x,
int  y,
char *  str 
)

A front end to XRotPaintAlignedString: -no alignment, no background.

Definition at line 283 of file Rotated.cxx.

◆ XRotFreeTextItem()

static void XRotFreeTextItem ( Display *  dpy,
RotatedTextItem_t item 
)
static

Free the resources used by a text item.

Definition at line 1206 of file Rotated.cxx.

◆ XRotMagnifyImage()

static XImage * XRotMagnifyImage ( Display *  dpy,
XImage ximage 
)
static

Magnify an XImage using bilinear interpolation.

Definition at line 1229 of file Rotated.cxx.

◆ XRotPaintAlignedString()

static int XRotPaintAlignedString ( Display *  dpy,
XFontStruct *  font,
float  angle,
Drawable  drawable,
GC  gc,
int  x,
int  y,
char *  text,
int  align,
int  bg 
)
static

Aligns and paints a rotated string.

Definition at line 327 of file Rotated.cxx.

◆ XRotRetrieveFromCache()

static RotatedTextItem_t * XRotRetrieveFromCache ( Display *  dpy,
XFontStruct *  font,
float  angle,
char *  text,
int  align 
)
static

Query cache for a match with this font/text/angle/alignment request, otherwise arrange for its creation.

Definition at line 652 of file Rotated.cxx.

◆ XRotSetBoundingBoxPad()

void XRotSetBoundingBoxPad ( int  p)

Set the padding used when calculating bounding boxes.

Definition at line 251 of file Rotated.cxx.

◆ XRotSetMagnification()

void XRotSetMagnification ( float  m)

Set the font magnification factor for all subsequent operations.

Definition at line 242 of file Rotated.cxx.

◆ XRotTextExtents()

XPoint * XRotTextExtents ( Display *  ,
XFontStruct *  font,
float  angle,
int  x,
int  y,
char *  text,
int  align 
)

Calculate the bounding box some text will have when painted.

Definition at line 1335 of file Rotated.cxx.

◆ XRotVersion()

float XRotVersion ( char *  str,
int  n 
)

Return version/copyright information.

Definition at line 232 of file Rotated.cxx.

Variable Documentation

◆ gFirstTextItem

RotatedTextItem_t* gFirstTextItem = nullptr
static

Definition at line 139 of file Rotated.cxx.

◆ gRotatedDebug

int gRotatedDebug =0
static

Definition at line 93 of file Rotated.cxx.

◆ gRotStyle

struct StyleTemplate_t gRotStyle
static
Initial value:
={
1.,
0
}