-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(graphics): add getframe, movie functions and double buffering
- im2frame, frame2im functions
- Loading branch information
1 parent
ff80f3d
commit 5e65c6a
Showing
81 changed files
with
1,341 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//============================================================================= | ||
// Copyright (c) 2016-present Allan CORNET (Nelson) | ||
//============================================================================= | ||
// This file is part of the Nelson. | ||
//============================================================================= | ||
// LICENCE_BLOCK_BEGIN | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
// LICENCE_BLOCK_END | ||
//============================================================================= | ||
#include "__getframe__Builtin.hpp" | ||
#include "GOWindow.hpp" | ||
#include "GOHelpers.hpp" | ||
#include "GOFiguresManager.hpp" | ||
#include "Error.hpp" | ||
#include "i18n.hpp" | ||
#include "GetFrame.hpp" | ||
#include "InputOutputArgumentsCheckers.hpp" | ||
//============================================================================= | ||
using namespace Nelson; | ||
//============================================================================= | ||
namespace Nelson::GraphicsGateway { | ||
//============================================================================= | ||
ArrayOfVector | ||
__getframe__Builtin(int nLhs, const ArrayOfVector& argIn) | ||
{ | ||
nargincheck(argIn, 1, 2); | ||
nargoutcheck(nLhs, 0, 1); | ||
|
||
if (!argIn[0].isGraphicsObject()) { | ||
Error(_W("Expected graphics object.")); | ||
} | ||
nelson_handle* gobject = (nelson_handle*)(argIn[0].getDataPointer()); | ||
if (isDeletedGraphicsObject(gobject[0])) { | ||
Error(_W("Valid graphics object expected.")); | ||
} | ||
|
||
if (gobject[0] == HANDLE_ROOT_OBJECT || gobject[0] >= HANDLE_OFFSET_OBJECT) { | ||
Error("figure object expected."); | ||
} | ||
GOWindow* goWindow = getFigure(gobject[0]); | ||
ArrayOfVector retval; | ||
retval << GetFrame(goWindow); | ||
return retval; | ||
} | ||
//============================================================================= | ||
} | ||
//============================================================================= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
//============================================================================= | ||
// Copyright (c) 2016-present Allan CORNET (Nelson) | ||
//============================================================================= | ||
// This file is part of the Nelson. | ||
//============================================================================= | ||
// LICENCE_BLOCK_BEGIN | ||
// SPDX-License-Identifier: LGPL-3.0-or-later | ||
// LICENCE_BLOCK_END | ||
//============================================================================= | ||
#pragma once | ||
//============================================================================= | ||
#include "ArrayOf.hpp" | ||
//============================================================================= | ||
namespace Nelson::GraphicsGateway { | ||
//============================================================================= | ||
ArrayOfVector | ||
__getframe__Builtin(int nLhs, const ArrayOfVector& argIn); | ||
//============================================================================= | ||
} | ||
//============================================================================= |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
%============================================================================= | ||
% Copyright (c) 2016-present Allan CORNET (Nelson) | ||
%============================================================================= | ||
% This file is part of the Nelson. | ||
%============================================================================= | ||
% LICENCE_BLOCK_BEGIN | ||
% SPDX-License-Identifier: LGPL-3.0-or-later | ||
% LICENCE_BLOCK_END | ||
%============================================================================= | ||
clear('M'); | ||
movie_directory = fileparts(mfilename('fullpathext')); | ||
figure('Position', [0 50 806 530]); | ||
|
||
% Define sequences and number of frames | ||
sequences = {'dance', 8; 'leap', 9; 'run', 8}; | ||
nb_frames = sum([sequences{:,2}]); | ||
|
||
% Initialize the structure M | ||
M(nb_frames) = struct('cdata', [], 'colormap', []); | ||
|
||
L = 1; | ||
for s = 1:size(sequences, 1) | ||
action = sequences{s, 1}; | ||
nb_frames_action = sequences{s, 2}; | ||
|
||
for i = 1:nb_frames_action | ||
% Construct the filename for the current frame | ||
filename = fullfile(movie_directory, sprintf('%s_%d.png', action, i)); | ||
|
||
% Read the image and store it in the movie structure | ||
M(L).cdata = imread(filename); | ||
L = L + 1; | ||
end | ||
end | ||
|
||
% Play the movie 5 times | ||
movie(M, 5); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
images from https://furiirakun.com/ | ||
https://furiirakun.com/aboutlicense | ||
|
||
Free to use, Free to share. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
%============================================================================= | ||
% Copyright (c) 2016-present Allan CORNET (Nelson) | ||
%============================================================================= | ||
% This file is part of the Nelson. | ||
%============================================================================= | ||
% LICENCE_BLOCK_BEGIN | ||
% SPDX-License-Identifier: LGPL-3.0-or-later | ||
% LICENCE_BLOCK_END | ||
%============================================================================= | ||
function varargout = frame2im(varargin) | ||
% RGB = frame2im(F) | ||
% [X, map] = frame2im(F) | ||
narginchk(1, 1); | ||
nargoutchk(0, 2); | ||
F = varargin{1}; | ||
mustBeA(varargin{1}, 'struct'); | ||
if (~isequal(fieldnames(F), {'cdata';'colormap'})) | ||
error('Nelson:frame2im:invalidInput', _('Invalid structure fields.')); | ||
end | ||
n = numel(F); | ||
X = []; | ||
map = []; | ||
if (n > 0) | ||
x = [F.cdata]; | ||
map(1) = F(1).colormap; | ||
end | ||
varargout{1} = x; | ||
if nargout > 1 | ||
varargout{2} = map; | ||
end | ||
end | ||
%============================================================================= |
Oops, something went wrong.