Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
libvncserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
libvncserver
Commits
21b1fd47
Commit
21b1fd47
authored
Apr 27, 2006
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add rotate and flip example
parent
6370f25f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
153 additions
and
2 deletions
+153
-2
ChangeLog
ChangeLog
+4
-0
.cvsignore
examples/.cvsignore
+2
-1
Makefile.am
examples/Makefile.am
+1
-1
pnmshow.c
examples/pnmshow.c
+2
-0
rotate.c
examples/rotate.c
+92
-0
rotatetemplate.c
examples/rotatetemplate.c
+52
-0
No files found.
ChangeLog
View file @
21b1fd47
2006-04-27 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
* examples/{rotate.c, rotatetemplate.c}: add modified pnmshow
which demonstrates fast rotating and flipping.
2006-04-26 Karl Runge <runge@karlrunge.com>
* all Makefile.am: use -I $(top_srcdir) instead of -I .. so VPATH
builds will work.
...
...
examples/.cvsignore
View file @
21b1fd47
...
...
@@ -14,4 +14,5 @@ colourmaptest
regiontest
mac
filetransfer
backchannel
rotate
examples/Makefile.am
View file @
21b1fd47
...
...
@@ -18,5 +18,5 @@ noinst_HEADERS=radon.h
noinst_PROGRAMS
=
example pnmshow regiontest pnmshow24 fontsel
\
vncev storepasswd colourmaptest simple simple15
$(MAC)
\
$(FILETRANSFER)
backchannel
$(BLOOPTEST)
camera
$(FILETRANSFER)
backchannel
$(BLOOPTEST)
camera
rotate
examples/pnmshow.c
View file @
21b1fd47
...
...
@@ -2,11 +2,13 @@
#include <rfb/rfb.h>
#include <rfb/keysym.h>
#ifndef HAVE_HANDLEKEY
static
void
HandleKey
(
rfbBool
down
,
rfbKeySym
key
,
rfbClientPtr
cl
)
{
if
(
down
&&
(
key
==
XK_Escape
||
key
==
'q'
||
key
==
'Q'
))
rfbCloseClient
(
cl
);
}
#endif
int
main
(
int
argc
,
char
**
argv
)
{
...
...
examples/rotate.c
0 → 100644
View file @
21b1fd47
#include <stdio.h>
#include <rfb/rfb.h>
#include <rfb/keysym.h>
static
int
gcd
(
int
x
,
int
y
)
{
if
(
x
==
0
)
return
y
;
return
gcd
((
y
%
x
),
x
);
}
#define CONCAT2(a,b) a##b
#define CONCAT2E(a,b) CONCAT2(a,b)
#define CONCAT3(a,b,c) a##b##c
#define CONCAT3E(a,b,c) CONCAT3(a,b,c)
#define FUNCNAME rfbRotate
#define FUNC(i, j) (h - 1 - j + i * h)
#define SWAPDIMENSIONS
#define OUT 8
#include "rotatetemplate.c"
#define OUT 16
#include "rotatetemplate.c"
#define OUT 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC
#define FUNCNAME rfbRotateCounterClockwise
#define FUNC(i, j) (j + (w - 1 - i) * h)
#define OUT 8
#include "rotatetemplate.c"
#define OUT 16
#include "rotatetemplate.c"
#define OUT 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC
#undef SWAPDIMENSIONS
#define FUNCNAME rfbFlipHorizontally
#define FUNC(i, j) ((w - 1 - i) + j * w)
#define OUT 8
#include "rotatetemplate.c"
#define OUT 16
#include "rotatetemplate.c"
#define OUT 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC
#define FUNCNAME rfbFlipVertically
#define FUNC(i, j) (i + (h - 1 - j) * w)
#define OUT 8
#include "rotatetemplate.c"
#define OUT 16
#include "rotatetemplate.c"
#define OUT 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC
#define FUNCNAME rfbRotateHundredAndEighty
#define FUNC(i, j) ((w - 1 - i) + (h - 1 - j) * w)
#define OUT 8
#include "rotatetemplate.c"
#define OUT 16
#include "rotatetemplate.c"
#define OUT 32
#include "rotatetemplate.c"
#undef FUNCNAME
#undef FUNC
static
void
HandleKey
(
rfbBool
down
,
rfbKeySym
key
,
rfbClientPtr
cl
)
{
if
(
down
)
{
if
(
key
==
XK_Escape
||
key
==
'q'
||
key
==
'Q'
)
rfbCloseClient
(
cl
);
else
if
(
key
==
'r'
)
rfbRotate
(
cl
->
screen
);
else
if
(
key
==
'R'
)
rfbRotateCounterClockwise
(
cl
->
screen
);
else
if
(
key
==
'f'
)
rfbFlipHorizontally
(
cl
->
screen
);
else
if
(
key
==
'F'
)
rfbFlipVertically
(
cl
->
screen
);
}
}
#define HAVE_HANDLEKEY
#include "pnmshow.c"
examples/rotatetemplate.c
0 → 100644
View file @
21b1fd47
#define OUT_T CONCAT3E(uint,OUT,_t)
#define FUNCTION CONCAT2E(FUNCNAME,OUT)
static
void
FUNCTION
(
rfbScreenInfoPtr
screen
)
{
OUT_T
*
buffer
=
(
OUT_T
*
)
screen
->
frameBuffer
;
int
i
,
j
,
w
=
screen
->
width
,
h
=
screen
->
height
;
OUT_T
*
newBuffer
=
(
OUT_T
*
)
malloc
(
w
*
h
*
sizeof
(
OUT_T
));
for
(
j
=
0
;
j
<
h
;
j
++
)
for
(
i
=
0
;
i
<
w
;
i
++
)
newBuffer
[
FUNC
(
i
,
j
)]
=
buffer
[
i
+
j
*
w
];
memcpy
(
buffer
,
newBuffer
,
w
*
h
*
sizeof
(
OUT_T
));
free
(
newBuffer
);
#ifdef SWAPDIMENSIONS
screen
->
width
=
h
;
screen
->
paddedWidthInBytes
=
h
*
OUT
/
8
;
screen
->
height
=
w
;
{
rfbClientIteratorPtr
iterator
;
rfbClientPtr
cl
;
iterator
=
rfbGetClientIterator
(
screen
);
while
((
cl
=
rfbClientIteratorNext
(
iterator
))
!=
NULL
)
cl
->
newFBSizePending
=
1
;
}
#endif
rfbMarkRectAsModified
(
screen
,
0
,
0
,
screen
->
width
,
screen
->
height
);
}
#if OUT == 32
void
FUNCNAME
(
rfbScreenInfoPtr
screen
)
{
if
(
screen
->
serverFormat
.
bitsPerPixel
==
32
)
CONCAT2E
(
FUNCNAME
,
32
)(
screen
);
else
if
(
screen
->
serverFormat
.
bitsPerPixel
==
16
)
CONCAT2E
(
FUNCNAME
,
16
)(
screen
);
else
if
(
screen
->
serverFormat
.
bitsPerPixel
==
8
)
CONCAT2E
(
FUNCNAME
,
8
)(
screen
);
else
{
rfbErr
(
"Unsupported pixel depth: %d
\n
"
,
screen
->
serverFormat
.
bitsPerPixel
);
return
;
}
}
#endif
#undef FUNCTION
#undef OUT
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment