mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 18:30:38 +00:00
Implement GSReadRect and initWithFocusedViewRect:
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17687 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
0d81427181
commit
50ed66958a
7 changed files with 68 additions and 18 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2003-09-19 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
* Headers/Additions/GNUstepGUI/GSMethodTable.h: Change NSReadPixel
|
||||||
|
to GSReadRect
|
||||||
|
* Headers/AppKit/NSGraphicsContext.h, Source/NSGraphicsContext.m: Idem.
|
||||||
|
* Headers/AppKit/NSGraphics.h (NSReadPixel): Move to...
|
||||||
|
* Source/Functions.m (NSReadPixel): here.
|
||||||
|
* Source/NSBitmapImageRep.m (-initWithFocusedViewRect:): Implement.
|
||||||
|
|
||||||
2003-09-16 Adam Fedor <fedor@gnu.org>
|
2003-09-16 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* GNUmakefile (SUBPROJECTS): Don't build Documentation by default.
|
* GNUmakefile (SUBPROJECTS): Don't build Documentation by default.
|
||||||
|
|
|
@ -279,8 +279,8 @@ typedef struct {
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* NSGraphics Ops */
|
/* NSGraphics Ops */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
NSColor * (*NSReadPixel_)
|
NSDictionary * (*GSReadRect_)
|
||||||
(NSGraphicsContext*, SEL, NSPoint);
|
(NSGraphicsContext*, SEL, NSRect);
|
||||||
|
|
||||||
void (*NSBeep)
|
void (*NSBeep)
|
||||||
(NSGraphicsContext*, SEL);
|
(NSGraphicsContext*, SEL);
|
||||||
|
|
|
@ -138,13 +138,7 @@ APPKIT_EXPORT void NSDottedFrameRect(NSRect aRect);
|
||||||
APPKIT_EXPORT void NSFrameRect(const NSRect aRect);
|
APPKIT_EXPORT void NSFrameRect(const NSRect aRect);
|
||||||
APPKIT_EXPORT void NSFrameRectWithWidth(const NSRect aRect, float frameWidth);
|
APPKIT_EXPORT void NSFrameRectWithWidth(const NSRect aRect, float frameWidth);
|
||||||
|
|
||||||
static inline NSColor*
|
APPKIT_EXPORT NSColor* NSReadPixel(NSPoint location);
|
||||||
NSReadPixel(NSPoint location)
|
|
||||||
{
|
|
||||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
|
||||||
return (ctxt->methods->NSReadPixel_)
|
|
||||||
(ctxt, @selector(NSReadPixel:), location);
|
|
||||||
}
|
|
||||||
|
|
||||||
APPKIT_EXPORT void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect,
|
APPKIT_EXPORT void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect,
|
||||||
NSRect destRect);
|
NSRect destRect);
|
||||||
|
|
|
@ -373,7 +373,7 @@ APPKIT_EXPORT NSGraphicsContext *GSCurrentContext(void);
|
||||||
/* NSGraphics Ops */
|
/* NSGraphics Ops */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
@interface NSGraphicsContext (NSGraphics)
|
@interface NSGraphicsContext (NSGraphics)
|
||||||
- (NSColor *) NSReadPixel: (NSPoint) location;
|
- (NSDictionary *) GSReadRect: (NSRect)rect;
|
||||||
|
|
||||||
/* Soon to be obsolete */
|
/* Soon to be obsolete */
|
||||||
- (void) NSDrawBitmap: (NSRect) rect : (int) pixelsWide : (int) pixelsHigh
|
- (void) NSDrawBitmap: (NSRect) rect : (int) pixelsWide : (int) pixelsHigh
|
||||||
|
|
|
@ -301,8 +301,15 @@ NSPlanarFromDepth(NSWindowDepth depth)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Graphic Ops */
|
/* Graphic Ops */
|
||||||
|
NSColor* NSReadPixel(NSPoint location)
|
||||||
|
{
|
||||||
|
NSLog(@"NSReadPixel not implemented");
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect)
|
void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect)
|
||||||
{
|
{
|
||||||
|
NSLog(@"NSCopyBitmapFromGState not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint)
|
void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint)
|
||||||
|
|
|
@ -35,9 +35,11 @@
|
||||||
#include <Foundation/NSDebug.h>
|
#include <Foundation/NSDebug.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSFileManager.h>
|
#include <Foundation/NSFileManager.h>
|
||||||
|
#include <Foundation/NSValue.h>
|
||||||
#include "AppKit/AppKitExceptions.h"
|
#include "AppKit/AppKitExceptions.h"
|
||||||
#include "AppKit/NSBitmapImageRep.h"
|
#include "AppKit/NSBitmapImageRep.h"
|
||||||
#include "AppKit/NSGraphics.h"
|
#include "AppKit/NSGraphics.h"
|
||||||
|
#include "AppKit/NSGraphicsContext.h"
|
||||||
#include "AppKit/NSPasteboard.h"
|
#include "AppKit/NSPasteboard.h"
|
||||||
#include "AppKit/NSView.h"
|
#include "AppKit/NSView.h"
|
||||||
#include "GSGuiPrivate.h"
|
#include "GSGuiPrivate.h"
|
||||||
|
@ -224,11 +226,45 @@ static BOOL supports_lzw_compression = NO;
|
||||||
|
|
||||||
- (id) initWithFocusedViewRect: (NSRect)rect
|
- (id) initWithFocusedViewRect: (NSRect)rect
|
||||||
{
|
{
|
||||||
// TODO
|
int bps, spp, alpha;
|
||||||
[self notImplemented: _cmd];
|
NSSize size;
|
||||||
|
NSString *space;
|
||||||
|
unsigned char *planes[4];
|
||||||
|
NSDictionary *dict;
|
||||||
|
|
||||||
RELEASE(self);
|
dict = [GSCurrentContext() GSReadRect: rect];
|
||||||
return nil;
|
if (dict == nil)
|
||||||
|
{
|
||||||
|
NSLog(@"NSBitmapImageRep initWithFocusedViewRect: failed");
|
||||||
|
RELEASE(self);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
_imageData = RETAIN([dict objectForKey: @"ImageData"]);
|
||||||
|
if (_imageData == nil)
|
||||||
|
{
|
||||||
|
NSLog(@"NSBitmapImageRep initWithFocusedViewRect: failed");
|
||||||
|
RELEASE(self);
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
bps = [[dict objectForKey: @"ImageBPS"] intValue];
|
||||||
|
if (bps == 0)
|
||||||
|
bps = 8;
|
||||||
|
spp = [[dict objectForKey: @"ImageSPP"] intValue];
|
||||||
|
alpha = [[dict objectForKey: @"ImageAlpha"] intValue];
|
||||||
|
size = [[dict objectForKey: @"ImageSize"] sizeValue];
|
||||||
|
space = [dict objectForKey: @"ImageColorSpace"];
|
||||||
|
planes[0] = (unsigned char *)[_imageData mutableBytes];
|
||||||
|
self = [self initWithBitmapDataPlanes: planes
|
||||||
|
pixelsWide: size.width
|
||||||
|
pixelsHigh: size.height
|
||||||
|
bitsPerSample: bps
|
||||||
|
samplesPerPixel: spp
|
||||||
|
hasAlpha: (alpha) ? YES : NO
|
||||||
|
isPlanar: NO
|
||||||
|
colorSpaceName: space
|
||||||
|
bytesPerRow: 0
|
||||||
|
bitsPerPixel: 0];
|
||||||
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -652,8 +652,8 @@ NSGraphicsContext *GSCurrentContext(void)
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* NSGraphics Ops */
|
/* NSGraphics Ops */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
methodTable.NSReadPixel_ =
|
methodTable.GSReadRect_ =
|
||||||
GET_IMP(@selector(NSReadPixel:));
|
GET_IMP(@selector(GSReadRect:));
|
||||||
|
|
||||||
methodTable.NSBeep =
|
methodTable.NSBeep =
|
||||||
GET_IMP(@selector(NSBeep));
|
GET_IMP(@selector(NSBeep));
|
||||||
|
@ -1454,9 +1454,13 @@ NSGraphicsContext *GSCurrentContext(void)
|
||||||
/* NSGraphics Ops */
|
/* NSGraphics Ops */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
@implementation NSGraphicsContext (NSGraphics)
|
@implementation NSGraphicsContext (NSGraphics)
|
||||||
/** Read the Color at a Screen Position
|
/** Read the data inside rect (defined in the current graphics state)
|
||||||
|
and return the information as a bitmap. The dictionary contains
|
||||||
|
the bitmap data plus various information about the size and format
|
||||||
|
of the data. The dictionary keys include ImageSize, ImageBPS,
|
||||||
|
ImageSPP, and ImageData.
|
||||||
*/
|
*/
|
||||||
- (NSColor *) NSReadPixel: (NSPoint) location
|
- (NSDictionary *) GSReadRect: (NSRect) rect
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
return nil;
|
return nil;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue