Bug with tint instruction

Report any Hollywood bugs here
Post Reply
User avatar
Juan Carlos
Posts: 891
Joined: Mon Sep 06, 2010 1:02 pm

Bug with tint instruction

Post by Juan Carlos »

Bug with tint instruction, the instruction tinted the picture copied to brush 2, but also tinted the brush 1.

Code: Select all

;Load a picture X.
@BRUSH 1, "pictureX.jpg", {Loader="inbuilt"}
;The variable Image takes the valour of 1 for the picture.
;because with this routine you can tint other pictures, in the same psotion X and Y.
Global Image=1

;Copy the picture 1 to picture 2.
CopyBrush(Image, 2)
;Now the picture 2 is tint to blue.
TintBrush(2, #BLUE, 64)
;Now copy the picture 2 (tinted) to Image.
CopyBrush(2, Image)
;Show the picture 2 tinted.
DisplayBrush(Image, 0, 0)
;But the picture 1 not tinted, is showed tinted like picture 2.
DisplayBrush(1, 200, 0)

EscapeQuit(False)
Repeat
  WaitEvent
This bug is very strange of fact I though that the problem was in my code of my current project an adventure point and click R.P.G. game, but after to rewrote the routines and ideas several times, I try this code, and yes the problem or bug is in the Tint brush, that tinted the copy brush and the original.
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Bug with tint instruction

Post by emeck »

@Juan Carlos

Hello. You are applying the tint effect to BRUSH 2 and then you are copying the modified BRUSH 2 to image, which is BRUSH 1:

Code: Select all

;Now the picture 2 is tint to blue.
TintBrush(2, #BLUE, 64)
;Now copy the picture 2 (tinted) to Image.
CopyBrush(2, Image)
If you want the original without the effect, why do you copy BRUSH 2 to BRUSH 1?
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
User avatar
Juan Carlos
Posts: 891
Joined: Mon Sep 06, 2010 1:02 pm

Re: Bug with tint instruction

Post by Juan Carlos »

Well, the idea is that Image is the wildcard image, to make the tint brushes, I copy the brush 1, or x , to image 2, using the variable the wildcard Image=x, where Image 2 (or brush 2) you have a copy of Brush 1, now you tint the brush 2 and I copy this tint brush to image to use this tinted brush in other places, the problem perhaps is that routine copies the tinted brush to Image and to Brush 1, doing a double copy of tinted brush, instead of my main idea the wildcard or comodin brush called Image. The routine overwrite the brush 2 in brush 1, here perhaps is my failed that I though that a brush with a picture loaded wasn't possible overwrite.
User avatar
emeck
Posts: 169
Joined: Fri Apr 03, 2015 3:17 pm

Re: Bug with tint instruction

Post by emeck »

I see. The problem here is that "image" is a variable that holds a value, in this case 1, so that is the brush used when you use the variable "image" in the brush functions.

You'll need something like this as a buffer or wilcard:

Code: Select all

bufferBrush = CreateBrush(Nil, 320, 320)
Then you can copy to bufferBrush without messing with your unmodified brushes.
PowerBook 5.2 MorphOS 3.15
PowerBook 5.8 MorphOS 3.15
Amiga 1200 BPPC/BVision AOS4.1 FE
User avatar
Juan Carlos
Posts: 891
Joined: Mon Sep 06, 2010 1:02 pm

Re: Bug with tint instruction

Post by Juan Carlos »

Thank you, it is a good idea, for future visual effects with potions and tint brush, I don't remember the NIL option again thank you.
Post Reply