libDXF 0.0.1
A library with DXF related functions written in C.
Functions

color.c File Reference

Functions for DXF colors. More...

#include "color.h"
Include dependency graph for color.c:

Go to the source code of this file.

Functions

DxfRGBColordxf_RGB_color_new ()
 Allocate memory for a DXF color.
DxfRGBColordxf_RGB_color_set (int red, int green, int blue)
 Set the passed integer values for a DXF color.
int dxf_ACI_init (DxfRGBColor *ACI[DXF_COLOR_INDEX_MAX_NUMBER_OF_COLORS])
 Initialise an array of colors according to the AutoCAD Color Index (ACI).
int dxf_RGB_to_triplet (int red, int green, int blue)
 Convert the passed integer values to a hexadecimal triplet.
char * dxf_RGB_color_get_name (int RGB_color_hex_triplet)
 Return the color name according to the Wikipedia List of Colors.
int dxf_RGB_color_free (DxfRGBColor *RGB_color)
 Free the allocated memory for a DXF DxfRGBColor and all it's data fields.
void dxf_RGB_color_free_chain (DxfRGBColor *colors)
 Free the allocated memory for a chain of DXF COLOR entities and all their data fields.

Detailed Description

Functions for DXF colors.

Author:
Copyright (C) 2012, 2014, 2015, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.

Copyright Notices.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Drawing eXchange Format (DXF) is a defacto industry standard for the exchange of drawing files between various Computer Aided Drafting programs.
DXF is an industry standard designed by Autodesk(TM).
For more details see http://www.autodesk.com.


Definition in file color.c.


Function Documentation

DxfRGBColor* dxf_RGB_color_new ( )

Allocate memory for a DXF color.

Fill the memory contents with zeros.

Definition at line 44 of file color.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_RGB_color_set().

DxfRGBColor* dxf_RGB_color_set ( int  red,
int  green,
int  blue 
)

Set the passed integer values for a DXF color.

Parameters:
redRed value for the color.
greenGreen value for the color.
blueBlue value for the color.

Definition at line 78 of file color.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_RGB_color_get_name(), dxf_RGB_color_new(), and dxf_RGB_to_triplet().

Referenced by dxf_ACI_init().

Here is the call graph for this function:

int dxf_ACI_init ( DxfRGBColor ACI[DXF_COLOR_INDEX_MAX_NUMBER_OF_COLORS])

Initialise an array of colors according to the AutoCAD Color Index (ACI).

These colors are defined by red value, green value, blue value and contain no alpha value (see also http://www.isctex.com/acadcolors.php).

Definition at line 158 of file color.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_RGB_color_set().

Here is the call graph for this function:

int dxf_RGB_to_triplet ( int  red,
int  green,
int  blue 
)

Convert the passed integer values to a hexadecimal triplet.

Parameters:
redRed value for the color.
greenGreen value for the color.
blueBlue value for the color.

Definition at line 449 of file color.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_RGB_color_set().

char* dxf_RGB_color_get_name ( int  RGB_color_hex_triplet)

Return the color name according to the Wikipedia List of Colors.

These color names are defined by Wikipedia's List of colors.

Returns:
a pointer to the color name string, or NULL if unknown.
Parameters:
RGB_color_hex_tripletdxf_RGB_color_hex_triplet is assumed to contain the hexadecimal values as in red value, green value, blue value in the order 0xRRGGBB (contains no alpha values).

Definition at line 515 of file color.c.

References DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_RGB_color_set().

int dxf_RGB_color_free ( DxfRGBColor RGB_color)

Free the allocated memory for a DXF DxfRGBColor and all it's data fields.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Parameters:
RGB_colorPointer to the memory occupied by the DXF RGB Color.

Definition at line 2220 of file color.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and DxfRGBColor::name.

Referenced by dxf_RGB_color_free_chain().

void dxf_RGB_color_free_chain ( DxfRGBColor colors)

Free the allocated memory for a chain of DXF COLOR entities and all their data fields.

Version:
According to DXF R10.
According to DXF R11.
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
colorsa pointer to the chain of DXF COLOR entities.

Definition at line 2266 of file color.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_RGB_color_free(), and DxfRGBColor::next.

Here is the call graph for this function: