[Pipmak-Devel] Problems/bugs with patch images

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Pipmak-Devel] Problems/bugs with patch images

aviare
Hello Christian!!

How are you?
I'm return to working on my "autocubic" project, and I'm trying to use the new patch positioning and image manipulation methods.
I have met some little problems:

1) I have to make the images bigger of 2 pixel (width and height), otherwise I can see a space between consecutive patches (I have explained this problem to you before, do you remember?)

2) I would like to create a transparent hole (alpha=0) in a png image, I need this for doors and windows, so I have operated  in this manner:

img=pipmak.loadimage(texture.."/front.png")
w,h=img:size()
img:color(0,0,0,0)
img:fill(w/3,h/3,w/3,2*h/3)

but I get only a black shape and not a transparent hole: this is a bug?

If I create a new white image instead of load a png, it works correctly:

i mg=pipmak.newimage(200,200):color(1,1,1,1):fill()
w,h=img:size()
img:color(0,0,0,0)
img:fill(w/3,h/3,w/3,2*h/3)

3) Apart the holes which aren't transparent, I think there are some bugs in the image cache management, because I reload the image always before the patch statement, and if there is a door, I modify the image using fill(), and finally call patch():

img=pipmak.loadimage(texture.."/front.png")

if door~=0 then    --the value of door is recalculated every time
   w,h=img:size()
   img:color(0,0,0,1)
   img:fill(w/3,h/3,w/3,2*h/3)
end

p = patch {
       face = dir,
       w = dimx+fix,  -- fix=2: workaround
       h = dimx+fix,
       anchorv = w/2,
       anchorh = h/2,
       x=0,y=0,  --values aren't influent: I don't need to set these!!!
       ny      =0,
       nz = -2*l-1,
       nx = 2*(j-l),
       visible = true,
       image = img
}

Well, I can view doors also where they would not have to be there!!  ( i.e.: patch  statement use a wrong image get from the cache instead of reload from disk)
I believe that this bug is connected to the assertion failed in the project map visualization which I show you in my authoring feature.

I hope that this help you to fix bugs.

I have stopped my pipmak development activity, because I don't know what you have in mind and how you want to proceed.
I don't want create a parallel version of pipmak,  I think you have understood now what I'm able to do and what I am not, so, if you desires my help in developping, you should tell me exactly what you need (for example: "I need a function which get these inputs, return these outputs and do this thing").
In any case, I would be happy to help you, if only you tell me how.
 
Bye

Andrea
Let's save the little pipmak from the forgotten land!
Reply | Threaded
Open this post in threaded view
|

Re: [Pipmak-Devel] Problems/bugs with patch images

cwalther
Administrator
Andrea Viarengo wrote:
> 2) I would like to create a transparent hole (alpha=0) in a png image, I
> need this for doors and windows, so I have operated  in this manner:
>
> img=pipmak.loadimage(texture.."/front.png")
> w,h=img:size()
> img:color(0,0,0,0)
> img:fill(w/3,h/3,w/3,2*h/3)
>
> but I get only a black shape and not a transparent hole: this is a bug?

image:fill() doesn't add an alpha channel to an image that doesn't
already have one. Whether that's a bug or not is debatable, it's
certainly a limitation that needs to be documented at least. Fixing it
is probably going to be non-trivial. Depending on how we decide to solve
the loadimage-returns-existing-object problem, it may go away entirely.

Thanks for finding this!

  -Christian