本文整理汇总了C++中dt_conf_get_int函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_conf_get_int函数的具体用法?C++ dt_conf_get_int怎么用?C++ dt_conf_get_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_conf_get_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _lib_recentcollection_updated
static void _lib_recentcollection_updated(gpointer instance, gpointer user_data)
{
dt_lib_module_t *self = (dt_lib_module_t *)user_data;
dt_lib_recentcollect_t *d = (dt_lib_recentcollect_t *)self->data;
// serialize, check for recently used
char confname[200];
const int bufsize = 4096;
char buf[bufsize];
if(dt_collection_serialize(buf, bufsize)) return;
// is the current position, i.e. the one to be stored with the old collection (pos0, pos1-to-be)
uint32_t curr_pos = dt_view_lighttable_get_position(darktable.view_manager);
uint32_t new_pos = -1;
if(!d->inited)
{
new_pos = dt_conf_get_int("plugins/lighttable/recentcollect/pos0");
d->inited = 1;
dt_view_lighttable_set_position(darktable.view_manager, new_pos);
}
else if(curr_pos != -1)
{
dt_conf_set_int("plugins/lighttable/recentcollect/pos0", curr_pos);
}
int n = -1;
for(int k = 0; k < CLAMPS(dt_conf_get_int("plugins/lighttable/recentcollect/num_items"), 0, NUM_LINES); k++)
{
// is it already in the current list?
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/line%1d", k);
gchar *line = dt_conf_get_string(confname);
if(!line) continue;
if(!strcmp(line, buf))
{
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/pos%1d", k);
new_pos = dt_conf_get_int(confname);
n = k;
break;
}
g_free(line);
}
if(n < 0)
{
const int num_items = CLAMPS(dt_conf_get_int("plugins/lighttable/recentcollect/num_items"), 0, NUM_LINES);
if(num_items < NUM_LINES)
{
// new, unused entry
n = num_items;
dt_conf_set_int("plugins/lighttable/recentcollect/num_items", num_items + 1);
}
else
{
// kill least recently used entry:
n = num_items - 1;
}
}
if(n >= 0 && n < NUM_LINES)
{
// sort n to the top
for(int k = n; k > 0; k--)
{
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/line%1d", k - 1);
gchar *line1 = dt_conf_get_string(confname);
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/pos%1d", k - 1);
uint32_t pos1 = dt_conf_get_int(confname);
if(line1 && line1[0] != '\0')
{
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/line%1d", k);
dt_conf_set_string(confname, line1);
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/pos%1d", k);
dt_conf_set_int(confname, pos1);
}
g_free(line1);
}
dt_conf_set_string("plugins/lighttable/recentcollect/line0", buf);
dt_conf_set_int("plugins/lighttable/recentcollect/pos0",
(new_pos != -1 ? new_pos : (curr_pos != -1 ? curr_pos : 0)));
}
// update button descriptions:
for(int k = 0; k < NUM_LINES; k++)
{
char str[2048] = { 0 };
char str_cut[200] = { 0 };
char str_pretty[200] = { 0 };
snprintf(confname, sizeof(confname), "plugins/lighttable/recentcollect/line%1d", k);
gchar *line2 = dt_conf_get_string(confname);
if(line2 && line2[0] != '\0') pretty_print(line2, str, sizeof(str));
g_free(line2);
g_object_set(G_OBJECT(d->item[k].button), "tooltip-text", str, (char *)NULL);
const int cut = 45;
if(g_utf8_validate(str, -1, NULL))
{
if(g_utf8_strlen(str, -1) > cut)
{
g_utf8_strncpy(str_cut, str, cut);
snprintf(str_pretty, sizeof(str_pretty), "%s...", str_cut);
gtk_button_set_label(GTK_BUTTON(d->item[k].button), str_pretty);
}
else
//.........这里部分代码省略.........
开发者ID:Acidburn0zzz,项目名称:darktable,代码行数:101,代码来源:recentcollect.c
示例2: dt_control_export_job_run
int32_t dt_control_export_job_run(dt_job_t *job)
{
long int imgid = -1;
dt_control_image_enumerator_t *t1 = (dt_control_image_enumerator_t *)job->param;
GList *t = t1->index;
const int total = g_list_length(t);
int size = 0;
dt_imageio_module_format_t *mformat = dt_imageio_get_format();
g_assert(mformat);
dt_imageio_module_storage_t *mstorage = dt_imageio_get_storage();
g_assert(mstorage);
// Get max dimensions...
uint32_t w,h,fw,fh,sw,sh;
fw=fh=sw=sh=0;
mstorage->dimension(mstorage, &sw,&sh);
mformat->dimension(mformat, &fw,&fh);
if( sw==0 || fw==0) w=sw>fw?sw:fw;
else w=sw<fw?sw:fw;
if( sh==0 || fh==0) h=sh>fh?sh:fh;
else h=sh<fh?sh:fh;
// get shared storage param struct (global sequence counter, one picasa connection etc)
dt_imageio_module_data_t *sdata = mstorage->get_params(mstorage, &size);
if(sdata == NULL)
{
dt_control_log(_("failed to get parameters from storage module, aborting export.."));
return 1;
}
dt_control_log(ngettext ("exporting %d image..", "exporting %d images..", total), total);
char message[512]= {0};
snprintf(message, 512, ngettext ("exporting %d image to %s", "exporting %d images to %s", total), total, mstorage->name() );
/* create a cancellable bgjob ui template */
const guint *jid = dt_control_backgroundjobs_create(darktable.control, 0, message );
dt_control_backgroundjobs_set_cancellable(darktable.control, jid, job);
const dt_control_t *control = darktable.control;
double fraction=0;
#ifdef _OPENMP
// limit this to num threads = num full buffers - 1 (keep one for darkroom mode)
// use min of user request and mipmap cache entries
const int full_entries = dt_conf_get_int ("parallel_export");
// GCC won't accept that this variable is used in a macro, considers
// it set but not used, which makes for instance Fedora break.
const __attribute__((__unused__)) int num_threads = MAX(1, MIN(full_entries, 8));
#if !defined(__SUNOS__)
#pragma omp parallel default(none) private(imgid, size) shared(control, fraction, w, h, stderr, mformat, mstorage, t, sdata, job, jid, darktable) num_threads(num_threads) if(num_threads > 1)
#else
#pragma omp parallel private(imgid, size) shared(control, fraction, w, h, mformat, mstorage, t, sdata, job, jid, darktable) num_threads(num_threads) if(num_threads > 1)
#endif
{
#endif
// get a thread-safe fdata struct (one jpeg struct per thread etc):
dt_imageio_module_data_t *fdata = mformat->get_params(mformat, &size);
fdata->max_width = dt_conf_get_int ("plugins/lighttable/export/width");
fdata->max_height = dt_conf_get_int ("plugins/lighttable/export/height");
fdata->max_width = (w!=0 && fdata->max_width >w)?w:fdata->max_width;
fdata->max_height = (h!=0 && fdata->max_height >h)?h:fdata->max_height;
int num = 0;
// Invariant: the tagid for 'darktable|changed' will not change while this function runs. Is this a sensible assumption?
guint tagid = 0;
dt_tag_new("darktable|changed",&tagid);
while(t && dt_control_job_get_state(job) != DT_JOB_STATE_CANCELLED)
{
#ifdef _OPENMP
#pragma omp critical
#endif
{
if(!t)
imgid = 0;
else
{
imgid = (long int)t->data;
t = g_list_delete_link(t, t);
num = total - g_list_length(t);
}
}
// remove 'changed' tag from image
dt_tag_detach(tagid, imgid);
// check if image still exists:
char imgfilename[DT_MAX_PATH_LEN];
const dt_image_t *image = dt_image_cache_read_get(darktable.image_cache, (int32_t)imgid);
if(image)
{
dt_image_full_path(image->id, imgfilename, DT_MAX_PATH_LEN);
if(!g_file_test(imgfilename, G_FILE_TEST_IS_REGULAR))
{
dt_control_log(_("image `%s' is currently unavailable"), image->filename);
fprintf(stderr, _("image `%s' is currently unavailable"), imgfilename);
// dt_image_remove(imgid);
dt_image_cache_read_release(darktable.image_cache, image);
}
else
{
dt_image_cache_read_release(darktable.image_cache, image);
mstorage->store(sdata, imgid, mformat, fdata, num, total);
//.........这里部分代码省略.........
开发者ID:ksyz,项目名称:darktable,代码行数:101,代码来源:control_jobs.c
示例3: write_image
int write_image (dt_imageio_module_data_t *d_tmp, const char *filename, const void *in_void, void *exif, int exif_len, int imgid)
{
dt_imageio_tiff_t *d=(dt_imageio_tiff_t*)d_tmp;
uint8_t* profile = NULL;
uint32_t profile_len = 0;
TIFF* tif = NULL;
void* rowdata = NULL;
uint32_t rowsize = 0;
uint32_t stripesize = 0;
uint32_t stripe = 0;
int rc = 1; // default to error
if(imgid > 0)
{
cmsHPROFILE out_profile = dt_colorspaces_create_output_profile(imgid);
cmsSaveProfileToMem(out_profile, 0, &profile_len);
if (profile_len > 0)
{
profile = malloc(profile_len);
if (!profile)
{
rc = 1;
goto exit;
}
cmsSaveProfileToMem(out_profile, profile, &profile_len);
}
dt_colorspaces_cleanup_profile(out_profile);
}
// Create little endian tiff image
tif = TIFFOpen(filename,"wl");
if (!tif)
{
rc = 1;
goto exit;
}
// http://partners.adobe.com/public/developer/en/tiff/TIFFphotoshop.pdf (dated 2002)
// "A proprietary ZIP/Flate compression code (0x80b2) has been used by some"
// "software vendors. This code should be considered obsolete. We recommend"
// "that TIFF implentations recognize and read the obsolete code but only"
// "write the official compression code (0x0008)."
// http://www.awaresystems.be/imaging/tiff/tifftags/compression.html
// http://www.awaresystems.be/imaging/tiff/tifftags/predictor.html
if (d->compress == 1)
{
TIFFSetField(tif, TIFFTAG_COMPRESSION, (uint16_t)COMPRESSION_ADOBE_DEFLATE);
TIFFSetField(tif, TIFFTAG_PREDICTOR, (uint16_t)1);
TIFFSetField(tif, TIFFTAG_ZIPQUALITY, (uint16_t)9);
}
else if (d->compress == 2)
{
TIFFSetField(tif, TIFFTAG_COMPRESSION, (uint16_t)COMPRESSION_ADOBE_DEFLATE);
TIFFSetField(tif, TIFFTAG_PREDICTOR, (uint16_t)2);
TIFFSetField(tif, TIFFTAG_ZIPQUALITY, (uint16_t)9);
}
else if (d->compress == 3)
{
TIFFSetField(tif, TIFFTAG_COMPRESSION, (uint16_t)COMPRESSION_ADOBE_DEFLATE);
if (d->bpp == 32)
TIFFSetField(tif, TIFFTAG_PREDICTOR, (uint16_t)3);
else
TIFFSetField(tif, TIFFTAG_PREDICTOR, (uint16_t)2);
TIFFSetField(tif, TIFFTAG_ZIPQUALITY, (uint16_t)9);
}
else // (d->compress == 0)
{
TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
}
TIFFSetField(tif, TIFFTAG_FILLORDER, (uint16_t)FILLORDER_MSB2LSB);
if (profile != NULL)
{
TIFFSetField(tif, TIFFTAG_ICCPROFILE, (uint32_t)profile_len, profile);
}
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, (uint16_t)3);
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, (uint16_t)d->bpp);
TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, (uint16_t)(d->bpp == 32 ? SAMPLEFORMAT_IEEEFP : SAMPLEFORMAT_UINT));
TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t)d->width);
TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t)d->height);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, (uint16_t)PHOTOMETRIC_RGB);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, (uint16_t)PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, (uint32_t)DT_TIFFIO_STRIPE);
TIFFSetField(tif, TIFFTAG_ORIENTATION, (uint16_t)ORIENTATION_TOPLEFT);
int resolution = dt_conf_get_int("metadata/resolution");
if (resolution > 0)
{
TIFFSetField(tif, TIFFTAG_XRESOLUTION, (float)resolution);
TIFFSetField(tif, TIFFTAG_YRESOLUTION, (float)resolution);
TIFFSetField(tif, TIFFTAG_RESOLUTIONUNIT, (uint16_t)RESUNIT_INCH);
}
rowsize = (d->width*3) * d->bpp / 8;
stripesize = rowsize * DT_TIFFIO_STRIPE;
stripe = 0;
//.........这里部分代码省略.........
开发者ID:markcottrell,项目名称:darktable,代码行数:101,代码来源:tiff.c
示例4: _lib_location_parser_start_element
static void _lib_location_parser_start_element(GMarkupParseContext *cxt, const char *element_name,
const char **attribute_names, const gchar **attribute_values,
gpointer user_data, GError **e)
{
dt_lib_location_t *lib = (dt_lib_location_t *)user_data;
/* only interested in place element */
if(strcmp(element_name, "place") != 0) return;
/* create new place */
_lib_location_result_t *place = g_malloc0(sizeof(_lib_location_result_t));
if(!place) return;
place->lon = NAN;
place->lat = NAN;
place->bbox_lon1 = NAN;
place->bbox_lat1 = NAN;
place->bbox_lon2 = NAN;
place->bbox_lat2 = NAN;
place->marker_type = MAP_DISPLAY_NONE;
place->marker_points = NULL;
gboolean show_outline = dt_conf_get_bool("plugins/map/show_outline");
int max_outline_nodes = dt_conf_get_int("plugins/map/max_outline_nodes");
/* handle the element attribute values */
const gchar **aname = attribute_names;
const gchar **avalue = attribute_values;
if(*aname)
{
while(*aname)
{
if(strcmp(*aname, "display_name") == 0)
{
place->name = g_strdup(*avalue);
if(!(place->name)) goto bail_out;
}
else if(strcmp(*aname, "lon") == 0)
place->lon = g_strtod(*avalue, NULL);
else if(strcmp(*aname, "lat") == 0)
place->lat = g_strtod(*avalue, NULL);
else if(strcmp(*aname, "boundingbox") == 0)
{
char *endptr;
float lon1, lat1, lon2, lat2;
lat1 = g_ascii_strtod(*avalue, &endptr);
if(*endptr != ',') goto broken_bbox;
endptr++;
lat2 = g_ascii_strtod(endptr, &endptr);
if(*endptr != ',') goto broken_bbox;
endptr++;
lon1 = g_ascii_strtod(endptr, &endptr);
if(*endptr != ',') goto broken_bbox;
endptr++;
lon2 = g_ascii_strtod(endptr, &endptr);
if(*endptr != '\0') goto broken_bbox;
place->bbox_lon1 = lon1;
place->bbox_lat1 = lat1;
place->bbox_lon2 = lon2;
place->bbox_lat2 = lat2;
broken_bbox:
;
}
// only use the first 'geotext' entry
else if(show_outline &&
strcmp(*aname, "geotext") == 0 &&
place->marker_type == MAP_DISPLAY_NONE)
{
if(g_str_has_prefix(*avalue, "POINT"))
{
char *endptr;
float lon = g_ascii_strtod(*avalue + strlen("POINT("), &endptr);
float lat = g_ascii_strtod(endptr, &endptr);
if(*endptr == ')')
{
place->marker_type = MAP_DISPLAY_POINT;
dt_geo_map_display_point_t *p = malloc(sizeof(dt_geo_map_display_point_t));
p->lon = lon;
p->lat = lat;
place->marker_points = g_list_append(place->marker_points, p);
}
}
else if(g_str_has_prefix(*avalue, "LINESTRING")
#ifdef HAVE_OSMGPSMAP_110_OR_NEWER
|| g_str_has_prefix(*avalue, "POLYGON")
|| g_str_has_prefix(*avalue, "MULTIPOLYGON")
#endif
)
{
gboolean error = FALSE;
const char *startptr = *avalue;
char *endptr;
while(startptr && (*startptr == ' ' || *startptr == '(' || (*startptr >= 'A' && *startptr <= 'Z')))
startptr++;
//.........这里部分代码省略.........
开发者ID:CChiappa,项目名称:darktable,代码行数:101,代码来源:location.c
示例5: dt_collection_update_query
void
dt_collection_update_query(const dt_collection_t *collection)
{
char query[1024], confname[200];
gchar *complete_query = NULL;
const int _n_r = dt_conf_get_int("plugins/lighttable/collect/num_rules");
const int num_rules = CLAMP(_n_r, 1, 10);
char *conj[] = {"and", "or", "and not"};
complete_query = dt_util_dstrcat(complete_query, "(");
for(int i=0; i<num_rules; i++)
{
snprintf(confname, 200, "plugins/lighttable/collect/item%1d", i);
const int property = dt_conf_get_int(confname);
snprintf(confname, 200, "plugins/lighttable/collect/string%1d", i);
gchar *text = dt_conf_get_string(confname);
if(!text) break;
snprintf(confname, 200, "plugins/lighttable/collect/mode%1d", i);
const int mode = dt_conf_get_int(confname);
gchar *escaped_text = dt_util_str_replace(text, "'", "''");
get_query_string(property, escaped_text, query);
if(i > 0)
complete_query = dt_util_dstrcat(complete_query, " %s %s", conj[mode], query);
else
complete_query = dt_util_dstrcat(complete_query, "%s", query);
g_free(escaped_text);
g_free(text);
}
complete_query = dt_util_dstrcat(complete_query, ")");
// printf("complete query: `%s'\n", complete_query);
/* set the extended where and the use of it in the query */
dt_collection_set_extended_where (collection, complete_query);
dt_collection_set_query_flags (collection, (dt_collection_get_query_flags (collection) | COLLECTION_QUERY_USE_WHERE_EXT));
/* remove film id from default filter */
dt_collection_set_filter_flags (collection, (dt_collection_get_filter_flags (collection) & ~COLLECTION_FILTER_FILM_ID));
/* update query and at last the visual */
dt_collection_update (collection);
/* free string */
g_free(complete_query);
// remove from selected images where not in this query.
sqlite3_stmt *stmt = NULL;
const gchar *cquery = dt_collection_get_query(collection);
complete_query = NULL;
if(cquery && cquery[0] != '\0')
{
complete_query = dt_util_dstrcat(complete_query, "delete from selected_images where imgid not in (%s)", cquery);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), complete_query, -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, 0);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 2, -1);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
/* free allocated strings */
g_free(complete_query);
}
/* raise signal of collection change, only if this is an original */
if (!collection->clone)
dt_control_signal_raise(darktable.signals, DT_SIGNAL_COLLECTION_CHANGED);
}
开发者ID:EvilBit,项目名称:darktable,代码行数:74,代码来源:collection.c
示例6: dt_mipmap_cache_init
void dt_mipmap_cache_init(dt_mipmap_cache_t *cache)
{
// make sure static memory is initialized
struct dt_mipmap_buffer_dsc *dsc = (struct dt_mipmap_buffer_dsc *)dt_mipmap_cache_static_dead_image;
dead_image_f((dt_mipmap_buffer_t *)(dsc+1));
cache->compression_type = 0;
gchar *compression = dt_conf_get_string("cache_compression");
if(compression)
{
if(!strcmp(compression, "low quality (fast)"))
cache->compression_type = 1;
else if(!strcmp(compression, "high quality (slow)"))
cache->compression_type = 2;
g_free(compression);
}
dt_print(DT_DEBUG_CACHE, "[mipmap_cache_init] using %s\n", cache->compression_type == 0 ? "no compression" :
(cache->compression_type == 1 ? "low quality compression" : "slow high quality compression"));
// adjust numbers to be large enough to hold what mem limit suggests.
// we want at least 100MB, and consider 2G just still reasonable.
uint32_t max_mem = CLAMPS(dt_conf_get_int("cache_memory"), 100u<<20, 2u<<30);
const uint32_t parallel = CLAMP(dt_conf_get_int ("worker_threads")*dt_conf_get_int("parallel_export"), 1, 8);
const int32_t max_size = 2048, min_size = 32;
int32_t wd = darktable.thumbnail_width;
int32_t ht = darktable.thumbnail_height;
wd = CLAMPS(wd, min_size, max_size);
ht = CLAMPS(ht, min_size, max_size);
// round up to a multiple of 8, so we can divide by two 3 times
if(wd & 0xf) wd = (wd & ~0xf) + 0x10;
if(ht & 0xf) ht = (ht & ~0xf) + 0x10;
// cache these, can't change at runtime:
cache->mip[DT_MIPMAP_F].max_width = wd;
cache->mip[DT_MIPMAP_F].max_height = ht;
cache->mip[DT_MIPMAP_F-1].max_width = wd;
cache->mip[DT_MIPMAP_F-1].max_height = ht;
for(int k=DT_MIPMAP_F-2; k>=DT_MIPMAP_0; k--)
{
cache->mip[k].max_width = cache->mip[k+1].max_width / 2;
cache->mip[k].max_height = cache->mip[k+1].max_height / 2;
}
// initialize some per-thread cached scratchmem for uncompressed buffers during thumb creation:
if(cache->compression_type)
{
cache->scratchmem.max_width = wd;
cache->scratchmem.max_height = ht;
cache->scratchmem.buffer_size = wd*ht*sizeof(uint32_t);
cache->scratchmem.size = DT_MIPMAP_3; // at max.
// TODO: use thread local storage instead (zero performance penalty on linux)
dt_cache_init(&cache->scratchmem.cache, parallel, parallel, 64, 0.9f*parallel*wd*ht*sizeof(uint32_t));
// might have been rounded to power of two:
const int cnt = dt_cache_capacity(&cache->scratchmem.cache);
cache->scratchmem.buf = dt_alloc_align(64, cnt * wd*ht*sizeof(uint32_t));
dt_cache_static_allocation(&cache->scratchmem.cache, (uint8_t *)cache->scratchmem.buf, wd*ht*sizeof(uint32_t));
dt_cache_set_allocate_callback(&cache->scratchmem.cache,
scratchmem_allocate, &cache->scratchmem);
dt_print(DT_DEBUG_CACHE,
"[mipmap_cache_init] cache has % 5d entries for temporary compression buffers (% 4.02f MB).\n",
cnt, cnt* wd*ht*sizeof(uint32_t)/(1024.0*1024.0));
}
for(int k=DT_MIPMAP_3; k>=0; k--)
{
// buffer stores width and height + actual data
const int width = cache->mip[k].max_width;
const int height = cache->mip[k].max_height;
// header + adjusted for dxt compression:
cache->mip[k].buffer_size = 4*sizeof(uint32_t) + compressed_buffer_size(cache->compression_type, width, height);
cache->mip[k].size = k;
// level of parallelism also gives minimum size (which is twice that)
// is rounded to a power of two by the cache anyways, we might as well.
const uint32_t max_mem2 = MAX(0, (k == 0) ? (max_mem) : (max_mem/(k+4)));
uint32_t thumbnails = MAX(2, nearest_power_of_two((uint32_t)((float)max_mem2/cache->mip[k].buffer_size)));
while(thumbnails > parallel && thumbnails * cache->mip[k].buffer_size > max_mem2) thumbnails /= 2;
// try to utilize that memory well (use 90% quota), the hopscotch paper claims good scalability up to
// even more than that.
dt_cache_init(&cache->mip[k].cache, thumbnails,
parallel,
64, 0.9f*thumbnails*cache->mip[k].buffer_size);
// might have been rounded to power of two:
thumbnails = dt_cache_capacity(&cache->mip[k].cache);
max_mem -= thumbnails * cache->mip[k].buffer_size;
// dt_print(DT_DEBUG_CACHE, "[mipmap mem] %4.02f left\n", max_mem/(1024.0*1024.0));
cache->mip[k].buf = dt_alloc_align(64, thumbnails * cache->mip[k].buffer_size);
dt_cache_static_allocation(&cache->mip[k].cache, (uint8_t *)cache->mip[k].buf, cache->mip[k].buffer_size);
dt_cache_set_allocate_callback(&cache->mip[k].cache,
dt_mipmap_cache_allocate, &cache->mip[k]);
// dt_cache_set_cleanup_callback(&cache->mip[k].cache,
// &dt_mipmap_cache_deallocate, &cache->mip[k]);
dt_print(DT_DEBUG_CACHE,
"[mipmap_cache_init] cache has % 5d entries for mip %d (% 4.02f MB).\n",
thumbnails, k, thumbnails * cache->mip[k].buffer_size/(1024.0*1024.0));
}
// full buffer needs dynamic alloc:
//.........这里部分代码省略.........
开发者ID:bleader,项目名称:darktable,代码行数:101,代码来源:mipmap_cache.c
示例7: _lib_tagging_tag_show
static gboolean _lib_tagging_tag_show(GtkAccelGroup *accel_group, GObject *acceleratable, guint keyval,
GdkModifierType modifier, dt_lib_module_t *self)
{
int mouse_over_id = -1;
int zoom = dt_conf_get_int("plugins/lighttable/images_in_row");
// the order is:
// if(zoom == 1) => currently shown image
// else if(selection not empty) => selected images
// else if(cursor over image) => hovered image
// else => return
if(zoom == 1 || dt_collection_get_selected_count(darktable.collection) == 0)
{
mouse_over_id = dt_control_get_mouse_over_id();
if(mouse_over_id < 0) return TRUE;
}
dt_lib_tagging_t *d = (dt_lib_tagging_t *)self->data;
d->floating_tag_imgid = mouse_over_id;
gint x, y;
gint px, py, w, h;
GtkWidget *window = dt_ui_main_window(darktable.gui->ui);
GtkWidget *center = dt_ui_center(darktable.gui->ui);
gdk_window_get_origin(gtk_widget_get_window(center), &px, &py);
w = gdk_window_get_width(gtk_widget_get_window(center));
h = gdk_window_get_height(gtk_widget_get_window(center));
x = px + 0.5 * (w - FLOATING_ENTRY_WIDTH);
y = py + h - 50;
/* put the floating box at the mouse pointer */
// gint pointerx, pointery;
// GdkDevice *device =
// gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(gtk_widget_get_display(widget)));
// gdk_window_get_device_position (gtk_widget_get_window (widget), device, &pointerx, &pointery, NULL);
// x = px + pointerx + 1;
// y = py + pointery + 1;
d->floating_tag_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/* stackoverflow.com/questions/1925568/how-to-give-keyboard-focus-to-a-pop-up-gtk-window */
gtk_widget_set_can_focus(d->floating_tag_window, TRUE);
gtk_window_set_decorated(GTK_WINDOW(d->floating_tag_window), FALSE);
gtk_window_set_type_hint(GTK_WINDOW(d->floating_tag_window), GDK_WINDOW_TYPE_HINT_POPUP_MENU);
gtk_window_set_transient_for(GTK_WINDOW(d->floating_tag_window), GTK_WINDOW(window));
gtk_widget_set_opacity(d->floating_tag_window, 0.8);
gtk_window_move(GTK_WINDOW(d->floating_tag_window), x, y);
GtkWidget *entry = gtk_entry_new();
gtk_widget_set_size_request(entry, FLOATING_ENTRY_WIDTH, -1);
gtk_widget_add_events(entry, GDK_FOCUS_CHANGE_MASK);
GtkEntryCompletion *completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, gtk_tree_view_get_model(GTK_TREE_VIEW(d->related)));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_completion_set_inline_completion(completion, TRUE);
gtk_entry_completion_set_popup_set_width(completion, FALSE);
gtk_entry_completion_set_match_func(completion, _completion_match_func, NULL, NULL);
gtk_entry_set_completion(GTK_ENTRY(entry), completion);
gtk_editable_select_region(GTK_EDITABLE(entry), 0, -1);
gtk_container_add(GTK_CONTAINER(d->floating_tag_window), entry);
g_signal_connect(entry, "focus-out-event", G_CALLBACK(_lib_tagging_tag_destroy), d->floating_tag_window);
g_signal_connect(entry, "key-press-event", G_CALLBACK(_lib_tagging_tag_key_press), self);
gtk_widget_show_all(d->floating_tag_window);
gtk_widget_grab_focus(entry);
gtk_window_present(GTK_WINDOW(d->floating_tag_window));
return TRUE;
}
开发者ID:fhrtms,项目名称:darktable,代码行数:73,代码来源:tagging.c
示例8: write_image
int write_image(dt_imageio_module_data_t *jpg_tmp, const char *filename, const void *in_tmp,
dt_colorspaces_color_profile_type_t over_type, const char *over_filename,
void *exif, int exif_len, int imgid, int num, int total, struct dt_dev_pixelpipe_t *pipe)
{
dt_imageio_jpeg_t *jpg = (dt_imageio_jpeg_t *)jpg_tmp;
const uint8_t *in = (const uint8_t *)in_tmp;
struct dt_imageio_jpeg_error_mgr jerr;
jpg->cinfo.err = jpeg_std_error(&jerr.pub);
jerr.pub.error_exit = dt_imageio_jpeg_error_exit;
if(setjmp(jerr.setjmp_buffer))
{
jpeg_destroy_compress(&(jpg->cinfo));
return 1;
}
jpeg_create_compress(&(jpg->cinfo));
FILE *f = g_fopen(filename, "wb");
if(!f) return 1;
jpeg_stdio_dest(&(jpg->cinfo), f);
jpg->cinfo.image_width = jpg->global.width;
jpg->cinfo.image_height = jpg->global.height;
jpg->cinfo.input_components = 3;
jpg->cinfo.in_color_space = JCS_RGB;
jpeg_set_defaults(&(jpg->cinfo));
jpeg_set_quality(&(jpg->cinfo), jpg->quality, TRUE);
if(jpg->quality > 90) jpg->cinfo.comp_info[0].v_samp_factor = 1;
if(jpg->quality > 92) jpg->cinfo.comp_info[0].h_samp_factor = 1;
if(jpg->quality > 95) jpg->cinfo.dct_method = JDCT_FLOAT;
if(jpg->quality < 50) jpg->cinfo.dct_method = JDCT_IFAST;
if(jpg->quality < 80) jpg->cinfo.smoothing_factor = 20;
if(jpg->quality < 60) jpg->cinfo.smoothing_factor = 40;
if(jpg->quality < 40) jpg->cinfo.smoothing_factor = 60;
jpg->cinfo.optimize_coding = 1;
// according to specs density_unit = 0, X_density = 1, Y_density = 1 should be fine and valid since it
// describes an image with unknown unit and square pixels.
// however, some applications (like the Telekom cloud thingy) seem to be confused by that, so let's set
// these calues to the same as stored in exiv :/
const int resolution = dt_conf_get_int("metadata/resolution");
if(resolution > 0)
{
jpg->cinfo.density_unit = 1;
jpg->cinfo.X_density = resolution;
jpg->cinfo.Y_density = resolution;
}
else
{
jpg->cinfo.density_unit = 0;
jpg->cinfo.X_density = 1;
jpg->cinfo.Y_density = 1;
}
jpeg_start_compress(&(jpg->cinfo), TRUE);
if(imgid > 0)
{
cmsHPROFILE out_profile = dt_colorspaces_get_output_profile(imgid, over_type, over_filename)->profile;
uint32_t len = 0;
cmsSaveProfileToMem(out_profile, 0, &len);
if(len > 0)
{
unsigned char *buf = malloc(len * sizeof(unsigned char));
cmsSaveProfileToMem(out_profile, buf, &len);
write_icc_profile(&(jpg->cinfo), buf, len);
free(buf);
}
}
uint8_t *row = malloc((size_t)3 * jpg->global.width * sizeof(uint8_t));
const uint8_t *buf;
while(jpg->cinfo.next_scanline < jpg->cinfo.image_height)
{
JSAMPROW tmp[1];
buf = in + (size_t)jpg->cinfo.next_scanline * jpg->cinfo.image_width * 4;
for(int i = 0; i < jpg->global.width; i++)
for(int k = 0; k < 3; k++) row[3 * i + k] = buf[4 * i + k];
tmp[0] = row;
jpeg_write_scanlines(&(jpg->cinfo), tmp, 1);
}
jpeg_finish_compress(&(jpg->cinfo));
free(row);
jpeg_destroy_compress(&(jpg->cinfo));
fclose(f);
dt_exif_write_blob(exif, exif_len, filename, 1);
return 0;
}
开发者ID:TurboGit,项目名称:darktable,代码行数:89,代码来源:jpeg.c
示例9: gui_init
void gui_init(struct dt_iop_module_t *self)
{
self->gui_data = malloc(sizeof(dt_iop_colorzones_gui_data_t));
dt_iop_colorzones_gui_data_t *c = (dt_iop_colorzones_gui_data_t *)self->gui_data;
dt_iop_colorzones_params_t *p = (dt_iop_colorzones_params_t *)self->params;
// c->channel = DT_IOP_COLORZONES_C;
c->channel = dt_conf_get_int("plugins/darkroom/colorzones/gui_channel");
int ch = (int)c->channel;
c->minmax_curve = dt_draw_curve_new(0.0, 1.0, CATMULL_ROM);
(void)dt_draw_curve_add_point(c->minmax_curve, p->equalizer_x[ch][DT_IOP_COLORZONES_BANDS-2]-1.0, p->equalizer_y[ch][DT_IOP_COLORZONES_BANDS-2]);
for(int k=0; k<DT_IOP_COLORZONES_BANDS; k++) (void)dt_draw_curve_add_point(c->minmax_curve, p->equalizer_x[ch][k], p->equalizer_y[ch][k]);
(void)dt_draw_curve_add_point(c->minmax_curve, p->equalizer_x[ch][1]+1.0, p->equalizer_y[ch][1]);
c->mouse_x = c->mouse_y = c->mouse_pick = -1.0;
c->dragging = 0;
c->x_move = -1;
c->mouse_radius = 1.0/DT_IOP_COLORZONES_BANDS;
self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, DT_GUI_IOP_MODULE_CONTROL_SPACING));
// select by which dimension
GtkHBox *hbox = GTK_HBOX(gtk_hbox_new(FALSE, 5));
GtkWidget *label = gtk_label_new(_("select by"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.5f);
c->select_by = gtk_combo_box_new_text();
gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
gtk_combo_box_append_text(GTK_COMBO_BOX(c->select_by), _("hue"));
gtk_combo_box_append_text(GTK_COMBO_BOX(c->select_by), _("saturation"));
gtk_combo_box_append_text(GTK_COMBO_BOX(c->select_by), _("lightness"));
gtk_box_pack_start(GTK_BOX(hbox), c->select_by, TRUE, TRUE, 0);
g_signal_connect (G_OBJECT (c->select_by), "changed", G_CALLBACK (select_by_changed), (gpointer)self);
GtkWidget *tb = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
g_object_set(G_OBJECT(tb), "tooltip-text", _("pick gui color from image"), (char *)NULL);
g_signal_connect(G_OBJECT(tb), "toggled", G_CALLBACK(request_pick_toggled), self);
gtk_box_pack_start(GTK_BOX(hbox), tb, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), FALSE, FALSE, 0);
// tabs
GtkVBox *vbox = GTK_VBOX(gtk_vbox_new(FALSE, 0));//DT_GUI_IOP_MODULE_CONTROL_SPACING));
c->channel_tabs = GTK_NOTEBOOK(gtk_notebook_new());
gtk_notebook_append_page(GTK_NOTEBOOK(c->channel_tabs), GTK_WIDGET(gtk_hbox_new(FALSE,0)), gtk_label_new(_("lightness")));
gtk_notebook_append_page(GTK_NOTEBOOK(c->channel_tabs), GTK_WIDGET(gtk_hbox_new(FALSE,0)), gtk_label_new(_("saturation")));
gtk_notebook_append_page(GTK_NOTEBOOK(c->channel_tabs), GTK_WIDGET(gtk_hbox_new(FALSE,0)), gtk_label_new(_("hue")));
gtk_widget_show_all(GTK_WIDGET(gtk_notebook_get_nth_page(c->channel_tabs, c->channel)));
gtk_notebook_set_current_page(GTK_NOTEBOOK(c->channel_tabs), c->channel);
g_object_set(G_OBJECT(c->channel_tabs), "homogeneous", TRUE, (char *)NULL);
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(c->channel_tabs), FALSE, FALSE, 0);
g_signal_connect(G_OBJECT(c->channel_tabs), "switch_page",
G_CALLBACK (colorzones_tab_switch), self);
// the nice graph
c->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(c->area), TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(vbox), TRUE, TRUE, 5);
gtk_drawing_area_size(c->area, 195, 195);
gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
g_signal_connect (G_OBJECT (c->area), "expose-event",
G_CALLBACK (colorzones_expose), self);
g_signal_connect (G_OBJECT (c->area), "button-press-event",
G_CALLBACK (colorzones_button_press), self);
g_signal_connect (G_OBJECT (c->area), "button-release-event",
G_CALLBACK (colorzones_button_release), self);
g_signal_connect (G_OBJECT (c->area), "motion-notify-event",
G_CALLBACK (colorzones_motion_notify), self);
g_signal_connect (G_OBJECT (c->area), "leave-notify-event",
G_CALLBACK (colorzones_leave_notify), self);
g_signal_connect (G_OBJECT (c->area), "enter-notify-event",
G_CALLBACK (colorzones_enter_notify), self);
g_signal_connect (G_OBJECT (c->area), "scroll-event",
G_CALLBACK (colorzones_scrolled), self);
c->hsRGB = dt_colorspaces_create_srgb_profile();
c->hLab = dt_colorspaces_create_lab_profile();
c->xform = cmsCreateTransform(c->hLab, TYPE_Lab_DBL, c->hsRGB, TYPE_RGB_DBL,
INTENT_PERCEPTUAL, 0);
}
开发者ID:munialabs,项目名称:openPablo,代码行数:85,代码来源:colorzones.c
示例10: dt_gui_gtk_init
int
dt_gui_gtk_init(dt_gui_gtk_t *gui, int argc, char *argv[])
{
// unset gtk rc from kde:
char gtkrc[PATH_MAX], path[PATH_MAX], datadir[PATH_MAX], configdir[PATH_MAX];
dt_loc_get_datadir(datadir, PATH_MAX);
dt_loc_get_user_config_dir(configdir, PATH_MAX);
g_snprintf(gtkrc, PATH_MAX, "%s/darktable.gtkrc", configdir);
if (!g_file_test(gtkrc, G_FILE_TEST_EXISTS))
g_snprintf(gtkrc, PATH_MAX, "%s/darktable.gtkrc", datadir);
if (g_file_test(gtkrc, G_FILE_TEST_EXISTS))
(void)setenv("GTK2_RC_FILES", gtkrc, 1);
else
fprintf(stderr, "[gtk_init] could not found darktable.gtkrc");
/* lets zero mem */
memset(gui,0,sizeof(dt_gui_gtk_t));
#if GLIB_MAJOR_VERSION <= 2
#if GLIB_MINOR_VERSION < 31
if (!g_thread_supported ()) g_thread_init(NULL);
#endif
#endif
gdk_threads_init();
gdk_threads_enter();
gtk_init (&argc, &argv);
GtkWidget *widget;
gui->ui = dt_ui_initialize(argc,argv);
gui->pixmap = NULL;
gui->center_tooltip = 0;
gui->presets_popup_menu = NULL;
if(g_file_test(gtkrc, G_FILE_TEST_EXISTS))
gtk_rc_parse (gtkrc);
// Initializing the shortcut groups
darktable.control->accelerators = gtk_accel_group_new();
darktable.control->accelerator_list = NULL;
// Connecting the callback to update keyboard accels for key_pressed
g_signal_connect(G_OBJECT(gtk_accel_map_get()),
"changed",
G_CALLBACK(key_accel_changed),
NULL);
// Initializing widgets
init_widgets();
// Adding the global shortcut group to the main window
gtk_window_add_accel_group(GTK_WINDOW(dt_ui_main_window(darktable.gui->ui)),
darktable.control->accelerators);
// get the screen resolution
gui->dpi = gdk_screen_get_resolution(gtk_widget_get_screen(GTK_WIDGET(dt_ui_main_window(darktable.gui->ui))));
// set constant width from conf key
int panel_width = dt_conf_get_int("panel_width");
if(panel_width < 20 || panel_width > 500)
{
// fix for unset/insane values.
panel_width = 300;
dt_conf_set_int("panel_width", panel_width);
}
// dt_gui_background_jobs_init();
/* Have the delete event (window close) end the program */
dt_loc_get_datadir(datadir, PATH_MAX);
snprintf(path, PATH_MAX, "%s/icons", datadir);
gtk_icon_theme_append_search_path (gtk_icon_theme_get_default (), path);
widget = dt_ui_center(darktable.gui->ui);
g_signal_connect (G_OBJECT (widget), "key-press-event",
G_CALLBACK (key_pressed), NULL);
g_signal_connect (G_OBJECT (widget), "configure-event",
G_CALLBACK (configure), NULL);
g_signal_connect (G_OBJECT (widget), "expose-event",
G_CALLBACK (expose), NULL);
g_signal_connect (G_OBJECT (widget), "motion-notify-event",
G_CALLBACK (mouse_moved), NULL);
g_signal_connect (G_OBJECT (widget), "leave-notify-event",
G_CALLBACK (center_leave), NULL);
g_signal_connect (G_OBJECT (widget), "enter-notify-event",
G_CALLBACK (center_enter), NULL);
g_signal_connect (G_OBJECT (widget), "button-press-event",
G_CALLBACK (button_pressed), NULL);
g_signal_connect (G_OBJECT (widget), "button-release-event",
G_CALLBACK (button_released), NULL);
g_signal_connect (G_OBJECT (widget), "scroll-event",
G_CALLBACK (scrolled), NULL);
// TODO: left, right, top, bottom:
//leave-notify-event
//.........这里部分代码省略.........
开发者ID:sk1p,项目名称:darktable,代码行数:101,代码来源:gtk.c
示例11: dt_ellipse_events_button_pressed
static int dt_ellipse_events_button_pressed(struct dt_iop_module_t *module, float pzx, float pzy,
double pressure, int which, int type, uint32_t state,
dt_masks_form_t *form, int parentid, dt_masks_form_gui_t *gui,
int index)
{
if(!gui) return 0;
if(gui->source_selected && !gui->creation && gui->edit_mode == DT_MASKS_EDIT_FULL)
{
dt_masks_form_gui_points_t *gpt = (dt_masks_form_gui_points_t *)g_list_nth_data(gui->points, index);
if(!gpt) return 0;
// we start the source dragging
gui->source_dragging = TRUE;
gui->posx = pzx * darktable.develop->preview_pipe->backbuf_width;
gui->posy = pzy * darktable.develop->preview_pipe->backbuf_height;
gui->dx = gpt->source[0] - gui->posx;
gui->dy = gpt->source[1] - gui->posy;
return 1;
}
else if(gui->point_selected >= 1 && !gui->creation && gui->edit_mode == DT_MASKS_EDIT_FULL
&& !((state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK))
{
dt_masks_form_gui_points_t *gpt = (dt_masks_form_gui_points_t *)g_list_nth_data(gui->points, index);
if(!gpt) return 0;
gui->point_dragging = gui->point_selected;
gui->posx = pzx * darktable.develop->preview_pipe->backbuf_width;
gui->posy = pzy * darktable.develop->preview_pipe->backbuf_height;
gui->dx = gpt->points[0] - gui->posx;
gui->dy = gpt->points[1] - gui->posy;
return 1;
}
else if(gui->form_selected && !gui->creation && gui->edit_mode == DT_MASKS_EDIT_FULL
&& !((state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK))
{
dt_masks_form_gui_points_t *gpt = (dt_masks_form_gui_points_t *)g_list_nth_data(gui->points, index);
if(!gpt) return 0;
// we start the form dragging or rotating
if((state & GDK_CONTROL_MASK) == GDK_CONTROL_MASK)
gui->form_rotating = TRUE;
else
gui->form_dragging = TRUE;
gui->posx = pzx * darktable.develop->preview_pipe->backbuf_width;
gui->posy = pzy * darktable.develop->preview_pipe->backbuf_height;
gui->dx = gpt->points[0] - gui->posx;
gui->dy = gpt->points[1] - gui->posy;
return 1;
}
else if(gui->form_selected && !gui->creation && ((state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK))
{
dt_masks_form_gui_points_t *gpt = (dt_masks_form_gui_points_t *)g_list_nth_data(gui->points, index);
if(!gpt) return 0;
gui->border_toggling = TRUE;
return 1;
}
else if(gui->creation && (which == 3))
{
dt_masks_set_edit_mode(module, DT_MASKS_EDIT_FULL);
dt_masks_iop_update(module);
dt_control_queue_redraw_center();
return 1;
}
else if(gui->creation)
{
dt_iop_module_t *crea_module = gui->creation_module;
// we create the ellipse
dt_masks_point_ellipse_t *ellipse
= (dt_masks_point_ellipse_t *)(malloc(sizeof(dt_masks_point_ellipse_t)));
// we change the center value
float wd = darktable.develop->preview_pipe->backbuf_width;
float ht = darktable.develop->preview_pipe->backbuf_height;
float pts[2] = { pzx * wd, pzy * ht };
dt_dev_distort_backtransform(darktable.develop, pts, 1);
ellipse->center[0] = pts[0] / darktable.develop->preview_pipe->iwidth;
ellipse->center[1] = pts[1] / darktable.develop->preview_pipe->iheight;
if(form->type & DT_MASKS_CLONE)
{
const float a = dt_conf_get_float("plugins/darkroom/spots/ellipse_radius_a");
const float b = dt_conf_get_float("plugins/darkroom/spots/ellipse_radius_b");
const float ellipse_border = dt_conf_get_float("plugins/darkroom/spots/ellipse_border");
const float rotation = dt_conf_get_float("plugins/darkroom/spots/ellipse_rotation");
const int flags = dt_conf_get_int("plugins/darkroom/spots/ellipse_flags");
ellipse->radius[0] = MAX(0.01f, MIN(0.5f, a));
ellipse->radius[1] = MAX(0.01f, MIN(0.5f, b));
ellipse->flags = flags;
ellipse->rotation = rotation;
const float min_radius = fmin(ellipse->radius[0], ellipse->radius[1]);
const float reference = (ellipse->flags & DT_MASKS_ELLIPSE_PROPORTIONAL ? 1.0f/min_radius : 1.0f);
ellipse->border = MAX(0.005f * reference, MIN(0.5f * reference, ellipse_border));
form->source[0] = ellipse->center[0] + 0.02f;
form->source[1] = ellipse->center[1] + 0.02f;
}
else
{
const float a = dt_conf_get_float("plugins/darkroom/masks/ellipse/radius_a");
const float b = dt_conf_get_float("plugins/darkroom/masks/ellipse/radius_b");
const float ellipse_border = dt_conf_get_float("plugins/darkroom/masks/ellipse/border");
const float rotation = dt_conf_get_float("plugins/darkroom/masks/ellipse/rotation");
//.........这里部分代码省略.........
开发者ID:CarVac,项目名称:darktable,代码行数:101,代码来源:ellipse.c
示例12: dt_imageio_export_with_flags
//.........这里部分代码省略.........
}
dev.history_end++;
dev.history = g_list_append(dev.history, h);
module_found = TRUE;
g_free(s->name);
break;
}
modules = g_list_next(modules);
}
if(!module_found) dt_style_item_free(s);
stls = g_list_next(stls);
}
g_list_free(stls);
}
dt_dev_pixelpipe_set_input(&pipe, &dev, (float *)buf.buf, buf.width, buf.height, buf.iscale);
dt_dev_pixelpipe_create_nodes(&pipe, &dev);
dt_dev_pixelpipe_synch_all(&pipe, &dev);
if(filter)
{
if(!strncmp(filter, "pre:", 4)) dt_dev_pixelpipe_disable_after(&pipe, filter + 4);
if(!strncmp(filter, "post:", 5)) dt_dev_pixelpipe_disable_before(&pipe, filter + 5);
}
dt_dev_pixelpipe_get_dimensions(&pipe, &dev, pipe.iwidth, pipe.iheight, &pipe.processed_width,
&pipe.processed_height);
dt_show_times(&start, "[export] creating pixelpipe", NULL);
// find output color profile for this image:
int sRGB = 1;
int icctype = dt_conf_get_int("plugins/lighttable/export/icctype");
if(icctype == DT_COLORSPACE_SRGB)
{
sRGB = 1;
}
else if(icctype == DT_COLORSPACE_NONE)
{
GList *modules = dev.iop;
dt_iop_module_t *colorout = NULL;
while(modules)
{
colorout = (dt_iop_module_t *)modules->data;
if(colorout->get_p && strcmp(colorout->op, "colorout") == 0)
{
const dt_colorspaces_color_profile_type_t *type = colorout->get_p(colorout->params, "type");
sRGB = (!type || *type == DT_COLORSPACE_SRGB);
break; // colorout can't have > 1 instance
}
modules = g_list_next(modules);
}
}
else
{
sRGB = 0;
}
// get only once at the beginning, in case the user changes it on the way:
const gboolean high_quality_processing
= ((format_params->max_width == 0 || format_params->max_width >= pipe.processed_width)
&& (format_params->max_height == 0 || format_params->max_height >= pipe.processed_height))
? FALSE
: high_quality;
开发者ID:imarsv, |
请发表评论