Commit Graph

96 Commits

Author SHA1 Message Date
Vadim Zeitlin
8bbac921f3 Add wxGraphicsRenderer::CreateContextFromUnknownDC()
It seems wrong to have this function in wxGraphicsContext only and not
in wxGraphicsRenderer, as this makes it impossible to create a context
associated with a non-default renderer while it doesn't cost us anything
to allow doing this.
2019-02-02 21:22:19 +01:00
Vadim Zeitlin
8fbca5cb70 Remove all trailing spaces
No real changes, just clean up sources by removing trailing spaces from
all the non-generated files.

This should hopefully avoid future commits mixing significant changes
with insignificant whitespace ones.
2019-01-30 17:35:54 +01:00
Vadim Zeitlin
5e53b22bd4 Add wxGraphicsContext::GetWindow()
This method allows to retrieve the window this context is associated
with, if any.

Add "wxWindow*" argument to wxGraphicsContext ctor and provide the
window pointer to it when available, i.e. when creating the context from
a wxWindow directly or from wxWindowDC, which is also associated with a
window, in platform-specific code.

No real changes yet.
2018-11-06 03:36:53 +01:00
Lauri Nurmi
f529dfaaef Fix wxPenInfo ctor compilation with gcc 4.4.7 on CentOS 6
Use template argument when calling the base template class ctor.
2017-11-05 16:42:20 +01:00
Vadim Zeitlin
8bad0e494f Get rid of wxGraphicsPenInfo::CreateFromPen()
This is a helper method used only in wxWidgets itself and only once, so
just inline it at the point of use to avoid exporting an unnecessary
function in the public API.
2017-09-10 01:53:02 +02:00
Vadim Zeitlin
76fd05b147 Leave only wxGraphicsRenderer::CreatePen(wxGraphicsPenInfo) overload
It doesn't make much sense to require all the graphics backends to
create wxGraphicsPen from either wxPen or wxGraphicsPenInfo when the
former can be handled just once in the common code.

So do just this, leaving CreatePen() overload taking wxGraphicsPenInfo
where the real pen construction takes place and implementing
wxGraphicsPen creation from wxPen in the common wxGraphicsContext code.

This is not 100% backwards-compatible as any code inheriting from
wxGraphicsRenderer and overriding its CreatePen() will now be broken,
however this should be extremely rare (there is no good reason to
inherit from this class in the user code) and result in compile errors
if it does happen.
2017-09-10 01:48:30 +02:00
Vadim Zeitlin
a156d5fa40 Extract wxPenInfoBase in a separate header
This allows to avoid dependency of wx/graphics.h on wx/pen.h.
2017-09-10 01:24:16 +02:00
Vadim Zeitlin
cc91a7d6d4 Minor formatting and style changes in wxPenInfo code
Use more standard formatting, wrap some overlong lines.
2017-09-10 01:11:06 +02:00
Adrien Tétar
999c750ca7 Review feedback 2017-09-10 01:02:21 +02:00
Adrien Tétar
2305604565 Introduce wxGraphicsPenInfo class 2017-09-10 01:02:20 +02:00
Stefan Csomor
6dfa897b4a Adding a native implementation for clearing bitmap/window contexts
Filling a bitmap surface is filled with ARGB 0,0,0,0. This way eg buffered transparent layers can be properly cleared.
2017-06-25 22:48:58 +02:00
Václav Slavík
e71be91ebe Add API to create wxGraphicsContext from win32 HDC
Add wxGraphicsContext::CreateFromNativeHDC() and wxGraphicsRenderer::
CreateContextFromNativeHDC() to allow creation not only from native
renderer object, but also from HDC, which is something universally
supported by win32 implementations.
2017-01-06 14:35:09 +01:00
Paul Cornett
5e906d80d8 Fix build with wxNO_RTTI
Since CreateFromUnknownDC() can return NULL anyway, just always define it,
and have it always return NULL with wxNO_RTTI
See #17765
2017-01-01 11:01:49 -08:00
Václav Slavík
7833c65c2a Add wxGraphicsContext::CreateFromUnknownDC()
A convenience helper for writing generic code that may operate on
different kinds of DCs, all supported by wxGraphicsContext, but without
knowing its specific type.
2016-11-22 14:51:39 +01:00
Artur Wieczorek
480a003c00 Add wxGraphicsContext::GetClipBox() function
This method returns bounding box of the current clipping region.
Added declaration, documentation and implemented for GDI+, Direct2D, Cairo renderers.
2016-08-21 20:57:40 +02:00
Dimitri Schoolwerth
8f8d58d193 Use wx-prefixed macros throughout the repository.
Change {DECLARE,IMPLEMENT}_*CLASS and {DECLARE,BEGIN,END}_EVENT_TABLE
occurrences to use the wx-prefixed version of the macros.
2015-04-23 22:00:35 +04:00
Stefan Csomor
9be91c8d67 added d2d
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77559 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-08 14:12:04 +00:00
Vadim Zeitlin
7ab7ff693b Add wxGraphicsRenderer::GetName() and GetVersion() methods.
Allow the code to determine which underlying technology is used for
implementing wxGraphics API. This is needed by the unit tests to account for
the known differences between platforms and may be useful in other cases.

Closes #16154.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-04-20 12:45:10 +00:00
Paul Cornett
8b4ae731d3 use wxOVERRIDE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-03-30 00:02:23 +00:00
Vadim Zeitlin
1eb17f24f0 Include the individual headers that we really need instead.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76163 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-03-18 19:28:50 +00:00
Vadim Zeitlin
8b777c1aa8 Don't include wx/dc.h from wx/graphics.h.
This is not necessary and prevents compilation of this header in wxUSE_GUI=0
case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76162 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-03-18 19:28:47 +00:00
Vadim Zeitlin
3f66f6a5b3 Remove all lines containing cvs/svn "$Id$" keyword.
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.

If nothing else, this will make an eventual transition to Git simpler.

Closes #14487.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-26 16:02:46 +00:00
Václav Slavík
17473a770a Fix lots of warnings reported by Clang.
Mostly potentially lossy implicit conversions in headers (long->int). Also dangling else warnings. Struct/class mismatches.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74473 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2013-07-10 16:41:34 +00:00
Vadim Zeitlin
a3db17b122 Make wxGraphicsContext::GetSize() const.
Closes #14556.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72290 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-08-03 13:05:11 +00:00
Robin Dunn
8b180bded6 Enable access to the native bitmap object wrapped by wxGraphicsBitmap
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-05-11 22:06:50 +00:00
Vadim Zeitlin
771563baee Added wxGraphicsContext::CreateMatrix(wxAffineMatrix2D) overload.
Make it easy to convert generic wxAffineMatrix2D to native wxGraphicsMatrix.

Closes #13188.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71085 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-03 11:50:19 +00:00
Robin Dunn
6e6f074b45 Delegate wxGraphicsBitmap::ConvertToImage to the renderer so we do not end up with more than one definition of the method when building with both the GDI+ GC and the Cairo GC enabled at the same time.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-20 04:49:12 +00:00
Vadim Zeitlin
fa378d369f Allow creating wxGraphicsFont without using wxFont.
This is mostly important to allow using wxImage-based wxGraphicsContext
without requiring X server connection under Unix: as wxFont can't be used
without X server, we needed another way to create wxGraphicsFont in this case.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69360 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-09 22:07:29 +00:00
Vadim Zeitlin
0a470e5ea5 Allow creating wxGraphicsBitmap and wxGraphicsContext from wxImage.
Provide a way to use wxGraphicsContext to draw on wxImage.

This is implemented internally by drawing on wxGraphicsBitmap which can be now
also created from wxImage.

Add a test of the new functionality to the image sample.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-09 22:07:22 +00:00
Vadim Zeitlin
08b2d55fdf Added wxGraphicsBitmap::ConvertToImage().
Allow to convert wxGraphicsBitmap directly to wxImage, without passing by
wxBitmap.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69353 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-10-09 22:07:07 +00:00
Stefan Csomor
8b98275595 removing trailing comma
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-08-22 15:11:37 +00:00
Vadim Zeitlin
bbd783e0b2 No real changes, just remove trailing commas from enum.
wxCompositionMode enum had a trailing comma not allowed by C++ 98 (and which
would result in warnings or errors with g++ pedantic switch).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68128 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-07-02 10:29:14 +00:00
Vadim Zeitlin
fec4e45897 Add wxCOMPOSITION_INVALID mode and use it to simplify the code.
Having an invalid element in wxCompositionMode enum allows to directly return
it from TranslateRasterOp() function instead of needing a separate bool
parameter to indicate that a ROP couldn't be translated.

This also incidentally fixes warnings about possibly uninitialized variables
in optimized g++ builds.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68127 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-07-02 10:29:11 +00:00
Stefan Csomor
3399af21d1 adding default interpolation enum
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67911 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-06-09 23:05:09 +00:00
Stefan Csomor
a173c81340 fixing test, adding minimal docs
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67910 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-06-09 21:44:19 +00:00
Stefan Csomor
133cb28b21 adding placeholders for interpolation setting
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67909 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-06-09 21:38:08 +00:00
Stefan Csomor
0217cfa537 support generic flag for pixel offsetting, see #11853
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-04-16 12:21:37 +00:00
Vadim Zeitlin
b129eaa377 Implement wxGraphicsContext::GetSize() for Cairo.
As the implementation of this method is basically the same for all ports move
it to the base class itself instead of requiring the derived classes to
implement it. Now the derived classes need to fill in m_width and m_height
members instead.

Do fill them when creating wxGraphicsContext in Cairo version.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67359 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-03-31 09:38:03 +00:00
Stefan Csomor
29188693b3 bracketing msw enhanced metafile usage
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2011-01-01 11:10:35 +00:00
Vadim Zeitlin
c929ad9141 Correct checks for wxUSE_PRINTING_ARCHITECTURE and wxUSE_ENH_METAFILE.
Compilation fixes for building without one or both of these symbols.

See #12664.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66172 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-11-16 22:38:32 +00:00
Jaakko Salli
8371a35340 Added wxGraphicsContext::Create(const wxEnhMetaFileDC& dc) so that wxPrintPreview can work with wxMSW's wxGraphicsContext (closes #12028)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64297 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-05-13 08:22:36 +00:00
Stefan Csomor
7d53220e14 fixing constants to be of the expected parameter type (float instead of double)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63976 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-14 12:16:42 +00:00
Vadim Zeitlin
2028c33ab5 Add default constructor to wxGraphicsGradientStop.
It may be convenient to create wxGraphicsGradientStop first and initialize it
later so allow doing this by providing the default argument for constructor
parameters and thus allowing to use it as the default constructor.

See #11897.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63869 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 13:55:35 +00:00
Vadim Zeitlin
3784bf308f Correct checks for gradient stop position.
It may be <= 1 in the final version and not < 1.

See #11897.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-06 00:17:16 +00:00
Vadim Zeitlin
4ee4c7b948 Add support for gradient stops to wxGraphicsContext.
Allow specifying a set of gradient stops instead of just the beginning and
ending colours. Add the new wxGraphicsGradientStop(s) classes and new
wxGraphicsContext::Create{Linear,Radial}GradientBrush() overloads. Also change
the same methods of wxGraphicsRenderer to take wxGraphicsGradientStops instead
of a pair of colours.

Implement the new API for MSW and Cairo. OS X still uses just the two colours
for now.

Closes #11897.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63857 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2010-04-05 12:15:11 +00:00
Kevin Ollivier
c0e69d720d Forward port of r60190 (wxMSW Cairo support) to trunk.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62681 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-11-18 19:05:42 +00:00
Stefan Csomor
9bd36c6c0f adding defaults as wxDC did
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62355 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-09 17:34:39 +00:00
Stefan Csomor
2986eb869c adding construction from native bitmaps
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62226 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-10-02 19:45:03 +00:00
Vadim Zeitlin
03647350fc No changes, just removed hard tabs and trailing white space.
This commit is huge but there are no non-white-space changes in it.

Some files containing third-party sources (src/msw/wince/time.cpp,
src/x11/pango*.cpp) were left unchanged.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61724 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-08-21 10:41:26 +00:00
Kevin Ollivier
2fc9c1ea77 Forward port wxGraphicsBitmap cairo implementation, and fix the credit info in measuring.cpp
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61152 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2009-06-20 23:33:55 +00:00