Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e12e6357
authored
Dec 09, 2016
by
german
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Problem with repeat bitmap repaired
parent
9a2b4543
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
28 deletions
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Picto.java
android/Pictogram/commonlibrary/src/main/java/com/yottacode/pictogram/dao/Picto.java
View file @
e12e6357
...
@@ -35,7 +35,7 @@ import java.io.IOException;
...
@@ -35,7 +35,7 @@ import java.io.IOException;
* @version 1.0
* @version 1.0
*/
*/
public
class
Picto
extends
Img
{
public
class
Picto
extends
Img
{
int
cont
=
0
;
Bitmap
bitmap
;
Bitmap
bitmap
;
// String constant for logs
// String constant for logs
...
@@ -449,8 +449,13 @@ public class Picto extends Img {
...
@@ -449,8 +449,13 @@ public class Picto extends Img {
}
}
}
}
Paint
paint
=
new
Paint
(
Paint
.
ANTI_ALIAS_FLAG
);
Paint
paint
=
new
Paint
(
Paint
.
ANTI_ALIAS_FLAG
);
int
width
=
bitmap
.
getWidth
();
//Ancho original
//if(!get_legend().equals(JSON_ATTTR_LEGEND_VALUES.NONE)){
int
height
=
bitmap
.
getHeight
();
//Alto original
int
dens
=
bitmap
.
getDensity
();
Log
.
i
(
"TAG_NUEVO"
,
"ancho: "
+
width
);
Log
.
i
(
"TAG_NUEVO"
,
"alto: "
+
height
);
Log
.
i
(
"TAG_NUEVO"
,
"densidad: "
+
dens
);
//if(!get_legend().equals(JSON_ATTTR_LEGEND_VALUES.NONE)){ //Si tiene leyenda
String
texto
=
this
.
translation
.
toUpperCase
();
String
texto
=
this
.
translation
.
toUpperCase
();
String
[]
words
=
texto
.
split
(
" "
);
String
[]
words
=
texto
.
split
(
" "
);
...
@@ -492,7 +497,6 @@ public class Picto extends Img {
...
@@ -492,7 +497,6 @@ public class Picto extends Img {
}
}
//if(get_legend().equals(JSON_ATTTR_LEGEND_VALUES.NORMAL)) {
//if(get_legend().equals(JSON_ATTTR_LEGEND_VALUES.NORMAL)) {
android
.
graphics
.
Bitmap
.
Config
bitmapConfig
=
bitmap
.
getConfig
();
android
.
graphics
.
Bitmap
.
Config
bitmapConfig
=
bitmap
.
getConfig
();
if
(
bitmapConfig
==
null
)
{
if
(
bitmapConfig
==
null
)
{
bitmapConfig
=
android
.
graphics
.
Bitmap
.
Config
.
ARGB_8888
;
bitmapConfig
=
android
.
graphics
.
Bitmap
.
Config
.
ARGB_8888
;
...
@@ -500,31 +504,30 @@ public class Picto extends Img {
...
@@ -500,31 +504,30 @@ public class Picto extends Img {
bitmap
=
bitmap
.
copy
(
bitmapConfig
,
true
);
bitmap
=
bitmap
.
copy
(
bitmapConfig
,
true
);
Canvas
canvas
=
new
Canvas
(
bitmap
);
Canvas
canvas
=
new
Canvas
(
bitmap
);
if
(
cont
==
0
)
{
//Copiar el bitmap a uno nuevo y reescalar
Bitmap
bm
=
Bitmap
.
createScaledBitmap
(
bitmap
,
width
/
2
,
height
/
2
,
false
);
canvas
.
drawColor
(
Color
.
TRANSPARENT
,
PorterDuff
.
Mode
.
CLEAR
);
//Poner en blanco el bitmap original para dibujar encima
canvas
.
drawBitmap
(
bm
,
25
,
0
,
paint
);
cont
++;
TextView
textView
=
new
TextView
(
context
);
textView
.
layout
(
0
,
50
,
100
,
100
);
textView
.
setPadding
(
0
,
0
,
0
,
0
);
textView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_PX
,
15
);
textView
.
setTextColor
(
Color
.
BLACK
);
textView
.
setBackgroundColor
(
Color
.
WHITE
);
textView
.
setWidth
(
100
);
textView
.
setGravity
(
Gravity
.
CENTER_HORIZONTAL
);
textView
.
setMaxLines
(
4
);
textView
.
setText
(
texto
);
textView
.
setDrawingCacheEnabled
(
true
);
canvas
.
drawBitmap
(
textView
.
getDrawingCache
(),
0
,
50
,
null
);
}
//Copiar el bitmap a uno nuevo y reescalar
int
width
=
bitmap
.
getWidth
();
//Ancho
int
height
=
bitmap
.
getHeight
();
//Alto
int
scaleWidth
=
50
/
width
;
int
scaleHeight
=
50
/
height
;
Bitmap
bm
=
Bitmap
.
createScaledBitmap
(
bitmap
,
50
,
50
,
false
);
canvas
.
drawColor
(
Color
.
TRANSPARENT
,
PorterDuff
.
Mode
.
CLEAR
);
canvas
.
drawBitmap
(
bm
,
25
,
0
,
null
);
TextView
textView
=
new
TextView
(
context
);
textView
.
layout
(
0
,
50
,
100
,
100
);
textView
.
setPadding
(
0
,
0
,
0
,
0
);
textView
.
setTextSize
(
TypedValue
.
COMPLEX_UNIT_PX
,
15
);
textView
.
setTextColor
(
Color
.
WHITE
);
textView
.
setBackgroundColor
(
Color
.
argb
(
150
,
0
,
0
,
0
));
textView
.
setWidth
(
100
);
textView
.
setGravity
(
Gravity
.
CENTER_HORIZONTAL
);
textView
.
setMaxLines
(
4
);
textView
.
setText
(
texto
);
textView
.
setDrawingCacheEnabled
(
true
);
canvas
.
drawBitmap
(
textView
.
getDrawingCache
(),
0
,
50
,
null
);
//}else{
//}else{
//Solo texto
//Solo texto
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment