Merge with trunk revision 40072

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@40130 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Marcian Lytwyn 2016-10-05 20:16:53 +00:00
parent be63eedc09
commit fd11511309
4 changed files with 89 additions and 19 deletions

View file

@ -0,0 +1,54 @@
/** <title>NSBitmapImageRepPrivate.h</title>
<abstract>The private methods of the NSBitmapImageRep classes.</abstract>
Copyright (C) 2016 Free Software Foundation, Inc.
Author: Fred Kiefer <fredkiefer@gmx.de>
Date: Jun 2016
This file is part of the GNUstep GUI Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#import "AppKit/NSBitmapImageRep.h"
#include "nsimage-tiff.h"
@interface NSBitmapImageRep (GSPrivate)
// GNUstep extension
+ (BOOL) _bitmapIsTIFF: (NSData *)data;
+ (NSArray*) _imageRepsWithTIFFData: (NSData *)imageData;
- (NSBitmapImageRep *) _initBitmapFromTIFF: (NSData *)imageData;
- (NSBitmapImageRep *) _initFromTIFFImage: (TIFF *)image number: (int)imageNumber;
- (void) _fillTIFFInfo: (NSTiffInfo*)info
usingCompression: (NSTIFFCompression)type
factor: (float)factor;
// Internal
+ (int) _localFromCompressionType: (NSTIFFCompression)type;
+ (NSTIFFCompression) _compressionTypeFromLocal: (int)type;
- (void) _premultiply;
- (void) _unpremultiply;
- (NSBitmapImageRep *) _convertToFormatBitsPerSample: (NSInteger)bps
samplesPerPixel: (NSInteger)spp
hasAlpha: (BOOL)alpha
isPlanar: (BOOL)isPlanar
colorSpaceName: (NSString*)colorSpaceName
bitmapFormat: (NSBitmapFormat)bitmapFormat
bytesPerRow: (NSInteger)rowBytes
bitsPerPixel: (NSInteger)pixelBits;
@end

View file

@ -36,7 +36,6 @@
#import "AppKit/NSButtonCell.h"
#import "AppKit/NSEvent.h"
#import "AppKit/NSWindow.h"
#import "GNUstepGUI/GSTheme.h"
//
// class variables

View file

@ -683,7 +683,7 @@ typedef struct _GSButtonCellFlags
returns NO</p>*/
- (BOOL) isOpaque
{
#if 0
#if 0 // Testplant-MAL-10052016: keeping branch code...
// May not be opaque, due to themes
return NO;
#else
@ -807,6 +807,7 @@ typedef struct _GSButtonCellFlags
[self setAlignment: NSLeftTextAlignment];
[self setBordered: NO];
[self setBezeled: NO];
// Testplant-MAL-10052016: keeping branch code...
[self setBezelStyle:NSRegularSquareBezelStyle];
[self setImageDimsWhenDisabled: NO];
break;
@ -1506,6 +1507,7 @@ typedef struct _GSButtonCellFlags
return s;
}
// Testplant-MAL-10052016: keeping branch code...
- (NSRect)insetFrame:(NSRect)frame withMargins:(GSThemeMargins)margins
{
NSRect result = frame;
@ -1555,6 +1557,7 @@ typedef struct _GSButtonCellFlags
border = [[GSTheme theme] buttonMarginsForCell: self
style: _bezel_style
state: buttonState];
// Testplant-MAL-10052016: keeping branch code...
interiorFrame = [self insetFrame:theRect withMargins:border];
/* Pushed in buttons contents are displaced to the bottom right 1px. */
@ -1567,6 +1570,7 @@ typedef struct _GSButtonCellFlags
}
else
{
// Testplant-MAL-10052016: keeping branch code...
GSThemeMargins margins = [[GSTheme theme] buttonMarginsForCell: self
style: _bezel_style
state: GSThemeNormalState];

View file

@ -2003,14 +2003,31 @@ static NSColor *dtxtCol;
return NSInsetRect(theRect, borderSize.width, borderSize.height);
}
/**<p>The GNUstep implementation returns -drawingRectForBounds:</p>
/**<p>Frame the image gets drawn in</p>
*/
- (NSRect) imageRectForBounds: (NSRect)theRect
{
return [self drawingRectForBounds: theRect];
if (_cell.type == NSImageCellType)
{
NSRect frame = [self drawingRectForBounds: theRect];
// Add spacing between border and inside
if (_cell.is_bordered || _cell.is_bezeled)
{
frame.origin.x += 3;
frame.size.width -= 6;
frame.origin.y += 1;
frame.size.height -= 2;
}
return frame;
}
else
{
return theRect;
}
}
/** <p>TODO</p>
/** <p>Frame the title gets drawn in</p>
*/
- (NSRect) titleRectForBounds: (NSRect)theRect
{
@ -2074,18 +2091,6 @@ static NSColor *dtxtCol;
*/
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
NSRect drawingRect = [self drawingRectForBounds: cellFrame];
//FIXME: Check if this is also neccessary for images,
// Add spacing between border and inside
if (_cell.is_bordered || _cell.is_bezeled)
{
drawingRect.origin.x += 3;
drawingRect.size.width -= 6;
drawingRect.origin.y += 1;
drawingRect.size.height -= 2;
}
switch (_cell.type)
{
case NSTextCellType:
@ -2093,7 +2098,7 @@ static NSColor *dtxtCol;
[self _drawEditorWithFrame: cellFrame inView: controlView];
else
[self _drawAttributedText: [self _drawAttributedString]
inFrame: drawingRect];
inFrame: [self titleRectForBounds: cellFrame]];
break;
case NSImageCellType:
@ -2101,12 +2106,20 @@ static NSColor *dtxtCol;
{
NSSize size;
NSPoint position;
NSRect drawingRect = [self imageRectForBounds: cellFrame];
NSRect rect;
size = [_cell_image size];
position.x = MAX(NSMidX(drawingRect) - (size.width/2.),0.);
position.y = MAX(NSMidY(drawingRect) - (size.height/2.),0.);
rect = NSMakeRect(position.x, position.y, size.width, size.height);
[_cell_image drawInRect: NSMakeRect(position.x, position.y, size.width, size.height)
if (nil != controlView)
{
rect = [controlView centerScanRect: rect];
}
[_cell_image drawInRect: rect
fromRect: NSZeroRect
operation: NSCompositeSourceOver
fraction: 1.0