00001
00002 #include <qimage.h>
00003 #include "StyleConsts.h"
00004
00005 GraphicLink::~GraphicLink() { delete graphic; }
00006
00007 pmstore::~pmstore()
00008 {
00010 delete graphic;
00011 }
00012
00013 CStyle::~CStyle()
00014 {
00015 if (graphic != NULL)
00016 {
00017 if (--(graphic->count) == 0)
00018 {
00019 delete graphic;
00020 }
00021 }
00022 }
00023
00024 CStyle::CStyle(const CStyle& rhs) : graphic(NULL)
00025 {
00026 *this = rhs;
00027 }
00028
00029 CStyle& CStyle::operator=(const CStyle& rhs)
00030 {
00031 if (rhs.graphic != NULL)
00032 {
00033 (rhs.graphic->count)++;
00034 if (graphic != NULL)
00035 {
00036 if (--(graphic->count) == 0)
00037 {
00038 delete graphic;
00039 }
00040 }
00041 graphic = rhs.graphic;
00042 }
00043 else
00044 {
00045 if (graphic != NULL)
00046 {
00047 if (--(graphic->count) == 0)
00048 {
00049 delete graphic;
00050 }
00051 graphic = NULL;
00052 }
00053 }
00054 sty = rhs.sty;
00055 return *this;
00056 }
00057
00058 void CStyle::clearPicture()
00059 {
00060 if (graphic != NULL)
00061 {
00062 if (--(graphic->count) == 0)
00063 {
00064 delete graphic;
00065 }
00066 graphic = NULL;
00067 }
00068 }
00069
00070 void CStyle::unset()
00071 {
00072 sty.unset();
00073 if (graphic != NULL)
00074 {
00075 if (--(graphic->count) == 0)
00076 {
00077 delete graphic;
00078 }
00079 graphic = NULL;
00080 }
00081 }
00082
00083 void CStyle::setPicture(bool canScale, QImage* _g, bool il, unsigned long tgt)
00084 {
00085 if (graphic != NULL)
00086 {
00087 if (--(graphic->count) == 0)
00088 {
00089 delete graphic;
00090 }
00091 graphic = NULL;
00092 }
00093 if (_g != NULL) graphic = new pmstore(canScale, _g, il, tgt);
00094 }
00095
00096 void CStyle::invert()
00097 {
00098 qDebug("Before:<%02x%02x%02x>", sty.bred, sty.bgreen, sty.bblue);
00099 qDebug("Before:<%02x%02x%02x>", sty.red, sty.green, sty.blue);
00100 sty.bred = 255-sty.bred;
00101 sty.bgreen = 255-sty.bgreen;
00102 sty.bblue = 255-sty.bblue;
00103 sty.red = 255-sty.red;
00104 sty.green = 255-sty.green;
00105 sty.blue = 255-sty.blue;
00106 qDebug("After:<%02x%02x%02x>", sty.bred, sty.bgreen, sty.bblue);
00107 qDebug("After:<%02x%02x%02x>", sty.red, sty.green, sty.blue);
00108 }