summaryrefslogtreecommitdiff
path: root/control-image.c
diff options
context:
space:
mode:
authorAndreas Brachold <vdr07@deltab.de>2005-07-26 15:46:37 +0000
committerAndreas Brachold <vdr07@deltab.de>2005-07-26 15:46:37 +0000
commit57ff8fb8eb79adfebfaf43c884eac70e3ffb2b2c (patch)
tree5cc9452ece6fa76e3cac3f3575807a897c58f35d /control-image.c
parent8fc94579f1e868dfe1e4bb5e80c52d552bae3b0a (diff)
downloadvdr-plugin-image-57ff8fb8eb79adfebfaf43c884eac70e3ffb2b2c.tar.gz
vdr-plugin-image-57ff8fb8eb79adfebfaf43c884eac70e3ffb2b2c.tar.bz2
- rotate pictures now in several 90° steps
Diffstat (limited to 'control-image.c')
-rw-r--r--control-image.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/control-image.c b/control-image.c
index b109c50..ac707c9 100644
--- a/control-image.c
+++ b/control-image.c
@@ -1,7 +1,7 @@
/*
* Image plugin to VDR (C++)
*
-* (C) 2004 Andreas Brachold <vdr04 -at- deltab.de>
+* (C) 2004-2005 Andreas Brachold <vdr04 -at- deltab.de>
* based on (C) 2003 Kai Tobias Burwieck <kai -at- burwieck.net>
*
* This code is free software; you can redistribute it and/or
@@ -872,12 +872,21 @@ bool cImageControl::CheckAccess() const
return false;
}
+const char* cImageControl::szRotation [] =
+{
+ "rotated", //0
+ "right", //1
+ "original",//2
+ "left", //3
+};
+
void cImageControl::OriginalImage(bool bCached)
{
m_nZoomFactor = 0;
+ m_nRotation = 2;
m_ePlayMode = ePlayModeNormal;
if(!CheckAccess()
- || !player->Convert(bCached?"":"original"))
+ || !player->Convert(bCached?"":szRotation[m_nRotation]))
{
OSD_ErrorNumMsg(errno,tr("Operation failed"));
}
@@ -886,8 +895,11 @@ void cImageControl::OriginalImage(bool bCached)
void cImageControl::RFlipImage(void)
{
m_ePlayMode = ePlayModeNormal;
+ --m_nRotation;
+ m_nRotation %= memberof(szRotation);
+
if(!CheckAccess()
- || !player->Convert("right"))
+ || !player->Convert(szRotation[m_nRotation]))
{
OSD_ErrorNumMsg(errno,tr("Operation failed"));
}
@@ -896,8 +908,11 @@ void cImageControl::RFlipImage(void)
void cImageControl::LFlipImage(void)
{
m_ePlayMode = ePlayModeNormal;
+ ++m_nRotation;
+ m_nRotation %= memberof(szRotation);
+
if(!CheckAccess()
- || !player->Convert("left"))
+ || !player->Convert(szRotation[m_nRotation]))
{
OSD_ErrorNumMsg(errno,tr("Operation failed"));
}
@@ -919,7 +934,7 @@ void cImageControl::PictureZoomInitial(void)
if(!szFileName)
return;
- strcpy(zoom_command, "original");
+ strncpy(m_szZoomRotation, szRotation[m_nRotation],sizeof(m_szZoomRotation));
m_nRealImageWidth = 720;
m_nRealImageHeight = 576;
@@ -929,7 +944,7 @@ void cImageControl::PictureZoomInitial(void)
dsyslog("imageplugin: open file %s", szFileName);
fgets(buf, sizeof(buf) - 1, f);
dsyslog("imageplugin: line=%s", buf);
- sscanf(buf, "%d %d %s", &m_nRealImageWidth,&m_nRealImageHeight,zoom_command);
+ sscanf(buf, "%d %d %s", &m_nRealImageWidth,&m_nRealImageHeight,m_szZoomRotation);
fclose(f);
}
else
@@ -1011,7 +1026,7 @@ void cImageControl::ConvertZoom()
// execute
if(!CheckAccess()
- || !player->ConvertZoom(zoom_command, m_nZoomFactor, nZoomXoff, nZoomYoff))
+ || !player->ConvertZoom(m_szZoomRotation, m_nZoomFactor, nZoomXoff, nZoomYoff))
{
OSD_ErrorNumMsg(errno,tr("Operation failed"));
}