Commit Graph

22 Commits

Author SHA1 Message Date
Stephan Aßmus 954a0a0c33 Fix some cases of updating draw state while recording a BPicture
* Also implemented recording DrawString(string, length,
   BPoint[] locations), which was previously not recorded at all.
 * Also implemented playing back recently added drawing commands
   in PicturePlayer.cpp. I don't quite understand what this is
   actually used for, but it seemed it was forgotten. I just followed
   the pattern already established in the code.
 * The other important bit in this change is to update the pen
   location when it is needed while recording a BPicture. Often
   the BView will use PenLocation() in order to transmit drawing
   commands to the app_server which use absolute coordinates only.
   This isn't actually so nice, since it means the client has to
   wait for the server to transmit the current pen location. If there
   were dedicated link-commands for pen-relative drawing commands,
   the client could just keep sending without waiting for the server.
   In any case, the app_server needs to update the pen location in
   the current DrawState and even the DrawingEngine even while
   recording a picture, because some next command may need up-2-date
   state information, such as the font state and the pen location.
 * I have not yet tried to find /all/ instances where the DrawState
   needs to be updated while recording. This change should repair
   /all/ font state changes, all versions of drawing a string, and
   all versions of StrokeLine().

Change-Id: Ia0f23e7b1cd058f70f76a5849acb2d02e0f0da09
Reviewed-on: https://review.haiku-os.org/c/817
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>
2019-01-06 00:06:56 +00:00
Julian Harnath 25dbf74b8e BView: add methods for affine translation/scaling/rotation
* BView::TranslateBy(), BView::ScaleBy() and BView::RotateBy()
  allow to conveniently modify the current affine transformation.
  This makes it unnecessary to first read the current transform,
  modify it, and then set it again.
  Uses the new Pre...() methods of BAffineTransform.

* Also, remove setting the transform "through" to the BView even
  while recording a BPicture, as this now results in transforms
  being applied more than once.
2015-11-10 23:34:08 +01:00
Julian Harnath 4bd6f322bb app_server/Interface Kit: add new clipping API
* Add new clipping API for rectangles (ClipToRect, ClipToInverseRect)
  and shapes (ClipToShape, ClipToInverseShape)

* Works with affine transforms and automatically switches from fast
  region-based clipping to alpha-mask based clipping as necessary.

* Always self-intersecting, i.e. no state push required to further
  narrow down the clipping region. All of the 4 new methods can be
  mixed in any order.
2015-11-10 23:33:54 +01:00
Julian Harnath 6109a2086d Merge branch 'app_server'
Conflicts:
	src/kits/interface/PicturePlayer.cpp
	src/servers/app/ServerPicture.cpp

In addition, the following files were also adapted to master branch
BPicture changes during the merge:
	src/kits/interface/PicturePlayer.h
	src/servers/app/PictureBoundingBoxPlayer.cpp
2015-11-10 23:09:54 +01:00
Stefano Ceccherini ce27f9612e Implement ClipToPicture inside a BPicture. Not working yet.
BView::ClipToPicture doesn't work anymore, when nested inside a BPicture,
This happened when its implementation was moved server-side.
2015-09-05 21:35:54 +02:00
Julian Harnath 551438b9be app_server: add new BView layers API
* Add new methods
    BView::BeginLayer(uint8 opacity)
    BView::EndLayer()

* All drawing between begin and end of a layer is redirected onto an
  intermediate bitmap. When ending the layer, this bitmap is
  composited onto the view with the opacity given when the layer was
  started.

* Layers can be nested arbitrarily and will be blended onto each
  other in order. There can also be any arbitrary interleaving of
  layer begin/end and drawing operations.

* Internally, drawing commands are redirected into a BPicture between
  BeginLayer and EndLayer (but client code need not know or care
  about this). Client code can also start/end other BPictures while
  inside a layer.

* Uses the PictureBoundingBoxPlayer to determine the size of the
  layer bitmap before allocating and drawing into it, so it does not
  allocate more memory than necessary and -- more importantly -- it
  will not alpha-composite more pixels than necessary.

* Drawing mode is always set to B_OP_ALPHA, blend mode to
  (B_PIXEL_ALPHA, B_ALPHA_COMPOSITE) while inside layers. This is
  necessary for (a) correct compositing output and (b) for
  redirection of drawing into the intermediate bitmap, which uses the
  renderer_region offset (in B_OP_COPY, the Painter does not use the
  AGG renderer methods, it directly accesses the pixel data. This
  would access out-of-bounds without the offset, so B_OP_COPY cannot
  be allowed.)
  To ensure these modes aren't changed, BView::SetDrawingMode()
  and BView::SetBlendingMode() are ignored while inside a layer.

* The main motivation behind this new API is WebKit, which internally
  expects such a layers functionality to be present. A performant and
  reusable implementation of this functionality can only be done
  server-side in app_server.
2015-07-25 16:35:52 +02:00
John Scipione 2c3505de79 PictureDataWriter: Style fixes only
No functional change intended
2015-03-16 20:19:52 -04:00
Stephan Aßmus a6db6bd40f Added WIP support for affine transformations to BViews.
Everything untested, but compiles, so it must work. The idea is to introduce
BAffineTransform additionally to the existing Origin and Scale properties of
BViews. One may use it in parallel or as an alternative. Painter in app_server
is not yet aware of the additional transformation. It is however already used
to transform drawing coordinates. It probably needs to work differently,
perhaps only in Painter and AGGTextRenderer.
2014-02-04 22:53:06 +01:00
Stefano Ceccherini 8752f52d71 Added an (empty) destructor. Use a const BRegion (since we can now), honour
the 80 column limit. Some comment clarification.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31853 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-28 16:56:29 +00:00
Axel Dörfler f6e4cbb952 * Rewrote BeBuild.h which had "a few" consequences (got rid of all those class
definitions).
* Minor cleanup here and there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22577 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-15 20:13:55 +00:00
Stefano Ceccherini b1af0a7a24 Setting the font shear in a BPicture didn't work, because the value was
treated as uint32 in some places, when it's a float.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-10 10:20:26 +00:00
Stefano Ceccherini 253d42a602 Implemented SetClipping op, but it's not working yet (looks like it's
never written into the data stream)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21947 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-14 15:21:15 +00:00
Stefano Ceccherini feb557a6d1 Implemented WriteSetFontFamily() and WriteSetFontStyle(). Only the
server side functions are missing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21941 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-14 09:17:21 +00:00
Stefano Ceccherini 37033892c5 Implemented SetPattern op. Reduced the buffer size to 4096 again.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21937 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-14 06:39:37 +00:00
Stefano Ceccherini 690c7474a4 Implemented BPicture's SetPenLocation() op, also nested
AppendToPicture() (but still doesn't work :( ). Moved some functions 
around in PictureDataWriter.h.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21925 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-13 14:07:12 +00:00
Stefano Ceccherini ed5de868df Implemented the following BPicture ops: fill region, stroke/fill arc,
stroke/fill polygon, stroke/fill bezier. some work towards drawing of 
nested pictures.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21918 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-08-13 07:20:43 +00:00
Stefano Ceccherini 140334f858 Added error checking using exceptions
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21112 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-12 08:46:56 +00:00
Stefano Ceccherini 4bfa8f22df completes previous commit. Sorry for breaking the build
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20998 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-03 16:34:31 +00:00
Stefano Ceccherini a3d758e369 Added support for font settings in PictureDataWriter. Not used yet
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20381 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-03-13 11:14:47 +00:00
Stefano Ceccherini 0c48fc7c74 Enable state synching for ServerPictures. Fixes bug 520
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19379 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-28 14:52:51 +00:00
Stefano Ceccherini 7022e7903a added license
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19269 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-13 07:28:19 +00:00
Stefano Ceccherini 420fe80e5c Moved picture data writing to its own class, thus simplifying code in
various places. Implemented SetLineMode op for BPicture, fixed shape 
drawing (I accidentally broke it in the previous commit).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19264 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-12 20:00:36 +00:00