Direct Image Buffer Access Macros

Post your FreeBASIC source, examples, tips and tricks here. Please don’t post code without including an explanation.
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Post by Lachie Dazdarian »

I like ONIONS.
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

ROTFLMAO!!!
anonymous1337
Posts: 5494
Joined: Sep 12, 2005 20:06
Location: California

Post by anonymous1337 »

Lachie Dazdarian wrote:I like ONION[...].
Onion make me cry :-(
dabooda
Posts: 112
Joined: Aug 28, 2006 21:35
Location: Texas
Contact:

Post by dabooda »

Some peoples children...

That is all I am going to say..

DaBooda out...
Merick
Posts: 1038
Joined: May 28, 2007 1:52

Post by Merick »

Lachie Dazdarian wrote:I like ONIONS.
Me too, but only if they're red onions
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

The licenses are included in the documentation: http://www.freebasic.net/wiki/wikka.php ... nuLicenses

You can see that the LGPL extension only applies to the runtime-library.

The gfxlib is not under the copyright of the whole team, so we can't simply change the license ourselves. Only the main author could add that LGPL extension. If he didn't do that until now, then he may have his reasons - pretty much everything in the gfxlib is his work, the other team members only committed some fixes here and there and added the DOS backend, so he has the choice to choose whatever OSS license he may want. Of course users don't have to agree with that, there are tons of GFX libs to be used with FB, each has a price to pay: complexity, size, lack of docs, exotic licenses, etc.
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Post by notthecheatr »

vdecampo, you apparently don't understand the meaning of LGPL. Look at this: http://en.wikipedia.org/wiki/LGPL

fbgfx is released under LGPL, which means that fbgfx
wikipedia wrote:can be linked to (in the case of a library, 'used by') a non-(L)GPLed program, which may be free software or proprietary software.
LGPL wrote:A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License.
This negates your reasons for not using fbgfx (BTW libfb, which you almost certainly use in some way, is released under the same license with only a slight variation), and makes your complaints pointless and unrelated to this thread. Which they would have been, regardless, since this thread is not about fbgfx or LGPL but rather about a few useful macros someone wrote for playing with FB.IMAGE buffers.

anonymous1337, on the other hand, was an asshole.
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

Thank you notthecheatr. I have since come to an understanding regarding the licensing of FBGFX. One I understood it was released under the LGPL and not GPL, I was able to glean that tidbit of info for myself.

And I had originally posted those macros, not expecting opposition to them, or the ensuing licensing debate. It's almost like some people are not happy unless things are done their way.

When you've been programming as long as I have (20+), you find there are many ways to do the same thing. They fall into many categories...

Some are Faster
Some are Cleaner (Syntactically)
Some are more Clever
Some are more Efficient

But as long as the code gets the job done, I have rarely heard someone say it is wrong.

[Rant Over] :-)

-Vince
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

Well, I committed a file inc/image_compat.bi, which should be in the latest release. It contains these functions for your convenience:

Code: Select all

#pragma once

#include "fbgfx.bi"

namespace FB
	
	function image_is_new( byval img as any ptr ) as integer
		function = (cast(IMAGE ptr, img)->type = PUT_HEADER_NEW)
	end function
	
	function image_width( byval img as any ptr ) as integer
		if( image_is_new( img ) ) then
			function = img->width
		else
			function = img->old.width
		end if
	end function
	
	function image_height( byval img as any ptr ) as integer
		if( image_is_new( img ) ) then
			function = img->height
		else
			function = img->old.height
		end if
	end function
	
	function image_bpp( byval img as any ptr ) as integer
		if( image_is_new( img ) ) then
			function = img->bpp
		else
			function = img->old.bpp
		end if
	end function
	
	function image_pitch( byval img as any ptr ) as integer
		if( image_is_new( img ) ) then
			function = img->pitch
		else
			function = img->old.width
		end if
	end function
	
	function image_data( byval img as any ptr ) as any ptr
		if( image_is_new( img ) ) then
			function = img + len(IMAGE)
		else
			function = img + len(_OLD_HEADER)
		end if
	end function
	
end namespace


Yes, I know putting code in .bi's is bad :/.
notthecheatr
Posts: 1759
Joined: May 23, 2007 21:52
Location: Cut Bank, MT
Contact:

Post by notthecheatr »

vdecampo wrote:Thank you notthecheatr. I have since come to an understanding regarding the licensing of FBGFX. One I understood it was released under the LGPL and not GPL, I was able to glean that tidbit of info for myself.

And I had originally posted those macros, not expecting opposition to them, or the ensuing licensing debate. It's almost like some people are not happy unless things are done their way.

When you've been programming as long as I have (20+), you find there are many ways to do the same thing. They fall into many categories...

Some are Faster
Some are Cleaner (Syntactically)
Some are more Clever
Some are more Efficient

But as long as the code gets the job done, I have rarely heard someone say it is wrong.

[Rant Over] :-)

-Vince
Ah, good. Enjoy FreeBasic!

You're right, there is no right or wrong. If I write a beautiful game nobody cares if it's crappy code. Of course, it's preferable to do it in the most efficient way possible, but then nobody knows what that is XD
Post Reply