/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#import "CDataTransferer.h"
#include "sun_lwawt_macosx_CDataTransferer.h"
#import <AppKit/AppKit.h>
#include "ThreadUtilities.h"
// ***** NOTE ***** This dictionary corresponds to the static array predefinedClipboardNames
// in CDataTransferer.java.
if (sStandardMappings == nil) {
}
return sStandardMappings;
}
/*
* Convert from a standard NSPasteboard data type to an index in our mapping table.
*/
// There should only be one matching key here...
}
// If we don't recognize the format, but it's a Java "custom" format register it
}
return returnValue;
}
/*
* Inverse of above -- given a long int index, get the matching data format NSString.
*/
}
return nextID;
}
/*
* Class: sun_lwawt_macosx_CDataTransferer
* Method: registerFormatWithPasteboard
*/
{
return returnValue;
}
/*
* Class: sun_lwawt_macosx_CDataTransferer
* Method: formatForIndex
*/
{
return returnValue;
}
/*
* Class: sun_lwawt_macosx_CDataTransferer
* Method: imageDataToPlatformImageBytes
* Signature: ([III)[B
*/
{
// The pixel data is in premultiplied ARGB format. That's exactly what
// we need for the bitmap image rep.
if (rawImageData != NULL) {
bitsPerPixel:32];
// Conver the ARGB data into RGBA data that the bitmap can draw.
unsigned char *currentRowBase;
jint x, y;
for (y = 0; y < inHeight; y++) {
for (x = 0; x < inWidth; x++) {
}
}
jsize tiffSize = (jsize)[tiffImage length]; // #warning 64-bit: -length returns NSUInteger, but NewByteArray takes jsize
(*env)->ReleasePrimitiveArrayCritical(env, returnValue, tiffData, 0); // Do not use JNI_COMMIT, as that will not free the buffer copy when +ProtectJavaHeap is on.
}
return returnValue;
}
{
// The ownership of the NSImage is passed to the new CImage jobject. No need to release it.
static JNF_STATIC_MEMBER_CACHE(jm_CImage_getCreator, jc_CImage, "getCreator", "()Lsun/lwawt/macosx/CImage$Creator;");
static JNF_MEMBER_CACHE(jm_CImage_Generator_createImageUsingNativeSize, jc_CImage_Generator, "createImageUsingNativeSize", "(J)Ljava/awt/image/BufferedImage;");
return JNFCallObjectMethod(env, creator, jm_CImage_Generator_createImageUsingNativeSize, ptr_to_jlong(newImage)); // AWT_THREADING Safe (known object)
}
/*
* Class: sun_lwawt_macosx_CDataTransferer
* Method: getImageForByteStream
*/
{
return img;
}
{
// Get the java.lang.String class object:
jobject jfilenameArray = (*env)->NewObjectArray(env, filenameCount, stringClazz, NULL); // AWT_THREADING Safe (known object)
return nil;
}
if (!jfilenameArray) {
NSLog(@"CDataTransferer_CreateJavaFilenameArray: couldn't create jfilenameArray.");
return nil;
}
// Iterate through all the filenames:
NSUInteger i;
for (i = 0; i < filenameCount; i++) {
NSMutableString *stringVal = [[NSMutableString alloc] initWithString:[filenameArray objectAtIndex:i]];
// Create a Java String:
continue;
}
if (!string) {
NSLog(@"CDataTransferer_CreateJavaFilenameArray: couldn't create jstring[%lu] for [%@].", (unsigned long) i, stringVal);
continue;
}
// Set the Java array element with our String:
continue;
}
// Release local String reference:
}
return jfilenameArray;
}
/*
* Class: sun_lwawt_macosx_CDataTransferer
* Method: draqQueryFile
*/
{
// Decodes a byte array into a set of String filenames.
// bytes here is an XML property list containing all of the filenames in the drag.
// Parse the XML list into strings and return an array of Java strings matching all of the
// files in the list.
// Get byte array elements:
return NULL;
}
// Wrap jbytes in an NSData object:
// Create a property list from the Java data:
id plist = [NSPropertyListSerialization propertyListFromData:xmlData mutabilityOption:NSPropertyListImmutable
// The property list must be an array of strings:
NSLog(@"CDataTransferer_dragQueryFile: plist not a valid NSArray (error %@):\n%@", errString, plist);
return NULL;
}
// Transfer all string items from the plistArray to filenameArray. This wouldn't be necessary
// if we could trust the array to contain all valid elements but this way we'll be sure.
NSUInteger i;
for (i = 0; i < plistItemCount; i++) {
// Filenames must be strings:
continue;
}
}
// Convert our array of filenames into a Java array of String filenames:
// We're done with the jbytes (backing the plist/plistArray):
return jreturnArray;
}