本文整理汇总了C++中dt_image_cache_read_get函数的典型用法代码示例。如果您正苦于以下问题:C++ dt_image_cache_read_get函数的具体用法?C++ dt_image_cache_read_get怎么用?C++ dt_image_cache_read_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dt_image_cache_read_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: star_key_accel_callback
static gboolean
star_key_accel_callback(GtkAccelGroup *accel_group, GObject *acceleratable,
guint keyval, GdkModifierType modifier, gpointer data)
{
long int num = (long int)data;
switch (num)
{
case DT_VIEW_REJECT:
case DT_VIEW_DESERT:
case DT_VIEW_STAR_1:
case DT_VIEW_STAR_2:
case DT_VIEW_STAR_3:
case DT_VIEW_STAR_4:
case DT_VIEW_STAR_5:
case 666:
{
int32_t mouse_over_id;
DT_CTL_GET_GLOBAL(mouse_over_id, lib_image_mouse_over_id);
if(mouse_over_id <= 0)
{
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select imgid from selected_images", -1, &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW)
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, sqlite3_column_int(stmt, 0));
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
if(num == 666 || num == DT_VIEW_DESERT) image->flags &= ~0xf;
else if(num == DT_VIEW_STAR_1 && ((image->flags & 0x7) == 1)) image->flags &= ~0x7;
else
{
image->flags &= ~0x7;
image->flags |= num;
}
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, cimg);
}
sqlite3_finalize(stmt);
}
else
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, mouse_over_id);
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
if(num == 666 || num == DT_VIEW_DESERT) image->flags &= ~0xf;
else if(num == DT_VIEW_STAR_1 && ((image->flags & 0x7) == 1)) image->flags &= ~0x7;
else
{
image->flags &= ~0x7;
image->flags |= num;
}
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, cimg);
}
dt_control_queue_redraw_center();
break;
}
default:
break;
}
return TRUE;
}
开发者ID:amitkr,项目名称:darktable,代码行数:60,代码来源:lighttable.c
示例2: dt_history_load_and_apply_on_selection
int
dt_history_load_and_apply_on_selection (gchar *filename)
{
int res=0;
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select * from selected_images", -1, &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW)
{
int imgid = sqlite3_column_int(stmt, 0);
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, (int32_t)imgid);
dt_image_t *img = dt_image_cache_write_get(darktable.image_cache, cimg);
if(img)
{
if (dt_exif_xmp_read(img, filename, 1))
{
res=1;
break;
}
/* if current image in develop reload history */
if (dt_dev_is_current_image(darktable.develop, imgid))
dt_dev_reload_history_items (darktable.develop);
dt_image_cache_write_release(darktable.image_cache, img, DT_IMAGE_CACHE_RELAXED);
dt_image_cache_read_release(darktable.image_cache, img);
dt_mipmap_cache_remove(darktable.mipmap_cache, imgid);
}
}
sqlite3_finalize(stmt);
return res;
}
开发者ID:itarozzi,项目名称:darktable,代码行数:31,代码来源:history.c
示例3: deflicker_prepare_histogram
static void
deflicker_prepare_histogram(dt_iop_module_t *self, uint32_t **histogram,
dt_dev_histogram_stats_t *histogram_stats)
{
dt_mipmap_buffer_t buf;
dt_mipmap_cache_read_get(darktable.mipmap_cache, &buf, self->dev->image_storage.id, DT_MIPMAP_FULL, DT_MIPMAP_BLOCKING);
const dt_image_t *img = dt_image_cache_read_get(darktable.image_cache, self->dev->image_storage.id);
dt_image_t image = *img;
dt_image_cache_read_release(darktable.image_cache, img);
if(buf.size != DT_MIPMAP_FULL)
{
dt_control_log(_("failed to get raw buffer from image `%s'"), image.filename);
dt_mipmap_cache_read_release(darktable.mipmap_cache, &buf);
return;
}
dt_dev_histogram_collection_params_t histogram_params;
memcpy(&histogram_params, &self->histogram_params, sizeof(dt_dev_histogram_collection_params_t));
dt_iop_roi_t roi = {0, 0, image.width, image.height, 1.0f};
histogram_params.roi = &roi;
dt_histogram_worker(&histogram_params, histogram_stats, buf.buf, histogram, dt_histogram_helper_cs_RAW_uint16);
histogram_stats->ch = 1u;
dt_mipmap_cache_read_release(darktable.mipmap_cache, &buf);
}
开发者ID:cyr123,项目名称:darktable,代码行数:27,代码来源:exposure.c
示例4: _jump_to
static void
_jump_to()
{
int32_t imgid = dt_control_get_mouse_over_id();
if(imgid == -1)
{
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"select imgid from selected_images", -1, &stmt, NULL);
if(sqlite3_step(stmt) == SQLITE_ROW)
imgid = sqlite3_column_int(stmt, 0);
sqlite3_finalize(stmt);
}
if(imgid != -1)
{
char path[512];
const dt_image_t *img = dt_image_cache_read_get(darktable.image_cache, imgid);
dt_image_film_roll_directory(img, path, sizeof(path));
dt_image_cache_read_release(darktable.image_cache, img);
char collect[1024];
snprintf(collect, sizeof(collect), "1:0:0:%s$", path);
dt_collection_deserialize(collect);
}
}
开发者ID:Coshibu,项目名称:darktable,代码行数:26,代码来源:metadata_view.c
示例5: _lib_filmstrip_ratings_key_accel_callback
static gboolean _lib_filmstrip_ratings_key_accel_callback(GtkAccelGroup *accel_group,
GObject *aceeleratable, guint keyval,
GdkModifierType modifier, gpointer data)
{
int num = GPOINTER_TO_INT(data);
switch (num)
{
case DT_VIEW_DESERT:
case DT_VIEW_REJECT:
case DT_VIEW_STAR_1:
case DT_VIEW_STAR_2:
case DT_VIEW_STAR_3:
case DT_VIEW_STAR_4:
case DT_VIEW_STAR_5:
case 666:
{
int32_t mouse_over_id;
DT_CTL_GET_GLOBAL(mouse_over_id, lib_image_mouse_over_id);
if (mouse_over_id <= 0) return FALSE;
/* get image from cache */
int32_t activated_image = -1;
activated_image = darktable.view_manager->proxy.filmstrip.activated_image(darktable.view_manager->proxy.filmstrip.module);
int offset = 0;
if(mouse_over_id == activated_image)
offset = dt_collection_image_offset(mouse_over_id);
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, mouse_over_id);
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
if (num == 666)
image->flags &= ~0xf;
else if (num == DT_VIEW_STAR_1 && ((image->flags & 0x7) == 1))
image->flags &= ~0x7;
else if(num == DT_VIEW_REJECT && ((image->flags & 0x7) == 6)) image->flags &= ~0x7;
else
{
image->flags &= ~0x7;
image->flags |= num;
}
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, image);
dt_collection_hint_message(darktable.collection); // More than this, we need to redraw all
if(mouse_over_id == activated_image)
if(_lib_filmstrip_imgid_in_collection(darktable.collection, mouse_over_id) == 0)
dt_view_filmstrip_scroll_relative(0, offset);
/* redraw all */
dt_control_queue_redraw();
break;
}
default:
break;
}
return TRUE;
}
开发者ID:danielbaak,项目名称:darktable,代码行数:59,代码来源:filmstrip.c
示例6: dt_image_add_time_offset
void dt_image_add_time_offset(const int imgid, const long int offset)
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid);
if (!cimg)
return;
// get the datetime_taken and calculate the new time
gint year;
gint month;
gint day;
gint hour;
gint minute;
gint seconds;
if (sscanf(cimg->exif_datetime_taken, "%d:%d:%d %d:%d:%d",
(int*)&year, (int*)&month, (int*)&day,
(int*)&hour,(int*)&minute,(int*)&seconds) != 6)
{
fprintf(stderr,"broken exif time in db, '%s', imgid %d\n", cimg->exif_datetime_taken, imgid);
dt_image_cache_read_release(darktable.image_cache, cimg);
return;
}
GTimeZone *tz = g_time_zone_new_utc();
GDateTime *datetime_original = g_date_time_new(tz, year, month, day, hour, minute, seconds);
g_time_zone_unref(tz);
if(!datetime_original)
{
dt_image_cache_read_release(darktable.image_cache, cimg);
return;
}
// let's add our offset
GDateTime *datetime_new = g_date_time_add_seconds(datetime_original, offset);
g_date_time_unref(datetime_original);
if(!datetime_new)
{
dt_image_cache_read_release(darktable.image_cache, cimg);
return;
}
gchar *datetime = g_date_time_format(datetime_new, "%Y:%m:%d %H:%M:%S");
g_date_time_unref(datetime_new);
// update exif_datetime_taken in img
if(datetime)
{
dt_image_t *img = dt_image_cache_write_get(darktable.image_cache, cimg);
g_strlcpy(img->exif_datetime_taken, datetime, 20);
dt_image_cache_write_release(darktable.image_cache, img, DT_IMAGE_CACHE_SAFE);
}
dt_image_cache_read_release(darktable.image_cache, cimg);
g_free(datetime);
}
开发者ID:michalfabik,项目名称:darktable,代码行数:56,代码来源:image.c
示例7: dt_image_remove
void dt_image_remove(const int32_t imgid)
{
sqlite3_stmt *stmt;
const dt_image_t *img = dt_image_cache_read_get(darktable.image_cache, imgid);
int old_group_id = img->group_id;
dt_image_cache_read_release(darktable.image_cache, img);
// make sure we remove from the cache first, or else the cache will look for imgid in sql
dt_image_cache_remove(darktable.image_cache, imgid);
int new_group_id = dt_grouping_remove_from_group(imgid);
if(darktable.gui && darktable.gui->expanded_group_id == old_group_id)
darktable.gui->expanded_group_id = new_group_id;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from images where id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"update tagxtag set count = count - 1 where "
"(id2 in (select tagid from tagged_images where imgid = ?1)) or "
"(id1 in (select tagid from tagged_images where imgid = ?1))",
-1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from tagged_images where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from history where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from color_labels where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from meta_data where id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db),
"delete from selected_images where imgid = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, imgid);
sqlite3_step(stmt);
sqlite3_finalize(stmt);
// also clear all thumbnails in mipmap_cache.
dt_mipmap_cache_remove(darktable.mipmap_cache, imgid);
}
开发者ID:jcsogo,项目名称:darktable,代码行数:55,代码来源:image.c
示例8: remove_preset_flag
static void
remove_preset_flag(const int imgid)
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid);
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
// clear flag
image->flags &= ~DT_IMAGE_AUTO_PRESETS_APPLIED;
// write through to sql+xmp
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, cimg);
}
开发者ID:yama1968,项目名称:darktable,代码行数:13,代码来源:history.c
示例9: dt_ratings_apply_to_image
void dt_ratings_apply_to_image (int imgid, int rating)
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid);
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
// one star is a toggle, so you can easily reject images by removing the last star:
if(((image->flags & 0x7) == 1) && (rating == 1)) rating = 0;
image->flags = (image->flags & ~0x7) | (0x7 & rating);
// synch through:
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, image);
dt_collection_hint_message(darktable.collection);
}
开发者ID:Coshibu,项目名称:darktable,代码行数:13,代码来源:ratings.c
示例10: finalize_store
void
finalize_store(dt_imageio_module_storage_t *self, dt_imageio_module_data_t *params)
{
dt_imageio_email_t *d = (dt_imageio_email_t *)params;
// All images are exported, generate a mailto uri and startup default mail client
gchar uri[4096]= {0};
gchar body[4096]= {0};
gchar attachments[4096]= {0};
gchar *uriFormat=NULL;
gchar *subject=_("images exported from darktable");
gchar *imageBodyFormat="%s %s"; // filename, exif oneliner
gchar *attachmentFormat=NULL;
gchar *attachmentSeparator="";
// If no default handler detected above, we use gtk_show_uri with mailto:// and hopes things goes right..
uriFormat="xdg-email --subject \"%s\" --body \"%s\" %s &"; // subject, body, and list of attachments with format:
attachmentFormat=" --attach \"%s\"";
while( d->images )
{
gchar exif[256]= {0};
_email_attachment_t *attachment=( _email_attachment_t *)d->images->data;
gchar *filename = g_path_get_basename( attachment->file );
const dt_image_t *img = dt_image_cache_read_get(darktable.image_cache, attachment->imgid);
dt_image_print_exif(img, exif, sizeof(exif));
g_snprintf(body+strlen(body),4096-strlen(body), imageBodyFormat, filename, exif );
g_free(filename);
if( strlen( attachments ) )
g_snprintf(attachments+strlen(attachments),4096-strlen(attachments), "%s", attachmentSeparator );
g_snprintf(attachments+strlen(attachments),4096-strlen(attachments), attachmentFormat, attachment->file );
// Free attachment item and remove
dt_image_cache_read_release(darktable.image_cache, img);
g_free( d->images->data );
d->images = g_list_remove( d->images, d->images->data );
}
// build uri and launch before we quit...
g_snprintf(uri, sizeof(uri), uriFormat, subject, body, attachments );
fprintf(stderr, "[email] launching `%s'\n", uri);
if(system( uri ) < 0)
{
// TODO: after string freeze is broken again, report to ui:
// dt_control_log(_("could not launch email client!"));
fprintf(stderr, "[email] could not launch subprocess!\n");
}
}
开发者ID:cherrot,项目名称:darktable,代码行数:50,代码来源:email.c
示例11: _lib_filmstrip_button_press_callback
static gboolean _lib_filmstrip_button_press_callback(GtkWidget *w, GdkEventButton *e, gpointer user_data)
{
dt_lib_module_t *self = (dt_lib_module_t *)user_data;
dt_lib_filmstrip_t *strip = (dt_lib_filmstrip_t *)self->data;
int32_t mouse_over_id = strip->mouse_over_id;
/* is this an activation of image */
if (e->button == 1 && e->type == GDK_2BUTTON_PRESS)
if (mouse_over_id > 0)
{
strip->activated_image = mouse_over_id;
dt_control_signal_raise(darktable.signals, DT_SIGNAL_VIEWMANAGER_FILMSTRIP_ACTIVATE);
return TRUE;
}
/* let check if any thumb controls was clicked */
switch(strip->image_over)
{
case DT_VIEW_DESERT:
break;
case DT_VIEW_REJECT:
case DT_VIEW_STAR_1:
case DT_VIEW_STAR_2:
case DT_VIEW_STAR_3:
case DT_VIEW_STAR_4:
case DT_VIEW_STAR_5:
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, mouse_over_id);
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
image->dirty = 1;
if(strip->image_over == DT_VIEW_STAR_1 && ((image->flags & 0x7) == 1)) image->flags &= ~0x7;
else if(strip->image_over == DT_VIEW_REJECT && ((image->flags & 0x7) == 6)) image->flags &= ~0x7;
else
{
image->flags &= ~0x7;
image->flags |= strip->image_over;
}
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, image);
break;
}
default:
return FALSE;
}
return TRUE;
}
开发者ID:nagyistoce,项目名称:radhermit-darktable,代码行数:50,代码来源:filmstrip.c
示例12: dt_image_set_location
void dt_image_set_location(const int32_t imgid, double lon, double lat)
{
/* fetch image from cache */
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid);
if (!cimg)
return;
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
/* set image location */
image->longitude = lon;
image->latitude = lat;
/* store */
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, image);
}
开发者ID:michalfabik,项目名称:darktable,代码行数:16,代码来源:image.c
示例13: group_with
int group_with(lua_State *L) {
dt_lua_image_t first_image;
luaA_to(L,dt_lua_image_t,&first_image,1);
if(lua_isnoneornil(L,2)) {
dt_grouping_remove_from_group(first_image);
return 0;
}
dt_lua_image_t second_image;
luaA_to(L,dt_lua_image_t,&second_image,2);
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, second_image);
int group_id = cimg->group_id;
dt_image_cache_read_release(darktable.image_cache, cimg);
dt_grouping_add_to_group(group_id,first_image);
return 0;
}
开发者ID:cherrot,项目名称:darktable,代码行数:17,代码来源:image.c
示例14: dt_control_write_sidecar_files_job_run
int32_t dt_control_write_sidecar_files_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;
while(t)
{
imgid = (long int)t->data;
const dt_image_t *img = dt_image_cache_read_get(darktable.image_cache, (int32_t)imgid);
char dtfilename[DT_MAX_PATH_LEN+4];
dt_image_full_path(img->id, dtfilename, DT_MAX_PATH_LEN);
char *c = dtfilename + strlen(dtfilename);
sprintf(c, ".xmp");
dt_exif_xmp_write(imgid, dtfilename);
dt_image_cache_read_release(darktable.image_cache, img);
t = g_list_delete_link(t, t);
}
return 0;
}
开发者ID:minusdreidb,项目名称:darktable,代码行数:19,代码来源:control_jobs.c
示例15: _lib_filmstrip_ratings_key_accel_callback
static gboolean _lib_filmstrip_ratings_key_accel_callback(GtkAccelGroup *accel_group,
GObject *aceeleratable, guint keyval,
GdkModifierType modifier, gpointer data)
{
long int num = (long int)data;
switch (num)
{
case DT_VIEW_DESERT:
case DT_VIEW_REJECT:
case DT_VIEW_STAR_1:
case DT_VIEW_STAR_2:
case DT_VIEW_STAR_3:
case DT_VIEW_STAR_4:
case DT_VIEW_STAR_5:
case 666:
{
int32_t mouse_over_id;
DT_CTL_GET_GLOBAL(mouse_over_id, lib_image_mouse_over_id);
if (mouse_over_id <= 0) return FALSE;
/* get image from cache */
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, mouse_over_id);
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
if (num == 666)
image->flags &= ~0xf;
else if (num == DT_VIEW_STAR_1 && ((image->flags & 0x7) == 1))
image->flags &= ~0x7;
else
{
image->flags &= ~0x7;
image->flags |= num;
}
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, image);
/* redraw all */
dt_control_queue_redraw();
break;
}
default:
break;
}
return TRUE;
}
开发者ID:nagyistoce,项目名称:radhermit-darktable,代码行数:43,代码来源:filmstrip.c
示例16: get_group
int get_group(lua_State *L) {
dt_lua_image_t first_image;
luaA_to(L,dt_lua_image_t,&first_image,1);
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, first_image);
int group_id = cimg->group_id;
dt_image_cache_read_release(darktable.image_cache, cimg);
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select id from images where group_id = ?1", -1, &stmt, NULL);
DT_DEBUG_SQLITE3_BIND_INT(stmt, 1, group_id);
lua_newtable(L);
while(sqlite3_step(stmt) == SQLITE_ROW)
{
int imgid = sqlite3_column_int(stmt, 0);
luaA_push(L,dt_lua_image_t,&imgid);
luaL_ref(L,-2);
}
luaA_push(L,dt_lua_image_t,&group_id);
lua_setfield(L,-2,"leader");
return 1;
}
开发者ID:cherrot,项目名称:darktable,代码行数:20,代码来源:image.c
示例17: _view_map_filmstrip_activate_callback
static void _view_map_filmstrip_activate_callback(gpointer instance, gpointer user_data)
{
dt_view_t *self = (dt_view_t*)user_data;
dt_map_t *lib = (dt_map_t*)self->data;
double longitude, latitude;
int32_t imgid = 0;
if ((imgid=dt_view_filmstrip_get_activated_imgid(darktable.view_manager))>0)
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid);
longitude = cimg->longitude;
latitude = cimg->latitude;
dt_image_cache_read_release(darktable.image_cache, cimg);
if(!isnan(longitude) && !isnan(latitude))
{
int zoom;
g_object_get(G_OBJECT(lib->map), "zoom", &zoom, NULL);
_view_map_center_on_location(self, longitude, latitude, zoom); // TODO: is it better to keep the zoom level or to zoom in? 16 is a nice close up.
}
}
}
开发者ID:chubinou,项目名称:darktable,代码行数:20,代码来源:map.c
示例18: dt_history_load_and_apply
int dt_history_load_and_apply(int imgid, gchar *filename, int history_only)
{
int res = 0;
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, imgid);
dt_image_t *img = dt_image_cache_write_get(darktable.image_cache, cimg);
if(img)
{
if(dt_exif_xmp_read(img, filename, history_only))
return 1;
/* if current image in develop reload history */
if(dt_dev_is_current_image(darktable.develop, imgid))
dt_dev_reload_history_items (darktable.develop);
dt_image_cache_write_release(darktable.image_cache, img, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, img);
dt_mipmap_cache_remove(darktable.mipmap_cache, imgid);
}
return res;
}
开发者ID:yama1968,项目名称:darktable,代码行数:20,代码来源:history.c
示例19: dt_ratings_apply_to_selection
void dt_ratings_apply_to_selection (int rating)
{
uint32_t count = dt_collection_get_selected_count(darktable.collection);
if (count)
{
dt_control_log(ngettext("applying rating %d to %d image", "applying rating %d to %d images", count), rating, count);
#if 0 // not updating cache
gchar query[1024]={0};
g_snprintf(query,1024,
"update images set flags=(images.flags & ~7) | (7 & %d) where id in (select imgid from selected_images)",
rating
);
DT_DEBUG_SQLITE3_EXEC(dt_database_get(darktable.db), query, NULL, NULL, NULL);
#endif
/* for each selected image update rating */
sqlite3_stmt *stmt;
DT_DEBUG_SQLITE3_PREPARE_V2(dt_database_get(darktable.db), "select imgid from selected_images", -1, &stmt, NULL);
while(sqlite3_step(stmt) == SQLITE_ROW)
{
const dt_image_t *cimg = dt_image_cache_read_get(darktable.image_cache, sqlite3_column_int(stmt, 0));
dt_image_t *image = dt_image_cache_write_get(darktable.image_cache, cimg);
image->flags = (image->flags & ~0x7) | (0x7 & rating);
// synch through:
dt_image_cache_write_release(darktable.image_cache, image, DT_IMAGE_CACHE_SAFE);
dt_image_cache_read_release(darktable.image_cache, image);
}
sqlite3_finalize(stmt);
/* redraw view */
dt_control_queue_redraw_center();
}
else
dt_control_log(_("no images selected to apply rating"));
}
开发者ID:sk1p,项目名称:darktable,代码行数:36,代码来源:ratings.c
示例20: luaA_to
static const dt_image_t*checkreadimage(lua_State*L,int index)
{
dt_lua_image_t imgid;
luaA_to(L,dt_lua_image_t,&imgid,index);
return dt_image_cache_read_get(darktable.image_cache,imgid);
}
开发者ID:cherrot,项目名称:darktable,代码行数:6,代码来源:image.c
注:本文中的dt_image_cache_read_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论