Commit Graph

66 Commits

Author SHA1 Message Date
Stephan Aßmus
0cbb6c11ee Icon-O-Matic: Make GradientTransformable a BReferenceable
* Switch to using support/Referenceable.h instead of using an older copy
   of this code.
 * Make GradientTransformable a BReferenceable and fix #12033.
2015-05-09 21:38:15 +02:00
Michael Lotz
9bf9ee3806 Whitespace and style cleanup only. 2015-04-12 18:50:01 +02:00
Michael Lotz
9ac1c4c25e libicon: Fix leak of Icon::Gradient.
This was most prominently visible in applications that show a lot of
icons like Tracker and Deskbar.
2015-04-11 14:55:11 +02:00
John Scipione
3a7f3317ce IconUtils: Improved error checking 2014-07-17 14:51:36 -04:00
John Scipione
bcd81d91f0 IconUtils: Style fixes
* Mostly just renaming variables for clarity and consistency
* whitespace
* fill out #pragma mark's
* indentation
2014-07-17 14:51:33 -04:00
Stephan Aßmus
39fce398ee Raised maximum vector data size from 16 KiB to 512 KiB.
* The maximum vector icon data size was a bit low. That may
   be hard to track down why a certain vector icon doesn't work,
   especially when imported from SVG...
 * Don't allocate the vector buffer on the stack anymore.
2014-03-23 21:59:58 +01:00
Adrien Destugues
e326520241 Fix bitmap scaling
Bug introduced in 810f0a42e5.
The uint8 cast were also acting as masks for each of the pixel
components, moving them out of the multiplications made things go wrong.

Use rgb_color instead of messing with bitshifts and masks for better
readbility (the colors are out of order, but the processing is the same
on each color so the end result is valid).
2014-01-14 19:12:45 +01:00
Stephan Aßmus
810f0a42e5 IconUtis.cpp: Fixed cast. 2014-01-12 13:47:30 +01:00
Ingo Weinhold
cf70d345b2 Merge remote-tracking branch 'haiku/master' into package-management
This reverts 8f7f28a7c3 (OpenGL: Upgrade
to
Mesa 9.2).

Conflicts:
	build/jam/BuildFeatures
	build/jam/HaikuImage
	build/jam/OptionalPackages
	build/scripts/build_cross_tools_gcc4
	src/add-ons/opengl/swpipe/Jamfile
	src/apps/diskusage/Jamfile
	src/kits/tracker/ContainerWindow.cpp
	src/kits/tracker/DeskWindow.cpp
	src/kits/tracker/Jamfile
2013-09-13 01:02:28 +02:00
Ingo Weinhold
7bd562abc9 lib{network,package,shared,agg,icon}: secondary arch support 2013-08-05 06:41:53 +02:00
John Scipione
46cb3d3ea6 IconUtils: Add parens to fix warnings
Fixes #9888
2013-07-22 13:42:48 -04:00
Matt Madia
a196160c9a On FreeBSD, "<malloc.h> has been replaced by <stdlib.h>" 2013-05-25 19:41:18 +02:00
John Scipione
afecfa9ca8 A few more bitmap icon updates, edge cases.
* Support downscaling icons to a size smaller than the source.
* For > 4x icon scaling do a scale4x followed by a bilinear scale.

Note that I tried to do a combination of scale2x/scale3x with bilinear scaling
and the results were worse than scale2x/scale3x with down scaling.

The 24x24 icon case looks pretty bad either using bilinear or scale2x followed
by a downscale because I am currently upscaling the 16x16 icon in Deskbar (we
didn't up until now support bitmap icon downscaling so I had no choice). It
might be a better idea to downscale the 32x32 version instead.

Note that all of the above has to do with bitmap icons ONLY and none of it
applies to HVIF icons that scale beautifully without these tricks.
2013-03-04 12:56:12 -05:00
John Scipione
b09c265cb4 Update bitmap downscaling for BeOS icons.
Implemented a simple down sampling algorithm in the scale_down() function. For
non-integer scaling first scale up using the scale2x, scale3x, or scale4x
algorithm doubling, tripling, or quadrupling the icon then use the downscaling
algorithm to shrink to the desired size. This produces nicer looking results
than bilinear scaling alone.

Note that this only applies to bitmap-based BeOS icons and not vector-based
HVIF icons.
2013-03-04 04:45:06 -05:00
Sergei Reznikov
7f4d1af49d Compilation fixes for x86_64.
Added quite a few missing components to image:

alert arp bc CortexAddOnHost

CDPlayer CharacterMap DeskCalc
Devices DiskUsage Expander LaunchBox MediaConverter NetworkStatus
PoorMan Pulse Screenshot ShowImage SoundRecorder TV Workspaces

DataTranslations Media Printers ScreenSaver

BSnow Cortex FontDemo OverlayImage Pairs

cddb_daemon midi_server power_daemon print_server print_addon_server

Canon LIPS3 Compatible Canon LIPS4 Compatible Gutenprint
PCL5 Compatible PCL6 Compatible PDF Writer PS Compatible

libgame.so libmedia.so

Signed-off-by: Alex Smith <alex@alex-smith.me.uk>
2013-01-04 18:45:22 +00:00
John Scipione
c15ad4e6b9 Space after for, thanks Ryan 2012-07-30 01:59:11 -04:00
John Scipione
1ac528017d Refactor IconUtils.cpp
Mostly style changes, some functional changes although there is no
change in functionality for the success case, just cleaner code.
2012-07-29 13:07:45 -04:00
John Scipione
1510ac0081 Refactor icon scaling, fix off-by-one error.
Refactor the icon scaling code in IconUtils.cpp to avoid code
duplication. Basically create and delete the temp bitmap to
convert from B_CMAP8 to B_RGBA32 for scale2x/scale3x/scale4x
just one time instead of 3.

There was an off-by-one error in Deskbar which was causing
it to scale up the 16x16 Bitmap icon to 32x32 instead of just
using the 32x32 icon. This only affected BeOS bitmap-based
icons, not Haiku HVIF icons.
2012-07-28 22:00:22 -04:00
John Scipione
e51854a127 Add 96x96 and 128x128 icon sizes to tracker including scaling of BeOS icons using scale3x and scale4x algorithms. 2012-07-28 14:07:43 -04:00
Stephan Aßmus
2d35ee03c0 Added operator== implementation 2012-05-06 16:50:02 +02:00
Oliver Tappe
546208a539 More catalog-related cleanup.
* rename B_TRANSLATE_CONTEXT to B_TRANSLATION_CONTEXT and
  B_TRANSLATE_WITH_CONTEXT to B_TRANSLATE_CONTEXT, squashing a TODO
* adjust all uses of both macros in Haiku's source tree
* use correct header guard for collecting/Catalog.h

The renamed macros require adjustments to all external applications
using catalogs.
2012-04-16 21:31:22 +02:00
Philippe Saint-Pierre
c5e599ac1a IconUtils: memory leak fix
The intermediate step BBitmap in scale2x wasn't deleted. CID 10692.
2012-01-02 21:07:55 -05:00
John Scipione
0e35d5d2e5 Change instances of wether in comments to whether. No functional change intended. 2011-12-12 14:41:49 -05:00
Stephan Aßmus
e9e50497fc Don't prevent shapes from being rendered when the global
icon scale is larger than the maximum visibility scale of
4.0f. This just means you cannot prevent shapes from
rendering in icons rendered larger than 256x256.
visibility scale is 4.0


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41206 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-04-08 18:34:11 +00:00
Stephan Aßmus
ed95053221 Applied patch by John Scipione that adds the scale2x algorithm to BIconUtils
and uses it when old B_CMAP8 icons are to be upscaled exactly 2x. Looks much
better than the previous blurry bilinear scaling. Small cleanups by myself,
closes #7130, thanks a lot!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40678 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-25 08:34:18 +00:00
Joachim Seemer
c16bcdfcb7 Made some more strings localizable, removed some unnecessary localizations from CDPlayer. I hope everything's OK...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40436 a95241bf-73f2-0310-859d-f6bbb57e9c96
2011-02-10 22:03:51 +00:00
Ingo Weinhold
25dc253d6a * Merged weak-symbols branch.
* Fixed trivial merge conflict in src/system/libroot/posix/locale/nl_langinfo.cpp
* Fixed gcc 2 compilation of src/system/glue/init_term_dyn.c.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39571 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-22 13:06:36 +00:00
Axel Dörfler
b15f7f0ed5 * Removed the output if unarchiving the message failed - since this is used in
a translator as well, this might just be expected.
* Minor style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39418 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-11-13 19:44:03 +00:00
Stephan Aßmus
c50dfc20df Small cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35037 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-12 22:11:17 +00:00
Stephan Aßmus
27dd21091a Disabled the display of the "Rounding" (a.k.a. Hinting) property for the time
being. The implementation isn't currently finished.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31810 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-07-27 14:39:39 +00:00
Axel Dörfler
7f5bbbdc56 * Removed PI, and PI2 from math.h.
* Replaced all occurences with the standard macros M_PI, and M_PI_2.
* Some coding style cleanup on the touched files, no other changes besides
  adding a missing check for a failed memory allocation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31250 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-06-26 11:58:43 +00:00
Michael Lotz
8b8d44bfcc Enable just enough of the message based format used in Icon-O-Matic to allow
BIconUtils to understand and render it. This makes it possible to use the
HVIFTranslator to also read Icon-O-Matic files out of the box. Will cleanup
now duplicated files next.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30794 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-05-18 20:15:04 +00:00
Stephan Aßmus
64eb49fd24 * Cleanup in the Gradient department. No fuctional change.
Renamed BGradient::color_step to BGradient::ColorStop
  as it's called everywhere else. Also renamed BGradient::gradient_type
  to just BGradient::Type. Renamed BGradient::Type() to GetType().
* Simplification of method names in Painter.cpp. Some not yet
  complete and yet inactive code to accelerate vertical gradients
  (bypassing AGG for this special case).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29214 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-02-15 15:15:49 +00:00
Stephan Aßmus
52de6dce94 Moved the gradient_type and color_step structs into the BGradient
class/namespace. Renamed the B_GRADIENT_* types to TYPE_* as the context
is already given.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28564 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-11-08 14:56:56 +00:00
Stephan Aßmus
991547ef6c Patch by Artur Wyszynski:
* Implemented BGradient, BGradientLinear, BGradientRadial,
  BGradientDiamond, BGradientConic and BGradientRadialFocus
  new Interface Kit classes.
* Implemented all the (AGG-based) backend necessary in
  the app_server to render gradients (Painter, DrawingEngine)
* app_server/View can convert a BGradient layout to screen
  coordinates.
* Added BGradient methods of the Fill* methods in BView.
* Implemented a test app and added it to the image as a
  demo.
* Adopted Icon-O-Matic and libs/icon in order to avoid
  clashing with the new BGradient class. Re-use some
  parts where possible.

Awesome work, Artur! Thanks a lot. Now a more modern
looking GUI has just become much easier to implement! :-)

TODO:
* Remove the need to have gradient type twice in the
  app_server protocol.
* Refactor some parts of the patch to remove duplicated
  code (Painter, DrawingEngine).
* Adopt the BPicture protocol to know about BGradients.
* Review some parts of the BArchivable implementation.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28109 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-10-14 21:27:42 +00:00
Axel Dörfler
6e006912aa * Added ConvertToCMAP8() bitmap variant.
* Put header guards in the system namespace.
* Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27035 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-08-18 11:40:01 +00:00
Stephan Aßmus
94a6647354 Improved the coding style.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25522 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-16 08:50:45 +00:00
Stephan Aßmus
8e48eb6c32 Base the visibility decision for a shape (Level of Detail) on the global
transform only, not combined with the shapes own scale, since that is likely
not what the user intended.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25521 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-05-16 08:47:38 +00:00
Stephan Aßmus
112d61551e * Add Style::HasTransparency() which just tells if any of the colors that the
style uses has an alpha value below 255.
* Add support for intermediate rendering passes to IconRenderer. Normally,
  the whole icon is rendered in a single pass, which means shapes cannot
  overlap. With the change, intermediate rendering passes are inserted when
  a shape is encountered that contains transparency. This is an easy way to
  allow for more feature rich icons, with easy support for glossy/reflective
  surface effects or other such effects that require support for transparent
  shapes on top of other shapes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24490 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-20 11:35:51 +00:00
Stephan Aßmus
12a257d7f8 * make sure that the ApproximationScale() implementation of any Transformer
not negative
* PathSource can now remember a global scale, and the IconRenderer sets
  it, since this value is used in the curve converter for on the fly
  generation of vertices, this change does not affect anything and doesn't
  create the need to "update" the conversion pipeline to render an icon at
  different sizes (like Icon-O-Matic does)

-> this change fixes edgy curves on icons rendered bigger than 64x64 as
  reported by Axel some time ago


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23093 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-12-09 15:36:28 +00:00
Stephan Aßmus
c50a1ab8a4 * fix spelling mistake diamont -> diamond (fixes #1618)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22906 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-11-11 23:00:11 +00:00
Stephan Aßmus
2a74c55308 * when a vector icon was present, BAppFileInfo::GetIcon() would return an
error if the provided bitmap was B_CMAP8, now BIconUtils will convert the
  icon to B_CMAP8
-> this behaviour is a little inconsistent compared to what happens when
  reading icons from attributes, there, the CMAP8 icon is prefered in case
  such a bitmap is passed, even if a vector icon exists. I am not really
  sure which behaviour is better. For a consistent UI, maybe it is better
  to prefer the vector icon always. I've added a note to BAppFileInfo.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22414 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-10-02 16:54:34 +00:00
Stephan Aßmus
015a014aa7 * fixed quite a few selections bugs, most were caused by cyclic notifications,
and the mechanism to prevent them not working...
* could have fixed the "there are still listeners attached" bug (debugger drop)
  on exit, I have not seen it again, but I am not sure if it is really fixed
* introduced a way to ask the user, if changes should be saved and then
  pick up the line of thought after saving


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22269 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-09-21 15:21:38 +00:00
Axel Dörfler
33dda9c275 Fixed build under BeOS.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20652 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-11 14:11:39 +00:00
Axel Dörfler
325a6253ce * Put the remaining libicon.a classes into the BPrivate::Icon namespace.
* Minor cleanup (like removing the extra blank line between the copyright and the
  header guard).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20507 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-04-02 09:08:57 +00:00
Stephan Aßmus
84db3be8a9 * put Transformable class into BPrivate::Icon namespace, which
solves the problem that app_server uses the wrong version of
  the class
* TODO: put all the other classes into this namespace as well,
  I'm just eager to close this crucial bug, which Ingo kindly
  tracked down

[darn, this commit stalled before, and I commited the next step
 already from another Terminal...]


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20481 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-03-31 18:24:32 +00:00
Stephan Aßmus
84cf0edda0 resolved TODO
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20479 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-03-31 18:14:31 +00:00
Axel Dörfler
1a948d749b Return better error code.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19319 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-17 15:36:10 +00:00
Stephan Aßmus
1584cff13b * fixed off-by-one error in scaling algo
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19303 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-16 10:16:59 +00:00
Stephan Aßmus
9f5078060d * fixed a couple of remaining issues with vector icons,
there is some unfortunate code duplication in AppFileInfo,
  because it cannot use BMimeType/BNode alone to retrieve icons,
  now it works closer to the code in BIconUtils, this fixes
  R5 icons not displaying for other icon sizes
* implemented a bilinear scaling function, I don't know if
  it is very fast, but I hope it is reasonable. Now that I
  see the results though, I wonder if R5 icons should be
  scaled with nearest neighbor instead...
* corrected a small bug in the icon format stuff...
  7 bit coords are -32-+95, not 96
* improved comment for BIconUtils function


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19302 a95241bf-73f2-0310-859d-f6bbb57e9c96
2006-11-16 04:53:24 +00:00