KOffice – TDE office suite
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines

  1. This is an attempt to explain how autosizing paintdevices work
  2. The tileddatamanager which is the underlying object that organizes the pixel
  3. storage is autoextending. So it starts with zero tiles, and as writing is
  4. being done new tiles are added as needed.
  5. There is also a default tile that is only readable (in theory). Whenever
  6. access is only readaccess you get this tile for areas that don't have their
  7. own tile yet. The idea is that the default tile is filled with transparent
  8. pixels. (Or, with special layers like the background pattern or the selection,
  9. with something else relevant. bsar)
  10. So imagine a new image of size 640x640. The layer has no tiles, but when the
  11. layer is being read (for viewing) we probe all over the image (640x640) and
  12. read from the default tile wherever we probe.
  13. The extent of the layer (paintdevice) is 0x0 because nothing has been
  14. written yet.
  15. Then some drawing is done in one corner and a tile is created automatically.
  16. Now the extent is 64x64 (tilesize defined at compilation) because a single
  17. tile exists.
  18. If some drawing is done in the opposite corner another tile is created. The
  19. extent is now 640x640, but only two tiles exist (one in each opposite
  20. corner). When probing for viewing the default tile is what you get except
  21. for the two tiles.
  22. If we now apply a filer that lightens the colors (or something else) we
  23. could iterate over the extent. That way we are sure to get all the real
  24. tiles that have been created.
  25. As there is no way for us to know which pixel have true tiles and which have
  26. the default, we would write to all the pixels within the extent, which would
  27. automatically create ALL the tiles inside the extent.
  28. (XXX: Of course, the tile manager could decide that the written value
  29. is the same as the default value, and if that's true for all pixels in a tile,
  30. not create a tile at all) (bsar))
  31. In other cases like a gradient fill we would probably want to fill the
  32. current image area, so we we would just write to the paintdevice, and tiles
  33. would be automatically created for us.
  34. So in short: if you read - data will be available (either real tiles or a
  35. default) - and if you write to the paintdevice - tiles will be created as
  36. needed. So simply don't worry.
  37. But in some cases, when you want to modify already written pixels, as in
  38. some filters you want to know where true data have been written. Otherwise
  39. we would have to modify an infinite number of pixels to be sure everything is
  40. changed. This is where the extent comes in handy. If you have absolutely
  41. no leeway, use exactBounds which is slow, but sure.