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

Committer:
embeddedartists
Date:
Mon Nov 04 14:31:50 2019 +0000
Revision:
22:f0d00f29bfeb
Parent:
17:6e2abf107800
More updates related to mbed OS 5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 17:6e2abf107800 1 /*
embeddedartists 17:6e2abf107800 2 * Copyright 2014 Embedded Artists AB
embeddedartists 17:6e2abf107800 3 *
embeddedartists 17:6e2abf107800 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 17:6e2abf107800 5 * you may not use this file except in compliance with the License.
embeddedartists 17:6e2abf107800 6 * You may obtain a copy of the License at
embeddedartists 17:6e2abf107800 7 *
embeddedartists 17:6e2abf107800 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 17:6e2abf107800 9 *
embeddedartists 17:6e2abf107800 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 17:6e2abf107800 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 17:6e2abf107800 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 17:6e2abf107800 13 * See the License for the specific language governing permissions and
embeddedartists 17:6e2abf107800 14 * limitations under the License.
embeddedartists 17:6e2abf107800 15 */
embeddedartists 17:6e2abf107800 16
embeddedartists 17:6e2abf107800 17 #include "mbed.h"
embeddedartists 17:6e2abf107800 18 #include "Resource.h"
embeddedartists 17:6e2abf107800 19
embeddedartists 17:6e2abf107800 20 Resource::Resource(const char* filename, int width, int height) :
embeddedartists 17:6e2abf107800 21 _width(width), _height(height), _isFile(true), _data(NULL), _dataSize(0)
embeddedartists 17:6e2abf107800 22 {
embeddedartists 17:6e2abf107800 23 _filename = (char*)malloc(strlen(filename)+1);
embeddedartists 17:6e2abf107800 24 if (_filename != NULL) {
embeddedartists 17:6e2abf107800 25 strcpy(_filename, filename);
embeddedartists 17:6e2abf107800 26 }
embeddedartists 17:6e2abf107800 27 memset(&_img, 0, sizeof(Image::ImageData_t));
embeddedartists 17:6e2abf107800 28 }
embeddedartists 17:6e2abf107800 29
embeddedartists 17:6e2abf107800 30 Resource::Resource(const unsigned char* data, const unsigned int dataSize, int width, int height) :
embeddedartists 17:6e2abf107800 31 _width(width), _height(height), _isFile(false), _filename(NULL), _data(data), _dataSize(dataSize)
embeddedartists 17:6e2abf107800 32 {
embeddedartists 17:6e2abf107800 33 memset(&_img, 0, sizeof(Image::ImageData_t));
embeddedartists 17:6e2abf107800 34 }
embeddedartists 17:6e2abf107800 35
embeddedartists 17:6e2abf107800 36 Resource::~Resource()
embeddedartists 17:6e2abf107800 37 {
embeddedartists 17:6e2abf107800 38 if (_filename != NULL) {
embeddedartists 17:6e2abf107800 39 free(_filename);
embeddedartists 17:6e2abf107800 40 _filename = NULL;
embeddedartists 17:6e2abf107800 41 }
embeddedartists 17:6e2abf107800 42 }
embeddedartists 17:6e2abf107800 43