本文整理汇总了C++中create_image函数的典型用法代码示例。如果您正苦于以下问题:C++ create_image函数的具体用法?C++ create_image怎么用?C++ create_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_image函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: list1_find
SimplyImage *simply_res_add_image(SimplyRes *self, uint32_t id, int16_t width, int16_t height,
uint8_t *pixels, uint16_t pixels_length) {
SimplyImage *image = (SimplyImage*) list1_find(self->images, id_filter, (void*)(uintptr_t) id);
if (image) {
destroy_image(self, image);
}
CreateDataContext context = {
.size = GSize(width, height),
.data_length = pixels_length,
.data = pixels,
};
image = IF_SDK_3_ELSE(create_image(self, create_bitmap_with_png_data, &context),
create_image(self, create_bitmap_with_data, &context));
if (image) {
image->id = id;
add_image(self, image);
}
return image;
}
void simply_res_remove_image(SimplyRes *self, uint32_t id) {
SimplyImage *image = (SimplyImage*) list1_find(self->images, id_filter, (void*)(uintptr_t) id);
if (image) {
destroy_image(self, image);
}
}
开发者ID:84zume,项目名称:pebblejs,代码行数:27,代码来源:simply_res.c
示例2: prepare_title
/* We create a sprite for the title and an animation
* with 6 frames.
* We also create a mask image for a spot and fade-in
* effect.
*/
static int prepare_title(struct game_title* title)
{
int f;
title->sprite = create_sprite(create_image("res/title.png"), 70, 15);
if (title->sprite == NULL) goto error;
title->bling = create_animation();
if (title->bling == NULL) goto error;
add_frame(title->bling, 0, SECOND / 2, NULL);
for (f = 5; f >= 0; f--)
add_frame(title->bling, f, SECOND / 10, NULL);
title->bling->mode = FREEZE_LAST_FRAME;
title->mask = create_target_image(192, 108, color_from_RGB(50, 50, 50));
if (title->mask == NULL) goto error;
set_blend_mode(title->mask, MULTIPLY);
title->spot = create_image("res/spot.png");
if (title->spot == NULL) goto error;
set_blend_mode(title->spot, ADD);
return 0;
error:
ERROR("Unable to prepare title");
cleanup_title(title);
return -1;
}
开发者ID:dmalves,项目名称:cage,代码行数:31,代码来源:wizard.c
示例3: TEST
TEST(PermutationTest, Multiplication) {
Permutation p = Permutation(create_image(3, 1, 0, 2));
Permutation q = Permutation(create_image(3, 0, 2, 1));
Permutation product = p * q;
EXPECT_EQ(1, product(0));
EXPECT_EQ(2, product(1));
EXPECT_EQ(0, product(2));
}
开发者ID:dvberkel,项目名称:schreier-sims,代码行数:10,代码来源:permutation_unittest.cpp
示例4: do_check
static pixman_bool_t
do_check (int i)
{
pixman_image_t *source, *dest, *mask;
pixman_op_t op;
int x, y, width, height;
pixman_image_t *dest_copy;
pixman_bool_t result = TRUE;
pixman_bool_t component_alpha;
prng_srand (i);
op = RANDOM_ELT (operators);
x = prng_rand_n (MAX_WIDTH);
y = prng_rand_n (MAX_HEIGHT);
width = prng_rand_n (MAX_WIDTH) + 4;
height = prng_rand_n (MAX_HEIGHT) + 4;
source = create_image (NULL);
mask = create_image (NULL);
dest = create_image (&dest_copy);
if (x >= dest->bits.width)
x = dest->bits.width / 2;
if (y >= dest->bits.height)
y = dest->bits.height / 2;
if (x + width > dest->bits.width)
width = dest->bits.width - x;
if (y + height > dest->bits.height)
height = dest->bits.height - y;
component_alpha = prng_rand_n (2);
pixman_image_set_component_alpha (mask, component_alpha);
pixman_image_composite32 (op, source, mask, dest,
0, 0, 0, 0,
x, y, width, height);
if (!verify (i, op, source, mask, dest, dest_copy,
x, y, width, height, component_alpha))
{
result = FALSE;
}
pixman_image_unref (source);
pixman_image_unref (mask);
pixman_image_unref (dest);
pixman_image_unref (dest_copy);
return result;
}
开发者ID:Distrotech,项目名称:pixman,代码行数:51,代码来源:tolerance-test.c
示例5: main
int main(int argc, char* argv[])
{
void* img = (void*)malloc(5000000);
create_image(img, 5000000);
char* outp = "initrd.img";
char* tdir = NULL;
for(int i = 1; i < argc; i++)
{
if(strcmp(argv[i], "-d") == 0)
{
tdir = argv[++i];
}
else if (strcmp(argv[i], "-o") == 0)
{
outp = argv[++i];
}
}
FILE* dmp = fopen(outp,"w");
process_directory(tdir, "");
fwrite(img,1, 5000000,dmp);
fclose(dmp);
return 0;
}
开发者ID:FalconGames,项目名称:infinity,代码行数:25,代码来源:main.c
示例6: sizeof
void BackProjection::create_prob()
{
int i, j;
input = (unsigned char *)malloc(r * c * sizeof(unsigned char));
for (i = 0; i < r; i++)
{
for (j = 0; j < c; j++)
{
input[ i * c + j ] = FALSE;
}
}
create_image(r, c, input, r < c ? r : c, r < c ? (F_TYPE) r / (F_TYPE) 4.0: (F_TYPE) c / (F_TYPE) 4.0);
std::string inName = "BackProjection_ref_in.dat";
std::string bmpName = "BackProjection_ref_in.bmp";
printimage(r, c, input, inName.c_str());
write_bmp(bmpName.c_str(), input, r, c);
rproj = (int *)malloc(r * sizeof(int));
cproj = (int *)malloc(c * sizeof(int));
uproj = (int *)malloc((r + c - 1) * sizeof(int));
dproj = (int *)malloc((r + c - 1) * sizeof(int));
rband = (int *)malloc(r * c * sizeof(int));
cband = (int *)malloc(c * sizeof(int));
uband = (int *)malloc((r + c - 1) * sizeof(int));
dband = (int *)malloc((r + c - 1) * sizeof(int));
makeband(r, c, rband, cband, uband, dband);
create_input(r, c, input, rproj, cproj, uproj, dproj, uband, dband);
}
开发者ID:ardiyu07,项目名称:bemap,代码行数:33,代码来源:BackProjection.cpp
示例7: do_create
/*
* create new map from scratch, using %x and %y as position parameters
* 0..nx-1 and 0..ny-1
*/
local void do_create(int nx, int ny,int nz)
{
double m_min, m_max, total;
real fin[5], fout;
int ix, iy, iz;
int badvalues;
m_min = HUGE; m_max = -HUGE;
total = 0.0; /* count total intensity in new map */
badvalues = 0; /* count number of bad operations */
if (nz > 0) {
warning("cube");
if (!create_cube (&iptr, nx, ny, nz)) /* create default empty image */
error("Could not create 3D image from scratch");
#if 0
Axis(iptr) = 1; /* set linear axistype with a fits-style reference pixel */
#endif
wcs_f2i(3,crpix,crval,cdelt,iptr);
for (iz=0; iz<nz; iz++) {
fin[2] = iz-crpix[2]+1; /* crpix is 1 for first pixel (FITS convention) */
for (iy=0; iy<ny; iy++) {
fin[1] = iy-crpix[1]+1;
for (ix=0; ix<nx; ix++) {
fout = 0.0;
CubeValue(iptr,ix,iy,iz) = fout;
m_min = MIN(m_min,fout); /* and check for new minmax */
m_max = MAX(m_max,fout);
total += fout; /* add up totals */
}
}
}
} else {
warning("2d-map");
if (!create_image (&iptr, nx, ny))
error("Could not create 2D image from scratch");
wcs_f2i(2,crpix,crval,cdelt,iptr);
for (iy=0; iy<ny; iy++) {
fin[1] = iy;
for (ix=0; ix<nx; ix++) {
fout = 0.0;
MapValue(iptr,ix,iy) = fout;
m_min = MIN(m_min,fout); /* and check for new minmax */
m_max = MAX(m_max,fout);
total += fout; /* add up totals */
}
}
}
MapMin(iptr) = m_min;
MapMax(iptr) = m_max;
dprintf(1,"New min and max in map are: %f %f\n",m_min,m_max);
dprintf(1,"New total brightness/mass is %f\n",
total*Dx(iptr)*Dy(iptr));
if (badvalues)
warning ("There were %d bad operations in dofie",badvalues);
}
开发者ID:Milkyway-at-home,项目名称:nemo,代码行数:64,代码来源:ccdgen.c
示例8: open_test_window
static void
open_test_window (void)
{
GtkWidget *grid;
int i;
test_window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (test_window), "Tests");
g_signal_connect (test_window, "delete-event",
G_CALLBACK (gtk_main_quit), test_window);
gtk_window_set_resizable (GTK_WINDOW (test_window), FALSE);
test_widgets[TEST_WIDGET_IMAGE] = create_image ();
test_widgets[TEST_WIDGET_LABEL] = create_label (FALSE, FALSE);
test_widgets[TEST_WIDGET_VERTICAL_LABEL] = create_label (TRUE, FALSE);
test_widgets[TEST_WIDGET_WRAP_LABEL] = create_label (FALSE, TRUE);
test_widgets[TEST_WIDGET_BUTTON] = create_button ();
test_widgets[TEST_WIDGET_ALIGNMENT] = create_alignment ();
grid = gtk_grid_new ();
gtk_container_add (GTK_CONTAINER (test_window), grid);
for (i = 0; i < TEST_WIDGET_LAST; ++i)
{
gtk_grid_attach (GTK_GRID (grid), test_widgets[i], i % 3, i / 3, 1, 1);
}
gtk_widget_show_all (test_window);
}
开发者ID:RavikumarTulugu,项目名称:antkorp,代码行数:32,代码来源:testadjustsize.c
示例9: create_frame_and_image
frame_t create_frame_and_image(unsigned long index, const int w, const int h) {
unsigned char* image_data = (unsigned char*)malloc(w * h);
int i=0;
for ( ; i<w * h ; ++i)
image_data[i] = (13 * i + (1243 & i)) % 256;
return create_frame(index, create_image(w, h, w, image_data, 1));
}
开发者ID:sebsgit,项目名称:toolbox,代码行数:7,代码来源:test.c
示例10: main
int main(int argc, char **argv)
{
srand(time(NULL));
clock_t beg, end;
int size = 50;
grid *grd = grid_allocate(size, size);
beg = clock();
grid_create(grd, 0.6);
cl_list* clusters = clusterization(grd);
end = clock();
int i, j;
for (i = 0; i < size; i++)
{
for (j = 0; j < size; j++)
printf("%d", grd->cells[i * size + j]);
printf("\n");
}
cl_list_print(clusters);
create_image("img.png", 2000, grd, clusters);
grid_free(grd);
printf("Finished in %g sec\n", (double)(end - beg) / CLOCKS_PER_SEC);
return 0;
}
开发者ID:TarasKuzyo,项目名称:percolation-clustering,代码行数:30,代码来源:driver.c
示例11: main
int main(int argc, char **argv)
{
char *progname = argv[0];
/* process command line options */
options.vm = 0;
options.extended = 0;
while ((argc > 1) && (argv[1][0] == '-') && (argv[1][1] == '-')) {
char *option = &argv[1][2];
if (strcmp(option, "vm") == 0) {
options.vm = 1;
} else if (strcmp(option, "extended") == 0) {
options.extended = 1;
} else {
error("%s: invalid option\nusage: %s %s\n", progname,
progname, ARGS);
}
argc--;
argv++;
}
if (options.vm == 1) {
error("%s: option --vm not implemented\n", progname);
}
if (argc < 3) {
/* at least 3 args (createimage bootblock kernel) */
error("usage: %s %s\n", progname, ARGS);
}
create_image(argc - 1, argv + 1);
return 0;
}
开发者ID:ahimelman,项目名称:project2,代码行数:31,代码来源:createimage.c
示例12: save_image
// Save a raw image instance into a file
bool save_image(const std::string &dest_filename, LLPointer<LLImageRaw> raw_image, int blocks_size, int precincts_size, int levels, bool reversible, bool output_stats)
{
LLPointer<LLImageFormatted> image = create_image(dest_filename);
// Set the image codestream parameters on output in the case of a j2c image
if (image->getCodec() == IMG_CODEC_J2C)
{
// That method doesn't exist (and likely, doesn't make sense) for any other image file format
// hence the required cryptic cast.
if ((blocks_size != -1) || (precincts_size != -1) || (levels != 0))
{
((LLImageJ2C*)(image.get()))->initEncode(*raw_image, blocks_size, precincts_size, levels);
}
((LLImageJ2C*)(image.get()))->setReversible(reversible);
}
if (!image->encode(raw_image, 0.0f))
{
return false;
}
if (output_stats)
{
output_image_stats(image, dest_filename);
}
return image->save(dest_filename);
}
开发者ID:AlchemyDev,项目名称:Carbon,代码行数:29,代码来源:llimage_libtest.cpp
示例13: create_image
SimplyImage *simply_res_add_bundled_image(SimplyRes *self, uint32_t id) {
SimplyImage *image = create_image(self, create_bitmap_with_id, (void*)(uintptr_t) id);
if (image) {
add_image(self, image);
}
return image;
}
开发者ID:84zume,项目名称:pebblejs,代码行数:7,代码来源:simply_res.c
示例14: piglit_display
enum piglit_result
piglit_display(void)
{
const unsigned w = 2;
const unsigned h = 2;
const unsigned cpp = 4;
const unsigned fourcc = DRM_FORMAT_ARGB8888;
const unsigned char *pixels = alloca(w * h * cpp);
struct piglit_dma_buf *buf;
EGLImageKHR img;
enum piglit_result res;
bool pass = true;
res = piglit_create_dma_buf(w, h, fourcc, pixels, &buf);
if (res != PIGLIT_PASS)
return res;
img = create_image(w, h, buf->fd, buf->stride[0], buf->offset[0]);
if (!img) {
piglit_destroy_dma_buf(buf);
/* unsupported format (BAD_MATCH) is not an error. */
return piglit_check_egl_error(EGL_BAD_MATCH) ?
PIGLIT_SKIP : PIGLIT_FAIL;
}
pass = try_as_texture_2d(img) && pass;
pass = try_as_render_buffer(img) && pass;
eglDestroyImageKHR(eglGetCurrentDisplay(), img);
piglit_destroy_dma_buf(buf);
return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
开发者ID:chemecse,项目名称:piglit,代码行数:35,代码来源:intel_external_sampler_only.c
示例15: create_image
image *scale_image_half(const image *img)
{
image *simg = create_image((img->width + 1) / 2, (img->height + 1) / 2);
for (uint32_t y = 0; y < img->height; y += 2)
{
for (uint32_t x = 0; x < img->width; x += 2)
{
uint32_t p = y * img->width + x;
uint32_t sp = y * img->width / 4 + x / 2;
for (int c = 0; c < CHANNELS; c++)
{
simg->data[sp * CHANNELS + c] = (
img->data[p * CHANNELS + c] +
(x + 1 == img->width ? 0 :
img->data[(p + 1) * CHANNELS + c]) +
(y + 1 == img->height ? 0 :
img->data[(p + img->width) * CHANNELS + c]) +
(x + 1 == img->width || y + 1 == img->height ? 0 :
img->data[(p + img->width + 1) * CHANNELS + c])
) / 4;
}
}
}
return simg;
}
开发者ID:saltire,项目名称:cmapbash,代码行数:28,代码来源:image.c
示例16: main
int main(int argc, char* argv[])
{
create_image_world();
int image = create_image(100, 100);
for(int x = 0; x < 100; x++)
{
for(int y = 0; y < 100; y++)
{
if (x == y)
{
set_pixel(image, x, y, 255, 0, 0, 255);
}
else if (x+y == 100)
{
set_pixel(image, x, y, 255, 255, 0, 0);
}
else
{
set_pixel(image, x, y, 255, 0, 255, 0);
}
}
}
put_image(image, get_screen_width()/2-get_image_width(image)/2, get_screen_height()/2-get_image_height(image)/2);
return p1world_shutdown();
}
开发者ID:chadhao,项目名称:Programming1,代码行数:29,代码来源:hw06q05.c
示例17: create_image
void Parser::DefineBitsJPEG3(Environment& env)
{
auto cid = env.stream.read_uint16();
auto size = env.stream.read_uint32();
auto image = create_image(env.stream, env.tag, cid, size);
if( image != nullptr )
env.player.set_character(image->get_character_id(), image);
}
开发者ID:drunkenme,项目名称:openswf,代码行数:8,代码来源:define_bits.cpp
示例18: mini_control_cover_set
void
mini_control_cover_set(minicontrol *mc, const char* path)
{
if (!path)
elm_object_part_content_set(mc->layout, "swallow.cover", create_icon(mc->layout, "background_cone.png"));
else
elm_object_part_content_set(mc->layout, "swallow.cover", create_image(mc->layout, path));
}
开发者ID:TizenTeam,项目名称:vlc-tizen,代码行数:8,代码来源:minicontrol_view.c
示例19: main
int main(int argc, char* argv[])
{
process_options(argc, argv);
create_image_preprocess();
create_image();
output_image();
return 0;
}
开发者ID:HackLinux,项目名称:darwin-sdk,代码行数:8,代码来源:image3maker.c
示例20: create_wizard
static struct wizard* create_wizard(void)
{
struct wizard* wizard = calloc(1, sizeof(*wizard));
if (wizard == NULL) goto error;
wizard->sprite = create_sprite(create_image("res/wizard.png"), 32, 32);
if (wizard->sprite == NULL) goto error;
wizard->walk_right = create_animation();
if (wizard->walk_right == NULL) goto error;
add_frame(wizard->walk_right, 4, 200, &PREP_SPEED);
add_frame(wizard->walk_right, 0, 200, &NORMAL_SPEED); /* <------+ */
add_frame(wizard->walk_right, 1, 200, &NORMAL_SPEED); /* | */
add_frame(wizard->walk_right, 2, 200, &NORMAL_SPEED); /* | */
add_frame(wizard->walk_right, 3, 200, &NORMAL_SPEED); /* <--+ | */
add_frame(wizard->walk_right, 4, 200, &BRAKE_SPEED); /* | | */
wizard->walk_right->loop_from = 1; /* --------------------------|---+ */
wizard->walk_right->loop_to = 4; /* --------------------------+ */
wizard->walk_left = create_animation();
if (wizard->walk_left == NULL) goto error;
add_frame(wizard->walk_left, 15, 200, &PREP_SPEED_L);
add_frame(wizard->walk_left, 11, 200, &NORMAL_SPEED_L); /* <------+ */
add_frame(wizard->walk_left, 10, 200, &NORMAL_SPEED_L); /* | */
add_frame(wizard->walk_left, 9, 200, &NORMAL_SPEED_L); /* | */
add_frame(wizard->walk_left, 8, 200, &NORMAL_SPEED_L); /* <--+ | */
add_frame(wizard->walk_left, 15, 200, &BRAKE_SPEED_L); /* | | */
wizard->walk_left->loop_from = 1; /* -----------------------------|---+ */
wizard->walk_left->loop_to = 4; /* -----------------------------+ */
wizard->stand = create_animation();
if (wizard->stand == NULL) goto error;
add_frame(wizard->stand, 5, 100, &NO_SPEED); /* <---+ */
wizard->stand->mode = FREEZE_LAST_FRAME; /* ------------+ */
wizard->spell = create_animation();
if (wizard->spell == NULL) goto error;
add_frame(wizard->spell, 5, 200, &NO_SPEED);
add_frame(wizard->spell, 6, 200, &NO_SPEED);
add_frame(wizard->spell, 7, 100, &NO_SPEED); /* <--+ */
add_frame(wizard->spell, 6, 200, &NO_SPEED); /* | */
wizard->spell->loop_from = 2; /* ----------------------+ */
wizard->spell->loop_to = 2; /* ----------------------+ */
play_animation(wizard->sprite, wizard->stand);
wizard->pos.x = 0;
wizard->pos.y = BASE_Y;
return wizard;
error:
destroy_wizard(wizard);
ERROR("Unable to create wizard");
return NULL;
}
开发者ID:dmalves,项目名称:cage,代码行数:56,代码来源:wizard.c
注:本文中的create_image函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论