Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
c26be513
Commit
c26be513
authored
Apr 15, 2013
by
Vianney BOYER
Committed by
Jean-Baptiste Kempf
Apr 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Puzzle: piece management and drawing
Signed-off-by:
Jean-Baptiste Kempf
<
jb@videolan.org
>
parent
ab6bcb28
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1090 additions
and
0 deletions
+1090
-0
modules/video_filter/puzzle_pce.c
modules/video_filter/puzzle_pce.c
+978
-0
modules/video_filter/puzzle_pce.h
modules/video_filter/puzzle_pce.h
+112
-0
No files found.
modules/video_filter/puzzle_pce.c
0 → 100644
View file @
c26be513
This diff is collapsed.
Click to expand it.
modules/video_filter/puzzle_pce.h
0 → 100644
View file @
c26be513
/*****************************************************************************
* puzzle_pce.h : Puzzle game filter - pieces functions
*****************************************************************************
* Copyright (C) 2013 Vianney Boyer
* $Id$
*
* Author: Vianney Boyer <vlcvboyer -at- gmail -dot- com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#ifndef VLC_LIB_PUZZLE_PCE_H
#define VLC_LIB_PUZZLE_PCE_H 1
#include <vlc_common.h>
#include <vlc_filter.h>
#include "puzzle_bezier.h"
#include "puzzle_lib.h"
#define SHAPES_QTY 20
#define PIECE_TYPE_NBR (4*2*(1+SHAPES_QTY))
#define puzzle_SHAPE_TOP 1
#define puzzle_SHAPE_LEFT 2
#define puzzle_SHAPE_RIGHT 4
#define puzzle_SHAPE_BTM 8
/*****************************************************************************
* Local prototypes
*****************************************************************************/
typedef
struct
{
uint8_t
i_type
;
/* 0 = fill ; 1 = offset */
int32_t
i_width
;
}
row_section_t
;
typedef
struct
{
int32_t
i_section_nbr
;
row_section_t
*
ps_row_section
;
}
piece_shape_row_t
;
typedef
struct
{
int32_t
i_row_nbr
;
int32_t
i_first_row_offset
;
piece_shape_row_t
*
ps_piece_shape_row
;
}
piece_shape_t
;
typedef
struct
{
int32_t
i_original_x
,
i_original_y
;
int32_t
i_actual_x
,
i_actual_y
;
int32_t
i_width
,
i_lines
;
}
piece_in_plane_t
;
typedef
struct
{
int32_t
i_original_row
,
i_original_col
;
int32_t
i_top_shape
,
i_btm_shape
,
i_right_shape
,
i_left_shape
;
piece_in_plane_t
*
ps_piece_in_plane
;
bool
b_finished
;
bool
b_overlap
;
int8_t
i_actual_angle
;
/* 0 = 0, 1 = 90... rotation center = top-left corner */
int32_t
i_actual_mirror
;
/* +1 = without mirror ; -1 = with mirror */
int32_t
i_step_x_x
,
i_step_x_y
,
i_step_y_y
,
i_step_y_x
;
int32_t
i_ORx
,
i_OTy
,
i_OLx
,
i_OBy
;
/* location of original piece's edges */
int32_t
i_TLx
,
i_TLy
,
i_TRx
,
i_TRy
,
i_BLx
,
i_BLy
,
i_BRx
,
i_BRy
;
/* location of grabed piece's corners */
int32_t
i_max_x
,
i_min_x
,
i_max_y
,
i_min_y
,
i_center_x
,
i_center_y
;
uint32_t
i_group_ID
;
}
piece_t
;
int
puzzle_bake_pieces_shapes
(
filter_t
*
);
void
puzzle_free_ps_pieces_shapes
(
filter_t
*
);
int
puzzle_find_piece
(
filter_t
*
p_filter
,
int32_t
i_x
,
int32_t
i_y
,
int32_t
i_except
);
void
puzzle_calculate_corners
(
filter_t
*
,
int32_t
i_piece
);
void
puzzle_rotate_pce
(
filter_t
*
p_filter
,
int32_t
i_piece
,
int8_t
i_rotate_mirror
,
int32_t
i_center_x
,
int32_t
i_center_y
,
bool
b_avoid_mirror
);
void
puzzle_move_group
(
filter_t
*
p_filter
,
int32_t
i_piece
,
int32_t
i_dx
,
int32_t
i_dy
);
void
puzzle_drw_basic_pce_in_plane
(
filter_t
*
p_filter
,
picture_t
*
p_pic_in
,
picture_t
*
p_pic_out
,
uint8_t
i_plane
,
piece_t
*
ps_piece
);
void
puzzle_drw_adv_pce_in_plane
(
filter_t
*
p_filter
,
picture_t
*
p_pic_in
,
picture_t
*
p_pic_out
,
uint8_t
i_plane
,
piece_t
*
ps_piece
);
void
puzzle_drw_complex_pce_in_plane
(
filter_t
*
p_filter
,
picture_t
*
p_pic_in
,
picture_t
*
p_pic_out
,
uint8_t
i_plane
,
piece_t
*
ps_piece
,
uint32_t
i_pce
);
void
puzzle_draw_pieces
(
filter_t
*
p_filter
,
picture_t
*
p_pic_in
,
picture_t
*
p_pic_out
);
int32_t
puzzle_diagonal_limit
(
filter_t
*
p_filter
,
int32_t
i_y
,
bool
b_left
,
uint8_t
i_plane
);
int
puzzle_generate_sect_border
(
filter_t
*
p_filter
,
piece_shape_t
*
ps_piece_shape
,
uint8_t
i_plane
,
uint8_t
i_border
);
int
puzzle_generate_sect_bezier
(
filter_t
*
p_filter
,
piece_shape_t
*
ps_piece_shape
,
uint8_t
i_pts_nbr
,
point_t
*
ps_pt
,
uint8_t
i_plane
,
uint8_t
i_border
);
void
puzzle_get_min_bezier
(
float
*
f_min_curve_x
,
float
*
f_min_curve_y
,
float
f_x_ratio
,
float
f_y_ratio
,
point_t
*
ps_pt
,
uint8_t
i_pts_nbr
);
int
puzzle_generate_shape_lines
(
filter_t
*
p_filter
,
piece_shape_t
*
ps_piece_shape
,
int32_t
i_min_y
,
int32_t
i_nb_y
,
float
f_x_ratio
,
float
f_y_ratio
,
point_t
*
ps_pt
,
uint8_t
i_pts_nbr
,
uint8_t
i_border
,
uint8_t
i_plane
);
int
puzzle_detect_curve
(
filter_t
*
p_filter
,
int32_t
i_y
,
float
f_x_ratio
,
float
f_y_ratio
,
point_t
*
ps_pt
,
uint8_t
i_pts_nbr
,
uint8_t
i_border
,
uint8_t
i_plane
,
int32_t
*
pi_sects
);
int
puzzle_generate_sectLeft2Right
(
filter_t
*
p_filter
,
piece_shape_t
*
ps_piece_shape
,
piece_shape_t
*
ps_left_piece_shape
,
uint8_t
i_plane
);
int
puzzle_generate_sectTop2Btm
(
filter_t
*
p_filter
,
piece_shape_t
*
ps_piece_shape
,
piece_shape_t
*
ps_top_piece_shape
,
uint8_t
i_plane
);
#endif
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