-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
4,215 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.02 KB
resources/spritesheets/SecretSheet/icons_lol/player_488_extra_001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#include "Bitmap.h" | ||
|
||
Bitmap::Bitmap() | ||
{ | ||
m_width = 0; | ||
m_hight = 0; | ||
m_data = NULL; | ||
}; | ||
|
||
Bitmap::~Bitmap() | ||
{ | ||
resetBitmap(); | ||
}; | ||
|
||
void Bitmap::allocateBitmap() | ||
{ | ||
assert(m_data == NULL && m_width * m_hight > 0); | ||
m_data = (Rgba*)malloc(m_width * m_hight * sizeof(Rgba)); | ||
}; | ||
|
||
void Bitmap::resetBitmap() | ||
{ | ||
if(m_data) | ||
{ | ||
free(m_data); | ||
m_data = NULL; | ||
} | ||
}; | ||
|
||
bool Bitmap::hasData() | ||
{ | ||
return m_data != NULL; | ||
} | ||
|
||
bool Bitmap::isValid() | ||
{ | ||
return m_width > 0 && m_hight >0 && hasData(); | ||
} | ||
|
||
uint32_t Bitmap::getPixelLenth() | ||
{ | ||
return m_width*m_hight; | ||
}; | ||
|
||
const uint32_t* Bitmap::getRGBA() | ||
{ | ||
if(m_data == NULL) | ||
{ | ||
return NULL; | ||
} | ||
return (uint32_t *) m_data; | ||
} | ||
|
||
void Bitmap::eraseColor(Rgba color) | ||
{ | ||
Rgba paintColor = color; | ||
|
||
// make rgb premultiplied | ||
if (255 != color.alpha) { | ||
paintColor.red = AlphaMul(color.red, color.alpha); | ||
paintColor.green = AlphaMul(color.green, color.alpha); | ||
paintColor.blue = AlphaMul(color.blue, color.alpha); | ||
} | ||
|
||
for (uint32_t i = 0; i < m_width * m_hight; i++) | ||
*(m_data + i) = paintColor; | ||
} | ||
|
||
Bitmap* Bitmap::getDebugBitmap() | ||
{ | ||
Bitmap* bitmap = new Bitmap; | ||
bitmap->m_width = 64; | ||
bitmap->m_hight = 64; | ||
|
||
bitmap->allocateBitmap(); | ||
for(uint32_t hight =0; hight < bitmap->m_hight; hight++ ) | ||
{ | ||
Rgba color ; | ||
color.alpha = 255; | ||
if(hight < 20) | ||
{ | ||
color.red = 255; | ||
color.green = 0; | ||
color.blue = 0; | ||
}else if(hight >= 20 && hight < 40) | ||
{ | ||
color.red = 0; | ||
color.green = 255; | ||
color.blue = 0; | ||
}else | ||
{ | ||
color.red = 0; | ||
color.green = 0; | ||
color.blue = 255; | ||
} | ||
|
||
for(uint32_t width = 0; width < bitmap->m_width; width++) | ||
{ | ||
Rgba& colorPixel = bitmap->m_data[hight*bitmap->m_width + width]; | ||
colorPixel = color; | ||
} | ||
|
||
} | ||
|
||
return bitmap; | ||
} | ||
|
||
Rgba* Bitmap::getAddr(int left, int top) | ||
{ | ||
return m_data + top * m_width + left; | ||
} | ||
|
||
void Bitmap::swap(Bitmap* toSwap) | ||
{ | ||
TSwap(this->m_data, toSwap->m_data); | ||
TSwap(this->m_width, toSwap->m_width); | ||
TSwap(this->m_hight, toSwap->m_hight); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
#ifndef BITMAP_H | ||
#define BITMAP_H | ||
|
||
#include <stdint.h> | ||
#include <assert.h> | ||
#include <cstdlib> | ||
#include "GifMacros.h" | ||
|
||
#define ColorType uint8_t | ||
#define UNINITIALIZED_UINT ((uint32_t)-1) | ||
|
||
class Rgba | ||
{ | ||
public: | ||
Rgba() | ||
{ | ||
blue = 0; | ||
green = 0; | ||
red = 0; | ||
alpha = 0; | ||
} | ||
Rgba(ColorType ialpha, ColorType ired, ColorType igreen, ColorType iblue) | ||
{ | ||
alpha = ialpha; | ||
red = ired; | ||
green = igreen; | ||
blue = iblue; | ||
} | ||
|
||
Rgba(Rgba& color) | ||
{ | ||
alpha = color.alpha; | ||
blue = color.blue; | ||
green = color.green; | ||
red = color.red; | ||
} | ||
|
||
void setColor(ColorType ialpha, ColorType ired, ColorType igreen, ColorType iblue) | ||
{ | ||
alpha = ialpha; | ||
red = ired; | ||
green = igreen; | ||
blue = iblue; | ||
} | ||
ColorType red; | ||
ColorType green; | ||
ColorType blue; | ||
ColorType alpha; | ||
}; | ||
|
||
class Bitmap{ | ||
|
||
public: | ||
|
||
uint32_t m_width; | ||
uint32_t m_hight; | ||
|
||
Bitmap(); | ||
virtual ~Bitmap(); | ||
void allocateBitmap(); | ||
void resetBitmap(); | ||
bool hasData(); | ||
bool isValid(); | ||
uint32_t getPixelLenth(); | ||
const uint32_t* getRGBA(); | ||
Rgba* getAddr(int left, int top); | ||
void swap(Bitmap*); | ||
void eraseColor(Rgba color); | ||
static Bitmap* getDebugBitmap(); | ||
private: | ||
Rgba* m_data; | ||
}; | ||
|
||
struct FrameData | ||
{ | ||
uint32_t m_duration; | ||
uint32_t m_index; | ||
FrameData(uint32_t duration, uint32_t index) | ||
{ | ||
m_duration = duration; | ||
m_index = index; | ||
} | ||
}; | ||
|
||
class GifFrame | ||
{ | ||
public: | ||
GifFrame() | ||
:m_frameData(UNINITIALIZED_UINT, UNINITIALIZED_UINT) | ||
{ | ||
} | ||
Bitmap* m_bm; | ||
FrameData m_frameData; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.