gwenhywfar  4.6.0beta
htmlimage.c
Go to the documentation of this file.
1 /***************************************************************************
2  begin : Fri Jul 16 2010
3  copyright : (C) 2010 by Martin Preuss
4  email : martin@libchipcard.de
5 
6  ***************************************************************************
7  * Please see toplevel file COPYING for license details *
8  ***************************************************************************/
9 
10 #ifdef HAVE_CONFIG_H
11 # include <config.h>
12 #endif
13 
14 #define DISABLE_DEBUGLOG
15 
16 
17 #include "htmlimage_p.h"
18 
19 
20 
23 
24 
25 HTML_IMAGE *HtmlImage_new(void) {
26  HTML_IMAGE *img;
27 
28  GWEN_NEW_OBJECT(HTML_IMAGE, img);
29  img->refCount=1;
30  GWEN_INHERIT_INIT(HTML_IMAGE, img);
31  GWEN_LIST_INIT(HTML_IMAGE, img);
32 
33  return img;
34 }
35 
36 
37 
39  if (img) {
40  assert(img->refCount);
41  if (img->refCount>1)
42  img->refCount--;
43  else {
46  free(img->imageName);
47 
48  img->refCount=0;
49  GWEN_FREE_OBJECT(img);
50  }
51  }
52 }
53 
54 
55 
57  assert(img);
58  assert(img->refCount);
59  img->refCount++;
60 }
61 
62 
63 
64 const char *HtmlImage_GetImageName(const HTML_IMAGE *img) {
65  assert(img);
66  assert(img->refCount);
67  return img->imageName;
68 }
69 
70 
71 
72 void HtmlImage_SetImageName(HTML_IMAGE *img, const char *s) {
73  assert(img);
74  assert(img->refCount);
75  free(img->imageName);
76  if (s) img->imageName=strdup(s);
77  else img->imageName=NULL;
78 }
79 
80 
81 
82 int HtmlImage_GetWidth(const HTML_IMAGE *img) {
83  assert(img);
84  assert(img->refCount);
85  return img->width;
86 }
87 
88 
89 
90 void HtmlImage_SetWidth(HTML_IMAGE *img, int i) {
91  assert(img);
92  assert(img->refCount);
93  img->width=i;
94 }
95 
96 
97 
99  assert(img);
100  assert(img->refCount);
101  return img->height;
102 }
103 
104 
105 
106 void HtmlImage_SetHeight(HTML_IMAGE *img, int i) {
107  assert(img);
108  assert(img->refCount);
109  img->height=i;
110 }
111 
112 
113