Beispiel #1
0
Scheme_Object *video_imgptr(int argc, Scheme_Object **argv)
{
    Scheme_Object *ret = NULL;
    MZ_GC_DECL_REG(2);
    MZ_GC_VAR_IN_REG(0, argv);
    MZ_GC_VAR_IN_REG(1, ret);
    MZ_GC_REG();

    if (!SCHEME_NUMBERP(argv[0]))
        scheme_wrong_type("video-imgptr", "number", 0, argc, argv);

    Video *v = find_video("video-imgptr", argv[0]);
    if (v == NULL)
    {
        MZ_GC_UNREG();
        return scheme_void;
    }

    ret = scheme_make_cptr(v->get_pixels(), scheme_make_utf8_string("imgptr"));

    MZ_GC_UNREG();
    return ret;
}
  void VideoTransform::rotate_270 (Video& dst, Video const& src)
  {
      auto tsbuf = static_cast<uint8_t*> (src.get_pixels ()) + src.m_impl->pitch - src.m_impl->bpp;
      auto sbuf = tsbuf;

      visual_return_if_fail (dst.m_impl->width == src.m_impl->height);
      visual_return_if_fail (dst.m_impl->height == src.m_impl->width);

      for (int y = 0; y < dst.m_impl->height; y++) {
          auto dbuf = static_cast<uint8_t*> (dst.m_impl->pixel_rows[y]);

          for (int x = 0; x < dst.m_impl->width; x++) {
              for (int i = 0; i < dst.m_impl->bpp; i++) {
                  *(dbuf++) = *(sbuf + i);
              }

              sbuf += src.m_impl->pitch;
          }

          tsbuf -= src.m_impl->bpp;
          sbuf = tsbuf;
      }
  }