comparison src/image.c @ 70431:7c25b386a4c3

(Qduration) [MAC_OS]: New variable. (syms_of_image) [MAC_OS]: Intern and staticpro it. [MAC_OS] (gif_load): Save image extension data in img->data.lisp_val. [MAC_OSX] (image_load_quartz2d): Use cfstring_create_with_utf8_cstring instead of cfstring_create_with_string.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Sat, 06 May 2006 06:52:24 +0000
parents 60bff6b0c656
children de135c2adb2f 1321f6cfb389
comparison
equal deleted inserted replaced
70430:a4ddaa03010e 70431:7c25b386a4c3
2626 { 2626 {
2627 image_error ("Cannot find image file `%s'", specified_file, Qnil); 2627 image_error ("Cannot find image file `%s'", specified_file, Qnil);
2628 UNGCPRO; 2628 UNGCPRO;
2629 return 0; 2629 return 0;
2630 } 2630 }
2631 path = cfstring_create_with_string (file); 2631 path = cfstring_create_with_utf8_cstring (SDATA (file));
2632 url = CFURLCreateWithFileSystemPath (NULL, path, 2632 url = CFURLCreateWithFileSystemPath (NULL, path,
2633 kCFURLPOSIXPathStyle, 0); 2633 kCFURLPOSIXPathStyle, 0);
2634 CFRelease (path); 2634 CFRelease (path);
2635 source = CGDataProviderCreateWithURL (url); 2635 source = CGDataProviderCreateWithURL (url);
2636 CFRelease (url); 2636 CFRelease (url);
7897 } 7897 }
7898 7898
7899 #else /* !HAVE_GIF */ 7899 #else /* !HAVE_GIF */
7900 7900
7901 #ifdef MAC_OS 7901 #ifdef MAC_OS
7902 static Lisp_Object Qduration;
7903
7902 static int 7904 static int
7903 gif_load (f, img) 7905 gif_load (f, img)
7904 struct frame *f; 7906 struct frame *f;
7905 struct image *img; 7907 struct image *img;
7906 { 7908 {
7918 Lisp_Object specified_bg; 7920 Lisp_Object specified_bg;
7919 XColor color; 7921 XColor color;
7920 RGBColor bg_color; 7922 RGBColor bg_color;
7921 int width, height; 7923 int width, height;
7922 XImagePtr ximg; 7924 XImagePtr ximg;
7923 TimeValue time; 7925 TimeScale time_scale;
7926 TimeValue time, duration;
7924 int ino; 7927 int ino;
7925 CGrafPtr old_port; 7928 CGrafPtr old_port;
7926 GDHandle old_gdh; 7929 GDHandle old_gdh;
7927 7930
7928 specified_file = image_spec_value (img->spec, QCfile, NULL); 7931 specified_file = image_spec_value (img->spec, QCfile, NULL);
8026 { 8029 {
8027 image_error ("Invalid image number `%s' in image `%s'", 8030 image_error ("Invalid image number `%s' in image `%s'",
8028 image, img->spec); 8031 image, img->spec);
8029 goto error; 8032 goto error;
8030 } 8033 }
8034 time_scale = GetMediaTimeScale (media);
8031 8035
8032 specified_bg = image_spec_value (img->spec, QCbackground, NULL); 8036 specified_bg = image_spec_value (img->spec, QCbackground, NULL);
8033 if (!STRINGP (specified_bg) || 8037 if (!STRINGP (specified_bg) ||
8034 !mac_defined_color (f, SDATA (specified_bg), &color, 0)) 8038 !mac_defined_color (f, SDATA (specified_bg), &color, 0))
8035 { 8039 {
8051 bg_color.blue = color.blue; 8055 bg_color.blue = color.blue;
8052 RGBBackColor (&bg_color); 8056 RGBBackColor (&bg_color);
8053 SetGWorld (old_port, old_gdh); 8057 SetGWorld (old_port, old_gdh);
8054 SetMovieActive (movie, 1); 8058 SetMovieActive (movie, 1);
8055 SetMovieGWorld (movie, ximg, NULL); 8059 SetMovieGWorld (movie, ximg, NULL);
8056 SampleNumToMediaTime (media, ino + 1, &time, NULL); 8060 SampleNumToMediaTime (media, ino + 1, &time, &duration);
8057 SetMovieTimeValue (movie, time); 8061 SetMovieTimeValue (movie, time);
8058 MoviesTask (movie, 0L); 8062 MoviesTask (movie, 0L);
8059 DisposeTrackMedia (media); 8063 DisposeTrackMedia (media);
8060 DisposeMovieTrack (track); 8064 DisposeMovieTrack (track);
8061 DisposeMovie (movie); 8065 DisposeMovie (movie);
8062 if (dh) 8066 if (dh)
8063 DisposeHandle (dh); 8067 DisposeHandle (dh);
8068
8069 /* Save GIF image extension data for `image-extension-data'.
8070 Format is (count IMAGES duration DURATION). */
8071 img->data.lisp_val = list4 (Qcount, make_number (nsamples), Qduration,
8072 make_float ((double)duration / time_scale));
8073
8064 /* Maybe fill in the background field while we have ximg handy. */ 8074 /* Maybe fill in the background field while we have ximg handy. */
8065 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 8075 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
8066 IMAGE_BACKGROUND (img, f, ximg); 8076 IMAGE_BACKGROUND (img, f, ximg);
8067 8077
8068 /* Put the image into the pixmap. */ 8078 /* Put the image into the pixmap. */
8614 Qgif = intern ("gif"); 8624 Qgif = intern ("gif");
8615 staticpro (&Qgif); 8625 staticpro (&Qgif);
8616 ADD_IMAGE_TYPE(Qgif); 8626 ADD_IMAGE_TYPE(Qgif);
8617 #endif 8627 #endif
8618 8628
8629 #ifdef MAC_OS
8630 Qduration = intern ("duration");
8631 staticpro (&Qduration);
8632 #endif
8633
8619 #if defined (HAVE_PNG) || defined (MAC_OS) 8634 #if defined (HAVE_PNG) || defined (MAC_OS)
8620 Qpng = intern ("png"); 8635 Qpng = intern ("png");
8621 staticpro (&Qpng); 8636 staticpro (&Qpng);
8622 ADD_IMAGE_TYPE(Qpng); 8637 ADD_IMAGE_TYPE(Qpng);
8623 #endif 8638 #endif