}
case Message::SCREENSHOT:
{
+#ifdef VOMP_PLATTFORM_MVP
Osd::getInstance()->screenShot("/out.jpg");
+#else
+ logger->log("Osd", Log::NOTICE, "Screenshot Message arrived");
+ Osd::getInstance()->screenShot("out.jpg");
+#endif
break;
}
case Message::CONNECTION_LOST:
}
case SIGUSR1:
{
+ logger->log("Core", Log::NOTICE, "USR1 signal, screenshot...");
command->sig1();
break;
}
height=BACKBUFFER_HEIGHT;
}
+void OsdOpenVG::getRealScreenSize(int &width, int &height)
+{
+ width=display_width;
+ height=display_height;
+}
+
+bool OsdOpenVG::screenShot(void *buffer, int width, int height, bool osd /*include osd*/)
+{
+ if (!initted) return false;
+ if (!buffer) return false;
+
+ DISPMANX_RESOURCE_HANDLE_T res;
+ DISPMANX_DISPLAY_HANDLE_T display;
+
+ uint32_t image_ptr;
+ VC_RECT_T rect;
+ res=vc_dispmanx_resource_create(VC_IMAGE_RGBA32,width,height,&image_ptr);
+ display=vc_dispmanx_display_open(0);
+ if (!osd ) {
+ vc_dispmanx_snapshot(display, res,
+ (DISPMANX_TRANSFORM_T)(DISPMANX_SNAPSHOT_NO_RGB|DISPMANX_SNAPSHOT_FILL/*|DISPMANX_SNAPSHOT_PACK*/));
+ }
+ else
+ {
+ vc_dispmanx_snapshot(display, res,
+ (DISPMANX_TRANSFORM_T)(DISPMANX_SNAPSHOT_FILL));
+ }
+ vc_dispmanx_rect_set(&rect,0,0,width,height);
+ vc_dispmanx_resource_read_data(res, &rect, buffer, width*4);
+ vc_dispmanx_resource_delete(res);
+ vc_dispmanx_display_close(display);
+ return true;
+
+}
+
void OsdOpenVG::initPaths()
{
int shutdown();
int stopUpdate();
+ bool screenShot(void *buffer, int width, int height, bool osd /*include osd*/);
long long lastrendertime;
void InternalRendering();
void getScreenSize(int &width, int &height);
+ void getRealScreenSize(int &width, int &height);
void OsdVector::screenShot(const char* fileName)
{
- //Do nothing,
+ //Do nothing, if no libmagick is there
+#ifdef PICTURE_DECODER_MAGICK
+ int width,height;
+ getRealScreenSize(width,height);
+ size_t length=width*height*4;
+ void *mem=malloc(length);
+
+ try {
+ Blob myblob;
+ if (!screenShot(mem,width,height,true)) {
+ Log::getInstance()->log("OsdVector", Log::DEBUG, "Screenshot failed!");
+ free(mem);
+ return;
+ }
+ myblob.updateNoCopy(mem,length,Blob::MallocAllocator);
+ Image image(myblob,Geometry(width,height),8,"RGBA");
+ image.write(fileName);
+ }catch( Exception &error_ )
+ {
+ Log::getInstance()->log("MagickEncoder", Log::DEBUG, "Libmagick: %s",error_.what());
+
+ }
+
+#endif
}
Surface * OsdVector::createNewSurface()
int getFD();
void screenShot(const char* fileName);
+ virtual bool screenShot(void *buffer, int width, int height, bool osd /*include osd*/)=0;
Surface * createNewSurface();
void BeginPainting();
unsigned int getStyleRef(const DrawStyle &c);
virtual void removeStyleRef(unsigned int ref);
virtual void getScreenSize(int &width, int &height)=0;
+ virtual void getRealScreenSize(int &width, int &height)=0;
// should be only called from command thread
void informPicture(LoadIndex index, ImageIndex i_index);