It is currently Tue May 23, 2017 1:52 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  [ 26 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Bitmaps
Unread postPosted: Mon Apr 10, 2017 3:23 pm 
Offline

Joined: Sat Apr 08, 2017 10:30 am
Posts: 1
How can i create a shape and put into a bitmap


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Mon Apr 10, 2017 11:37 pm 
Online

Joined: Sat Mar 02, 2013 11:04 am
Posts: 836
Location: France
gr.bitmap.create vptr, width, height
gr.bitmap.drawinto.start vptr
! draw the shape
gr.bitmap.drawinto.end

then gr.bitmap.draw ptr, vptr, px, py

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Tue Apr 11, 2017 12:36 am 
Offline
User avatar

Joined: Mon Aug 18, 2014 1:16 pm
Posts: 1336
Cassiope34 wrote:
gr.bitmap.create vptr, width, height
gr.bitmap.drawinto.start vptr
! draw the shape
gr.bitmap.drawinto.end

then gr.bitmap.draw ptr, vptr, px, py


And to draw the shape you could have a look at 'gr.poly' page 158 in the manual

Regards Roy


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Tue Apr 11, 2017 12:45 am 
Offline
User avatar

Joined: Mon Aug 18, 2014 1:16 pm
Posts: 1336
This is a demo I did some time back that create shapes and put them into a bitmaps

Code:
Rem Floating Digits
Rem Converted from Mintoris basic to RFO Basic
Rem For Android
Rem November 2016
Rem December Added Sprites Rotate
Rem Version 2.00
Rem By Roy Shepherd

di_height = 1152 % set to my Device
di_width = 672

gr.open 255,0,0,0
gr.orientation 1 % Portrait 
pause 1000
WakeLock 3

gr.screen screenWidth, screenHeight
scale_x = screenWidth / di_width
scale_y = screenHeight / di_height
gr.scale scale_x, scale_y

gr.text.size 50
gr.set.stroke 4

maxSprites = 10
angle = 0

dim bitmap[maxSprites]
dim rotBitmap[maxSprites]
dim x[maxSprites]
dim y[maxSprites]
dim vx[maxSprites]
dim vy[maxSprites]
dim angleTurn[maxSprites]
dim angle[maxSprites]

maxX = di_width - 100
maxY = di_height - 100

For i = 1 to maxSprites
    gosub MakeBitmap
    x[i] = floor(maxX * rnd())
    y[i] = floor(maxY * rnd())
    vx[i] = floor(20 * rnd()-10)
    vy[i] = floor(20 * rnd()-10)
    angleTurn[i] = (4 * rnd() - 2)
Next

Do

  For i = 1 to maxSprites

    x[i] = x[i] + vx[i]
    y[i] = y[i] + vy[i]

    if x[i] < 0 then
      x[i] = 0
     vx[i] = vx[i] * -1
    endif

    if x[i] > maxX then
      x[i] = maxX
      vx[i] = vx[i] * -1
    endif

    if y[i] < 0 then
      y[i] = 0
      vy[i] = vy[i] * -1
    endif

    if y[i] > maxY then
      y[i] = maxY
      vy[i] = vy[i] * -1
    endif

    angle[i] += angleTurn[i]
    gr.modify rotBitmap[i], "angle", angle[i], "x", x[i] + 50, "y", y[i] + 50
   
    gr.modify bitmap[i], "x", x[i], "y", y[i]
   
  Next

gr.render
until 0

onBackKey:
  end
back.resume

MakeBitmap:
    digit = i - 1
    gr.bitmap.create bitmap, 100, 100
    gr.bitmap.drawinto.start bitmap

    gr.color 255,0, 255, 0, 1
    gr.line null, 0,0,99,99
    gr.line null, 0,99,99,0
   
    gr.color 255,255, 0, 0, 0
    gr.circle null, 50, 50, 48
   
    gr.color 255, 255, 255, 255, 1
    d$ = int$(digit)
    gr.text.draw null, 35, 65, d$
   
    gr.bitmap.drawinto.end
   
    gr.rotate.start 0,  - 100, - 100, rotBitmap[i]
        gr.bitmap.draw bitmap[i], bitmap, - 100, - 100
    gr.rotate.end
   
return


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Tue Apr 11, 2017 1:08 am 
Online

Joined: Sat Mar 02, 2013 11:04 am
Posts: 836
Location: France
Hello Roy,
I can see you had use Mintoris ! ( the version 8.0 will arrive soon )
Can I ask you why do you prefer RFO ?

Cheers

Gilles

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Tue Apr 11, 2017 7:11 am 
Offline
User avatar

Joined: Mon Aug 18, 2014 1:16 pm
Posts: 1336
Cassiope34 wrote:
Hello Roy,
I can see you had use Mintoris ! ( the version 8.0 will arrive soon )
Can I ask you why do you prefer RFO ?

Cheers

Gilles

Hi Gilles

I down load the free trial.

One of the thinks I like about RFO Basic is the way you can develop apps on the computer and test using BlueStacks. This is thanks to Nicolas.
I don't know if you can do that with Mintoris

Mintoris dose have some function for getting battery info, so I guess it has others as well. And it as a game engine. You can scale bitmaps up and down in the app and there in multi touch, a GUI and so on.

Just a pity you have to pay £7, otherwise I'd give it a go, and I guess you'll have to pay for upgrades.



Regards Roy


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Wed Apr 12, 2017 2:15 am 
Online

Joined: Sat Mar 02, 2013 11:04 am
Posts: 836
Location: France
Thanks Roy ;)

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Thu Apr 13, 2017 8:22 am 
Offline
User avatar

Joined: Mon Mar 27, 2017 2:42 pm
Posts: 14
Just a suggestion: I know your original question was creating bitmaps, but here's a useful website that will turn any clipart, drawing, or photo into a bitmap or even an icon if you really want to trick out your desktop. But I have to advise you on file size: A 7Kb color JPEG ended up being a 110KB bitmap. A simple black and white 3KB PNG came back at 6Kb.

Maybe won't suit your needs, just thought I'd mention it.
Peace,
ReNoob


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Thu Apr 13, 2017 11:48 pm 
Online

Joined: Sat Mar 02, 2013 11:04 am
Posts: 836
Location: France
Just one thing ReNoob : a "bitmap" in RFO BASIC! is not absolutely in the BMP format but can be JPEG or PNG...

_________________
"It is better to mobilize intelligence for stupid things, rather than mobilizing stupidity for intelligent things."
Galaxy TAB S 8.4, 2560x1600, Marshmallow 6.0.1
Galaxy Note II, 1280x720, JB4.1.2
Galaxy A3, 1280x720, Android 6.0.1


Report this post
Top
 Profile  
 
 Post subject: Re: Bitmaps
Unread postPosted: Fri Apr 14, 2017 9:37 am 
Offline
User avatar

Joined: Mon Mar 27, 2017 2:42 pm
Posts: 14
Quite so. You know, one of these days, I'm going to actually have to RTFM. Thanks for the heads-up!

--ReNoob


Report this post
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2, 3  Next


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