Term-Gnuplot
view release on metacpan or search on metacpan
where like symbols are stored in one byte. Vertical packing can be
arranged by reversing x and y dimensions and setting the global
b_rastermode to TRUE. (eg epson 8-pin dot-matrix printer)
Functions provided are
(internal fns ? - should probably be static, not external ?)
b_setpixel(x,y,value)
b_setmaskpixel(x,y,value)
b_putc(x,y,char,angle)
b_setvalue(size)
setting up stuff
b_makebitmap(x,y,planes) - make a bitmap of size x * y
b_freebitmap() - free bitmap
b_charsize(size)
gnuterm/bitmap.c view on Meta::CPAN
* Russell Lang, 1990
*/
#include "bitmap.h"
#include "alloc.h"
#include "util.h"
static void b_putc __PROTO((unsigned int, unsigned int, int, unsigned int));
static GP_INLINE void b_setpixel __PROTO((unsigned int x, unsigned int y, unsigned int value));
static GP_INLINE void b_setmaskpixel __PROTO((unsigned int x, unsigned int y, unsigned int value));
static void b_line __PROTO((unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2));
bitmap *b_p = (bitmap *) NULL; /* global pointer to bitmap */
static unsigned int b_currx, b_curry; /* the current coordinates */
unsigned int b_xsize, b_ysize; /* the size of the bitmap */
unsigned int b_planes; /* number of color planes */
unsigned int b_psize; /* size of each plane */
unsigned int b_rastermode; /* raster mode rotates -90deg */
unsigned int b_linemask = 0xffff; /* 16 bit mask for dotted lines */
static unsigned int b_value = 1; /* colour of lines */
gnuterm/bitmap.c view on Meta::CPAN
}
(void) free((char *) b_p);
b_p = (bitmap *) (NULL);
}
/*
* set pixel at (x,y) with color b_value and dotted mask b_linemask.
*/
static GP_INLINE void
b_setmaskpixel(x, y, value)
unsigned int x, y, value;
{
/* dotted line generator */
if ((b_linemask >> b_maskcount) & (unsigned int) (1)) {
b_setpixel(x, y, value);
}
b_maskcount = (b_maskcount + 1) % 16;
b_lastx = x; /* last pixel set with mask */
b_lasty = y;
}
gnuterm/bitmap.c view on Meta::CPAN
else if (y2 == y1)
yinc = 0;
else
yinc = -1;
xplot = x1;
yplot = y1;
if (dx > dy) {
/* iterate x */
if ((b_linemask == 0xffff) ||
((xplot != b_lastx) && (yplot != b_lasty)))
b_setmaskpixel(xplot, yplot, b_value);
while (xplot != x2) {
xplot += xinc;
runcount += dy;
if (runcount >= (dx - runcount)) {
yplot += yinc;
runcount -= dx;
}
b_setmaskpixel(xplot, yplot, b_value);
}
} else {
/* iterate y */
if ((b_linemask == 0xffff) ||
((xplot != b_lastx) && (yplot != b_lasty)))
b_setmaskpixel(xplot, yplot, b_value);
while (yplot != y2) {
yplot += yinc;
runcount += dx;
if (runcount >= (dy - runcount)) {
xplot += xinc;
runcount -= dy;
}
b_setmaskpixel(xplot, yplot, b_value);
}
}
}
/*
* set character size
*/
void
b_charsize(size)
gnuterm/term/README view on Meta::CPAN
where like symbols are stored in one byte. Vertical packing can be
arranged by reversing x and y dimensions and setting the global
b_rastermode to TRUE. (eg epson 8-pin dot-matrix printer)
Functions provided are
(internal fns ? - should probably be static, not external ?)
b_setpixel(x,y,value)
b_setmaskpixel(x,y,value)
b_putc(x,y,char,angle)
b_setvalue(size)
setting up stuff
b_makebitmap(x,y,planes) - make a bitmap of size x * y
b_freebitmap() - free bitmap
b_charsize(size)
gnuterm/term/sun.trm view on Meta::CPAN
#endif /* TERM_PROTO */
#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY
#include <suntool/sunview.h>
#include <suntool/canvas.h>
#include <suntool/scrollbar.h>
#include <suntool/panel.h>
#include <pixrect/pixrect_hs.h>
void sun_setmaskpixel __PROTO((unsigned int x, unsigned int y, unsigned int value));
void sun_line __PROTO((unsigned int x1, unsigned int x2, unsigned int y1, unsigned int y2));
static Notify_value local_notice_destroy __PROTO((Frame frame, Destroy_status status));
#define MARGIN 5
#define MINWIN 128
static Frame frame;
static Canvas canvas;
static Pixwin *pw;
static struct pixfont *sun_font = NULL;
gnuterm/term/sun.trm view on Meta::CPAN
term->xmax = SUN_XMAX;
term->ymax = SUN_YMAX;
window_set(frame, WIN_SHOW, FALSE, 0);
return;
}
void
sun_setmaskpixel(x, y, value)
unsigned int x, y, value;
{
/* dotted line generator */
if ((sun_line_mask >> sun_mask_count) & (unsigned int) (1)) {
pw_put(pw, x, term->ymax - 1 - y, sun_value);
}
sun_mask_count = (sun_mask_count + 1) % 16;
sun_lastx = x; /* last pixel set with mask */
sun_lasty = y;
}
gnuterm/term/sun.trm view on Meta::CPAN
if (y2 == y1)
yinc = 0;
if (y2 < y1)
yinc = -1;
xplot = x1;
yplot = y1;
if (dx > dy) {
/* iterate x */
if ((sun_line_mask == 0xffff) ||
((xplot != sun_lastx) && (yplot != sun_lasty)))
sun_setmaskpixel(xplot, yplot, sun_value);
while (xplot != x2) {
xplot += xinc;
runcount += dy;
if (runcount >= (dx - runcount)) {
yplot += yinc;
runcount -= dx;
}
sun_setmaskpixel(xplot, yplot, sun_value);
}
} else {
/* iterate y */
if ((sun_line_mask == 0xffff) ||
((xplot != sun_lastx) && (yplot != sun_lasty)))
sun_setmaskpixel(xplot, yplot, sun_value);
while (yplot != y2) {
yplot += yinc;
runcount += dx;
if (runcount >= (dy - runcount)) {
xplot += xinc;
runcount -= dy;
}
sun_setmaskpixel(xplot, yplot, sun_value);
}
}
}
static Notify_value
local_notice_destroy(frame, status)
Frame frame;
Destroy_status status;
{
( run in 0.720 second using v1.01-cache-2.11-cpan-cc502c75498 )