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 EmbeddedArtists AB

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Resource.cpp Source File

Resource.cpp

00001 /*
00002  *  Copyright 2014 Embedded Artists AB
00003  *
00004  *  Licensed under the Apache License, Version 2.0 (the "License");
00005  *  you may not use this file except in compliance with the License.
00006  *  You may obtain a copy of the License at
00007  *
00008  *    http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *  Unless required by applicable law or agreed to in writing, software
00011  *  distributed under the License is distributed on an "AS IS" BASIS,
00012  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *  See the License for the specific language governing permissions and
00014  *  limitations under the License.
00015  */
00016 
00017 #include "mbed.h"
00018 #include "Resource.h"
00019 
00020 Resource::Resource(const char* filename, int width, int height) :
00021     _width(width), _height(height), _isFile(true), _data(NULL), _dataSize(0)
00022 {
00023     _filename = (char*)malloc(strlen(filename)+1);
00024     if (_filename != NULL) {
00025         strcpy(_filename, filename);
00026     }
00027     memset(&_img, 0, sizeof(Image::ImageData_t));
00028 }
00029 
00030 Resource::Resource(const unsigned char* data, const unsigned int dataSize, int width, int height) :
00031     _width(width), _height(height), _isFile(false), _filename(NULL), _data(data), _dataSize(dataSize)
00032 {
00033     memset(&_img, 0, sizeof(Image::ImageData_t));
00034 }
00035 
00036 Resource::~Resource()
00037 {
00038     if (_filename != NULL) {
00039         free(_filename);
00040         _filename = NULL;
00041     }
00042 }
00043