It is currently Thu Mar 06, 2014 1:37 am



Welcome
Welcome to rfobasic

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today. **You are not required to provide truthful information to any registration questions. Be whomever you wish to be.!


Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Saving contents of the graphics screen
Unread postPosted: Tue Mar 04, 2014 11:56 am 
Offline

Joined: Tue Mar 04, 2014 11:25 am
Posts: 3
Hello!

I've got a very simpleminded program to use the graphics screen to show the characteristics of a sequence of blood pressure measurements.

The program draws 2 line segment graphs, one for for the diastolic, one for the systolic pressures. It then calculates the minimum, quartile and maximum values of both these pressures after which it draws them as text on the screen also.

When this done the resulting screen is saved using the line
gr.save "bpm.jpg",100

This saving has stopped working in version v01.78. I've tried to use the .png type also but both variations seem to save a blank screen. In v01.77 the saving functions.

My device is Nexus 7 with Android 4.4.2

Thanks,
Jussi


Top
 Profile  
 
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Wed Mar 05, 2014 1:21 am 
Online

Joined: Wed Mar 05, 2014 1:15 am
Posts: 4
The same thing occurs with my tablet.
It is simple tool which connects two pieces of photographs to one piece.

My device is OS 4.0.3 L-01A.

code:

http://pastebin.com/heUW58Jt

Please help me.


Top
 Profile  
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Wed Mar 05, 2014 7:40 am 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 717
Thank you both for reporting this.

I have tried saving a graphics screen on an Android 2.3.6 phone and a 4.1.2 tablet. It works okay on both. We will have to dig deeper.

@Yussi, did you get an Android OS update recently? Are you using the default Base Drive or have you set a different one?

@sinagawa1, I will try running your code later today.

- Marc


Top
 Profile  
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Wed Mar 05, 2014 12:59 pm 
Offline

Joined: Tue Mar 04, 2014 11:25 am
Posts: 3
Hi Marc!

My version 4.4.2 has kernel version
3.4.0-gac9222c
that is dated
Wed Nov 20 14:50:44 PST 2013
so it really is not a new one.

I have no external storage devices and the directory I am trying to save my .jpg file to is the default rfo-basic/data.

I'm attaching my code so you can try it if you have time. The code is self-contained, so all you need to do is to run it.

But I repeat: the same code creates a blank .jpg when run in v01.78 and a valid .jpg when run in v01.77. So there has to be some difference between these versions that is responsible for this behaviour change even though it may be that there isn't.

For some reason I can't get the choose-file-add-file-procedure below so I try to insert the code below my name. (Seems to succeed but the indentations disappear, at least in preview)

Jussi

REM Start of BASIC! Program

fn.def arr_prn(arr[])
array.length al,arr[]
for i=1 to al
print format$("###", arr[i]), " ";
next i
print " "
fn.end

fn.def mmq123(press[], which, mmq[])
array.length last, press[]
mmq[which,1] = press[1]
mmq[which,2] = press[ceil(last/4)]
mmq[which,3] = press[ceil(last/2)]
mmq[which,4] = press[ceil(3*last/4)]
mmq[which,5] = press[last]
fn.end

fn.def jsmin(m,n)
if m < n then fn.rtn m else fn.rtn n
fn.end

fn.def jsmax(m,n)
if m < n then fn.rtn n else fn.rtn m
fn.end

! Set the device independent sizes
height = 100
width = 100
h_offset = 5
w_offset = 5
w_free = 15
hmho = height - h_offset

! get the actual width and height
gr.open 255, 255, 255, 255, 0, 0
gr.color 255, 0, 0, 0, 0
gr.screen actual_w, actual_h
!print actual_w, actual_h

! calculate the scale factors
scale_width = actual_w /width
scale_height = actual_h /height
! Set the scale
!print scale_width, scale_height
!print width*scale_width, height*scale_height
gr.scale scale_width, scale_height

gr.text.typeface 2
gr.text.size 2
!gr.text.align 1
s$ = "This"
!gr.get.textbounds s$,l,t,r,b
!print l,t,r,b
gr.rect x, w_offset, 1, width-w_free,height-h_offset

d$ = "109/79 114/80 111/81 108/78 114/79 106/75 " + ~
"110/77 110/78 109/79 110/77 110/81 108/77 " + ~
"111/84 116/84 107/81 110/82 108/80 116/83 116/82"

split result$[],d$,"[ /]+"
array.length length,result$[]

for i=1 to length
! print result$[i] + "|";
next i
!print " "

dim mmq[2,5]
plen = length / 2
!print plen
dim p2[2,plen], p[plen]

for i=0 to 1
ind = 1
for j=1 to length step 2
!print result$[j+i] + "|";
p[ind] = val(result$[j+i])
p2[i+1,ind] = p[ind]
ind += 1
next j
!print " "
!dummy = arr_prn(p[])
array.sort p[]
!dummy = arr_prn(p[])
dummy = mmq123(p[], i+1, mmq[])
next i

for i=1 to 2
for j=1 to 5
!print format$("###",mmq[i,j]), " ";
next j
!print " "
next i

gr.text.draw x, width-w_free+1, 3, " |Sys|Dia|"
gr.text.draw x, width-w_free+1, 4, "___|___|___|"
array.load descr$[],"Min"," Q1"," Q2"," Q3","Max"
for i=1 to 5
gr.text.draw x, width-w_free+1, 4+i*2, descr$[i] + "|" + mid$(format$("###",mmq[1,i]),3) + "|" + mid$(format$("###",mmq[2,i]),3) + "|"
next i

min = jsmin(mmq[1,1],mmq[2,1])
max = jsmax(mmq[1,5],mmq[2,5])
min = floor(min/10) * 10
max = ceil(max/10) * 10
sc = hmho / (max - min)
!print "sc=",sc,min,max

fn.def tr(press,hmho,scale)
fn.rtn hmho - press*scale
fn.end

!dummy = arr_prn(press[])
for i=1 to 2
for j=1 to plen-1
p1 = tr(p2[i,j]-min,hmho,sc)
p2 = tr(p2[i,j+1]-min,hmho,sc)
!print i,j,p1,p2
gr.line x, j+w_offset, p1, j+w_offset+1, p2
!gr.line x, j+w_offset, 1, j+w_offset, hmho
next j
next i
!print " "

for i=min to max step 5
p1 = tr(i-min,hmho,sc)
gr.line x, w_offset, p1, width-w_free, p1
gr.text.draw x,1,p1,mid$(format$("###",i),3)
next i


gr.render

gr.save "bpm.jpg",100
pause 1000
popup "DONE",0,0,0

do
until 0


Top
 Profile  
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Wed Mar 05, 2014 1:03 pm 
Offline

Joined: Tue Mar 04, 2014 11:25 am
Posts: 3
Correction:

even though it may be that there isn't.

===>

even though it may seem that there isn't.

Jussi


Top
 Profile  
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Wed Mar 05, 2014 2:57 pm 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 717
Thank you, Jussi. It's hard for me to see how anything in 1.78 could cause this, but that's the nature of bugs. With your code I should be able to track it down.

@sinagawa1, I ran your code on a XOOM (4.1.2). Your instructions say to put two files in the ../../gattai directory. I did that. They do not say I need to create the ../../gkekka directory, so the program failed with "ENENT (No such file or directory)". I added this to your program:
Code:
FILE.EXISTS fex, pathx$
IF !fex THEN FILE.MKDIR pathx$
Then your program runs. It creates images in the gkekka directory.

The images are only the color the user selects. They do not have any of the photos from the gattai directory. I think this must be an error in the logic with the GR.BITMAP.CROP commands. When I get time, I will look at your program logic to see if I can find an error.

- Marc


Top
 Profile  
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Wed Mar 05, 2014 4:31 pm 
Online

Joined: Wed Mar 05, 2014 1:15 am
Posts: 4
Hi Marc.

Thank you for quick response.

Thank you for directory exist check logic suggestion.

I used this program 10 months ago,every week.

Generated photo in gkekka directory is had 3photos like this.

(before Basic!1.77 or 1.78)
https://www.dropbox.com/sh/yv2ydjmr091kfgs/HEy7fMVyg9

(afrer Basic!1.77 or 1.78)
https://www.dropbox.com/sh/noil4hw0fgzd1xm/3rk2dOgjos

But,afrer Basic!1.77 or 1.78,Generated photo in gkekka directory .jpg has no photos.

I'm very sad....Please help me.


Last edited by sinagawa1 on Wed Mar 05, 2014 9:01 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Wed Mar 05, 2014 5:07 pm 
Online

Joined: Wed Mar 05, 2014 1:15 am
Posts: 4
Hi Marc.

>I think this must be an error in the logic with the GR.BITMAP.CROP commands

My program generated 3 photo in gattai directly.

kall.jpg ---> GR.BITMAP.CROP is not used in generate logic only GR.SAVE command.
ktate.jpg ---> GR.BITMAP.CROP is used in generate logic.
kyoko.jpg ---> GR.BITMAP.CROP is used in generate logic.


I think that it is a different cause.

sinagawa1


Top
 Profile  
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Wed Mar 05, 2014 11:11 pm 
Offline

Joined: Wed Oct 03, 2012 9:53 am
Posts: 717
Hi, sinagawa1. Thank you for explaining. You are right, your logic is good. I tried your program on v01.76, and it makes good images. v01.78 makes pastel rectangles. BASIC! saving a bitmap to a file, but the bitmap is all one color.

You, too, Jussi. When I run your code on v01.76 it saves the graphs, but on v01.78 it saves white.

I will report here when I get this fixed.

- Marc


Top
 Profile  
 
 Post subject: Re: Saving contents of the graphics screen
Unread postPosted: Thu Mar 06, 2014 1:33 am 
Online

Joined: Wed Mar 05, 2014 1:15 am
Posts: 4
Hi Marc.

>I tried your program on v01.76, and it makes good images. v01.78 makes pastel rectangles. BASIC! saving a bitmap to a file, but the bitmap is all one color.

Thank you for quick response.
Thank you for test my program on v01.76.

>I will report here when I get this fixed.

I wait for a good report.
I hope that this problem is fixed in V1.79.

sinagawa1


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
suspicion-preferred