Oyranos  0.9.7
Oyranos is a full featured Color Management System
Oyranos User API Documentation

Descriptive Contents

Introduction | Installation | links
User Tools Documentation | Environment Variables | User API Documentation | Programming Tutorial | Threading | Extending Oyranos

License
new BSD http://www.opensource.org/licenses/BSD-3-Clause
Author
Kai-Uwe Behrmann and others
Since
March 2004
Internet
http://www.oyranos.org/about
Development
https://github.com/oyranos-cms/oyranos



Introduction

Oyranos is intended as a entry point for color savy applications. In its current stage it configures profile paths, sets default profiles, maps devices to profiles, sets a monitor profile in X and uploads a vcgt tag. This means for instance all applications using Oyranos will use for a incoming digital camera picture the same profile and watch it through the same monitor profile with the same options for rendering intent, simulation and so on.

User Tools Documentation

  • oyranos-icc - access embedded profiles from images, color convert images
  • oyranos-monitor - a commandline tool for calling from a setup script like .xinitrc. It selects a profile for the current monitor and sets up the X server at startup time. Usage:
    # select a monitor profile, load the binary blob into X and fill the
    # VideoCardGammaTable, if appropriate
    oyranos-monitor
    
  • oyranos-monitor-white-point - a tool for setting display white point. It covers a geo location and time sensitive daemon for white point adaption to red night light. The daemon is called from oyranos-monitor.
  • oyranos-policy - a tool to set a policy from a xml file. Use it like:
    oyranos-policy `oyranos-config --syscolordir`/`oyranos-config --settingsdirname`/office.policy.xml
    
    Affected are default profiles and some behaviour settings.
  • oyranos-profile - access profile information
  • oyranos-profile-graph - draw a 2D graph from profiles
  • oyranos-profiles - lookup profiles in the systems color paths, download and install
  • oyranos-config-fltk - a configuration UI application, using some functions of the Oyranos APIs. If you have ICC Examin installed it can be called to show details of profiles.
  • oyranos-config - a command line tool to get compiler flags to using Oyranos in your own project. Try oyranos-config –help to see the appropriate options.

User API Documentation

The basic Oyranos API gets included with oyranos.h. An application, which wants to use these functions, needs to link against Oyranos.

The monitor related interfaces are accessed through Device Handling interfaces. Loading of the according module for the device depedent libraries is done on runtime.

The key names, which Oyranos uses to store its configuration in an Elektra file tree, are defined in oyranos_definitions.h.

Programming Tutorial

Frist you have to put a

#include <oyranos.h>
The API header for general users to include in your application.

in your source text, in order to use Oyranos.

int main( int argc, char ** argv ) {
int oyranos_version = oyVersion( 0 );
return 0;
}
int oyVersion(int type)
give the compiled in library version
Definition: oyranos_core.c:913

oyranos-config –cflags delivers the compiler flags and oyranos-config –ldflags the linker flags.

Then you can put Oyranos functions in your code and compile with:

cc `oyranos-config --cflags --ldflags` mycode.c -o myApp 

to link Oyranos into your application.

The second code sample will be more useful and handle obtaining a monitor profile:

#include <oyranos.h>
#include <oyConversion_s.h>
#include <stdio.h>
int main( int argc OY_UNUSED, char ** argv OY_UNUSED ) {
oyConfigs_s * devices = NULL;
oyConfig_s * monitor = NULL;
oyOptions_s * options = NULL;
oyProfile_s * monitor_icc = NULL;
const char * monitor_icc_dscr = NULL;
// get all monitors
oyDevicesGet( NULL, "monitor", NULL, &devices );
// just pick the first monitor
monitor = oyConfigs_Get( devices, 0 );
/* get XCM_ICC_COLOR_SERVER_TARGET_PROFILE_IN_X_BASE */
"//"OY_TYPE_STD"/config/icc_profile.x_color_region_target", "yes", OY_CREATE_NEW );
oyDeviceGetProfile( monitor, options, &monitor_icc );
// get the profiles internal name
monitor_icc_dscr = oyProfile_GetText( monitor_icc, oyNAME_DESCRIPTION );
printf( "first monitor has profile: %s\n", monitor_icc_dscr );
// now convert some colors from sRGB to monitor space
// find the appropriate profile flags
uint32_t icc_profile_flags =oyICCProfileSelectionFlagsFromOptions( OY_CMM_STD,
"//" OY_TYPE_STD "/icc_color", NULL, 0 );
oyProfile_s * srgb = oyProfile_FromStd( oyASSUMED_WEB, icc_profile_flags, 0 );
float rgb_in[9] = {0,0,0, 0.5,0.5,0.5, 1,1,1};
float rgb_moni[9];
// setup the color context
srgb, rgb_in, OY_TYPE_123_FLOAT,
monitor_icc, rgb_moni, OY_TYPE_123_FLOAT,
NULL, 3 );
// convert by running the conversion graph
// show the source colors and the converted colors
int i;
for(i = 0; i < 3; ++i)
printf("%.02f %.02f %.02f -> %.05f %.05f %.05f\n",
rgb_in[3*i+0],rgb_in[3*i+1],rgb_in[3*i+2], rgb_moni[3*i+0],rgb_moni[3*i+1],rgb_moni[3*i+2]);
return 0;
}
uint32_t oyICCProfileSelectionFlagsFromOptions(const char *db_base_key, const char *base_pattern, oyOptions_s *options, int select_core)
Get valid profile selection flags from node options and fallbacks.
Definition: oyranos_devices.c:3348
OYAPI int OYEXPORT oyDevicesGet(const char *device_type, const char *device_class, oyOptions_s *options, oyConfigs_s **devices)
get all devices matching to a device class and type
Definition: oyranos_devices.c:111
#define OY_TYPE_123_FLOAT
Definition: oyranos_image.h:160
#define OY_CREATE_NEW
Definition: oyOptions_s.h:52
@ oyASSUMED_WEB
Definition: oyranos.h:210
@ oyNAME_DESCRIPTION
Definition: oyranos_core.h:75
#define OY_TYPE_STD
Definition: oyranos_definitions.h:141
#define OY_CMM_STD
Definition: oyranos_definitions.h:154
A group of options for a device.
Definition: oyConfig_s.h:66
A Configs list.
Definition: oyConfigs_s.h:69
OYAPI oyConfig_s *OYEXPORT oyConfigs_Get(oyConfigs_s *list, int pos)
get a element of a Configs list
Definition: oyConfigs_s.c:192
Image Manipulation by a Graph (DAG)
Definition: oyConversion_s.h:199
oyConversion_s * oyConversion_CreateBasicPixelsFromBuffers(oyProfile_s *p_in, oyPointer buf_in, oyPixel_t buf_type_in, oyProfile_s *p_out, oyPointer buf_out, oyPixel_t buf_type_out, oyOptions_s *options, int count)
One dimensional color conversion context.
Definition: oyConversion_s.c:325
int oyConversion_RunPixels(oyConversion_s *conversion, oyPixelAccess_s *pixel_access)
Iterate over a conversion graph.
Definition: oyConversion_s.c:692
generic Options
Definition: oyOptions_s.h:80
int oyOptions_SetFromString(oyOptions_s **obj, const char *registration, const char *value, uint32_t flags)
change a value
Definition: oyOptions_s.c:1519
A profile and its attributes.
Definition: oyProfile_s.h:96
OYAPI const oyChar *OYEXPORT oyProfile_GetText(oyProfile_s *profile, oyNAME_e type)
Get a presentable name.
Definition: oyProfile_s.c:1452
OYAPI oyProfile_s *OYEXPORT oyProfile_FromStd(oyPROFILE_e type, uint32_t flags, oyObject_s object)
Create from default color space settings.
Definition: oyProfile_s.c:122

The code is from tutorial1.c

Writing of filters and modules for Oyranos is covered in the Extending Oyranos page.