source: libcaca/trunk/cucul/buffer.c @ 813

Last change on this file since 813 was 813, checked in by Sam Hocevar, 14 years ago
  • Renamed main canvas-related functions so that they have "canvas" in their name, eg. cucul_create() -> cucul_create_canvas() etc.
  • Moved buffer-related functions to cucul/buffer.c.
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1/*
2 *  libcucul      Canvas for ultrafast compositing of Unicode letters
3 *  Copyright (c) 2002-2006 Sam Hocevar <sam@zoy.org>
4 *                All Rights Reserved
5 *
6 *  $Id: buffer.c 813 2006-04-18 15:54:33Z sam $
7 *
8 *  This library is free software; you can redistribute it and/or
9 *  modify it under the terms of the Do What The Fuck You Want To
10 *  Public License, Version 2, as published by Sam Hocevar. See
11 *  http://sam.zoy.org/wtfpl/COPYING for more details.
12 */
13
14/*
15 *  This file contains buffer handling functions.
16 */
17
18#include "config.h"
19
20#if !defined(__KERNEL__)
21#   include <stdio.h>
22#   include <stdlib.h>
23#   include <string.h>
24#endif
25
26#include "cucul.h"
27#include "cucul_internals.h"
28
29/** \brief Get the buffer size.
30 *
31 *  This function returns the length (in bytes) of the memory area stored
32 *  in the given \e libcucul buffer.
33 *
34 *  \param buf A \e libcucul buffer
35 *  \return The buffer data length.
36 */
37unsigned long int cucul_get_buffer_size(cucul_buffer_t *buf)
38{
39    return buf->size;
40}
41
42/** \brief Get the buffer data.
43 *
44 *  This function returns a pointer to the memory area stored in the given
45 *  \e libcucul buffer.
46 *
47 *  \param buf A \e libcucul buffer
48 *  \return A pointer to the buffer memory area.
49 */
50void * cucul_get_buffer_data(cucul_buffer_t *buf)
51{
52    return buf->data;
53}
54
55/** \brief Free a buffer.
56 *
57 *  This function frees the structures associated with the given
58 *  \e libcucul buffer.
59 *
60 *  \param buf A \e libcucul buffer
61 */
62void cucul_free_buffer(cucul_buffer_t *buf)
63{
64    free(buf->data);
65    free(buf);
66}
67
Note: See TracBrowser for help on using the repository browser.