That's really a different sentence, in which "this" is an adjective rather than a pronoun.
Ez piros alma - subject ez (this); predicate piros alma (is a red apple). This is a red apple.
Ez az alma piros - subject ez az alma (this apple); predicate piros (is red). This apple is red.
What about "this red apple" as in:
Q. "What are you eating?" A. "This red apple" shows person apple
That would be ez a piros alma with an extra a in there.
Plus, if it's the object of a verb such as "eating", you need the accusative -t as well - Ezt a piros almát.