A basic graphics package for the LPC4088 Display Module.
Dependents: lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI lpc4088_displaymodule_fs_aid ... more
Fork of DMBasicGUI by
Diff: Application/Resource.cpp
- Revision:
- 17:6e2abf107800
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Application/Resource.cpp Fri Mar 20 14:25:46 2015 +0100 @@ -0,0 +1,43 @@ +/* + * Copyright 2014 Embedded Artists AB + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "mbed.h" +#include "Resource.h" + +Resource::Resource(const char* filename, int width, int height) : + _width(width), _height(height), _isFile(true), _data(NULL), _dataSize(0) +{ + _filename = (char*)malloc(strlen(filename)+1); + if (_filename != NULL) { + strcpy(_filename, filename); + } + memset(&_img, 0, sizeof(Image::ImageData_t)); +} + +Resource::Resource(const unsigned char* data, const unsigned int dataSize, int width, int height) : + _width(width), _height(height), _isFile(false), _filename(NULL), _data(data), _dataSize(dataSize) +{ + memset(&_img, 0, sizeof(Image::ImageData_t)); +} + +Resource::~Resource() +{ + if (_filename != NULL) { + free(_filename); + _filename = NULL; + } +} +