Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a797dcb58475535087df2ea4b28b3b95c72baef9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*******************************************************************************
 * Copyright (c) 2000, 2017 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.swt.internal.cocoa;

public class NSImage extends NSObject {

public NSImage() {
	super();
}

public NSImage(long /*int*/ id) {
	super(id);
}

public NSImage(id id) {
	super(id);
}

public NSData TIFFRepresentation() {
	long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_TIFFRepresentation);
	return result != 0 ? new NSData(result) : null;
}

public void addRepresentation(NSImageRep imageRep) {
	OS.objc_msgSend(this.id, OS.sel_addRepresentation_, imageRep != null ? imageRep.id : 0);
}

public NSImageRep bestRepresentationForDevice(NSDictionary deviceDescription) {
	long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_bestRepresentationForDevice_, deviceDescription != null ? deviceDescription.id : 0);
	return result != 0 ? new NSImageRep(result) : null;
}

public void drawAtPoint(NSPoint point, NSRect fromRect, long /*int*/ op, double /*float*/ delta) {
	OS.objc_msgSend(this.id, OS.sel_drawAtPoint_fromRect_operation_fraction_, point, fromRect, op, delta);
}

public void drawInRect(NSRect rect, NSRect fromRect, long /*int*/ op, double /*float*/ delta) {
	OS.objc_msgSend(this.id, OS.sel_drawInRect_fromRect_operation_fraction_, rect, fromRect, op, delta);
}

public static NSImage imageNamed(NSString name) {
	long /*int*/ result = OS.objc_msgSend(OS.class_NSImage, OS.sel_imageNamed_, name != null ? name.id : 0);
	return result != 0 ? new NSImage(result) : null;
}

public NSImage initByReferencingFile(NSString fileName) {
	long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_initByReferencingFile_, fileName != null ? fileName.id : 0);
	return result == this.id ? this : (result != 0 ? new NSImage(result) : null);
}

public NSImage initWithContentsOfFile(NSString fileName) {
	long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_initWithContentsOfFile_, fileName != null ? fileName.id : 0);
	return result == this.id ? this : (result != 0 ? new NSImage(result) : null);
}

public NSImage initWithData(NSData data) {
	long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_initWithData_, data != null ? data.id : 0);
	return result == this.id ? this : (result != 0 ? new NSImage(result) : null);
}

public NSImage initWithIconRef(long /*int*/ iconRef) {
	long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_initWithIconRef_, iconRef);
	return result == this.id ? this : (result != 0 ? new NSImage(result) : null);
}

public NSImage initWithSize(NSSize aSize) {
	long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_initWithSize_, aSize);
	return result == this.id ? this : (result != 0 ? new NSImage(result) : null);
}

public void lockFocus() {
	OS.objc_msgSend(this.id, OS.sel_lockFocus);
}

public void removeRepresentation(NSImageRep imageRep) {
	OS.objc_msgSend(this.id, OS.sel_removeRepresentation_, imageRep != null ? imageRep.id : 0);
}

public NSArray representations() {
	long /*int*/ result = OS.objc_msgSend(this.id, OS.sel_representations);
	return result != 0 ? new NSArray(result) : null;
}

public void setCacheMode(long /*int*/ cacheMode) {
	OS.objc_msgSend(this.id, OS.sel_setCacheMode_, cacheMode);
}

public void setScalesWhenResized(boolean flag) {
	OS.objc_msgSend(this.id, OS.sel_setScalesWhenResized_, flag);
}

public void setSize(NSSize size) {
	OS.objc_msgSend(this.id, OS.sel_setSize_, size);
}

public NSSize size() {
	NSSize result = new NSSize();
	OS.objc_msgSend_stret(result, this.id, OS.sel_size);
	return result;
}

public void unlockFocus() {
	OS.objc_msgSend(this.id, OS.sel_unlockFocus);
}

}

Back to the top