Skip to content

Commit

Permalink
add 2D affine transformation support
Browse files Browse the repository at this point in the history
  • Loading branch information
mcorino committed Apr 3, 2024
1 parent f0f7b71 commit a9a0127
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 7 deletions.
51 changes: 51 additions & 0 deletions rakelib/lib/director/affine_matrix.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright (c) 2023 M.J.N. Corino, The Netherlands
#
# This software is released under the MIT license.

###
# wxRuby3 wxWidgets interface director
###

module WXRuby3

class Director

class AffineMatrix2D < Director

def setup
spec.items.unshift('wxAffineMatrix2DBase') << 'wxMatrix2D'

spec.make_abstract 'wxAffineMatrix2DBase'
spec.disable_proxies

spec.map_apply 'int * OUTPUT' => ['wxDouble *']
spec.map 'wxPoint2DDouble *' => 'Wx::Point2DDouble' do
map_in ignore: true, temp: 'wxPoint2DDouble tmp', code: '$1 = &tmp;'

map_argout code: <<~__CODE
$result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(new wxPoint2DDouble(tmp$argnum), SWIGTYPE_p_wxPoint2DDouble, SWIG_POINTER_OWN));
__CODE
end
spec.map 'wxMatrix2D *' => 'Wx::Matrix2D' do
map_in ignore: true, temp: 'wxMatrix2D tmp', code: '$1 = &tmp;'

map_argout code: <<~__CODE
$result = SWIG_Ruby_AppendOutput($result, SWIG_NewPointerObj(new wxMatrix2D(tmp$argnum), SWIGTYPE_p_wxPoint2DDouble, SWIG_POINTER_OWN));
__CODE
end

spec.ignore 'wxAffineMatrix2D::Mirror',
'wxAffineMatrix2D::TransformPoint',
'wxAffineMatrix2D::TransformDistance',
'wxAffineMatrix2D::IsEqual'

spec.regard 'wxMatrix2D::m_11', 'wxMatrix2D::m_12',
'wxMatrix2D::m_21', 'wxMatrix2D::m_22'

end

end

end

end
8 changes: 1 addition & 7 deletions rakelib/lib/director/dc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ def setup
'wxDC::GetLogicalOrigin(wxCoord *,wxCoord *) const',
'wxDC::GetHandle'
]
# ignore Matrix Transformation methods until someone asks for them
# TODO : possibly wrap at a later time
spec.ignore 'wxDC::SetTransformMatrix',
'wxDC::GetTransformMatrix',
'wxDC::ResetTransformMatrix',
'wxDC::CanUseTransformMatrix'
spec.disable_proxies
spec.disable_proxies
spec.rename_for_ruby({
'GetDimensions' => 'wxDC::GetSize(wxCoord *, wxCoord *) const',
'GetDimensionsMM' => 'wxDC::GetSizeMM(wxCoord *, wxCoord *) const',
Expand Down
1 change: 1 addition & 0 deletions rakelib/lib/specs/interfaces.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ module WXRuby3
Director.Spec(pkg, 'wxSecretStore', requirements: %w[USE_SECRETSTORE])
Director.Spec(pkg, 'wxDCOverlay', director: Director::DerivedDC)
Director.Spec(pkg, 'wxGeometry', requirements: %w[USE_GEOMETRY])
Director.Spec(pkg, 'wxAffineMatrix2D', requirements: %w[USE_GEOMETRY])
}

Director.Package('Wx::PRT', 'USE_PRINTING_ARCHITECTURE') do |pkg|
Expand Down

0 comments on commit a9a0127

Please sign in to comment.