Browse Source

* src/io.c:

+ Do not report mouse motions if the coordinates did not change.
  * src/bitmap.c:
    + More documentation.
tags/v0.99.beta14
Sam Hocevar sam 21 years ago
parent
commit
1866961050
3 changed files with 35 additions and 22 deletions
  1. +1
    -0
      NEWS
  2. +31
    -19
      src/bitmap.c
  3. +3
    -3
      src/io.c

+ 1
- 0
NEWS View File

@@ -3,6 +3,7 @@ $Id$
Changes between 0.6 and 0.7:
----------------------------

* many bugfixes in the event handling
* cacaball, a metaball animation example

Changes between 0.5 and 0.6:


+ 31
- 19
src/bitmap.c View File

@@ -170,15 +170,21 @@ static void mask2shift(unsigned int mask, int *right, int *left)
/**
* \brief Create an internal bitmap object.
*
* \param bpp The bitmap depth in bits per pixel.
* \param w The bitmap width in pixels.
* \param h The bitmap height in pixels.
* \param pitch The bitmap pitch in bytes.
* \param rmask The bitmask for red values.
* \param gmask The bitmask for green values.
* \param bmask The bitmask for blue values.
* \param amask The bitmask for alpha values.
* \return A bitmap object or NULL upon error.
* Create a bitmap structure from its coordinates (depth, width, height and
* pitch) and pixel mask values. If the depth is 8 bits per pixel, the mask
* values are ignored and the colour palette should be set using the
* caca_set_bitmap_palette() function. For depths greater than 8 bits per
* pixel, a zero alpha mask causes the alpha values to be ignored.
*
* \param bpp Bitmap depth in bits per pixel.
* \param w Bitmap width in pixels.
* \param h Bitmap height in pixels.
* \param pitch Bitmap pitch in bytes.
* \param rmask Bitmask for red values.
* \param gmask Bitmask for green values.
* \param bmask Bitmask for blue values.
* \param amask Bitmask for alpha values.
* \return Bitmap object, or NULL upon error.
*/
struct caca_bitmap *caca_create_bitmap(unsigned int bpp, unsigned int w,
unsigned int h, unsigned int pitch,
@@ -237,11 +243,14 @@ struct caca_bitmap *caca_create_bitmap(unsigned int bpp, unsigned int w,
/**
* \brief Set the palette of an 8bpp bitmap object.
*
* \param bitmap The bitmap object.
* \param red An array of 256 red values.
* \param green An array of 256 green values.
* \param blue An array of 256 blue values.
* \param alpha An array of 256 alpha values.
* Set the palette of an 8 bits per pixel bitmap. Values should be between
* 0 and 4095 (0xfff).
*
* \param bitmap Bitmap object.
* \param red Array of 256 red values.
* \param green Array of 256 green values.
* \param blue Array of 256 blue values.
* \param alpha Array of 256 alpha values.
*/
void caca_set_bitmap_palette(struct caca_bitmap *bitmap,
unsigned int red[], unsigned int green[],
@@ -276,8 +285,9 @@ void caca_set_bitmap_palette(struct caca_bitmap *bitmap,
/**
* \brief Free the memory associated with a bitmap.
*
* \param bitmap The bitmap object to be freed.
* \return void
* Free the memory allocated by caca_create_bitmap().
*
* \param bitmap Bitmap object.
*/
void caca_free_bitmap(struct caca_bitmap *bitmap)
{
@@ -377,13 +387,15 @@ static inline void rgb2hsv_default(int r, int g, int b,
/**
* \brief Draw a bitmap on the screen.
*
* Draw a bitmap at the given coordinates. The bitmap can be of any size and
* will be stretched to the text area.
*
* \param x1 X coordinate of the upper-left corner of the drawing area.
* \param y1 Y coordinate of the upper-left corner of the drawing area.
* \param x2 X coordinate of the lower-right corner of the drawing area.
* \param y2 Y coordinate of the lower-right corner of the drawing area.
* \param bitmap The bitmap object to be drawn.
* \param pixels A pointer to the bitmap's pixels.
* \return void
* \param bitmap Bitmap object to be drawn.
* \param pixels Bitmap's pixels.
*/
void caca_draw_bitmap(int x1, int y1, int x2, int y2,
struct caca_bitmap const *bitmap, void *pixels)


+ 3
- 3
src/io.c View File

@@ -138,14 +138,14 @@ static unsigned int _get_next_event(void)
unsigned int newx = xevent.xmotion.x / x11_font_width;
unsigned int newy = xevent.xmotion.y / x11_font_height;

if(x11_x == newx && x11_y == newy)
continue;

if(newx >= _caca_width)
newx = _caca_width - 1;
if(newy >= _caca_height)
newy = _caca_height - 1;

if(x11_x == newx && x11_y == newy)
continue;

x11_x = newx & 0xfff;
x11_y = newy & 0xfff;



Loading…
Cancel
Save