The R Project SVN R

Rev

Rev 26234 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 26234 Rev 26839
Line 395... Line 395...
395
	if (data)
395
	if (data)
396
		setbitmapdata(obj, data);
396
		setbitmapdata(obj, data);
397
	return obj;
397
	return obj;
398
}
398
}
399
 
399
 
400
void getbitmapdata2(bitmap obj, unsigned char **data, int *row_bytes)
400
void getbitmapdata2(bitmap obj, unsigned char **data)
401
{
401
{
402
	rect r = obj->rect;
402
	rect r = obj->rect;
403
	int depth = 32, size, ret;
403
	int depth = 32, size, ret;
404
	BITMAPINFO bmi;
404
	BITMAPINFO bmi;
405
 
405
 
Line 409... Line 409...
409
	bmi.bmiHeader.biPlanes = 1;
409
	bmi.bmiHeader.biPlanes = 1;
410
	bmi.bmiHeader.biBitCount = depth;
410
	bmi.bmiHeader.biBitCount = depth;
411
	bmi.bmiHeader.biCompression = BI_RGB;
411
	bmi.bmiHeader.biCompression = BI_RGB;
412
	bmi.bmiHeader.biClrUsed = 0;
412
	bmi.bmiHeader.biClrUsed = 0;
413
 
413
 
414
	*row_bytes = ((depth * r.width) + 7) / 8;
-
 
415
	size = *row_bytes * r.height;
414
	size = 4 * r.width * r.height;
416
	*data = (unsigned char *) malloc(size);
415
	*data = (unsigned char *) malloc(size);
417
	if(*data) {
416
	if(*data) {
418
	    ret = GetDIBits(get_context(obj), (HBITMAP)obj->handle, 
417
	    ret = GetDIBits(get_context(obj), (HBITMAP)obj->handle, 
419
			    1, r.height, (LPSTR)*data, &bmi, DIB_RGB_COLORS);
418
			    0, r.height, (LPSTR)*data, &bmi, DIB_RGB_COLORS);
420
	    if(!ret) {
419
	    if(!ret) {
421
		free(*data);
420
		free(*data);
422
		*data = NULL;
421
		*data = NULL;
423
	    }
422
	    }
424
	}
423
	}