BYTE* test_progressive_load_bitmap(char* path, char* file, UINT32* size, int quarter)
{
	int status;
	BYTE* buffer;
	wImage* image;
	char* filename;

	filename = GetCombinedPath(path, file);

	if (!filename)
		return NULL;

	image = winpr_image_new();

	if (!image)
		return NULL;

	status = winpr_image_read(image, filename);

	if (status < 0)
		return NULL;

	buffer = image->data;
	*size = image->height * image->scanline;

	test_fill_image_alpha_channel(image->data, image->width, image->height, 0xFF);
	test_image_fill_unused_quarters(image->data, image->scanline, image->width, image->height, quarter, 0xFF000000);

	winpr_image_free(image, FALSE);
	free(filename);

	return buffer;
}
Example #2
0
static wImage *get_image(const char *src)
{
	int status;
	wImage* image = NULL;

	image = winpr_image_new();

	if (!image)
	{
		fprintf(stderr, "Failed to create image!");
		goto cleanup;
	}

	status = winpr_image_read(image, src);

	if (status < 0)
	{
		fprintf(stderr, "Failed to read image %s!", src);
		winpr_image_free(image, TRUE);
		image = NULL;
	}

cleanup:

	return image;
}
Example #3
0
rdtkFont* rdtk_font_new(rdtkEngine* engine, const char* path, const char* file)
{
	int status;
	int length;
	rdtkFont* font;
	char* fontBaseFile;
	char* fontImageFile;
	char* fontDescriptorFile;

	fontBaseFile = GetCombinedPath(path, file);

	if (!fontBaseFile)
		return NULL;

	length = strlen(fontBaseFile);

	fontImageFile = (char*) malloc(length + 8);

	if (!fontImageFile)
		return NULL;

	strcpy(fontImageFile, fontBaseFile);
	strcpy(&fontImageFile[length], ".png");

	fontDescriptorFile = (char*) malloc(length + 8);

	if (!fontImageFile)
		return NULL;

	strcpy(fontDescriptorFile, fontBaseFile);
	strcpy(&fontDescriptorFile[length], ".xml");

	free(fontBaseFile);

	if (!PathFileExistsA(fontImageFile))
		return NULL;

	if (!PathFileExistsA(fontDescriptorFile))
		return NULL;

	font = (rdtkFont*) calloc(1, sizeof(rdtkFont));

	if (!font)
		return NULL;

	font->engine = engine;

	font->image = winpr_image_new();

	if (!font->image)
		return NULL;

	status = winpr_image_read(font->image, fontImageFile);

	if (status < 0)
		return NULL;

	status = rdtk_font_load_descriptor(font, fontDescriptorFile);

	free(fontImageFile);
	free(fontDescriptorFile);

	return font;
}