/usr/include/zbar/Window.h is in libzbar-dev 0.10+doc-7build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | //------------------------------------------------------------------------
// Copyright 2007-2009 (c) Jeff Brown <spadix@users.sourceforge.net>
//
// This file is part of the ZBar Bar Code Reader.
//
// The ZBar Bar Code Reader is free software; you can redistribute it
// and/or modify it under the terms of the GNU Lesser Public License as
// published by the Free Software Foundation; either version 2.1 of
// the License, or (at your option) any later version.
//
// The ZBar Bar Code Reader is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser Public License for more details.
//
// You should have received a copy of the GNU Lesser Public License
// along with the ZBar Bar Code Reader; if not, write to the Free
// Software Foundation, Inc., 51 Franklin St, Fifth Floor,
// Boston, MA 02110-1301 USA
//
// http://sourceforge.net/projects/zbar
//------------------------------------------------------------------------
#ifndef _ZBAR_WINDOW_H_
#define _ZBAR_WINDOW_H_
/// @file
/// Output Window C++ wrapper
#ifndef _ZBAR_H_
# error "include zbar.h in your application, **not** zbar/Window.h"
#endif
#include "Image.h"
namespace zbar {
/// mid-level output window abstraction.
/// displays images to user-specified platform specific output window
class Window {
public:
/// constructor.
Window (zbar_window_t *window = NULL)
{
if(window)
_window = window;
else
_window = zbar_window_create();
}
/// constructor.
Window (void *x11_display_w32_hwnd,
unsigned long x11_drawable)
{
_window = zbar_window_create();
attach(x11_display_w32_hwnd, x11_drawable);
}
~Window ()
{
zbar_window_destroy(_window);
}
/// cast to C window object.
operator zbar_window_t* () const
{
return(_window);
}
/// associate reader with an existing platform window.
/// see zbar_window_attach()
void attach (void *x11_display_w32_hwnd,
unsigned long x11_drawable = 0)
{
if(zbar_window_attach(_window,
x11_display_w32_hwnd, x11_drawable) < 0)
throw_exception(_window);
}
/// control content level of the reader overlay.
/// see zbar_window_set_overlay()
void set_overlay (int level)
{
zbar_window_set_overlay(_window, level);
}
/// retrieve current content level of reader overlay.
/// see zbar_window_get_overlay()
/// draw a new image into the output window.
/// see zbar_window_draw()
void draw (Image& image)
{
if(zbar_window_draw(_window, image) < 0)
throw_exception(_window);
}
/// clear the image from the output window.
/// see zbar_window_draw()
void clear ()
{
if(zbar_window_draw(_window, NULL) < 0)
throw_exception(_window);
}
/// redraw the last image.
/// zbar_window_redraw()
void redraw ()
{
if(zbar_window_redraw(_window) < 0)
throw_exception(_window);
}
/// resize the image window.
/// zbar_window_resize()
void resize (unsigned width, unsigned height)
{
if(zbar_window_resize(_window, width, height) < 0)
throw_exception(_window);
}
private:
zbar_window_t *_window;
};
/// select a compatible format between video input and output window.
/// see zbar_negotiate_format()
static inline void negotiate_format (Video& video, Window& window)
{
if(zbar_negotiate_format(video, window) < 0)
throw_exception(video);
}
}
#endif
|