Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2016
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2010 Alberto Pajuelo Montes <paju1986@gmail.com>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  17. * Boston, MA 02110-1301, USA.
  18. */
  19.  
  20. #include "../headers/webcamwin.h"
  21. #include <QFile>
  22. HWND hwndVideo; // video capture window
  23. void encender()
  24. {
  25. ::hwndVideo = capCreateCaptureWindowA("captura",WS_POPUP ,1,1 ,240 ,320,NULL,0);
  26. capDriverConnect(::hwndVideo,0);
  27. capPreviewRate(::hwndVideo,100);
  28. capPreviewScale(::hwndVideo,false);
  29. }
  30.  
  31. void apagar()
  32. {
  33. capDriverDisconnect(::hwndVideo);
  34. DestroyWindow(::hwndVideo);
  35. ::hwndVideo = NULL;
  36. }
  37.  
  38. QPixmap capturar()
  39. {
  40. capGrabFrame(::hwndVideo);
  41. QPixmap imagen;
  42. QFile crear;
  43. crear.setFileName("data");
  44. crear.open(QFile::WriteOnly);
  45. crear.close();
  46. capFileSaveDIB(::hwndVideo,L"data");
  47. imagen.load("data");
  48. return imagen;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement