Commit graph

182 commits

Author SHA1 Message Date
Marcian Lytwyn
2623a6af57 Remove #endif
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38620 72102866-910b-0410-8b05-ffd578937521
2015-06-11 21:59:20 +00:00
Marcian Lytwyn
20f140ca29 Remove OS_API_VERSION around new constants added last time to implementation file
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38619 72102866-910b-0410-8b05-ffd578937521
2015-06-11 21:58:35 +00:00
Marcian Lytwyn
a768e5ab48 Initial constants for built-in image support
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38617 72102866-910b-0410-8b05-ffd578937521
2015-06-11 21:03:05 +00:00
Jonathan Gillaspie
a139d7094a Switch XIB cursor logs to Debug level
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37631 72102866-910b-0410-8b05-ffd578937521
2014-01-23 16:13:37 +00:00
Frank Le Grand
c6fdf580ff Fixed bug introduced in my last commit on the Ibeam cursor issue.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37216 72102866-910b-0410-8b05-ffd578937521
2013-10-10 18:12:15 +00:00
Frank Le Grand
44c6dfb650 Added a small hack to work around and Ibeam cursor image inserted in XIB files by Xcode, which would not be found in the project and therefore was substituted with the default arrow cursor.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@37189 72102866-910b-0410-8b05-ffd578937521
2013-10-03 20:20:25 +00:00
Frank Le Grand
4b27157a46 Merged Trunk changes from rev 35219 to TestPlant branch.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@36953 72102866-910b-0410-8b05-ffd578937521
2013-08-09 14:24:48 +00:00
Marcian Lytwyn
36e77b95f7 Merge from revision 35723 from main branch plus NSCell allowsUndo flag extract from xib
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@35724 72102866-910b-0410-8b05-ffd578937521
2012-10-19 22:51:20 +00:00
Marcian Lytwyn
0cb5167322 Save NSURL (from rep) before trying to replace so it's available if the NSImageRep fails
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@35406 72102866-910b-0410-8b05-ffd578937521
2012-08-13 22:37:18 +00:00
Gregory John Casamento
eee9416e6b Merging changes from the trunk to the branch for testplant for NSImage changes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@35317 72102866-910b-0410-8b05-ffd578937521
2012-07-24 17:04:52 +00:00
Fred Kiefer
2d48b49175 Deal with images taht result in no data. This happens in themes that
have to small images to be split up into 9 tiles.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34688 72102866-910b-0410-8b05-ffd578937521
2012-02-01 10:49:35 +00:00
Eric Wasylishen
cbf7bc52a9 * Source/NSImage.m (+imageNamed:): Don't try to look up path
if called with nil (just return nil).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34632 72102866-910b-0410-8b05-ffd578937521
2012-01-25 23:25:14 +00:00
Richard Frith-MacDonald
db92916b2f Attempt to get gnome and windows themes working again.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34528 72102866-910b-0410-8b05-ffd578937521
2012-01-14 17:55:43 +00:00
Fred Kiefer
e2884bafce * Source/NSImage.m (+_clearFileTypeCaches): Use DESTROY instead of
RELEASE.
Patch by Philippe Roussel <p.o.roussel@free.fr>.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34492 72102866-910b-0410-8b05-ffd578937521
2012-01-11 08:12:43 +00:00
Eric Wasylishen
53ac9ad559 * Source/NSImage.m: Remove duplicate #import
* Source/NSImage.m: Correct _clearFileTypeCaches notification
method to take a NSNotification* parameter.
* Soure/NSImage.m (themeDidActivate:): Move to a class method,
and move the GSThemeDidActivateNotification subscription
to +[NSImage initialize]. Now the +_themeDidActivate: updates
all images by looking at all the values in nameDict. This should
function exactly the same as before, but seems to be quite a bit
faster due to fewer notifications being sent (?)
* Source/NSImage.m (+imageNamed:): Remove redundant fetch from
nameDict pointed out by Fred


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34482 72102866-910b-0410-8b05-ffd578937521
2012-01-10 19:16:46 +00:00
Eric Wasylishen
378ca9230e * Source/NSImage.m (+pathForImageNamed:): Add underscore and
move to private category. Also remove use of lock as it is
unnecessary
* Source/NSImage.m: (-themeDidActivate:): Extract method
_resetAndUseFromFile:. Don't reset _size if
flags.sizeWasExplicitlySet was true.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34481 72102866-910b-0410-8b05-ffd578937521
2012-01-10 18:55:57 +00:00
Eric Wasylishen
bff0f57b54 * Source/GSTheme.m: Remove code which sets and unsets images
on theme activation/deactivation.
* Source/NSImage.m (+imageNamed:): Factor out code for finding
the path for a name to a separate method, +pathForImageNamed.
The code is unchanged otherwise, except for fixing the retrieval
of images from the theme bundle, which was broken.
* Source/NSImage.m (-setName:): Remove code for creating theme
proxy. Subscribe/unscribe to theme change notification when
the receiver is added/removed from the name dictionary.
* Source/NSImage.m (-themeDidActivate:): Method called in
response to a GSThemeDidActivateNotification on images with
a name set. It does a path lookup in the same way that
+imageNamed: would, and checks if the path has changed due
to the theme change. If it has, all reps are discarded and
the image at the new path is loaded. This avoids the need for
the theme proxy objects.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34474 72102866-910b-0410-8b05-ffd578937521
2012-01-10 04:38:10 +00:00
Fred Kiefer
82eac9eaf0 Declare the new method
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34470 72102866-910b-0410-8b05-ffd578937521
2012-01-09 14:40:45 +00:00
Fred Kiefer
93403780f3 Cache the file type results for the image reps and clear the cache when these change.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34469 72102866-910b-0410-8b05-ffd578937521
2012-01-09 14:39:50 +00:00
Fred Kiefer
eaafb6754d * Source/NSImage.m (-bestRepresentationForDevice:): Fix last
change for the case where there are no representations for the
image.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34168 72102866-910b-0410-8b05-ffd578937521
2011-11-13 19:24:17 +00:00
Eric Wasylishen
3ace7a7cf7 * Source/NSImage.m (-bestRepresentationForDevice:): When
all other matching criteria fail, use the first image instead
of the last (arbitrary, but seems to match cocoa.)


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34166 72102866-910b-0410-8b05-ffd578937521
2011-11-12 01:57:01 +00:00
Eric Wasylishen
c7531f2386 * Source/NSImage.m (-setScalesWhenResized:): Disable this method
as it is currently broken on the cairo backend.
* Source/NSApplication.m (-setApplicationIconImage:): Don't
use call -setScalesWhenResized:, because if it worked as it is
supposed to, it would scale all icon reps down to 48x48,
making large icon sizes useless.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34164 72102866-910b-0410-8b05-ffd578937521
2011-11-12 00:40:18 +00:00
Fred Kiefer
2fa1752b03 * Source/NSImage.m (-lockFocusOnRepresentation:): Draw the
representation into the new cache. Use NSRectFillUsingOperation
  instead of PScompositerect.
* Source/NSImage.m (-drawRepresentation:inRect:): Use DPS
  operations instead of PS operations.

Should fix bug #34470


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33948 72102866-910b-0410-8b05-ffd578937521
2011-10-06 11:06:31 +00:00
Eric Wasylishen
507b4c76e8 * Source/NSImage.m (_cacheForRep:): Don't assume rep is non-nil. This should fix
locking focus on an image with no representations.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33827 72102866-910b-0410-8b05-ffd578937521
2011-09-09 19:49:08 +00:00
Gregory John Casamento
9a606392b7 Correction for compilation error. NSSizesEqual should have been NSEqualSizes.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33820 72102866-910b-0410-8b05-ffd578937521
2011-09-08 20:13:42 +00:00
Eric Wasylishen
192e2d6174 * Source/NSImage.m: Throw an exception if you attempt to lock focus on an image with
size (0, 0)
* Source/NSCachedImageRep.m: Throw an exception if you attempt to create a cached
image rep with a size of (0, 0).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33819 72102866-910b-0410-8b05-ffd578937521
2011-09-08 18:42:31 +00:00
Fred Kiefer
5554634f9c Correct last commit to use && instead of ||.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33788 72102866-910b-0410-8b05-ffd578937521
2011-08-26 07:35:41 +00:00
Riccardo Mottola
4e0e32caac check that the array of reps is populated, not just non-nil
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33786 72102866-910b-0410-8b05-ffd578937521
2011-08-25 15:20:45 +00:00
Eric Wasylishen
e14b034d8d * Source/NSImage.m (-setSize:): Don't invalidate the cache anymore,
because we now cache the entire representation and not the rep scaled
to the image's size.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33770 72102866-910b-0410-8b05-ffd578937521
2011-08-20 18:37:52 +00:00
Eric Wasylishen
5531d27e56 * Source/NSImage.m: Reinstate use of the cached image rep, but only
on backends supporting GSdraw: (cairo).  This means we don't have to
create a window for every call to draw an image, and gives me a 5-10x
speedup for image drawing.
* Source/NSCachedImageRep.m: Implement private method
-nativeDrawInRect:.. which is called by NSImageRep's
-drawInRect:fromRect:..., and efficiently draw the cached rep
using GSdraw:. Also make some changes so cached image reps can have a
DPI != 72.
* Headers/AppKit/NSCachedImageRep.h: New private init method that lets
you specify diferent pixel size and point size.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33765 72102866-910b-0410-8b05-ffd578937521
2011-08-19 19:06:41 +00:00
Eric Wasylishen
99abec2ebf * Headers/AppKit/NSImageRep.h: Add
-drawInRect:fromRect:operation:fraction:respectFlipped:hints: method
* Source/NSImage.m:
* Source/NSImageRep.m: Refactor drawing code from NSImage to NSImageRep.
This should cause no functionlity change, but it lets NSImageRep
subclasses implement more efficient versions of -drawInRect:fromRect:...
that don't involve the (expensive) drawing of the image in a temporary
offscreen window and then drawing from there on to the destination surface.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33764 72102866-910b-0410-8b05-ffd578937521
2011-08-18 23:57:50 +00:00
Eric Wasylishen
6ec3f1a58b * Source/NSImage.m (GSResolutionOfImageRep): Specify behaviour when the
rep has a size of zero, or is a vector rep. Prevent division by 0.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33742 72102866-910b-0410-8b05-ffd578937521
2011-08-15 20:19:21 +00:00
Eric Wasylishen
e9367ed059 * Source/NSImage.m (-nativeDrawInRect:...): Deal with a zero rep size
* Source/NSCustomImageRep.m:
- Don't retain the delegate (matching OS X)
- Remove unnecessary flip checks from -drawAtPoint: and -drawInRect:
  to match the code in NSImageRep
- Fix a mistake when setting the ctm scale factor


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33741 72102866-910b-0410-8b05-ffd578937521
2011-08-15 20:11:11 +00:00
Eric Wasylishen
97e9d3bda8 * Source/NSImage.m: Implement
-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33571 72102866-910b-0410-8b05-ffd578937521
2011-07-16 02:09:06 +00:00
Eric Wasylishen
4e36d04d40 * Source/NSImage.m (-nativeDrawInRect:...): Fix two bugs
demonstrated in GSTest:
- drawing an image in a flipped view with -drawInRect:... wasn't
  working, and
- drawing a vector rep in a dest rect larger than the point
  size of the rep was resulting in blurry output.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33570 72102866-910b-0410-8b05-ffd578937521
2011-07-16 01:23:40 +00:00
Fred Kiefer
86ff6abf69 Replace direct use of the isa pointer with a call to object_getClass()
to make David happy.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33545 72102866-910b-0410-8b05-ffd578937521
2011-07-14 07:17:24 +00:00
Fred Kiefer
f13ac2cd84 * Source/NSImage.m (-nativeDrawInRect:...): Compute the rep size
after the nil test.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33513 72102866-910b-0410-8b05-ffd578937521
2011-07-11 09:41:47 +00:00
Eric Wasylishen
7383ae4b49 * Source/NSImage.m: Use -bestRepresentationForRect:context:hints: in
-guiDrawInRect:... as well.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33308 72102866-910b-0410-8b05-ffd578937521
2011-06-15 02:04:33 +00:00
Eric Wasylishen
37ceff2824 * Source/NSImage.m: Implement -bestRepresentationForRect:context:hints:,
which chooses the smallest rep larger than or equal to the provided size.

Modify -nativeDrawInRect:... to use the above method for choosing a rep.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33304 72102866-910b-0410-8b05-ffd578937521
2011-06-14 19:00:23 +00:00
Eric Wasylishen
d0b58a4fd4 * Source/NSImage.m (-guiDrawInRect:...): Handle dstRect with a zero size
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33303 72102866-910b-0410-8b05-ffd578937521
2011-06-14 18:31:35 +00:00
Eric Wasylishen
903996fd17 * Source/NSImage.m: Remove unnecessary DPSgsave/DPSgrestore I added
earlier in -nativeDrawInRect:... and replace them with saving/restoring
the transformation matrix. The DPSgsave/DPSgrestore were causing problems
when drawing images with a non-rectangular clipping area.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33300 72102866-910b-0410-8b05-ffd578937521
2011-06-14 16:27:38 +00:00
Eric Wasylishen
baeb44bf84 * Source/NSImage.m: Tidy the -composite*/-dissolve* methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33299 72102866-910b-0410-8b05-ffd578937521
2011-06-14 06:08:40 +00:00
Eric Wasylishen
d29ec43ebd * Source/NSImage.m: Completely overhaul the best rep selection.
It should now be very close to the algorithm described in the cocoa
drawing guide, and fixes numerous bugs with the old code.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33295 72102866-910b-0410-8b05-ffd578937521
2011-06-13 22:32:28 +00:00
Wolfgang Lux
31ff24d0c6 Improve implementation of NSImage -bestRepresentationForDevice: for
images with multiple representations and fix a related bug.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33211 72102866-910b-0410-8b05-ffd578937521
2011-05-31 07:35:57 +00:00
Eric Wasylishen
8e6b334c1d * Source/NSImage.m (-nativeDrawInRect:...): Fix drawing images
with a source rect smaller than the entire image. This was a mistake
left by my last commit to this method.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33135 72102866-910b-0410-8b05-ffd578937521
2011-05-26 20:50:50 +00:00
Eric Wasylishen
ce051d9bd8 * Source/NSScreen.m: Use -userSpaceScaleFactor to calculate
NSDeviceResolution
* Source/NSImage.m: Implement -_bestRep:withResolutionMatch:
* Images/common_Dimple.tiff:
* Images/common_3DArrowRight.tiff: Add to these images
a second 'page' at 4x the original resolution which I drew.

If you use GSScaleFactor > 1 then the high resolution version
of these images should be used.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32975 72102866-910b-0410-8b05-ffd578937521
2011-05-04 01:33:21 +00:00
Eric Wasylishen
2042ff816c * Source/NSImage.m (-nativeDrawInRect:...): Fix a bug in my recent change
here which mis-positioned images.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32921 72102866-910b-0410-8b05-ffd578937521
2011-04-21 23:21:44 +00:00
Eric Wasylishen
50e9a10212 * Source/NSImage.m (-nativeDrawInRect:...): Make the cache window
large enough so that detail is preserved when drawing using a scale factor
larger than 1. This change should only improve output quality but not
affect image drawing otherwise.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32917 72102866-910b-0410-8b05-ffd578937521
2011-04-21 05:46:06 +00:00
Eric Wasylishen
a6ec05473b * Source/NSImage.m (-compositeToPoint:fromRect:operation:fraction:):
New simple implementation which calls
-drawAtPoint:fromRect:operation:fraction:.
Also respects the user space scale factor.
* Source/NSImage.m (-guiDrawInRect:fromRect:operation:fraction):
Remove a special case which called -compositeToPoint:..., which would
cause an infinite loop when combined with the above change.

Also avoid using -drawRepresentation:inRect: because -drawInRect:...
is supposed to fill the destination rect regardless of the setting
of -scalesWhenResized. This is a change borrowed from
-nativeDrawInRect:...


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32895 72102866-910b-0410-8b05-ffd578937521
2011-04-18 23:12:28 +00:00
Fred Kiefer
3b0c5dfe24 Small changes found by static analyser.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@32434 72102866-910b-0410-8b05-ffd578937521
2011-03-02 21:30:18 +00:00